index.jsx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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 infoShow from '@common/images/info-show.png';
  9. import infoMove from '@common/images/info-move.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, index) {
  104. // item.treatIndex = index
  105. const { showTreat, getTreatResult } = this.props;
  106. getTreatResult && getTreatResult(item);
  107. // showTreat && showTreat();//添加loading,移到async-actions中
  108. this.setState({
  109. treatTitle: item.name
  110. })
  111. }
  112. handleClickDiag(item) {
  113. const { getTips } = this.props;
  114. // getTips && getTips(item);
  115. getTips && getTips({id:item.conceptId, type:7, name: item.name, position: 0});
  116. }
  117. hideTips() {
  118. const { hideTipsDetailsModal } = this.props;
  119. hideTipsDetailsModal && hideTipsDetailsModal()
  120. }
  121. referRecord() {
  122. const { hideReferRecord, showHistoryCaseModal ,chronicMagItem,hisTemplates,autoFillModules,typeConfig} = this.props;
  123. hideReferRecord && hideReferRecord();
  124. // showHistoryCaseModal && showHistoryCaseModal()
  125. // store.dispatch(initItemList(chronicMagItem))
  126. initItemList(chronicMagItem).then((res)=>{
  127. const result = res.data;
  128. if(result.code==0 && result.data){
  129. store.dispatch(setInitHistory(result.data));
  130. showHistoryCaseModal && showHistoryCaseModal();
  131. }else{
  132. Notify.info("暂无历史病历,已默认展示慢病相关内容");
  133. const timer = setTimeout(function(){
  134. autoFillModules && autoFillModules();
  135. clearTimeout(timer);
  136. },1000) //需求要求延时
  137. }
  138. })
  139. }
  140. noReferRecord() {
  141. const { hideReferRecord ,autoFillModules,refreshScroller} = this.props;
  142. hideReferRecord && hideReferRecord();
  143. autoFillModules&&autoFillModules();
  144. store.dispatch(getMRAnalyse());
  145. setTimeout(function(){
  146. refreshScroller()&&refreshScroller().scrollTop();
  147. },100)
  148. }
  149. referCase() {//确定
  150. const { hideHistoryCaseModal, items ,autoFillModules,typeConfig} = this.props;
  151. const {sign,activeItem} = this.state;
  152. hideHistoryCaseModal && hideHistoryCaseModal()
  153. if (this.state.activeHistory === -1) {//没有选择历史病例直接点确定
  154. Notify.info("未选择历史病历,已默认展示慢病相关内容");
  155. const timer = setTimeout(function(){
  156. autoFillModules && autoFillModules();
  157. clearTimeout(timer);
  158. },1000)
  159. return
  160. }
  161. // let baseList = store.getState();
  162. // let baseObj = items[this.state.activeHistory];
  163. // pushAllDataList(baseObj.sign,'push',baseObj,'history') //引用
  164. store.dispatch(getHistempDetail(activeItem));
  165. this.props.getBilling({mode:10});
  166. this.setState({
  167. activeHistory: -1,
  168. sign:-1,
  169. activeItem:{}
  170. })
  171. }
  172. closeHistoryCaseModal() {
  173. const { hideHistoryCaseModal ,autoFillModules,typeConfig} = this.props
  174. this.setState({
  175. activeHistory: -1,
  176. sign:-1,
  177. activeItem:{}
  178. })
  179. hideHistoryCaseModal && hideHistoryCaseModal()
  180. autoFillModules&&autoFillModules();
  181. }
  182. handleQuoteClick(item, index) {
  183. // const { handleQuoteClick } = this.props
  184. // handleQuoteClick && handleQuoteClick(item)
  185. this.setState({
  186. activeHistory: index,
  187. sign:item.sign,
  188. activeItem:item
  189. })
  190. }
  191. getHistoryCase() {
  192. const { items } = this.props
  193. return (<div className={style['history-info']}>
  194. {items.map((item, index) => {
  195. return<div onClick={this.handleQuoteClick.bind(this, item, index)} style={this.state.activeHistory === index ? {color: '#3B9ED0'} : ''}>
  196. <img src={this.state.activeHistory === index ? iconRadioActive : iconRadioDefault}/>{item.diagnose} {item.inquiryDate}
  197. </div>
  198. })}
  199. </div>)
  200. }
  201. showAssessFn(item){
  202. const {setAssess} = this.props;
  203. const that = this;
  204. if(item&&item.conceptId){ //显示评估弹窗
  205. getAssessData(item.conceptId,item.name).then((res)=>{
  206. if(res.data.code=='0'){
  207. const data = res.data.data;
  208. if(!data||data.length==0){
  209. Notify.info('暂无数据');
  210. }else{
  211. setAssess&&setAssess(data,item.name);
  212. that.setState({
  213. showAssess:true,
  214. isAssessConfirm:false,
  215. assessId:item.conceptId,
  216. disName:item.name
  217. });
  218. }
  219. }else{
  220. Notify.error(res.data.msg);
  221. }
  222. }).catch(error=>{
  223. console.log(error);
  224. });
  225. }else{ //关闭评估弹窗
  226. this.setState({
  227. showAssess:false,
  228. isAssessConfirm:false,
  229. });
  230. dragBox('dragModalWrap','dragModalTitle','del')
  231. }
  232. }
  233. handleSaveAssess(){
  234. this.setState({
  235. isAssessConfirm:true
  236. });
  237. const that=this;
  238. setTimeout(()=>{
  239. that.setState({
  240. showAssess:false
  241. });
  242. });
  243. dragBox('dragModalWrap','dragModalTitle','del')
  244. }
  245. componentWillReceiveProps(nextprops) {
  246. if (this.props.diagnosticStr != nextprops.diagnosticStr) {
  247. this.props.getBilling({mode:10});
  248. }
  249. }
  250. handleEnterDel(index) {
  251. this.setState({
  252. hasOnIndex: index,
  253. hasOndel: true
  254. })
  255. }
  256. handleLeaveDel() {
  257. this.setState({
  258. hasOnIndex: -1,
  259. hasOndel: false
  260. })
  261. }
  262. handleMouseEnterDrug(index) {
  263. this.setState({
  264. hasEnterItem: index,
  265. })
  266. }
  267. handleMouseLeaveDrug() {
  268. this.setState({
  269. hasEnterItem: -1,
  270. })
  271. }
  272. handleMouseEnterImg() {
  273. this.setState({
  274. hasEnterImg: true
  275. })
  276. }
  277. handleMouseLeaveImg() {
  278. this.setState({
  279. hasEnterImg: false
  280. })
  281. }
  282. render(){
  283. const { list, treatment,pushMessage, showReferRecord, showHistoryCase ,chronicMagItem,loading,refreshScroller,windowWidth,hideChronic} = this.props;
  284. const {showTipsDetails,tipsDetails,showAllName}=pushMessage;
  285. const {visible, treatTitle, showAssess, isAssessConfirm, assessId, disName, hasOndel, hasOnIndex,hasEnterItem,hasEnterImg} = this.state;
  286. const chronicList = JSON.parse(localStorage.getItem('chronic')||null);
  287. //let isChronic = false; //是否要显示管理评估
  288. const footer = <Footer print={true}
  289. footText="确定"
  290. handlePrint={this.onPrint}
  291. handleConfirm={this.handleSaveAssess}/>;
  292. return(
  293. <div className={style['diaglist-wrap']}>
  294. {list && (list.length > 0) && list.map((item, index) => {
  295. /*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)
  296. || (item.drugHistory && item.drugHistory['慢病用药内容'] && item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory &&item.drugHistory['普通病用药内容'] && item.drugHistory['普通病用药内容'].length > 0) ||item.follow)
  297. isChronic = !hideChronic&&chronicMagItem&&item.type==2&&chronicList&&chronicList.findIndex((it)=>it.conceptId==item.conceptId)!=-1;*/
  298. return (<div draggable={true} className={`${style['diag-box']} ${setFontColorSize(2,3)} clearfix`} id="diagListBox" key={item.conceptId} >
  299. {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
  300. {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
  301. <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '1' : index+1}</span>
  302. <span className={style['diag-name']}
  303. onMouseEnter={this.handleMouseEnterDrug.bind(this,index)}
  304. onMouseLeave = {this.handleMouseLeaveDrug.bind(this)}
  305. >
  306. <span className={style['diag-name-box']} style={{maxWidth: windowWidth > 1024 ?windowWidth-900 +'px':'130px'}}>
  307. {item.name}
  308. </span>
  309. {/* <img className={`${style['info-img']}`}
  310. title='点击i图标可查看详细说明'
  311. style ={hasEnterItem===index ? {display: "inline-block"} : {display: "none"}}
  312. src={hasEnterImg ? infoMove : infoShow}
  313. onMouseEnter={this.handleMouseEnterImg.bind(this)}
  314. onMouseLeave = {this.handleMouseLeaveImg.bind(this)}
  315. onClick={this.handleClickDiag.bind(this,item,false,false,false)}
  316. /> */}
  317. </span>
  318. {/* {item.type === 1 ? <span className={style['diag-first']}>初诊</span> :<span className={style['diag-second']}> 复诊</span>}
  319. <span className={style['treat']}
  320. // style ={hasTreat ? '' : { color: 'gray', cursor: 'text'}}
  321. onClick={() =>{this.showTreat(item, index)}}>
  322. 治疗方案
  323. </span> */}
  324. {/*{isChronic&&index===0&&item.conceptId===chronicMagItem.conceptId?<span className={style['assess']}
  325. onClick={this.showAssessFn.bind(this,item)}>
  326. 管理评估
  327. </span>:''}*/}
  328. <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)}}/>
  329. </div>)
  330. })}
  331. {treatment&&<Treat title={treatTitle} refreshScroller={refreshScroller}></Treat>}
  332. {/*{showAssess?<ComplexModal onclose={this.showAssessFn.bind(this)} footer={footer}
  333. title='管理和评估'
  334. icon={manageIcon}
  335. top={'3%'}
  336. bottom={'3%'}
  337. width={820}>
  338. <AssessResult closeAssess={this.showAssessFn.bind(this)}
  339. disId={assessId}
  340. disName={disName}
  341. chronicMagItemName={list[0].name}
  342. isAssessConfirm={isAssessConfirm}
  343. ></AssessResult>
  344. </ComplexModal>:''}*/}
  345. {showTipsDetails &&<DetailsModal
  346. showTipsDetails = {showTipsDetails}
  347. hideTips = {this.hideTips}
  348. showAllName = {showAllName}
  349. tipsDetails = {tipsDetails}/>}
  350. <ConfirmModal visible={visible}
  351. okText='删除'
  352. cancelText='取消'
  353. confirm={this.deleteItem}
  354. cancel={this.cancel}
  355. close={this.close}
  356. >
  357. <div className={style['del-msg']}>是否删除该诊断?</div>
  358. </ConfirmModal>
  359. {/*<ConfirmModal visible={showReferRecord} okText='是' cancelText='否' confirm={this.referRecord} cancel={this.noReferRecord} close={this.noReferRecord}>
  360. <div className={style['confirm-info']}>是否引用往期病历</div>
  361. </ConfirmModal>
  362. <ConfirmModal visible={showHistoryCase} noFooter='true' title='请选择历史病历' close={this.closeHistoryCaseModal} titleBg="#DFEAFE" icon={tableIcon} height={300}>
  363. {this.getHistoryCase()}
  364. <div className={style['confirm-history']}><span className={style['confirm-history-btn']} onClick={this.referCase}>确定</span></div>
  365. </ConfirmModal>*/}
  366. <Loading show={loading}/>
  367. </div>
  368. )
  369. }
  370. }
  371. export default DiagnosticList;