index.jsx 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. import React from 'react';
  2. import store from '@store';
  3. import styles from './index.less';
  4. import ReactDom from "react-dom";
  5. import sort from "./img/sort.png"
  6. import close from "./img/close.png";
  7. import PreviewBody from '@components/PreviewBody';
  8. import Empty from '@components/Empty'
  9. import { pushAllDataList,didPushParamChange } from '@utils/tools';
  10. import { dragBox } from '@utils/drag';
  11. import $ from 'jquery';
  12. import { ConfirmModal } from '@commonComp';
  13. import {showHistory} from "@store/actions/historyTemplates";
  14. import { CONFIRM_TYPE } from "@store/types/typeConfig";
  15. import {billing} from '@store/async-actions/pushMessage';
  16. import {getHistempDetail} from '@store/async-actions/historyTemplates';
  17. class HistoryCaseContainer extends React.Component {
  18. constructor(props){
  19. super(props);
  20. this.state = {
  21. activeHis:{},//预览数据
  22. activeId:'0',
  23. dataStr:[],
  24. dataJson:{},
  25. visible:false
  26. }
  27. this.handleCaseClick=this.handleCaseClick.bind(this)
  28. this.handleQuoteClick=this.handleQuoteClick.bind(this)
  29. this.close = this.close.bind(this);
  30. this.makeSure = this.makeSure.bind(this);
  31. }
  32. componentDidMount(){
  33. dragBox('hisWrapMove','closeHis','add')
  34. this.handleCaseClick(0)
  35. this.setState({
  36. visible:false
  37. })
  38. }
  39. handleCaseClick(idx){
  40. const {items} = this.props;
  41. let tmpItems = []
  42. $("#hislistLeft li").eq(idx).css({
  43. background:'#fff'
  44. }).siblings().css({
  45. background:'#d2d1d1'
  46. })
  47. if(items.length == 0){
  48. return
  49. }else{
  50. tmpItems=items[idx]
  51. }
  52. this.setState({
  53. activeId:idx,
  54. activeHis:tmpItems,
  55. dataStr:tmpItems.detailList||[],
  56. // dataJson:JSON.parse(tmpItems.dataJson)||{},
  57. })
  58. }
  59. makeSure(){
  60. const {activeHis} = this.state
  61. this.setState({visible:false})
  62. store.dispatch(showHistory(false))
  63. store.dispatch({type: CONFIRM_TYPE, confirmType: activeHis.sign});
  64. store.dispatch(getHistempDetail(activeHis))
  65. if(didPushParamChange()){
  66. store.dispatch(billing())
  67. }
  68. const {handleQuoteClick} = this.props
  69. handleQuoteClick&&handleQuoteClick()
  70. dragBox('hisWrapMove','closeHis','del')
  71. }
  72. close(){
  73. this.setState({
  74. visible:false
  75. })
  76. }
  77. handleQuoteClick(e,val,idx){
  78. this.setState({
  79. visible:true,
  80. activeId:idx,
  81. activeHis:val,
  82. dataStr:val.detailList||[],
  83. // dataJson:JSON.parse(val.dataJson)||{},
  84. })
  85. }
  86. render(){
  87. const { items,handleSortClick,showHistoryBox,preInfo } = this.props;
  88. const { activeHis,visible,dataJson,dataStr } = this.state;
  89. const getAllDataStringList = () =>{ //获取所有模块文本的数据
  90. let jsonDataString = {};
  91. jsonDataString.lis = {};
  92. jsonDataString.chief = dataStr[0].content || ''; //主诉
  93. jsonDataString.present = dataStr[1].content || ''; //现病史
  94. jsonDataString.other = dataStr[2].content || ''; //其他史
  95. jsonDataString.vital = dataStr[3].content || ''; //查体
  96. jsonDataString.lis = dataStr[4].content || ''; //化验导入填写
  97. jsonDataString.pacs = dataStr[5].content || ''; //辅检
  98. jsonDataString.diag = dataStr[6].content || ''; //诊断
  99. jsonDataString.advice = dataStr[7].content || ''; //医嘱
  100. return jsonDataString;
  101. }
  102. return (
  103. <div className={styles.mainHistory} id="hisWrapMove">
  104. <div className={`${styles.closeHis} drag-title`} id="closeHis"></div>
  105. <img className={styles.close} src={close} alt="关闭历史病历" onClick={showHistoryBox}/>
  106. <div className={styles.mainHistoryLeft}>
  107. <div className={styles.title}>
  108. <span className={styles.his}>历史病历</span>
  109. <span className={styles.sort} onClick={handleSortClick}>排序 <img src={sort} alt="排序"/></span>
  110. </div>
  111. <div className={styles.lists}>
  112. <ul id="hislistLeft">
  113. {
  114. (items && items.length > 0)? items.map((val,idx)=>{
  115. // return <li key={val.id} className={val.id == activeHistory.id?styles.bgc:''} onClick={(e)=>{this.handleCaseClick(e,idx)}}>
  116. return <li key={val.id} onClick={()=>{this.handleCaseClick(idx)}}>
  117. <span title={val.diagnose}>{val.diagnose}</span>
  118. {/* <span className={val.id == activeHistory.id?`${styles.time} ${styles.quoteHide}`:styles.time}>{val.inquiryDate}</span>
  119. <button
  120. className={val.id == activeHistory.id?`${styles.quote} ${styles.quoteShow}`:styles.quote}
  121. onClick={(e)=>{handleQuoteClick(e,val)}}
  122. >引 用</button> */}
  123. <button
  124. className={styles.quote}
  125. onClick={(e)=>{this.handleQuoteClick(e,val,idx)}}
  126. >引 用</button>
  127. <span className={styles.time}>{val.inquiryDate}</span>
  128. </li>
  129. }):<Empty message={'无历史病历'}></Empty>
  130. }
  131. </ul>
  132. </div>
  133. </div>
  134. <div className={styles.mainHistoryRight}>
  135. {
  136. activeHis == undefined || JSON.stringify(activeHis) == "{}" ? null :
  137. <PreviewBody
  138. preInfo={preInfo}
  139. showHistoryCases={this.props.showHistoryCases}
  140. dataJson={dataJson}
  141. baseObj={activeHis}
  142. dataStr={dataStr.length > 0?getAllDataStringList(dataStr):[]}
  143. show={false}
  144. flg={true}
  145. showAssessBtn={true}
  146. ></PreviewBody>
  147. }
  148. </div>
  149. <ConfirmModal
  150. visible={visible}
  151. confirm={this.makeSure}
  152. close={this.close}
  153. cancel={this.close}
  154. okText={"引用"}
  155. okBorderColor={'#3B9ED0'}
  156. okColor={'#fff'}
  157. oKBg={'#3B9ED0'}
  158. >
  159. <p className={styles['center']}>确认引用该病历?</p>
  160. </ConfirmModal>
  161. </div>
  162. )
  163. }
  164. }
  165. export default HistoryCaseContainer;