index.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. import React, { Component } from "react";
  2. import style from "./index.less";
  3. import { normalVal, filterDataArr, filterOtherDataArr,timestampToTime } from '@utils/tools';
  4. import Notify from '@commonComp/Notify';
  5. import Information from '../Information';
  6. import $ from "jquery";
  7. import AssessResultHis from '@containers/AssessResultHis'
  8. class PreviewBody extends Component {
  9. constructor(props) {
  10. super(props)
  11. this.state = {
  12. dateTime: "",
  13. }
  14. this.getCurrentDate = this.getCurrentDate.bind(this);
  15. this.onPrint = this.onPrint.bind(this);
  16. }
  17. componentDidMount() {
  18. this.getCurrentDate();
  19. }
  20. onPrint() {
  21. $("#content").jqprint({
  22. debug: false,
  23. importCSS: true,
  24. printContainer: true,
  25. operaSupport: false,
  26. });
  27. this.props.onClose()
  28. }
  29. surePrint(jsonStr) {
  30. if (filterDataArr(JSON.parse(jsonStr.chief)) == '') {
  31. Notify.info('主诉不能为空');
  32. return false;
  33. } else if (!jsonStr.diag || jsonStr.diag.trim().length < 1) {
  34. Notify.info('诊断不能为空');
  35. return false;
  36. } else {
  37. this.onPrint();
  38. this.props.save(true)
  39. }
  40. }
  41. getCurrentDate() {
  42. let myDate = new Date();
  43. let year = myDate.getFullYear(); //获取完整的年份(4位,1970-????)
  44. let mon = myDate.getMonth() - 0 + 1; //获取当前月份(0-11,0代表1月)
  45. let day = myDate.getDate(); //获取当前日(1-31)
  46. let date = year + '-' + (mon < 10 ? '0' + mon : mon) + '-' + (day < 10 ? '0' + day : day);
  47. this.setState({ dateTime: date })
  48. }
  49. showDetails(val) {
  50. if (val.questionDetailList.length > 0) {
  51. return val.questionDetailList.map((item) => {
  52. if (val.value == item.name) {
  53. return <td style={{ width: '16%', fontSize: '12px' }}><span style={{ color: item.abnormal != '0' ? "red" : null }}>{val.value}</span> {val.labelSuffix}</td>
  54. }
  55. })
  56. } else {
  57. return <td style={{ width: '16%', fontSize: '12px' }}><span style={{ color: (val.value - 0).toString() == 'NaN' ? "red" : (val.maxValue || val.minValue) ? (val.value > val.maxValue || val.value < val.minValue ? "red" : null) : null }}>{val.value}</span> {val.labelSuffix}</td>
  58. }
  59. }
  60. toTime(time){
  61. let tmpTim = time.split(',').join('')-0
  62. if(time && tmpTim.toString() != 'NaN'){
  63. let date = new Date('1900-01-01');
  64. let dateTim = date.getTime();
  65. let times = (tmpTim-2)*24*60*60*1000;
  66. let result = timestampToTime(dateTim+times).split(' ')[0]
  67. return result;
  68. }else{
  69. return time;
  70. }
  71. }
  72. render() {
  73. const { show, preInfo, dataJson, dataStr, baseObj, flg ,showAssessBtn} = this.props;
  74. const other_yjs = filterOtherDataArr(JSON.parse(dataStr.other),dataJson.other);
  75. const noData = JSON.stringify(preInfo) == '{}';
  76. return <div className={style['content']} style={{ width: flg ? '700' : '820' }}>
  77. <div className={style['contents']} id="content" style={{ margin: "0 auto", maxWidth: "620px" }}>
  78. <Information baseObj={baseObj} preInfo={preInfo}></Information>
  79. <table className={style['infos']}>
  80. <tr className={style['patInfoFst']}>
  81. <td className={style['patInfoSec']}>主诉:</td>
  82. <td className={style['patInfoSec']}>
  83. {
  84. filterDataArr(JSON.parse(dataStr.chief))
  85. }
  86. </td>
  87. </tr>
  88. <tr className={style['patInfoFst']}>
  89. <td className={style['patInfoSec']}>现病史:</td>
  90. <td className={style['patInfoSec']}>
  91. {
  92. filterDataArr(JSON.parse(dataStr.present))
  93. }
  94. </td>
  95. </tr>
  96. <tr className={style['patInfoFst']}>
  97. <td className={style['patInfoSec']}>其他史:</td>
  98. <td className={style['patInfoSec']}>
  99. {
  100. other_yjs.str1
  101. }
  102. {dataJson['yjs_1']||dataJson['yjs_2']||dataJson['yjs_3']||dataJson['yjs_4']?<table style={{textAlign:'center',verticalAlign: 'middle',display:'inline-block'}}>
  103. <tr>
  104. <td rowSpan='2' style={{verticalAlign: 'middle'}}>月经史:(</td>
  105. <td rowSpan='2' style={{verticalAlign: 'middle'}}>{dataJson['yjs_1']||'初潮年龄'}</td>
  106. <td style={{borderBottom:'1px solid #000'}}>{dataJson['yjs_2']||'行经天数'}</td>
  107. <td rowSpan='2' style={{verticalAlign: 'middle'}}>{dataJson['yjs_4']||'停经时间'})</td>
  108. </tr>
  109. <tr>
  110. <td style={{textAlign:'center'}}>{dataJson['yjs_3']||'周期'}</td>
  111. </tr>
  112. </table>:''}
  113. {
  114. other_yjs.str2
  115. }
  116. </td>
  117. </tr>
  118. <tr className={style['patInfoFst']}>
  119. <td className={style['patInfoSec']}>查体:</td>
  120. <td className={style['patInfoSec']}>
  121. {
  122. filterDataArr(JSON.parse(dataStr.vital))
  123. }
  124. </td>
  125. </tr>
  126. <tr className={style['patInfoFst']}>
  127. <td className={style['patInfoSec']}>化验:</td>
  128. <td className={style['patInfoSec']}>
  129. {
  130. dataJson.lis.getExcelDataList && dataJson.lis.getExcelDataList.map((items) => {
  131. return items.lisExcelRes && items.lisExcelRes.map((item) => {
  132. return <table style={{ marginBottom: '10px', width: '100%', fontSize: '12px' }}>
  133. <tr style={{ fontSize: '14px', lineHeight: '1.5' }}><td><span style={{ borderBottom: '1px solid #666666' }}>{item.menus}</span></td></tr>
  134. {
  135. item.lisExcelItem && item.lisExcelItem.map((value) => {
  136. return <tr style={{ lineHeight: '1.5', maxWidth: '650px' }}>
  137. <td style={{ width: '32%', fontSize: '12px' }}>{value.itemName}</td>
  138. <td style={{ width: '16%', fontSize: '12px' }}><span style={{ fontSize: '12px', color: value.type == 1 ? "red" : null }}>{value.value}</span> {value.unit}</td>
  139. <td style={{ width: '24%', fontSize: '12px' }}>
  140. {normalVal(value.min, value.max)}
  141. </td>
  142. <td style={{ width: '28%', fontSize: '12px' }}>{value.time == '' ? ('导入时间: ' + this.state.dateTime) : '化验时间: ' + this.toTime(value.time)
  143. }</td>
  144. </tr>
  145. })
  146. }
  147. </table>
  148. })
  149. })
  150. }
  151. {
  152. dataJson.lis.labelList && dataJson.lis.labelList.map((item, idx) => {
  153. // if (item.show) {
  154. return <table style={{ margin: '8px 0', width: '100%' }}>
  155. {
  156. item.show?<tr style={{ fontSize: '14px', lineHeight: '1.5' }}><td><span style={{ borderBottom: '1px solid #666666' }}> {item.name} </span></td></tr>:
  157. <tr style={{ fontSize: '14px', lineHeight: '1.5' }}><td><span style={{ position:'relative',left:'-10px' }}>「{item.name}」</span></td></tr>
  158. }
  159. {
  160. item.details.map((val) => {
  161. if (val.value && val.value != '') {
  162. return <tr style={{ lineHeight: '1.5', width: '100%', fontSize: '12px' }}>
  163. <td style={{ width: '32%', fontSize: '12px' }}>{val.name}</td>
  164. {this.showDetails(val)}
  165. <td style={{ width: '24%', fontSize: '12px' }}>
  166. {normalVal(val.minValue, val.maxValue)}
  167. </td>
  168. <td style={{ width: '28%', fontSize: '12px' }}>{'化验时间:' + item.time}</td>
  169. </tr>
  170. }
  171. })
  172. }
  173. </table>
  174. // }
  175. })
  176. }
  177. </td>
  178. </tr>
  179. <tr className={style['patInfoFst']}>
  180. <td className={style['patInfoSec']}>辅检:</td>
  181. <td className={style['patInfoSec']}>
  182. {
  183. dataStr.pacs && dataStr.pacs != '' && dataStr.pacs.split(';').map((item) => {
  184. return <div style={{ fontSize: '14px',wordBreak:"break-all" }}>{item}</div>
  185. })
  186. }
  187. </td>
  188. </tr>
  189. <tr className={style['patInfoFst']}>
  190. <td className={style['patInfoSec']}>诊断:</td>
  191. <td className={style['patInfoSec']}>
  192. {
  193. dataStr.diag && dataStr.diag != '' && dataStr.diag.split(';').map((item) => {
  194. return <div style={{ fontSize: '14px' }}>{item}</div>
  195. })
  196. }
  197. </td>
  198. </tr>
  199. <tr className={style['patInfoFst']}>
  200. <td className={style['patInfoSec']}>医嘱:</td>
  201. <td className={style['patInfoSec']} style={{ fontSize: '14px', padding: '1px 0px 8px 0px', lineHeight: '20px' }}>
  202. {dataJson.advice.commontreatment && dataJson.advice.commontreatment.length > 0 && <p style={{ fontSize: '14px', marginBottom: '8px', marginTop: '8px' }}><span>一般治疗</span></p>}
  203. {
  204. dataJson.advice.commontreatment && <div style={{ padding: '0px 0px 5px 0px',wordBreak:"break-all" }}>{dataJson.advice.commontreatment}</div>
  205. }
  206. {dataJson.advice.scheme && dataJson.advice.scheme.length > 0 && <p style={{ fontSize: '14px', marginBottom: '8px', marginTop: '8px' }}><span>治疗方案</span></p>}
  207. {
  208. dataJson.advice.scheme && dataJson.advice.scheme.map((item, index) => {
  209. return <p>{item.treatment.map((it, ii) => {
  210. return (it.treatmentStr && it.treatmentStr.length > 0 ?
  211. <div style={{ padding: '0px 0px 5px 0px' }}>{it.treatmentStr}</div> : '')
  212. })}</p>
  213. })
  214. }
  215. {
  216. dataJson.advice.adviceInput && <div style={{ padding: '0px 0px 5px 0px',wordBreak:"break-all" }}>{dataJson.advice.adviceInput}</div>
  217. }
  218. </td>
  219. </tr>
  220. </table>
  221. <p style={{textAlign:'right',marginTop:'15px'}}>医生签名:<span style={{minWidth: '60px',padding: '0 5px 2px 5px',borderBottom: '1px solid #333',}}>{baseObj ? baseObj.doctorName : (noData ? '' : preInfo.doctorName)}</span></p>
  222. {showAssessBtn?<AssessResultHis inquiryId={baseObj&&baseObj.id} inquiryDate={baseObj&&baseObj.inquiryDate}></AssessResultHis>:""}
  223. </div>
  224. <div onClick={() => { this.surePrint(dataStr) }} style={{
  225. display: show ? 'inline-block' : 'none',
  226. padding: '10px 20px',
  227. float: 'right',
  228. marginTop: '15px',
  229. background: '#3B9ED0',
  230. color: '#fff',
  231. borderRadius: '4px',
  232. cursor: 'pointer',
  233. position: 'absolute',
  234. right: '40px'
  235. }}>打印</div>
  236. </div>
  237. }
  238. }
  239. export default PreviewBody;