index.jsx 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. import React, { Component } from 'react';
  2. import style from './index.less';
  3. import del_icon from './img/delete.png'
  4. import diagUp from './img/diagUp.png'
  5. import diagDown from './img/diagDown.png'
  6. import {ConfirmModal, Message} from '@commonComp';
  7. import Notify from '@commonComp/Notify';
  8. import Treat from '@containers/Treat'
  9. import store from '@store';
  10. import { initItemList ,setInitHistory} from '@store/async-actions/historyTemplates';
  11. import { pushAllDataList,inspectAndAssist } from '@utils/tools';
  12. import iconRadioDefault from '@common/images/icon-radio-default.png'
  13. import iconRadioActive from '@common/images/icon-radio-active.png'
  14. import tableIcon from '@common/images/table.png';
  15. import { delFollowUp } from '../../store/actions/treat';
  16. import { CONFIRM_TYPE } from "@store/types/typeConfig";
  17. class DiagnosticList extends Component {
  18. constructor(props) {
  19. super(props);
  20. this.state = {
  21. visible: false,
  22. delItem: {},
  23. treatTitle: '',
  24. activeHistory: -1,
  25. sign:-1
  26. }
  27. this.deleteItem = this.deleteItem.bind(this);
  28. this.cancel = this.cancel.bind(this);
  29. this.close = this.close.bind(this);
  30. this.showTreat = this.showTreat.bind(this);
  31. this.handleClickDiag = this.handleClickDiag.bind(this);
  32. this.referRecord = this.referRecord.bind(this);
  33. this.noReferRecord = this.noReferRecord.bind(this);
  34. this.getHistoryCase = this.getHistoryCase.bind(this);
  35. this.closeHistoryCaseModal = this.closeHistoryCaseModal.bind(this);
  36. this.referCase = this.referCase.bind(this);
  37. }
  38. componentWillReceiveProps(nextprops) {
  39. if (this.props.diagnosticStr != nextprops.diagnosticStr) {
  40. this.props.getBilling();
  41. }
  42. }
  43. upDiagnostic(index) {
  44. const { upDiagnostic } = this.props;
  45. upDiagnostic && upDiagnostic(index)
  46. }
  47. downDiagnostic(index) {
  48. const { downDiagnostic } = this.props;
  49. downDiagnostic && downDiagnostic(index)
  50. }
  51. deleteItem() {
  52. const { delItem } = this.state;
  53. const { delDiagnostic, delReact,delFollowUp } = this.props;
  54. delDiagnostic && delDiagnostic(delItem);
  55. delReact && delReact(delItem)
  56. delFollowUp && delFollowUp(delItem)
  57. this.setState({
  58. visible: false,
  59. })
  60. Notify.success('删除成功')
  61. }
  62. cancel() {
  63. this.setState({
  64. visible: false
  65. })
  66. }
  67. close() {
  68. this.setState({
  69. visible: false
  70. })
  71. }
  72. handleDeleteItem(item) {
  73. this.setState({
  74. visible: true,
  75. delItem: item,
  76. })
  77. }
  78. showTreat(item, index) {
  79. // item.treatIndex = index
  80. const { showTreat, getTreatResult } = this.props;
  81. getTreatResult && getTreatResult(item);
  82. // showTreat && showTreat();//添加loading,移到async-actions中
  83. this.setState({
  84. treatTitle: item.name
  85. })
  86. }
  87. handleClickDiag(item) {
  88. const { getTips } = this.props;
  89. // getTips && getTips(item);
  90. getTips && getTips({id:item.id,type:7});
  91. }
  92. referRecord() {
  93. const { hideReferRecord, showHistoryCaseModal ,chronicMagItem,hisTemplates,autoFillModules,typeConfig} = this.props
  94. hideReferRecord && hideReferRecord()
  95. // showHistoryCaseModal && showHistoryCaseModal()
  96. // store.dispatch(initItemList(chronicMagItem))
  97. initItemList(chronicMagItem).then((res)=>{
  98. const result = res.data;
  99. if(result.code==0 && result.data){
  100. store.dispatch(setInitHistory(result.data));
  101. showHistoryCaseModal && showHistoryCaseModal();
  102. }else{
  103. if(typeConfig==0){
  104. Notify.info("暂无历史病历,已默认展示慢病相关内容");
  105. const timer = setTimeout(function(){
  106. autoFillModules && autoFillModules();
  107. clearTimeout(timer);
  108. },1000) //需求要求延时
  109. }
  110. }
  111. })
  112. }
  113. noReferRecord() {
  114. const { hideReferRecord ,autoFillModules,typeConfig} = this.props
  115. hideReferRecord && hideReferRecord();
  116. if(typeConfig==0){//智能推送模式才自动填充
  117. autoFillModules&&autoFillModules();
  118. }
  119. }
  120. referCase() {
  121. const { hideHistoryCaseModal, items ,autoFillModules,typeConfig} = this.props
  122. const {sign} = this.state;
  123. hideHistoryCaseModal && hideHistoryCaseModal()
  124. if (this.state.activeHistory === -1 && typeConfig==0) {//没有选择历史病例直接点确定
  125. Notify.info("未选择历史病历,已默认展示慢病相关内容");
  126. const timer = setTimeout(function(){
  127. autoFillModules && autoFillModules();
  128. clearTimeout(timer);
  129. },1000)
  130. return
  131. }
  132. let baseList = store.getState();
  133. let baseObj = items[this.state.activeHistory];
  134. // 切换模式
  135. if(sign != typeConfig){
  136. store.dispatch({type: CONFIRM_TYPE, confirmType: baseObj.sign});
  137. }
  138. pushAllDataList(baseObj.sign,'push',baseObj,'history') //引用
  139. this.props.getBilling();
  140. this.setState({
  141. activeHistory: -1,
  142. sign:-1
  143. })
  144. }
  145. closeHistoryCaseModal() {
  146. const { hideHistoryCaseModal ,autoFillModules,typeConfig} = this.props
  147. this.setState({
  148. activeHistory: -1,
  149. sign:-1
  150. })
  151. hideHistoryCaseModal && hideHistoryCaseModal()
  152. if(typeConfig==0){//智能推送模式才自动填充
  153. autoFillModules&&autoFillModules();
  154. }
  155. }
  156. handleQuoteClick(item, index) {
  157. const { handleQuoteClick } = this.props
  158. // handleQuoteClick && handleQuoteClick(item)
  159. this.setState({
  160. activeHistory: index,
  161. sign:item.sign
  162. })
  163. }
  164. getHistoryCase() {
  165. const { items } = this.props
  166. return (<div className={style['history-info']}>
  167. {items.map((item, index) => {
  168. return<div onClick={this.handleQuoteClick.bind(this, item, index)} style={this.state.activeHistory === index ? {color: '#3B9ED0'} : ''}>
  169. <img src={this.state.activeHistory === index ? iconRadioActive : iconRadioDefault}/>{item.diagnose + '(' + item.inquiryDate + ')'}
  170. </div>
  171. })}
  172. </div>)
  173. }
  174. render(){
  175. const { list, treatment, showReferRecord, showHistoryCase } = this.props
  176. const { visible, treatTitle } = this.state
  177. const lastIndex = list.length -1;
  178. return(
  179. <div className={style['diaglist-wrap']}>
  180. {list && (list.length > 0) && list.map((item, index) => {
  181. const hasTreat = item.treat && (item.treat.commonTreatment.content || item.treat.surgeryTreatment.content || item.treat.treatment.length>0 ||(item.adverseReactions&&item.adverseReactions.length > 0)
  182. || (item.drugHistory && item.drugHistory['慢病用药内容'] && item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory &&item.drugHistory['普通病用药内容'] && item.drugHistory['普通病用药内容'].length > 0) ||item.follow)
  183. // const hasTreat= true;
  184. return (<div draggable={true} className={style['diag-box'] + ' clearfix'} key={item.id} >
  185. {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
  186. {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
  187. <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '主' : index+1}</span>
  188. <span className={style['diag-name']} onClick={()=>{this.handleClickDiag(item)}}>{item.name}<span></span></span>
  189. {item.type === 1 ? <span className={style['diag-first']}>初诊</span> :<span className={style['diag-second']}> 复诊</span>}
  190. <span className={style['treat']}
  191. // style ={{ color: hasTreat ?'' : 'gray', border: hasTreat ?'1px solid #3B9ED0' : '1px solid gray', cursor: hasTreat ? '' : 'text'}}
  192. style ={hasTreat ? '' : { color: 'gray', border: '1px solid gray', cursor: 'text'}}
  193. onClick={() =>{hasTreat && this.showTreat(item, index)}}>
  194. 治疗方案
  195. </span>
  196. <img className={style['diag-del']} src={del_icon} onClick={()=>{this.handleDeleteItem(item)}}/>
  197. </div>)
  198. })}
  199. {treatment&&<Treat title={treatTitle}></Treat>}
  200. <ConfirmModal visible={visible}
  201. okText='删除'
  202. cancelText='取消'
  203. confirm={this.deleteItem}
  204. cancel={this.cancel}
  205. close={this.close}
  206. >
  207. <div className={style['del-msg']}>是否删除该诊断?</div>
  208. </ConfirmModal>
  209. <ConfirmModal visible={showReferRecord} okText='是' cancelText='否' confirm={this.referRecord} cancel={this.noReferRecord} close={this.noReferRecord}>
  210. <div className={style['confirm-info']}>是否引用往期病历</div>
  211. </ConfirmModal>
  212. <ConfirmModal visible={showHistoryCase} noFooter='true' title='请选择历史病历' close={this.closeHistoryCaseModal} titleBg="#DFEAFE" icon={tableIcon} height={300}>
  213. {this.getHistoryCase()}
  214. <div className={style['confirm-history']}><span className={style['confirm-history-btn']} onClick={this.referCase}>确定</span></div>
  215. </ConfirmModal>
  216. </div>
  217. )
  218. }
  219. }
  220. export default DiagnosticList;