index.jsx 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import React, { Component } from 'react';
  2. import style from './index.less';
  3. import {ConfirmModal} from '@commonComp';
  4. import Notify from '@commonComp/Notify';
  5. import store from '@store';
  6. import infoShow from '@common/images/info-show.png';
  7. import infoMove from '@common/images/info-move.png';
  8. import {getChronic} from '@store/async-actions/homePage.js';
  9. import {storageLocal} from '@utils/tools';
  10. import {
  11. embedPush
  12. } from '@store/async-actions/pushMessage';
  13. class DiagnosticItem extends Component{
  14. constructor(props){
  15. super(props);
  16. this.state = {
  17. visible: false,
  18. hasEnterItem: false,
  19. hasEnterImg: false
  20. }
  21. this.addDiagodal = this.addDiagodal.bind(this);
  22. this.chooseDiagodal = this.chooseDiagodal.bind(this);
  23. this.confirm = this.confirm.bind(this);
  24. this.cancel = this.cancel.bind(this)
  25. this.close = this.close.bind(this)
  26. this.getTips = this.getTips.bind(this)
  27. }
  28. confirm() {
  29. this.props.setHighter&&this.props.setHighter(80)
  30. this.close();
  31. const diagType = 1;
  32. this.addDiagodal(diagType)
  33. }
  34. cancel() {
  35. this.props.setHighter&&this.props.setHighter(80)
  36. this.close();
  37. const diagType = 2;
  38. this.addDiagodal(diagType)
  39. }
  40. close(){
  41. this.setState({
  42. visible: false
  43. })
  44. }
  45. chooseDiagodal(item) {
  46. const { diagnosticList,isTcm,tcmList,showSym} = this.props;
  47. if(isTcm&&showSym){ //添加的是中医症候,判断是否重复,添加中医诊断不需要判断
  48. const lastTcmDiag = tcmList[tcmList.length-1].tcmDiag;
  49. for (let i = 0; i < tcmList.length-1; i++) {
  50. if(tcmList[i].tcmDiag+tcmList[i].tcmSyndrome=== lastTcmDiag+item.name) {
  51. Notify.info('该中医诊断+中医症候已存在');
  52. return
  53. }
  54. }
  55. }else{
  56. for (let i = 0; i < diagnosticList.length; i++) {
  57. if(diagnosticList[i].name === item.name) {
  58. Notify.info('该诊断已存在');
  59. return
  60. }
  61. }
  62. }
  63. this.props.setHighter&&this.props.setHighter(80)
  64. const diagType = 1;
  65. this.addDiagodal(diagType)
  66. this.setState({
  67. visible: true
  68. })
  69. }
  70. getTips(item, e) {
  71. e.stopPropagation();
  72. const {getTips } = this.props;
  73. getTips && getTips({id:item.id,type:7,name: item.name, position: 1});
  74. }
  75. addDiagodal(diagType){
  76. const {item,EMRScrollCont,isTcm,showSym,type,addDiagnostic, clearInput, hideSearch} = this.props;
  77. item.type = diagType;
  78. /*if(item.type == 2&&mode=='0') { //文本模式不走慢病。6.0慢病取消
  79. isChronicMag(item);
  80. }*/
  81. addDiagnostic&&addDiagnostic(item,isTcm,showSym);
  82. clearInput&&clearInput();
  83. hideSearch&&hideSearch();
  84. this.context.scrollArea&&this.context.scrollArea.refresh();
  85. //document.getElementById("diagnosisResult").scrollIntoView(true)
  86. if(type == 'disSelect') {
  87. const scrollTop = document.getElementById("diagnosisResult").offsetTop
  88. setTimeout(() =>{
  89. EMRScrollCont.scrollYTo(scrollTop);
  90. })
  91. }
  92. showSym&&store.dispatch(embedPush({mode:10,action: "diag",}))
  93. }
  94. handleMouseEnterDrug() {
  95. this.setState({
  96. hasEnterItem: true,
  97. })
  98. }
  99. handleMouseLeaveDrug() {
  100. this.setState({
  101. hasEnterItem: false,
  102. })
  103. }
  104. handleMouseEnterImg() {
  105. this.setState({
  106. hasEnterImg: true
  107. })
  108. }
  109. handleMouseLeaveImg() {
  110. this.setState({
  111. hasEnterImg: false
  112. })
  113. }
  114. render(){
  115. const { visible,hasEnterItem,hasEnterImg } = this.state
  116. const { item, title, type } = this.props
  117. return (<span className={style['diag-item']} >
  118. <span className={`${style['diag-name']}`}
  119. title = {item.name}
  120. onMouseEnter={this.handleMouseEnterDrug.bind(this)}
  121. onMouseLeave = {this.handleMouseLeaveDrug.bind(this)}
  122. onClick={() =>{this.chooseDiagodal(item)}}
  123. >
  124. <p className={`${style['diag-name-box']} ${type == 'search'?style['diag-name-search']:style['diag-name-disSelect']}`}>{item.name} </p>
  125. {/* {type== 'disSelect' &&<img className={style['info-img']}
  126. title='点击i图标可查看详细说明'
  127. style ={hasEnterItem ? {display: "inline-block"} : {display: "none"}}
  128. src={hasEnterImg ? infoMove : infoShow}
  129. onMouseEnter={this.handleMouseEnterImg.bind(this)}
  130. onMouseLeave = {this.handleMouseLeaveImg.bind(this)}
  131. onClick={this.getTips.bind(this,item)}
  132. />} */}
  133. </span>
  134. {/* <ConfirmModal visible={visible} okText='初诊' cancelText='复诊' confirm={this.confirm} cancel={this.cancel} close={this.close}>
  135. <div className={style['confirm-info']}>确定选择“{item.name}”为</div>
  136. </ConfirmModal> */}
  137. </span>)
  138. }
  139. }
  140. DiagnosticItem.contextTypes = {
  141. scrollArea: React.PropTypes.object
  142. };
  143. export default DiagnosticItem;