index.jsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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 {getAssessData} from '@store/async-actions/fetchModules';
  19. import tableIcon from '@common/images/table.png';
  20. import { CONFIRM_TYPE } from "@store/types/typeConfig";
  21. import $ from "jquery";
  22. class DiagnosticList extends Component {
  23. constructor(props) {
  24. super(props);
  25. this.state = {
  26. visible: false,
  27. delItem: {},
  28. treatTitle: '',
  29. activeHistory: -1,
  30. sign:-1,
  31. showAssess:false,
  32. assessId:'',
  33. disName:'',
  34. isAssessConfirm:false,
  35. hasOndel: false,
  36. hasOnIndex: -1
  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.onPrint = this.onPrint.bind(this);
  50. }
  51. onPrint() {
  52. let dom = $("#AssistResult");
  53. dom.jqprint({
  54. debug: false,
  55. importCSS: true,
  56. printContainer: true,
  57. operaSupport: false,
  58. });
  59. }
  60. upDiagnostic(index) {
  61. const { upDiagnostic } = this.props;
  62. upDiagnostic && upDiagnostic(index)
  63. }
  64. downDiagnostic(index) {
  65. const { downDiagnostic } = this.props;
  66. downDiagnostic && downDiagnostic(index)
  67. }
  68. deleteItem() {
  69. const { delItem } = this.state;
  70. const { delDiagnostic, delReact,delFollowUp } = this.props;
  71. delDiagnostic && delDiagnostic(delItem);
  72. delReact && delReact(delItem);
  73. delFollowUp && delFollowUp(delItem);
  74. this.setState({
  75. visible: false,
  76. })
  77. Notify.success('删除成功')
  78. }
  79. cancel() {
  80. this.setState({
  81. visible: false
  82. })
  83. }
  84. close() {
  85. this.setState({
  86. visible: false
  87. })
  88. }
  89. handleDeleteItem(item) {
  90. this.setState({
  91. visible: true,
  92. delItem: item,
  93. })
  94. }
  95. showTreat(item, index) {
  96. // item.treatIndex = index
  97. const { showTreat, getTreatResult } = this.props;
  98. getTreatResult && getTreatResult(item);
  99. // showTreat && showTreat();//添加loading,移到async-actions中
  100. this.setState({
  101. treatTitle: item.name
  102. })
  103. }
  104. handleClickDiag(item) {
  105. const { getTips } = this.props;
  106. // getTips && getTips(item);
  107. getTips && getTips({id:item.conceptId, type:7, name: item.name, position: 1});
  108. }
  109. referRecord() {
  110. const { hideReferRecord, showHistoryCaseModal ,chronicMagItem,hisTemplates,autoFillModules,typeConfig} = this.props
  111. hideReferRecord && hideReferRecord()
  112. // showHistoryCaseModal && showHistoryCaseModal()
  113. // store.dispatch(initItemList(chronicMagItem))
  114. initItemList(chronicMagItem).then((res)=>{
  115. console.log(99999,chronicMagItem)
  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. const {setAssess} = this.props;
  194. const that = this;
  195. if(item&&item.conceptId){ //显示评估弹窗
  196. getAssessData(item.conceptId,item.name).then((res)=>{
  197. if(res.data.code=='0'){
  198. const data = res.data.data;
  199. if(!data||data.length==0){
  200. Notify.info('暂无数据');
  201. }else{
  202. setAssess&&setAssess(data,item.name);
  203. that.setState({
  204. showAssess:true,
  205. isAssessConfirm:false,
  206. assessId:item.conceptId,
  207. disName:item.name
  208. });
  209. }
  210. }else{
  211. Notify.error(res.data.msg);
  212. }
  213. }).catch(error=>{
  214. console.log(error);
  215. });
  216. }else{ //关闭评估弹窗
  217. this.setState({
  218. showAssess:false,
  219. isAssessConfirm:false,
  220. });
  221. dragBox('dragModalWrap','dragModalTitle','del')
  222. }
  223. }
  224. handleSaveAssess(){
  225. this.setState({
  226. isAssessConfirm:true
  227. });
  228. const that=this;
  229. setTimeout(()=>{
  230. that.setState({
  231. showAssess:false
  232. });
  233. });
  234. dragBox('dragModalWrap','dragModalTitle','del')
  235. }
  236. componentWillReceiveProps(nextprops) {
  237. if (this.props.diagnosticStr != nextprops.diagnosticStr) {
  238. this.props.getBilling();
  239. }
  240. }
  241. handleEnterDel(index) {
  242. this.setState({
  243. hasOnIndex: index,
  244. hasOndel: true
  245. })
  246. }
  247. handleLeaveDel() {
  248. this.setState({
  249. hasOnIndex: -1,
  250. hasOndel: false
  251. })
  252. }
  253. render(){
  254. const { list, treatment, showReferRecord, showHistoryCase ,chronicMagItem,loading} = this.props;
  255. const {visible, treatTitle, showAssess, isAssessConfirm, assessId, disName, hasOndel, hasOnIndex} = this.state;
  256. const chronicList = JSON.parse(localStorage.getItem('chronic')||null);
  257. let isChronic = false; //是否要显示管理评估
  258. const footer = <Footer print={true}
  259. footText="确定"
  260. handlePrint={this.onPrint}
  261. handleConfirm={this.handleSaveAssess}/>;
  262. return(
  263. <div className={style['diaglist-wrap']}>
  264. {list && (list.length > 0) && list.map((item, index) => {
  265. 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)
  266. || (item.drugHistory && item.drugHistory['慢病用药内容'] && item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory &&item.drugHistory['普通病用药内容'] && item.drugHistory['普通病用药内容'].length > 0) ||item.follow)
  267. isChronic = chronicMagItem&&item.type==2&&chronicList.findIndex((it)=>it.conceptId==item.conceptId)!=-1;
  268. return (<div draggable={true} className={style['diag-box'] + ' clearfix'} key={item.conceptId} >
  269. {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
  270. {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
  271. <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '1' : index+1}</span>
  272. <span className={style['diag-name']} onClick={()=>{this.handleClickDiag(item)}}>{item.name}<span></span></span>
  273. {item.type === 1 ? <span className={style['diag-first']}>初诊</span> :<span className={style['diag-second']}> 复诊</span>}
  274. <span className={style['treat']}
  275. // style ={hasTreat ? '' : { color: 'gray', cursor: 'text'}}
  276. onClick={() =>{this.showTreat(item, index)}}>
  277. 治疗方案
  278. </span>
  279. {isChronic?<span className={style['assess']}
  280. onClick={this.showAssessFn.bind(this,item)}>
  281. 管理评估
  282. </span>:''}
  283. <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)}}/>
  284. </div>)
  285. })}
  286. {treatment&&<Treat title={treatTitle}></Treat>}
  287. {showAssess?<ComplexModal onclose={this.showAssessFn.bind(this)} footer={footer}
  288. title='管理和评估'
  289. icon={manageIcon}
  290. top={'3%'}
  291. bottom={'3%'}
  292. width={820}>
  293. <AssessResult closeAssess={this.showAssessFn.bind(this)}
  294. disId={assessId}
  295. disName={disName}
  296. chronicMagItemName={list[0].name}
  297. isAssessConfirm={isAssessConfirm}
  298. ></AssessResult>
  299. </ComplexModal>:''}
  300. <ConfirmModal visible={visible}
  301. okText='删除'
  302. cancelText='取消'
  303. confirm={this.deleteItem}
  304. cancel={this.cancel}
  305. close={this.close}
  306. >
  307. <div className={style['del-msg']}>是否删除该诊断?</div>
  308. </ConfirmModal>
  309. <ConfirmModal visible={showReferRecord} okText='是' cancelText='否' confirm={this.referRecord} cancel={this.noReferRecord} close={this.noReferRecord}>
  310. <div className={style['confirm-info']}>是否引用往期病历</div>
  311. </ConfirmModal>
  312. <ConfirmModal visible={showHistoryCase} noFooter='true' title='请选择历史病历' close={this.closeHistoryCaseModal} titleBg="#DFEAFE" icon={tableIcon} height={300}>
  313. {this.getHistoryCase()}
  314. <div className={style['confirm-history']}><span className={style['confirm-history-btn']} onClick={this.referCase}>确定</span></div>
  315. </ConfirmModal>
  316. <Loading show={loading}/>
  317. </div>
  318. )
  319. }
  320. }
  321. export default DiagnosticList;