index.jsx 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. import React, { Component } from 'react';
  2. import style from './index.less';
  3. import del_icon from './img/delete.png'
  4. import del_on from './img/delete-on.png'
  5. import diagUp from './img/diagUp.png'
  6. import diagDown from './img/diagDown.png'
  7. import manageIcon from '@common/images/manage.png';
  8. import singleB from './img/singleB.png';
  9. import singleL from './img/singleL.png';
  10. import {ConfirmModal, Message,ComplexModal,Footer,Loading} from '@commonComp';
  11. import Notify from '@commonComp/Notify';
  12. import Treat from '@containers/Treat'
  13. import store from '@store';
  14. import { initItemList ,setInitHistory,getHistempDetail} from '@store/async-actions/historyTemplates';
  15. import { pushAllDataList,inspectAndAssist ,deepClone,setFontColorSize} from '@utils/tools';
  16. import { dragBox } from '@utils/drag';
  17. import iconRadioDefault from '@common/images/icon-radio-default.png'
  18. import iconRadioActive from '@common/images/icon-radio-active.png'
  19. import AssessResult from '@containers/AssessResult';
  20. import {getAssessData} from '@store/async-actions/fetchModules';
  21. import DetailsModal from '@components/PushItems/DetailsModal';
  22. import tableIcon from '@common/images/table.png';
  23. import { CONFIRM_TYPE } from "@store/types/typeConfig";
  24. import config from '@config/index';
  25. import $ from "jquery";
  26. import {getMRAnalyse} from '@store/async-actions/pushMessage';
  27. class DiagnosticList extends Component {
  28. constructor(props) {
  29. super(props);
  30. this.state = {
  31. visible: false,
  32. delItem: {},
  33. treatTitle: '',
  34. activeHistory: -1,
  35. sign:-1,
  36. showAssess:false,
  37. assessId:'',
  38. disName:'',
  39. isAssessConfirm:false,
  40. hasOndel: false,
  41. hasOnIndex: -1,
  42. activeItem:{},
  43. hasEnterItem: -1,
  44. hasEnterImg: false,
  45. timer:null
  46. }
  47. this.deleteItem = this.deleteItem.bind(this);
  48. this.cancel = this.cancel.bind(this);
  49. this.close = this.close.bind(this);
  50. this.showTreat = this.showTreat.bind(this);
  51. this.handleClickDiag = this.handleClickDiag.bind(this);
  52. this.referRecord = this.referRecord.bind(this);
  53. this.noReferRecord = this.noReferRecord.bind(this);
  54. this.getHistoryCase = this.getHistoryCase.bind(this);
  55. this.closeHistoryCaseModal = this.closeHistoryCaseModal.bind(this);
  56. this.referCase = this.referCase.bind(this);
  57. this.handleSaveAssess = this.handleSaveAssess.bind(this); //评估弹窗确定
  58. this.onPrint = this.onPrint.bind(this);
  59. this.hideTips=this.hideTips.bind(this);
  60. }
  61. onPrint() {
  62. let dom = $("#AssistResult");
  63. dom.jqprint({
  64. debug: false,
  65. importCSS: true,
  66. printContainer: true,
  67. operaSupport: false,
  68. });
  69. }
  70. upDiagnostic(index) {
  71. const { upDiagnostic } = this.props;
  72. upDiagnostic && upDiagnostic(index)
  73. }
  74. downDiagnostic(index) {
  75. const { downDiagnostic } = this.props;
  76. downDiagnostic && downDiagnostic(index)
  77. }
  78. deleteItem() {
  79. const { delItem,idxNum } = this.state;
  80. const { delDiagnostic, delReact,delFollowUp } = this.props;
  81. delDiagnostic && delDiagnostic(delItem,idxNum);
  82. delReact && delReact(delItem);
  83. delFollowUp && delFollowUp(delItem);
  84. this.setState({
  85. visible: false,
  86. })
  87. Notify.success('删除成功')
  88. }
  89. handleBlur(e,delItem,idxNum){
  90. const { delDiagnostic } = this.props;
  91. let name = e.target.value
  92. if(name.trim() == ''){
  93. delDiagnostic && delDiagnostic(delItem,idxNum);
  94. }
  95. }
  96. cancel() {
  97. this.setState({
  98. visible: false
  99. })
  100. }
  101. close() {
  102. this.setState({
  103. visible: false
  104. })
  105. }
  106. handleDeleteItem(item,idx) {
  107. this.setState({
  108. visible: true,
  109. delItem: item,
  110. idxNum:idx
  111. })
  112. }
  113. showTreat(item, idx) {
  114. const { getTreatResult,getBilling } = this.props;
  115. getTreatResult && getTreatResult(item,idx);
  116. getBilling({mode:10});
  117. }
  118. handleClickDiag(item) {
  119. const { getTips } = this.props;
  120. // getTips && getTips(item);
  121. getTips && getTips({id:item.conceptId, type:7, name: item.name, position: 0});
  122. }
  123. hideTips() {
  124. const { hideTipsDetailsModal } = this.props;
  125. hideTipsDetailsModal && hideTipsDetailsModal()
  126. }
  127. referRecord() {
  128. const { hideReferRecord, showHistoryCaseModal ,chronicMagItem,hisTemplates,autoFillModules,typeConfig} = this.props;
  129. hideReferRecord && hideReferRecord();
  130. // showHistoryCaseModal && showHistoryCaseModal()
  131. // store.dispatch(initItemList(chronicMagItem))
  132. initItemList(chronicMagItem).then((res)=>{
  133. const result = res.data;
  134. if(result.code==0 && result.data){
  135. store.dispatch(setInitHistory(result.data));
  136. showHistoryCaseModal && showHistoryCaseModal();
  137. }else{
  138. Notify.info("暂无历史病历,已默认展示慢病相关内容");
  139. const timer = setTimeout(function(){
  140. autoFillModules && autoFillModules();
  141. clearTimeout(timer);
  142. },1000) //需求要求延时
  143. }
  144. })
  145. }
  146. noReferRecord() {
  147. const { hideReferRecord ,autoFillModules,refreshScroller} = this.props;
  148. hideReferRecord && hideReferRecord();
  149. autoFillModules&&autoFillModules();
  150. store.dispatch(getMRAnalyse());
  151. setTimeout(function(){
  152. refreshScroller()&&refreshScroller().scrollTop();
  153. },100)
  154. }
  155. referCase() {//确定
  156. const { hideHistoryCaseModal, items ,autoFillModules,typeConfig} = this.props;
  157. const {sign,activeItem} = this.state;
  158. hideHistoryCaseModal && hideHistoryCaseModal()
  159. if (this.state.activeHistory === -1) {//没有选择历史病例直接点确定
  160. Notify.info("未选择历史病历,已默认展示慢病相关内容");
  161. const timer = setTimeout(function(){
  162. autoFillModules && autoFillModules();
  163. clearTimeout(timer);
  164. },1000)
  165. return
  166. }
  167. // let baseList = store.getState();
  168. // let baseObj = items[this.state.activeHistory];
  169. // pushAllDataList(baseObj.sign,'push',baseObj,'history') //引用
  170. store.dispatch(getHistempDetail(activeItem));
  171. this.props.getBilling({mode:10});
  172. this.setState({
  173. activeHistory: -1,
  174. sign:-1,
  175. activeItem:{}
  176. })
  177. }
  178. closeHistoryCaseModal() {
  179. const { hideHistoryCaseModal ,autoFillModules,typeConfig} = this.props
  180. this.setState({
  181. activeHistory: -1,
  182. sign:-1,
  183. activeItem:{}
  184. })
  185. hideHistoryCaseModal && hideHistoryCaseModal()
  186. autoFillModules&&autoFillModules();
  187. }
  188. handleQuoteClick(item, index) {
  189. // const { handleQuoteClick } = this.props
  190. // handleQuoteClick && handleQuoteClick(item)
  191. this.setState({
  192. activeHistory: index,
  193. sign:item.sign,
  194. activeItem:item
  195. })
  196. }
  197. getHistoryCase() {
  198. const { items } = this.props
  199. return (<div className={style['history-info']}>
  200. {items.map((item, index) => {
  201. return<div onClick={this.handleQuoteClick.bind(this, item, index)} style={this.state.activeHistory === index ? {color: '#3B9ED0'} : ''}>
  202. <img src={this.state.activeHistory === index ? iconRadioActive : iconRadioDefault}/>{item.diagnose} {item.inquiryDate}
  203. </div>
  204. })}
  205. </div>)
  206. }
  207. showAssessFn(item){
  208. const {setAssess} = this.props;
  209. const that = this;
  210. if(item&&item.conceptId){ //显示评估弹窗
  211. getAssessData(item.conceptId,item.name).then((res)=>{
  212. if(res.data.code=='0'){
  213. const data = res.data.data;
  214. if(!data||data.length==0){
  215. Notify.info('暂无数据');
  216. }else{
  217. setAssess&&setAssess(data,item.name);
  218. that.setState({
  219. showAssess:true,
  220. isAssessConfirm:false,
  221. assessId:item.conceptId,
  222. disName:item.name
  223. });
  224. }
  225. }else{
  226. Notify.error(res.data.msg);
  227. }
  228. }).catch(error=>{
  229. console.log(error);
  230. });
  231. }else{ //关闭评估弹窗
  232. this.setState({
  233. showAssess:false,
  234. isAssessConfirm:false,
  235. });
  236. dragBox('dragModalWrap','dragModalTitle','del')
  237. }
  238. }
  239. handleSaveAssess(){
  240. this.setState({
  241. isAssessConfirm:true
  242. });
  243. const that=this;
  244. setTimeout(()=>{
  245. that.setState({
  246. showAssess:false
  247. });
  248. });
  249. dragBox('dragModalWrap','dragModalTitle','del')
  250. }
  251. componentWillReceiveProps(nextprops) {
  252. let flg = store.getState().print.mrInfo.mrId&&store.getState().print.mrInfo.mrId.indexOf('reStart')>-1
  253. if (this.props.diagnosticStr.split(',').length != nextprops.diagnosticStr.split(',').length&&!flg) {
  254. this.props.getBilling({mode:10});
  255. }
  256. }
  257. handleEnterDel(index) {
  258. this.setState({
  259. hasOnIndex: index,
  260. hasOndel: true
  261. })
  262. }
  263. handleLeaveDel() {
  264. this.setState({
  265. hasOnIndex: -1,
  266. hasOndel: false
  267. })
  268. }
  269. handleMouseEnterDrug(index) {
  270. this.setState({
  271. hasEnterItem: index,
  272. })
  273. }
  274. handleMouseLeaveDrug() {
  275. this.setState({
  276. hasEnterItem: -1,
  277. })
  278. }
  279. handleMouseEnterImg() {
  280. this.setState({
  281. hasEnterImg: true
  282. })
  283. }
  284. handleMouseLeaveImg() {
  285. this.setState({
  286. hasEnterImg: false
  287. })
  288. }
  289. handleInput(e,index){
  290. const {editDiagName,getBilling} = this.props;
  291. let name = (e.target.value).trim()
  292. editDiagName(index,name)
  293. //右侧推送--延时推送
  294. const stimer = this.state.timer;
  295. clearTimeout(stimer);
  296. let timer = setTimeout(function(){
  297. getBilling&&getBilling({mode:10});
  298. clearTimeout(stimer);
  299. },config.delayPushTime);
  300. this.setState({timer})
  301. }
  302. render(){
  303. const { list, treatment,pushMessage, showReferRecord, showHistoryCase ,chronicMagItem,loading,refreshScroller,windowWidth,hideChronic} = this.props;
  304. const {showTipsDetails,tipsDetails,showAllName}=pushMessage;
  305. const {visible, treatTitle, showAssess, isAssessConfirm, assessId, disName, hasOndel, hasOnIndex,hasEnterItem,hasEnterImg,delItem} = this.state;
  306. const chronicList = JSON.parse(localStorage.getItem('chronic')||null);
  307. //let isChronic = false; //是否要显示管理评估
  308. const footer = <Footer print={true}
  309. footText="确定"
  310. handlePrint={this.onPrint}
  311. handleConfirm={this.handleSaveAssess}/>;
  312. return(
  313. <div className={style['diaglist-wrap']}>
  314. {list && (list.length > 0) && list.map((item, index) => {
  315. /*const hasTreat = item.treat && ((item.treat.commonTreatment&&item.treat.commonTreatment.content) || (item.treat.surgeryTreatment&&item.treat.surgeryTreatment.content) || item.treat.treatment.length>0 ||(item.adverseReactions&&item.adverseReactions.length > 0)
  316. || (item.drugHistory && item.drugHistory['慢病用药内容'] && item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory &&item.drugHistory['普通病用药内容'] && item.drugHistory['普通病用药内容'].length > 0) ||item.follow)
  317. isChronic = !hideChronic&&chronicMagItem&&item.type==2&&chronicList&&chronicList.findIndex((it)=>it.conceptId==item.conceptId)!=-1;*/
  318. return (<div draggable={false} className={`${style['diag-box']} ${setFontColorSize(2,3)} clearfix`} id="diagListBox" key={item.conceptId} >
  319. {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
  320. {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
  321. <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '1' : index+1}</span>
  322. <span className={style['diag-name']}
  323. onMouseEnter={this.handleMouseEnterDrug.bind(this,index)}
  324. onMouseLeave = {this.handleMouseLeaveDrug.bind(this)}
  325. >
  326. <span title={item.name} className={style['diag-name-box']} style={{'max-width': '300px'}}>
  327. <input type="text" value={item.name} onBlur={(e)=>{this.handleBlur(e,item,index)}} onInput={(e)=>this.handleInput(e,index)}/>
  328. </span>
  329. {/* <img className={`${style['info-img']}`}
  330. title='点击i图标可查看详细说明'
  331. style ={hasEnterItem===index ? {display: "inline-block"} : {display: "none"}}
  332. src={hasEnterImg ? infoMove : infoShow}
  333. onMouseEnter={this.handleMouseEnterImg.bind(this)}
  334. onMouseLeave = {this.handleMouseLeaveImg.bind(this)}
  335. onClick={this.handleClickDiag.bind(this,item,false,false,false)}
  336. /> */}
  337. </span>
  338. {/* {item.type === 1 ? <span className={style['diag-first']}>初诊</span> :<span className={style['diag-second']}> 复诊</span>} */}
  339. <span className={style['treat']}
  340. // style ={hasTreat ? '' : { color: 'gray', cursor: 'text'}}
  341. onClick={() =>{this.showTreat(item, index)}}>
  342. <img src={item.hasTreat?singleB:singleL} alt=""/>
  343. 治疗方案
  344. </span>
  345. {/*{isChronic&&index===0&&item.conceptId===chronicMagItem.conceptId?<span className={style['assess']}
  346. onClick={this.showAssessFn.bind(this,item)}>
  347. 管理评估
  348. </span>:''}*/}
  349. <img className={style['diag-del']} src={hasOnIndex == index ? hasOndel ? del_on : del_icon : del_icon} onMouseEnter={this.handleEnterDel.bind(this,index)} onMouseLeave={this.handleLeaveDel.bind(this)} onClick={()=>{this.handleDeleteItem(item,index)}}/>
  350. </div>)
  351. })}
  352. {treatment&&<Treat title={treatTitle} refreshScroller={refreshScroller}></Treat>}
  353. {/*{showAssess?<ComplexModal onclose={this.showAssessFn.bind(this)} footer={footer}
  354. title='管理和评估'
  355. icon={manageIcon}
  356. top={'3%'}
  357. bottom={'3%'}
  358. width={820}>
  359. <AssessResult closeAssess={this.showAssessFn.bind(this)}
  360. disId={assessId}
  361. disName={disName}
  362. chronicMagItemName={list[0].name}
  363. isAssessConfirm={isAssessConfirm}
  364. ></AssessResult>
  365. </ComplexModal>:''}*/}
  366. {showTipsDetails &&<DetailsModal
  367. showTipsDetails = {showTipsDetails}
  368. hideTips = {this.hideTips}
  369. showAllName = {showAllName}
  370. tipsDetails = {tipsDetails}/>}
  371. <ConfirmModal visible={visible}
  372. okText='删除'
  373. cancelText='取消'
  374. confirm={this.deleteItem}
  375. cancel={this.cancel}
  376. close={this.close}
  377. >
  378. <div className={style['del-msg']}>是否删除诊断{delItem.name}?</div>
  379. </ConfirmModal>
  380. {/*<ConfirmModal visible={showReferRecord} okText='是' cancelText='否' confirm={this.referRecord} cancel={this.noReferRecord} close={this.noReferRecord}>
  381. <div className={style['confirm-info']}>是否引用往期病历</div>
  382. </ConfirmModal>
  383. <ConfirmModal visible={showHistoryCase} noFooter='true' title='请选择历史病历' close={this.closeHistoryCaseModal} titleBg="#DFEAFE" icon={tableIcon} height={300}>
  384. {this.getHistoryCase()}
  385. <div className={style['confirm-history']}><span className={style['confirm-history-btn']} onClick={this.referCase}>确定</span></div>
  386. </ConfirmModal>*/}
  387. <Loading show={loading}/>
  388. </div>
  389. )
  390. }
  391. }
  392. export default DiagnosticList;