index.jsx 14 KB

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