index.jsx 16 KB

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