index.jsx 14 KB

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