index.jsx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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 singleB from './img/singleB.png';
  9. import singleL from './img/singleL.png';
  10. import {ConfirmModal, Message,ComplexModal,Footer,Loading} from '@commonComp';
  11. import Notify from '@commonComp/Notify';
  12. import Treat from '@containers/Treat'
  13. import store from '@store';
  14. import { initItemList ,setInitHistory,getHistempDetail} from '@store/async-actions/historyTemplates';
  15. import { pushAllDataList,inspectAndAssist ,deepClone,setFontColorSize} from '@utils/tools';
  16. import { dragBox } from '@utils/drag';
  17. import iconRadioDefault from '@common/images/icon-radio-default.png'
  18. import iconRadioActive from '@common/images/icon-radio-active.png'
  19. import AssessResult from '@containers/AssessResult';
  20. import {getAssessData} from '@store/async-actions/fetchModules';
  21. import DetailsModal from '@components/PushItems/DetailsModal';
  22. import tableIcon from '@common/images/table.png';
  23. import { CONFIRM_TYPE } from "@store/types/typeConfig";
  24. import $ from "jquery";
  25. import {getMRAnalyse} from '@store/async-actions/pushMessage';
  26. class DiagnosticList extends Component {
  27. constructor(props) {
  28. super(props);
  29. this.state = {
  30. visible: false,
  31. delItem: {},
  32. treatTitle: '',
  33. activeHistory: -1,
  34. sign:-1,
  35. showAssess:false,
  36. assessId:'',
  37. disName:'',
  38. isAssessConfirm:false,
  39. hasOndel: false,
  40. hasOnIndex: -1,
  41. activeItem:{},
  42. hasEnterItem: -1,
  43. hasEnterImg: false
  44. }
  45. this.deleteItem = this.deleteItem.bind(this);
  46. this.cancel = this.cancel.bind(this);
  47. this.close = this.close.bind(this);
  48. this.showTreat = this.showTreat.bind(this);
  49. this.handleClickDiag = this.handleClickDiag.bind(this);
  50. this.referRecord = this.referRecord.bind(this);
  51. this.noReferRecord = this.noReferRecord.bind(this);
  52. this.getHistoryCase = this.getHistoryCase.bind(this);
  53. this.closeHistoryCaseModal = this.closeHistoryCaseModal.bind(this);
  54. this.referCase = this.referCase.bind(this);
  55. this.handleSaveAssess = this.handleSaveAssess.bind(this); //评估弹窗确定
  56. this.onPrint = this.onPrint.bind(this);
  57. this.hideTips=this.hideTips.bind(this);
  58. }
  59. onPrint() {
  60. let dom = $("#AssistResult");
  61. dom.jqprint({
  62. debug: false,
  63. importCSS: true,
  64. printContainer: true,
  65. operaSupport: false,
  66. });
  67. }
  68. upDiagnostic(index) {
  69. const { upDiagnostic } = this.props;
  70. upDiagnostic && upDiagnostic(index)
  71. }
  72. downDiagnostic(index) {
  73. const { downDiagnostic } = this.props;
  74. downDiagnostic && downDiagnostic(index)
  75. }
  76. deleteItem() {
  77. const { delItem } = this.state;
  78. const { delDiagnostic, delReact,delFollowUp } = this.props;
  79. delDiagnostic && delDiagnostic(delItem);
  80. delReact && delReact(delItem);
  81. delFollowUp && delFollowUp(delItem);
  82. this.setState({
  83. visible: false,
  84. })
  85. Notify.success('删除成功')
  86. }
  87. cancel() {
  88. this.setState({
  89. visible: false
  90. })
  91. }
  92. close() {
  93. this.setState({
  94. visible: false
  95. })
  96. }
  97. handleDeleteItem(item) {
  98. this.setState({
  99. visible: true,
  100. delItem: item,
  101. })
  102. }
  103. showTreat(item, idx) {
  104. const { getTreatResult,getBilling } = this.props;
  105. getTreatResult && getTreatResult(item,idx);
  106. getBilling({mode:10});
  107. }
  108. handleClickDiag(item) {
  109. const { getTips } = this.props;
  110. // getTips && getTips(item);
  111. getTips && getTips({id:item.conceptId, type:7, name: item.name, position: 0});
  112. }
  113. hideTips() {
  114. const { hideTipsDetailsModal } = this.props;
  115. hideTipsDetailsModal && hideTipsDetailsModal()
  116. }
  117. referRecord() {
  118. const { hideReferRecord, showHistoryCaseModal ,chronicMagItem,hisTemplates,autoFillModules,typeConfig} = this.props;
  119. hideReferRecord && hideReferRecord();
  120. // showHistoryCaseModal && showHistoryCaseModal()
  121. // store.dispatch(initItemList(chronicMagItem))
  122. initItemList(chronicMagItem).then((res)=>{
  123. const result = res.data;
  124. if(result.code==0 && result.data){
  125. store.dispatch(setInitHistory(result.data));
  126. showHistoryCaseModal && showHistoryCaseModal();
  127. }else{
  128. Notify.info("暂无历史病历,已默认展示慢病相关内容");
  129. const timer = setTimeout(function(){
  130. autoFillModules && autoFillModules();
  131. clearTimeout(timer);
  132. },1000) //需求要求延时
  133. }
  134. })
  135. }
  136. noReferRecord() {
  137. const { hideReferRecord ,autoFillModules,refreshScroller} = this.props;
  138. hideReferRecord && hideReferRecord();
  139. autoFillModules&&autoFillModules();
  140. store.dispatch(getMRAnalyse());
  141. setTimeout(function(){
  142. refreshScroller()&&refreshScroller().scrollTop();
  143. },100)
  144. }
  145. referCase() {//确定
  146. const { hideHistoryCaseModal, items ,autoFillModules,typeConfig} = this.props;
  147. const {sign,activeItem} = this.state;
  148. hideHistoryCaseModal && hideHistoryCaseModal()
  149. if (this.state.activeHistory === -1) {//没有选择历史病例直接点确定
  150. Notify.info("未选择历史病历,已默认展示慢病相关内容");
  151. const timer = setTimeout(function(){
  152. autoFillModules && autoFillModules();
  153. clearTimeout(timer);
  154. },1000)
  155. return
  156. }
  157. // let baseList = store.getState();
  158. // let baseObj = items[this.state.activeHistory];
  159. // pushAllDataList(baseObj.sign,'push',baseObj,'history') //引用
  160. store.dispatch(getHistempDetail(activeItem));
  161. this.props.getBilling({mode:10});
  162. this.setState({
  163. activeHistory: -1,
  164. sign:-1,
  165. activeItem:{}
  166. })
  167. }
  168. closeHistoryCaseModal() {
  169. const { hideHistoryCaseModal ,autoFillModules,typeConfig} = this.props
  170. this.setState({
  171. activeHistory: -1,
  172. sign:-1,
  173. activeItem:{}
  174. })
  175. hideHistoryCaseModal && hideHistoryCaseModal()
  176. autoFillModules&&autoFillModules();
  177. }
  178. handleQuoteClick(item, index) {
  179. // const { handleQuoteClick } = this.props
  180. // handleQuoteClick && handleQuoteClick(item)
  181. this.setState({
  182. activeHistory: index,
  183. sign:item.sign,
  184. activeItem:item
  185. })
  186. }
  187. getHistoryCase() {
  188. const { items } = this.props
  189. return (<div className={style['history-info']}>
  190. {items.map((item, index) => {
  191. return<div onClick={this.handleQuoteClick.bind(this, item, index)} style={this.state.activeHistory === index ? {color: '#3B9ED0'} : ''}>
  192. <img src={this.state.activeHistory === index ? iconRadioActive : iconRadioDefault}/>{item.diagnose} {item.inquiryDate}
  193. </div>
  194. })}
  195. </div>)
  196. }
  197. showAssessFn(item){
  198. const {setAssess} = this.props;
  199. const that = this;
  200. if(item&&item.conceptId){ //显示评估弹窗
  201. getAssessData(item.conceptId,item.name).then((res)=>{
  202. if(res.data.code=='0'){
  203. const data = res.data.data;
  204. if(!data||data.length==0){
  205. Notify.info('暂无数据');
  206. }else{
  207. setAssess&&setAssess(data,item.name);
  208. that.setState({
  209. showAssess:true,
  210. isAssessConfirm:false,
  211. assessId:item.conceptId,
  212. disName:item.name
  213. });
  214. }
  215. }else{
  216. Notify.error(res.data.msg);
  217. }
  218. }).catch(error=>{
  219. console.log(error);
  220. });
  221. }else{ //关闭评估弹窗
  222. this.setState({
  223. showAssess:false,
  224. isAssessConfirm:false,
  225. });
  226. dragBox('dragModalWrap','dragModalTitle','del')
  227. }
  228. }
  229. handleSaveAssess(){
  230. this.setState({
  231. isAssessConfirm:true
  232. });
  233. const that=this;
  234. setTimeout(()=>{
  235. that.setState({
  236. showAssess:false
  237. });
  238. });
  239. dragBox('dragModalWrap','dragModalTitle','del')
  240. }
  241. componentWillReceiveProps(nextprops) {
  242. // let flg = store.getState().print.mrInfo.mrId&&store.getState().print.mrInfo.mrId.indexOf('reStart')>-1
  243. if (this.props.diagnosticStr != nextprops.diagnosticStr) {
  244. this.props.getBilling({mode:10});
  245. }
  246. }
  247. handleEnterDel(index) {
  248. this.setState({
  249. hasOnIndex: index,
  250. hasOndel: true
  251. })
  252. }
  253. handleLeaveDel() {
  254. this.setState({
  255. hasOnIndex: -1,
  256. hasOndel: false
  257. })
  258. }
  259. handleMouseEnterDrug(index) {
  260. this.setState({
  261. hasEnterItem: index,
  262. })
  263. }
  264. handleMouseLeaveDrug() {
  265. this.setState({
  266. hasEnterItem: -1,
  267. })
  268. }
  269. handleMouseEnterImg() {
  270. this.setState({
  271. hasEnterImg: true
  272. })
  273. }
  274. handleMouseLeaveImg() {
  275. this.setState({
  276. hasEnterImg: false
  277. })
  278. }
  279. render(){
  280. const { list, treatment,pushMessage, showReferRecord, showHistoryCase ,chronicMagItem,loading,refreshScroller,windowWidth,hideChronic} = this.props;
  281. const {showTipsDetails,tipsDetails,showAllName}=pushMessage;
  282. const {visible, treatTitle, showAssess, isAssessConfirm, assessId, disName, hasOndel, hasOnIndex,hasEnterItem,hasEnterImg,delItem} = this.state;
  283. const chronicList = JSON.parse(localStorage.getItem('chronic')||null);
  284. //let isChronic = false; //是否要显示管理评估
  285. const footer = <Footer print={true}
  286. footText="确定"
  287. handlePrint={this.onPrint}
  288. handleConfirm={this.handleSaveAssess}/>;
  289. return(
  290. <div className={style['diaglist-wrap']}>
  291. {list && (list.length > 0) && list.map((item, index) => {
  292. /*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)
  293. || (item.drugHistory && item.drugHistory['慢病用药内容'] && item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory &&item.drugHistory['普通病用药内容'] && item.drugHistory['普通病用药内容'].length > 0) ||item.follow)
  294. isChronic = !hideChronic&&chronicMagItem&&item.type==2&&chronicList&&chronicList.findIndex((it)=>it.conceptId==item.conceptId)!=-1;*/
  295. return (<div draggable={true} className={`${style['diag-box']} ${setFontColorSize(2,3)} clearfix`} id="diagListBox" key={item.conceptId} >
  296. {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
  297. {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
  298. <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '1' : index+1}</span>
  299. <span className={style['diag-name']}
  300. onMouseEnter={this.handleMouseEnterDrug.bind(this,index)}
  301. onMouseLeave = {this.handleMouseLeaveDrug.bind(this)}
  302. >
  303. <span title={item.name} className={style['diag-name-box']} style={{'max-width': '300px'}}>
  304. {item.name}
  305. </span>
  306. {/* <img className={`${style['info-img']}`}
  307. title='点击i图标可查看详细说明'
  308. style ={hasEnterItem===index ? {display: "inline-block"} : {display: "none"}}
  309. src={hasEnterImg ? infoMove : infoShow}
  310. onMouseEnter={this.handleMouseEnterImg.bind(this)}
  311. onMouseLeave = {this.handleMouseLeaveImg.bind(this)}
  312. onClick={this.handleClickDiag.bind(this,item,false,false,false)}
  313. /> */}
  314. </span>
  315. {/* {item.type === 1 ? <span className={style['diag-first']}>初诊</span> :<span className={style['diag-second']}> 复诊</span>} */}
  316. <span className={style['treat']}
  317. // style ={hasTreat ? '' : { color: 'gray', cursor: 'text'}}
  318. onClick={() =>{this.showTreat(item, index)}}>
  319. <img src={item.hasTreat?singleB:singleL} alt=""/>
  320. 治疗方案
  321. </span>
  322. {/*{isChronic&&index===0&&item.conceptId===chronicMagItem.conceptId?<span className={style['assess']}
  323. onClick={this.showAssessFn.bind(this,item)}>
  324. 管理评估
  325. </span>:''}*/}
  326. <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)}}/>
  327. </div>)
  328. })}
  329. {treatment&&<Treat title={treatTitle} refreshScroller={refreshScroller}></Treat>}
  330. {/*{showAssess?<ComplexModal onclose={this.showAssessFn.bind(this)} footer={footer}
  331. title='管理和评估'
  332. icon={manageIcon}
  333. top={'3%'}
  334. bottom={'3%'}
  335. width={820}>
  336. <AssessResult closeAssess={this.showAssessFn.bind(this)}
  337. disId={assessId}
  338. disName={disName}
  339. chronicMagItemName={list[0].name}
  340. isAssessConfirm={isAssessConfirm}
  341. ></AssessResult>
  342. </ComplexModal>:''}*/}
  343. {showTipsDetails &&<DetailsModal
  344. showTipsDetails = {showTipsDetails}
  345. hideTips = {this.hideTips}
  346. showAllName = {showAllName}
  347. tipsDetails = {tipsDetails}/>}
  348. <ConfirmModal visible={visible}
  349. okText='删除'
  350. cancelText='取消'
  351. confirm={this.deleteItem}
  352. cancel={this.cancel}
  353. close={this.close}
  354. >
  355. <div className={style['del-msg']}>是否删除诊断{delItem.name}?</div>
  356. </ConfirmModal>
  357. {/*<ConfirmModal visible={showReferRecord} okText='是' cancelText='否' confirm={this.referRecord} cancel={this.noReferRecord} close={this.noReferRecord}>
  358. <div className={style['confirm-info']}>是否引用往期病历</div>
  359. </ConfirmModal>
  360. <ConfirmModal visible={showHistoryCase} noFooter='true' title='请选择历史病历' close={this.closeHistoryCaseModal} titleBg="#DFEAFE" icon={tableIcon} height={300}>
  361. {this.getHistoryCase()}
  362. <div className={style['confirm-history']}><span className={style['confirm-history-btn']} onClick={this.referCase}>确定</span></div>
  363. </ConfirmModal>*/}
  364. <Loading show={loading}/>
  365. </div>
  366. )
  367. }
  368. }
  369. export default DiagnosticList;