index.jsx 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import React, { Component } from 'react';
  2. import style from './index.less';
  3. import info from './../img/info.png';
  4. import info1 from './../img/info1.png';
  5. import info2 from './../img/info2.png';
  6. import info3 from './../img/info3.png';
  7. import drugIcon from './../img/drug.png';
  8. import more from '@common/images/addItem1.png';
  9. import HasInfoItem from '@common/components/HasInfoItem'
  10. import $ from "jquery";
  11. class DrugTreat extends Component {
  12. constructor(props) {
  13. super(props);
  14. this.state = {
  15. currentImg: -1,
  16. }
  17. this.handleSelect = this.handleSelect.bind(this);
  18. this.setOtherRecommend = this.setOtherRecommend.bind(this);
  19. this.setDrugInfo = this.setDrugInfo.bind(this);
  20. this.showTreatDesc = this.showTreatDesc.bind(this);
  21. this.handleMouseLeaveDrug = this.handleMouseLeaveDrug.bind(this);
  22. this.handleMouseLeaveImg = this.handleMouseLeaveImg.bind(this);
  23. this.getImg = this.getImg.bind(this);
  24. }
  25. handleSelect(position) {
  26. const { selectDrug } = this.props;
  27. selectDrug && selectDrug(position);
  28. }
  29. handleMouseEnterDrug(ii, index, it) {
  30. this.setState({
  31. currentIndex: index,
  32. currentImg: ii
  33. })
  34. }
  35. handleMouseLeaveDrug() {
  36. this.setState({
  37. currentIndex: -1,
  38. })
  39. }
  40. handleMouseEnterImg() {
  41. this.setState({
  42. hasEnterImg: true
  43. })
  44. }
  45. handleMouseLeaveImg() {
  46. this.setState({
  47. hasEnterImg: false
  48. })
  49. }
  50. setOtherRecommend( position) {
  51. this.showTreatDesc();
  52. const { setOtherRecommend } = this.props;
  53. setOtherRecommend && setOtherRecommend(position);
  54. }
  55. setDrugInfo(item) {
  56. const { setDrugInfo } = this.props;
  57. setDrugInfo && setDrugInfo({name: item.medicitionName, type: 8, position: 5});
  58. }
  59. getImg() {
  60. }
  61. //搜索药品说明书(查看数据用)
  62. handleInputDrug(e) {
  63. this.setState({
  64. drugIdList: e.target.value
  65. })
  66. }
  67. //搜索药品说明书(查看数据用)
  68. searchDrug() {
  69. const { setDrugInfoMore } = this.props
  70. const drugIdList = this.state.drugIdList.split(' ')
  71. setDrugInfoMore({drugIdList: drugIdList})
  72. }
  73. showTreatDesc() {
  74. $('#treatDescBox').css({'display': 'block'});
  75. $('#dragModalWrap').animate({'margin-left': '-471px','left':'50%'}, 300);
  76. $('#treatDescBox').animate({'width': '260px'}, 500);
  77. }
  78. render(){
  79. const { treatmentPlan,showDrugInfo } = this.props
  80. const { currentImg, currentIndex, hasEnterImg } = this.state
  81. return(
  82. treatmentPlan && treatmentPlan.length > 0 && <div className={style['drug-box']}>
  83. <h3 className={style['drug-title']}><img className={style['drug-icon']} src={drugIcon}/> 推荐药物</h3>
  84. {/* 查看药物说明书 (添加数据查看数据用)*/}
  85. {/* <div> <input onInput={this.handleInputDrug.bind(this)} style={{border:'1px solid #000'}} type="text"/><button onClick = {this.searchDrug.bind(this)}>搜索药品说明</button></div> */}
  86. {treatmentPlan.map((item0, index0) =>{
  87. return(<div className={`${style['diag-content-box']} clearfix`}>
  88. <div className={style['diag-content-title']}><i className={style['diag-content-circle']}></i>{item0.title}</div>
  89. {item0.meditionDetails.map((item1,index1) => {
  90. return (<div className={`${style['diag-content']} clearfix`}>
  91. {item1.description&&<div className={style['diag-content-description']}>{item1.description}</div>}
  92. {item1.treatment.map((item2,index2)=>{
  93. return (<div className={`${style['drug-item']} clearfix`}>
  94. <div className={style['drug-name-box']}>
  95. <span style={item2.drugsForbidden === '2'? {opacity: '0.3', filter:'alpha(opacity=30)',filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=30)'} : ''}>{index2 + 1 + '. ' }<span>{item2.subdrugsName}</span>:&nbsp;</span>
  96. {item2.medicitionsList.map((item3, index3) => {
  97. return ((item3.isShow == 1 || item3.selected) && <HasInfoItem
  98. item = {item3}
  99. setDrugInfo = {this.setDrugInfo}
  100. position = {[index0, index1, index2, index3]}
  101. handleSelect = {this.handleSelect}
  102. >
  103. </HasInfoItem>
  104. )
  105. })}
  106. </div>
  107. {<div className={style['drug-more']} onClick={this.setOtherRecommend.bind(this, [index0,index1,index2])} ><img className={style['info-img-more']} src={more} />更多同类药</div> }
  108. </div>)
  109. })}
  110. </div>)
  111. })}
  112. </div>)
  113. })}
  114. </div>
  115. )
  116. }
  117. }
  118. export default DrugTreat;