index.jsx 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import React,{Component} from 'react';
  2. import style from './index.less';
  3. import {ItemBox} from '@commonComp';
  4. class Advice extends Component{
  5. constructor(props){
  6. super(props);
  7. this.treatInput = React.createRef();
  8. this.assayRef = React.createRef();
  9. this.checkRef = React.createRef();
  10. this.handleTreatInput = this.handleTreatInput.bind(this);
  11. this.handleAssayInput = this.handleAssayInput.bind(this);
  12. this.handleCheckInput = this.handleCheckInput.bind(this);
  13. }
  14. handleTreatInput(e, index, ii) {
  15. const {advice} = this.props.pushMessage;
  16. const changeInput = e.target.value //改变的同类药的值
  17. const { setChangeAdviceTreatment } = this.props;
  18. setChangeAdviceTreatment && setChangeAdviceTreatment(index, ii, changeInput)
  19. }
  20. handleAssayInput(e) {
  21. console.log(e.target.value)
  22. const changeInput = e.target.value
  23. const { setChangeAdviceAssay } = this.props;
  24. setChangeAdviceAssay && setChangeAdviceAssay(changeInput)
  25. }
  26. handleCheckInput(e) {
  27. console.log(e.target.value)
  28. const changeInput = e.target.value
  29. const { setChangeAdviceCheck } = this.props;
  30. setChangeAdviceCheck && setChangeAdviceCheck(changeInput)
  31. }
  32. render(){
  33. const {advice} = this.props.pushMessage;
  34. let billing = ''
  35. // advice.assay.forEach((item, index) => {
  36. // if(index === advice.assay.length - 1){
  37. // billing = billing + (index + 1) + ':' + item + ';'
  38. // }else{
  39. // billing = billing + (index + 1) + ':' + item + ','
  40. // }
  41. // })
  42. // advice.check.forEach((item, index) => {
  43. // if(index === advice.check.length - 1){
  44. // billing = billing + (index + 1) + ':' + item + ';'
  45. // }else{
  46. // billing = billing + (index + 1) + ':' + item + ','
  47. // }
  48. // })
  49. let scheme = advice.scheme && advice.scheme.map((item, index) => {
  50. return <p>{item.treatment.map((it,ii) =>{
  51. return(it.treatmentStr && it.treatmentStr.length > 0 ?
  52. <div>
  53. { it.treatmentStr }
  54. {/* <input className={style['treat-input']} ref={this.treatInput} onInput={(e)=>{this.handleTreatInput(e, index, ii)}} type='text' value={ it.treatmentStr }/> */}
  55. </div>: '')
  56. // return <div>{it.drugs.length > 0 ? it.name : ''}: {it.drugs.map((drug, drugIndex) =>{
  57. // return(<span>{drug.selected ? (drugIndex === 0 ? drug.name : ' ' + drug.name) : ''}</span>)
  58. // })}</div>
  59. })}</p>
  60. })
  61. return <div className={`${'mainsuit-box'} ${style['main-suit']}`}>
  62. <ItemBox title='医嘱' editable={false} border={true} marginTop="10px">
  63. <div className={style['billing']}>
  64. {advice.assay && advice.assay.length > 0 || advice.check && advice.check.length > 0 ? <h1>开单项目</h1> : ''}
  65. {advice.assay && <span className={style['treat-input']}> {advice.assay}</span>}
  66. {advice.check && <span className={style['treat-input']}> {advice.check}</span>}
  67. {/* {billing} */}
  68. </div>
  69. <div className={style['scheme']}>
  70. {advice.scheme && advice.scheme.length > 0 && <h1>治疗方案</h1>}
  71. {scheme}
  72. </div>
  73. </ItemBox>
  74. </div>
  75. }
  76. }
  77. export default Advice;