index.jsx 11 KB

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