index.jsx 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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 } from '@store/async-actions/historyTemplates';
  11. import { pushAllDataList } 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. class DiagnosticList extends Component {
  17. constructor(props) {
  18. super(props);
  19. this.state = {
  20. visible: false,
  21. delItem: {},
  22. treatTitle: '',
  23. activeHistory: -1
  24. }
  25. this.deleteItem = this.deleteItem.bind(this);
  26. this.cancel = this.cancel.bind(this);
  27. this.close = this.close.bind(this);
  28. this.showTreat = this.showTreat.bind(this);
  29. this.handleClickDiag = this.handleClickDiag.bind(this);
  30. this.referRecord = this.referRecord.bind(this);
  31. this.noReferRecord = this.noReferRecord.bind(this);
  32. this.getHistoryCase = this.getHistoryCase.bind(this);
  33. this.closeHistoryCaseModal = this.closeHistoryCaseModal.bind(this);
  34. this.referCase = this.referCase.bind(this);
  35. }
  36. componentWillReceiveProps(nextprops) {
  37. if (this.props.diagnosticStr != nextprops.diagnosticStr) {
  38. this.props.getBilling();
  39. }
  40. }
  41. upDiagnostic(index) {
  42. const { upDiagnostic } = this.props;
  43. upDiagnostic && upDiagnostic(index)
  44. }
  45. downDiagnostic(index) {
  46. const { downDiagnostic } = this.props;
  47. downDiagnostic && downDiagnostic(index)
  48. }
  49. deleteItem() {
  50. const { delItem } = this.state;
  51. const { delDiagnostic, delReact,delFollowUp } = this.props;
  52. delDiagnostic && delDiagnostic(delItem);
  53. delReact && delReact(delItem)
  54. delFollowUp && delFollowUp(delItem)
  55. this.setState({
  56. visible: false,
  57. })
  58. Notify.success('删除成功')
  59. }
  60. cancel() {
  61. this.setState({
  62. visible: false
  63. })
  64. }
  65. close() {
  66. this.setState({
  67. visible: false
  68. })
  69. }
  70. handleDeleteItem(item) {
  71. this.setState({
  72. visible: true,
  73. delItem: item,
  74. })
  75. }
  76. showTreat(item, index) {
  77. // item.treatIndex = index
  78. const { showTreat, getTreatResult } = this.props;
  79. getTreatResult && getTreatResult(item);
  80. showTreat && showTreat();
  81. this.setState({
  82. treatTitle: item.name
  83. })
  84. }
  85. handleClickDiag(item) {
  86. const { getTips } = this.props;
  87. // getTips && getTips(item);
  88. getTips && getTips({id:item.id,type:7});
  89. }
  90. referRecord() {
  91. const { hideReferRecord, showHistoryCaseModal ,chronicMagItem} = this.props
  92. hideReferRecord && hideReferRecord()
  93. showHistoryCaseModal && showHistoryCaseModal()
  94. store.dispatch(initItemList(chronicMagItem));
  95. }
  96. noReferRecord() {
  97. const { hideReferRecord } = this.props
  98. hideReferRecord && hideReferRecord()
  99. }
  100. referCase() {
  101. const { hideHistoryCaseModal, items } = this.props
  102. hideHistoryCaseModal && hideHistoryCaseModal()
  103. if (this.state.activeHistory === -1) {
  104. return
  105. }
  106. let baseList = store.getState();
  107. let baseObj = items[this.state.activeHistory];
  108. // store.dispatch({type: CONFIRM_TYPE, confirmType: baseObj.sign});
  109. pushAllDataList(baseObj.sign,'push',baseObj,'history') //引用
  110. this.props.getBilling();
  111. this.setState({
  112. activeHistory: -1
  113. })
  114. }
  115. closeHistoryCaseModal() {
  116. const { hideHistoryCaseModal } = this.props
  117. this.setState({
  118. activeHistory: -1
  119. })
  120. hideHistoryCaseModal && hideHistoryCaseModal()
  121. }
  122. handleQuoteClick(item, index) {
  123. console.log('asadsd', item)
  124. const { handleQuoteClick } = this.props
  125. // handleQuoteClick && handleQuoteClick(item)
  126. this.setState({
  127. activeHistory: index
  128. })
  129. }
  130. getHistoryCase() {
  131. const { items } = this.props
  132. return (<div className={style['history-info']}>
  133. {items.map((item, index) => {
  134. return<div onClick={this.handleQuoteClick.bind(this, item, index)} style={this.state.activeHistory === index ? {color: '#abcdef'} : ''}>
  135. <img src={this.state.activeHistory === index ? iconRadioActive : iconRadioDefault}/>{item.diagnose}
  136. </div>
  137. })}
  138. </div>)
  139. }
  140. render(){
  141. const { list, treatment, showReferRecord, showHistoryCase } = this.props
  142. const { visible, treatTitle } = this.state
  143. const lastIndex = list.length -1;
  144. return(
  145. <div className={style['diaglist-wrap']}>
  146. {list && (list.length > 0) && list.map((item, index) => {
  147. const hasTreat = item.treat && (item.treat.commonTreatment.content || item.treat.surgeryTreatment.content || item.treat.treatment.length>0)
  148. // const hasTreat= true;
  149. return (<div draggable={true} className={style['diag-box'] + ' clearfix'} key={item.id} >
  150. {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
  151. {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
  152. <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '主' : index+1}</span>
  153. <span className={style['diag-name']} onClick={()=>{this.handleClickDiag(item)}}>{item.name}<span></span></span>
  154. {item.type === 1 ? <span className={style['diag-first']}>初诊</span> :<span className={style['diag-second']}> 复诊</span>}
  155. <span className={style['treat']}
  156. // style ={{ color: hasTreat ?'' : 'gray', border: hasTreat ?'1px solid #3B9ED0' : '1px solid gray', cursor: hasTreat ? '' : 'text'}}
  157. style ={hasTreat ? '' : { color: 'gray', border: '1px solid gray', cursor: 'text'}}
  158. onClick={() =>{hasTreat && this.showTreat(item, index)}}>
  159. 治疗方案
  160. </span>
  161. <img className={style['diag-del']} src={del_icon} onClick={()=>{this.handleDeleteItem(item)}}/>
  162. </div>)
  163. })}
  164. {treatment&&<Treat title={treatTitle}></Treat>}
  165. <ConfirmModal visible={visible}
  166. okText='删除'
  167. cancelText='取消'
  168. confirm={this.deleteItem}
  169. cancel={this.cancel}
  170. close={this.close}
  171. >
  172. <div className={style['del-msg']}>是否删除该诊断?</div>
  173. </ConfirmModal>
  174. <ConfirmModal visible={showReferRecord} okText='是' cancelText='否' confirm={this.referRecord} cancel={this.noReferRecord} close={this.noReferRecord}>
  175. <div className={style['confirm-info']}>是否引用往期病历</div>
  176. </ConfirmModal>
  177. <ConfirmModal visible={showHistoryCase} noFooter='true' title='请选择历史病历' close={this.closeHistoryCaseModal} titleBg="#DFEAFE" icon={tableIcon} height={300}>
  178. {this.getHistoryCase()}
  179. <div className={style['confirm-history']}><span className={style['confirm-history-btn']} onClick={this.referCase}>确定</span></div>
  180. </ConfirmModal>
  181. </div>
  182. )
  183. }
  184. }
  185. export default DiagnosticList;