index.jsx 14 KB

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