index.jsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  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, Add} 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 { getPageCoordinate,setPosition,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 DiagResultSearch from '@containers/DiagResultSearch';
  23. import tableIcon from '@common/images/table.png';
  24. import { CONFIRM_TYPE } from "@store/types/typeConfig";
  25. import config from '@config/index';
  26. import $ from "jquery";
  27. import {getMRAnalyse} from '@store/async-actions/pushMessage';
  28. class DiagnosticList extends Component {
  29. constructor(props) {
  30. super(props);
  31. this.state = {
  32. visible: false,
  33. delItem: {},
  34. treatTitle: '',
  35. activeHistory: -1,
  36. sign:-1,
  37. showAssess:false,
  38. assessId:'',
  39. disName:'',
  40. isAssessConfirm:false,
  41. hasOndel: false,
  42. hasOnIndex: -1,
  43. activeItem:{},
  44. hasEnterItem: -1,
  45. hasEnterImg: false,
  46. timer:null,
  47. pageTop:''
  48. }
  49. this.deleteItem = this.deleteItem.bind(this);
  50. this.cancel = this.cancel.bind(this);
  51. this.close = this.close.bind(this);
  52. this.showTreat = this.showTreat.bind(this);
  53. this.handleClickDiag = this.handleClickDiag.bind(this);
  54. this.referRecord = this.referRecord.bind(this);
  55. this.noReferRecord = this.noReferRecord.bind(this);
  56. this.getHistoryCase = this.getHistoryCase.bind(this);
  57. this.closeHistoryCaseModal = this.closeHistoryCaseModal.bind(this);
  58. this.referCase = this.referCase.bind(this);
  59. this.handleSaveAssess = this.handleSaveAssess.bind(this); //评估弹窗确定
  60. this.onPrint = this.onPrint.bind(this);
  61. this.hideTips=this.hideTips.bind(this);
  62. this.handleTcmShowSearch = this.handleTcmShowSearch.bind(this);
  63. this.handleSymShowSearch = this.handleSymShowSearch.bind(this);
  64. this.showTcmSearch=this.showTcmSearch.bind(this);
  65. this.showSymSearch=this.showSymSearch.bind(this);
  66. }
  67. onPrint() {
  68. let dom = $("#AssistResult");
  69. dom.jqprint({
  70. debug: false,
  71. importCSS: true,
  72. printContainer: true,
  73. operaSupport: false,
  74. });
  75. }
  76. upDiagnostic(index) {
  77. const { upDiagnostic,isTcm } = this.props;
  78. upDiagnostic && upDiagnostic(index,isTcm)
  79. }
  80. downDiagnostic(index) {
  81. const { downDiagnostic,isTcm } = this.props;
  82. downDiagnostic && downDiagnostic(index,isTcm)
  83. }
  84. deleteItem() {
  85. const { delItem,idxNum } = this.state;
  86. const { delDiagnostic, delReact,delFollowUp,isTcm } = this.props;
  87. delDiagnostic && delDiagnostic(delItem,idxNum,isTcm);
  88. delReact && delReact(delItem); //删除对应不良反应
  89. delFollowUp && delFollowUp(delItem); //删除对应回访记录
  90. this.setState({
  91. visible: false,
  92. })
  93. Notify.success('删除成功')
  94. }
  95. handleBlur(e,delItem,idxNum){
  96. const { delDiagnostic,isTcm } = this.props;
  97. let name = e.target.value
  98. if(name.trim() == ''){
  99. delDiagnostic && delDiagnostic(delItem,idxNum,isTcm);
  100. }
  101. }
  102. handleTcmShowSearch(e) {
  103. this.props.showTcm ? this.hideTcmSearch() : this.showTcmSearch()
  104. this.setState({pageTop: getPageCoordinate(e).boxTop})
  105. if (this.props.showTcm) {
  106. this.props.setHighter(48)
  107. } else {
  108. //this.props.getBilling({mode: 10});
  109. setPosition(e, "#searchOption", this.props.setHighter)
  110. }
  111. }
  112. handleSymShowSearch(e) {
  113. this.showSymSearch(this.props.showSym ? false : true)
  114. this.setState({pageTop: getPageCoordinate(e).boxTop})
  115. if (this.props.showSym) {
  116. this.props.setHighter(48)
  117. } else {
  118. //this.props.getBilling({mode: 10});
  119. setPosition(e, "#searchOption", this.props.setHighter)
  120. }
  121. }
  122. showTcmSearch(flag) {
  123. const {showTcmSearch} = this.props;
  124. showTcmSearch && showTcmSearch(flag)
  125. }
  126. showSymSearch(flag) {
  127. const {showSymSearch} = this.props;
  128. showSymSearch && showSymSearch(flag)
  129. }
  130. cancel() {
  131. this.setState({
  132. visible: false
  133. })
  134. }
  135. close() {
  136. this.setState({
  137. visible: false
  138. })
  139. }
  140. handleDeleteItem(item,idx) {
  141. this.setState({
  142. visible: true,
  143. delItem: item,
  144. idxNum:idx
  145. })
  146. }
  147. showTreat(item, idx) {
  148. const { getTreatResult,getBilling,isTcm } = this.props;
  149. getTreatResult && getTreatResult(item,idx,isTcm);
  150. getBilling({mode:10});
  151. }
  152. handleClickDiag(item) {
  153. const { getTips } = this.props;
  154. // getTips && getTips(item);
  155. getTips && getTips({id:item.conceptId, type:7, name: item.name, position: 0});
  156. }
  157. hideTips() {
  158. const { hideTipsDetailsModal } = this.props;
  159. hideTipsDetailsModal && hideTipsDetailsModal()
  160. }
  161. referRecord() {
  162. const { hideReferRecord, showHistoryCaseModal ,chronicMagItem,hisTemplates,autoFillModules,typeConfig} = this.props;
  163. hideReferRecord && hideReferRecord();
  164. // showHistoryCaseModal && showHistoryCaseModal()
  165. // store.dispatch(initItemList(chronicMagItem))
  166. initItemList(chronicMagItem).then((res)=>{
  167. const result = res.data;
  168. if(result.code==0 && result.data){
  169. store.dispatch(setInitHistory(result.data));
  170. showHistoryCaseModal && showHistoryCaseModal();
  171. }else{
  172. Notify.info("暂无历史病历,已默认展示慢病相关内容");
  173. const timer = setTimeout(function(){
  174. autoFillModules && autoFillModules();
  175. clearTimeout(timer);
  176. },1000) //需求要求延时
  177. }
  178. })
  179. }
  180. noReferRecord() {
  181. const { hideReferRecord ,autoFillModules,refreshScroller} = this.props;
  182. hideReferRecord && hideReferRecord();
  183. autoFillModules&&autoFillModules();
  184. store.dispatch(getMRAnalyse());
  185. setTimeout(function(){
  186. refreshScroller()&&refreshScroller().scrollTop();
  187. },100)
  188. }
  189. referCase() {//确定
  190. const { hideHistoryCaseModal, items ,autoFillModules,typeConfig} = this.props;
  191. const {sign,activeItem} = this.state;
  192. hideHistoryCaseModal && hideHistoryCaseModal()
  193. if (this.state.activeHistory === -1) {//没有选择历史病例直接点确定
  194. Notify.info("未选择历史病历,已默认展示慢病相关内容");
  195. const timer = setTimeout(function(){
  196. autoFillModules && autoFillModules();
  197. clearTimeout(timer);
  198. },1000)
  199. return
  200. }
  201. // let baseList = store.getState();
  202. // let baseObj = items[this.state.activeHistory];
  203. // pushAllDataList(baseObj.sign,'push',baseObj,'history') //引用
  204. store.dispatch(getHistempDetail(activeItem));
  205. this.props.getBilling({mode:10});
  206. this.setState({
  207. activeHistory: -1,
  208. sign:-1,
  209. activeItem:{}
  210. })
  211. }
  212. closeHistoryCaseModal() {
  213. const { hideHistoryCaseModal ,autoFillModules,typeConfig} = this.props
  214. this.setState({
  215. activeHistory: -1,
  216. sign:-1,
  217. activeItem:{}
  218. })
  219. hideHistoryCaseModal && hideHistoryCaseModal()
  220. autoFillModules&&autoFillModules();
  221. }
  222. handleQuoteClick(item, index) {
  223. // const { handleQuoteClick } = this.props
  224. // handleQuoteClick && handleQuoteClick(item)
  225. this.setState({
  226. activeHistory: index,
  227. sign:item.sign,
  228. activeItem:item
  229. })
  230. }
  231. getHistoryCase() {
  232. const { items } = this.props
  233. return (<div className={style['history-info']}>
  234. {items.map((item, index) => {
  235. return<div onClick={this.handleQuoteClick.bind(this, item, index)} style={this.state.activeHistory === index ? {color: '#3B9ED0'} : ''}>
  236. <img src={this.state.activeHistory === index ? iconRadioActive : iconRadioDefault}/>{item.diagnose} {item.inquiryDate}
  237. </div>
  238. })}
  239. </div>)
  240. }
  241. showAssessFn(item){
  242. const {setAssess} = this.props;
  243. const that = this;
  244. if(item&&item.conceptId){ //显示评估弹窗
  245. getAssessData(item.conceptId,item.name).then((res)=>{
  246. if(res.data.code=='0'){
  247. const data = res.data.data;
  248. if(!data||data.length==0){
  249. Notify.info('暂无数据');
  250. }else{
  251. setAssess&&setAssess(data,item.name);
  252. that.setState({
  253. showAssess:true,
  254. isAssessConfirm:false,
  255. assessId:item.conceptId,
  256. disName:item.name
  257. });
  258. }
  259. }else{
  260. Notify.error(res.data.msg);
  261. }
  262. }).catch(error=>{
  263. console.log(error);
  264. });
  265. }else{ //关闭评估弹窗
  266. this.setState({
  267. showAssess:false,
  268. isAssessConfirm:false,
  269. });
  270. dragBox('dragModalWrap','dragModalTitle','del')
  271. }
  272. }
  273. handleSaveAssess(){
  274. this.setState({
  275. isAssessConfirm:true
  276. });
  277. const that=this;
  278. setTimeout(()=>{
  279. that.setState({
  280. showAssess:false
  281. });
  282. });
  283. dragBox('dragModalWrap','dragModalTitle','del')
  284. }
  285. componentWillReceiveProps(nextprops) {
  286. let flg = store.getState().print.mrInfo.mrId&&store.getState().print.mrInfo.mrId.indexOf('reStart')>-1
  287. if (this.props.diagnosticStr.split(',').length != nextprops.diagnosticStr.split(',').length&&!flg) {
  288. this.props.getBilling({mode:10});
  289. }
  290. }
  291. handleEnterDel(index) {
  292. this.setState({
  293. hasOnIndex: index,
  294. hasOndel: true
  295. })
  296. }
  297. handleLeaveDel() {
  298. this.setState({
  299. hasOnIndex: -1,
  300. hasOndel: false
  301. })
  302. }
  303. handleMouseEnterDrug(index) {
  304. this.setState({
  305. hasEnterItem: index,
  306. })
  307. }
  308. handleMouseLeaveDrug() {
  309. this.setState({
  310. hasEnterItem: -1,
  311. })
  312. }
  313. handleMouseEnterImg() {
  314. this.setState({
  315. hasEnterImg: true
  316. })
  317. }
  318. handleMouseLeaveImg() {
  319. this.setState({
  320. hasEnterImg: false
  321. })
  322. }
  323. handleFocus(){
  324. const {getBilling} = this.props;
  325. getBilling&&getBilling({mode:10});
  326. }
  327. handleInput(e,index){
  328. const {editDiagName,getBilling} = this.props;
  329. let name = (e.target.value).trim()
  330. editDiagName(index,name)
  331. //右侧推送--延时推送
  332. const stimer = this.state.timer;
  333. clearTimeout(stimer);
  334. let timer = setTimeout(function(){
  335. getBilling&&getBilling({mode:10});
  336. clearTimeout(stimer);
  337. },config.delayPushTime);
  338. this.setState({timer})
  339. }
  340. render(){
  341. const { list,tcmList, treatment,pushMessage, loading,refreshScroller,windowHeight,setHighter,isTcm} = this.props;
  342. const {showTipsDetails,tipsDetails,showAllName}=pushMessage;
  343. const {visible, treatTitle, hasOndel, hasOnIndex,delItem} = this.state;
  344. const diagList = isTcm?tcmList:list;
  345. if(isTcm){ //中医,添加中医诊断后才显示中医症候添加按钮
  346. return(
  347. <div className={style['diaglist-wrap']}>
  348. {diagList && (diagList.length > 0) && diagList.map((item, index) => {
  349. const {tcmDiag,tcmSyndrome} = item;
  350. return (<div draggable={false} className={`${style['diag-box']} ${setFontColorSize(2,3)} clearfix`} id="diagListBox" key={index} >
  351. {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
  352. {diagList.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
  353. <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '1' : index+1}</span>
  354. {tcmDiag?<span className={style['diag-name']}
  355. onMouseEnter={this.handleMouseEnterDrug.bind(this,index)}
  356. onMouseLeave = {this.handleMouseLeaveDrug.bind(this)}
  357. >
  358. <span title={tcmDiag} className={style['diag-name-box']} style={{'max-width': '300px'}}>
  359. <input type="text" value={tcmDiag} onFocus={(e)=>{this.handleFocus()}} onBlur={(e)=>{this.handleBlur(e,item,index)}} onInput={(e)=>this.handleInput(e,index)}/>
  360. </span>
  361. </span>:<Add showText="添加中医诊断结果" isTcm={isTcm} handleClick={this.handleTcmShowSearch} id="addTcmDiag" height="50px" />}
  362. {tcmSyndrome?<span className={style['diag-name']} onMouseEnter={this.handleMouseEnterDrug.bind(this,index)} onMouseLeave = {this.handleMouseLeaveDrug.bind(this)}>
  363. <span title={tcmSyndrome} className={style['diag-name-box']} style={{'max-width': '300px'}}>
  364. <input type="text" value={tcmSyndrome} onFocus={(e)=>{this.handleFocus()}} onBlur={(e)=>{this.handleBlur(e,item,index)}} onInput={(e)=>this.handleInput(e,index)}/>
  365. </span>
  366. </span>:(tcmDiag?<Add showText="添加中医症候" isTcm={isTcm} handleClick={this.handleSymShowSearch} id="addSymDiag" height="50px" />:'')}
  367. {tcmDiag&&tcmSyndrome?'':<DiagResultSearch
  368. refreshScroller={refreshScroller}
  369. setHighter={setHighter}
  370. windowHeight={windowHeight}
  371. pageTop={this.state.pageTop}
  372. isTcm={isTcm}
  373. height={150}>
  374. </DiagResultSearch>}
  375. {tcmDiag&&tcmSyndrome?<span className={style['treat']}
  376. onClick={() =>{this.showTreat(item, index)}}>
  377. <img src={item.hasTreat?singleB:singleL} alt=""/>
  378. 治疗方案
  379. </span>:''}
  380. <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,index)}}/>
  381. </div>)
  382. })}
  383. {treatment&&<Treat title={treatTitle} refreshScroller={refreshScroller}></Treat>}
  384. {showTipsDetails &&<DetailsModal
  385. showTipsDetails = {showTipsDetails}
  386. hideTips = {this.hideTips}
  387. showAllName = {showAllName}
  388. tipsDetails = {tipsDetails}/>}
  389. <ConfirmModal visible={visible}
  390. okText='删除'
  391. cancelText='取消'
  392. confirm={this.deleteItem}
  393. cancel={this.cancel}
  394. close={this.close}
  395. >
  396. <div className={style['del-msg']}>是否删除中医诊断{delItem.tcmDiag}?</div>
  397. </ConfirmModal>
  398. <Loading show={loading}/>
  399. </div>
  400. )
  401. }
  402. return(
  403. <div className={style['diaglist-wrap']}>
  404. {diagList && (diagList.length > 0) && diagList.map((item, index) => {console.log(diagList,item)
  405. return (<div draggable={false} className={`${style['diag-box']} ${setFontColorSize(2,3)} clearfix`} id="diagListBox" key={item.conceptId} >
  406. {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
  407. {diagList.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
  408. <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '1' : index+1}</span>
  409. <span className={style['diag-name']}
  410. onMouseEnter={this.handleMouseEnterDrug.bind(this,index)}
  411. onMouseLeave = {this.handleMouseLeaveDrug.bind(this)}
  412. >
  413. <span title={item.name} className={style['diag-name-box']} style={{'max-width': '300px'}}>
  414. <input type="text" value={item.name} onFocus={(e)=>{this.handleFocus()}} onBlur={(e)=>{this.handleBlur(e,item,index)}} onInput={(e)=>this.handleInput(e,index)}/>
  415. </span>
  416. </span>
  417. <span className={style['treat']}
  418. onClick={() =>{this.showTreat(item, index)}}>
  419. <img src={item.hasTreat?singleB:singleL} alt=""/>
  420. 治疗方案
  421. </span>
  422. <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,index)}}/>
  423. </div>)
  424. })}
  425. {treatment&&<Treat title={treatTitle} refreshScroller={refreshScroller}></Treat>}
  426. {showTipsDetails &&<DetailsModal
  427. showTipsDetails = {showTipsDetails}
  428. hideTips = {this.hideTips}
  429. showAllName = {showAllName}
  430. tipsDetails = {tipsDetails}/>}
  431. <ConfirmModal visible={visible}
  432. okText='删除'
  433. cancelText='取消'
  434. confirm={this.deleteItem}
  435. cancel={this.cancel}
  436. close={this.close}
  437. >
  438. <div className={style['del-msg']}>是否删除诊断{delItem.name}?</div>
  439. </ConfirmModal>
  440. <Loading show={loading}/>
  441. </div>
  442. )
  443. }
  444. }
  445. export default DiagnosticList;