index.jsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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 } 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 iconRadioDefault from '@common/images/icon-radio-default.png'
  15. import iconRadioActive from '@common/images/icon-radio-active.png'
  16. import AssessResult from '@containers/AssessResult';
  17. import tableIcon from '@common/images/table.png';
  18. import { CONFIRM_TYPE } from "@store/types/typeConfig";
  19. import $ from "jquery";
  20. class DiagnosticList extends Component {
  21. constructor(props) {
  22. super(props);
  23. this.state = {
  24. visible: false,
  25. delItem: {},
  26. treatTitle: '',
  27. activeHistory: -1,
  28. sign: -1,
  29. showAssess: false,
  30. assessId: '',
  31. disName: '',
  32. isAssessConfirm: false,
  33. radioVal: {}, //可能结果选择内容
  34. possible: {}, //可能结果
  35. hasOndel: false
  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.handleSavePossible = this.handleSavePossible.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.id, type: 7 });
  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. const result = res.data;
  116. if (result.code == 0 && result.data) {
  117. store.dispatch(setInitHistory(result.data));
  118. showHistoryCaseModal && showHistoryCaseModal();
  119. } else {
  120. if (typeConfig == 0) {
  121. Notify.info("暂无历史病历,已默认展示慢病相关内容");
  122. const timer = setTimeout(function () {
  123. autoFillModules && autoFillModules();
  124. clearTimeout(timer);
  125. }, 1000) //需求要求延时
  126. }
  127. }
  128. })
  129. }
  130. noReferRecord() {
  131. const { hideReferRecord, autoFillModules, typeConfig } = this.props
  132. hideReferRecord && hideReferRecord();
  133. if (typeConfig == 0) {//智能推送模式才自动填充
  134. autoFillModules && autoFillModules();
  135. }
  136. }
  137. referCase() {
  138. const { hideHistoryCaseModal, items, autoFillModules, typeConfig } = this.props
  139. const { sign } = this.state;
  140. hideHistoryCaseModal && hideHistoryCaseModal()
  141. if (this.state.activeHistory === -1 && typeConfig == 0) {//没有选择历史病例直接点确定
  142. Notify.info("未选择历史病历,已默认展示慢病相关内容");
  143. const timer = setTimeout(function () {
  144. autoFillModules && autoFillModules();
  145. clearTimeout(timer);
  146. }, 1000)
  147. return
  148. }
  149. let baseList = store.getState();
  150. let baseObj = items[this.state.activeHistory];
  151. // 切换模式
  152. if (sign != typeConfig) {
  153. store.dispatch({ type: CONFIRM_TYPE, confirmType: baseObj.sign });
  154. }
  155. pushAllDataList(baseObj.sign, 'push', baseObj, 'history') //引用
  156. this.props.getBilling();
  157. this.setState({
  158. activeHistory: -1,
  159. sign: -1
  160. })
  161. }
  162. closeHistoryCaseModal() {
  163. const { hideHistoryCaseModal, autoFillModules, typeConfig } = this.props
  164. this.setState({
  165. activeHistory: -1,
  166. sign: -1
  167. })
  168. hideHistoryCaseModal && hideHistoryCaseModal()
  169. if (typeConfig == 0) {//智能推送模式才自动填充
  170. autoFillModules && autoFillModules();
  171. }
  172. }
  173. handleQuoteClick(item, index) {
  174. const { handleQuoteClick } = this.props
  175. // handleQuoteClick && handleQuoteClick(item)
  176. this.setState({
  177. activeHistory: index,
  178. sign: item.sign
  179. })
  180. }
  181. getHistoryCase() {
  182. const { items } = this.props
  183. return (<div className={style['history-info']}>
  184. {items.map((item, index) => {
  185. return <div onClick={this.handleQuoteClick.bind(this, item, index)} style={this.state.activeHistory === index ? { color: '#3B9ED0' } : ''}>
  186. <img src={this.state.activeHistory === index ? iconRadioActive : iconRadioDefault} />{item.diagnose + '(' + item.inquiryDate + ')'}
  187. </div>
  188. })}
  189. </div>)
  190. }
  191. showAssessFn(item) {
  192. if (item && item.id) { //显示评估弹窗
  193. this.setState({
  194. showAssess: true,
  195. isAssessConfirm: false,
  196. assessId: item.id,
  197. disName: item.name
  198. });
  199. } else { //关闭评估弹窗
  200. this.setState({
  201. showAssess: false,
  202. isAssessConfirm: false,
  203. });
  204. }
  205. }
  206. handleSavePossible(obj) {
  207. this.setState({
  208. possible: Object.assign({}, obj.possible),
  209. radioVal: Object.assign({}, obj.radioVal),//不设置radioVal只有最近一次选中的值
  210. })
  211. }
  212. handleSaveAssess() {
  213. this.setState({
  214. isAssessConfirm: true
  215. });
  216. const that = this;
  217. setTimeout(() => {
  218. that.setState({
  219. showAssess: false
  220. });
  221. });
  222. }
  223. componentWillReceiveProps(nextprops) {
  224. if (this.props.diagnosticStr != nextprops.diagnosticStr) {
  225. this.props.getBilling();
  226. }
  227. if (deepClone(nextprops.wholeResults) != deepClone(this.props.wholeResults)) {
  228. this.setState({
  229. radioVal: Object.assign({}, nextprops.wholeResults.radioVal),
  230. possible: Object.assign({}, nextprops.wholeResults.possible),
  231. })
  232. }
  233. }
  234. handleEnterDel() {
  235. this.setState({
  236. hasOndel: true
  237. })
  238. }
  239. handleLeaveDel() {
  240. this.setState({
  241. hasOndel: false
  242. })
  243. }
  244. render() {
  245. const { list, treatment, showReferRecord, showHistoryCase, chronicMagItem } = this.props;
  246. const { visible, treatTitle, showAssess, isAssessConfirm, radioVal, possible, assessId, disName, hasOndel } = this.state;
  247. const chronicList = JSON.parse(localStorage.getItem('chronic') || null);
  248. const chronicLine = chronicMagItem && chronicMagItem.name; //当前是否走的慢病流程
  249. let isChronic = false; //是否要显示管理评估
  250. const footer = <Footer print={true}
  251. footText="确定"
  252. handlePrint={this.onPrint}
  253. handleConfirm={this.handleSaveAssess} />;
  254. return (
  255. <div className={style['diaglist-wrap']}>
  256. {list && (list.length > 0) && list.map((item, index) => {
  257. const hasTreat = item.treat && (item.treat.commonTreatment.content || item.treat.surgeryTreatment.content || item.treat.treatment.length > 0 || (item.adverseReactions && item.adverseReactions.length > 0)
  258. || (item.drugHistory && item.drugHistory['慢病用药内容'] && item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory && item.drugHistory['普通病用药内容'] && item.drugHistory['普通病用药内容'].length > 0) || item.follow)
  259. isChronic = chronicLine && item.type == 2 && chronicList.findIndex((it) => it.id == item.id) != -1;
  260. return (<div draggable={true} className={style['diag-box'] + ' clearfix'} key={item.id} >
  261. {index === 0 ? '' : <span className={style['diag-up']} onClick={() => { this.upDiagnostic(index) }}><img className={style["diag-up"]} src={diagUp} /></span>}
  262. {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => { this.downDiagnostic(index) }} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown} /></span>}
  263. <span className={style['diag-number']} style={{ fontWeight: index === 0 ? 'bold' : 'normal' }}>{index === 0 ? '1' : index + 1}</span>
  264. <span className={style['diag-name']} onClick={() => { this.handleClickDiag(item) }}>{item.name}<span></span></span>
  265. {item.type === 1 ? <span className={style['diag-first']}>初诊</span> : <span className={style['diag-second']}> 复诊</span>}
  266. <span className={style['treat']}
  267. style={hasTreat ? '' : { color: 'gray', cursor: 'text' }}
  268. onClick={() => { hasTreat && this.showTreat(item, index) }}>
  269. 治疗方案
  270. </span>
  271. {isChronic ? <span className={style['assess']}
  272. onClick={this.showAssessFn.bind(this, item)}>
  273. 管理评估
  274. </span> : ''}
  275. <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) }} />
  276. </div>)
  277. })}
  278. {treatment && <Treat title={treatTitle}></Treat>}
  279. {showAssess ? <ComplexModal onclose={this.showAssessFn.bind(this)} footer={footer}
  280. title='管理和评估'
  281. icon={manageIcon}
  282. top={'3%'}
  283. bottom={'3%'}
  284. width={820}>
  285. <AssessResult handleSavePossible={this.handleSavePossible}
  286. closeAssess={this.showAssessFn.bind(this)}
  287. disId={assessId}
  288. disName={disName}
  289. radioVal={radioVal}
  290. possible={possible}
  291. isAssessConfirm={isAssessConfirm}
  292. ></AssessResult>
  293. </ComplexModal> : ''}
  294. <ConfirmModal visible={visible}
  295. okText='删除'
  296. cancelText='取消'
  297. confirm={this.deleteItem}
  298. cancel={this.cancel}
  299. close={this.close}
  300. >
  301. <div className={style['del-msg']}>是否删除该诊断?</div>
  302. </ConfirmModal>
  303. <ConfirmModal visible={showReferRecord} okText='是' cancelText='否' confirm={this.referRecord} cancel={this.noReferRecord} close={this.noReferRecord}>
  304. <div className={style['confirm-info']}>是否引用往期病历</div>
  305. </ConfirmModal>
  306. <ConfirmModal visible={showHistoryCase} noFooter='true' title='请选择历史病历' close={this.closeHistoryCaseModal} titleBg="#DFEAFE" icon={tableIcon} height={300}>
  307. {this.getHistoryCase()}
  308. <div className={style['confirm-history']}><span className={style['confirm-history-btn']} onClick={this.referCase}>确定</span></div>
  309. </ConfirmModal>
  310. </div>
  311. )
  312. }
  313. }
  314. export default DiagnosticList;