import React, { Component } from "react"; import style from "./index.less"; import { normalVal, filterDataArr, filterOtherDataArr,timestampToTime } from '@utils/tools'; import Notify from '@commonComp/Notify'; import Information from '../Information'; import PreviewInspect from './Inspect'; import ItemPart from './ItemPart'; import $ from "jquery"; import AssessResultHis from '@containers/AssessResultHis' class PreviewBody extends Component { constructor(props) { super(props) this.state = { dateTime: "", } this.getCurrentDate = this.getCurrentDate.bind(this); this.onPrint = this.onPrint.bind(this); } componentDidMount() { this.getCurrentDate(); } onPrint() { $("#content").jqprint({ debug: false, importCSS: true, printContainer: true, operaSupport: false, }); this.props.onClose() } surePrint(jsonStr) { if (filterDataArr(JSON.parse(jsonStr.chief)) == '') { Notify.info('主诉不能为空'); return false; } else if (!jsonStr.diag || jsonStr.diag.trim().length < 1) { Notify.info('诊断不能为空'); return false; } else { this.onPrint(); this.props.save(true) } } getCurrentDate() { let myDate = new Date(); let year = myDate.getFullYear(); //获取完整的年份(4位,1970-????) let mon = myDate.getMonth() - 0 + 1; //获取当前月份(0-11,0代表1月) let day = myDate.getDate(); //获取当前日(1-31) let date = year + '-' + (mon < 10 ? '0' + mon : mon) + '-' + (day < 10 ? '0' + day : day); this.setState({ dateTime: date }) } showDetails(val) { if (val.questionDetailList.length > 0) { return val.questionDetailList.map((item) => { if (val.value == item.name) { return {val.value} {val.labelSuffix} } }) } else { return val.maxValue || val.value < val.minValue ? "red" : null) : null }}>{val.value} {val.labelSuffix} } } toTime(time){ let tmpTim = time.split(',').join('')-0 if(time && tmpTim.toString() != 'NaN'){ let date = new Date('1900-01-01'); let dateTim = date.getTime(); let times = (tmpTim-2)*24*60*60*1000; let result = timestampToTime(dateTim+times).split(' ')[0] return result; }else{ return time; } } render() { const { show, preInfo, dataJson, dataStr, baseObj, flg ,showAssessBtn,showHistoryCases} = this.props; const other_yjs = dataStr.other?filterOtherDataArr(JSON.parse(dataStr.other),dataJson.other):''; const noData = JSON.stringify(preInfo) == '{}'; return
医嘱: {((dataJson.advice.assay && dataJson.advice.assay.length > 0) || (dataJson.advice.check && dataJson.advice.assay.check > 0)) &&

开单项目

} { ((dataJson.advice.assay && dataJson.advice.assay.length > 0) || (dataJson.advice.check && dataJson.advice.assay.check > 0)) &&
{dataJson.advice.check?dataJson.advice.check+',':''} {dataJson.advice.assay}
} {dataJson.advice.commontreatment && dataJson.advice.commontreatment.length > 0 &&

一般治疗

} { dataJson.advice.commontreatment &&
{dataJson.advice.commontreatment}
} {dataJson.advice.followUp && dataJson.advice.followUp.length > 0 &&

回访时间:{dataJson.advice.followUp} 后回访,不适随诊

} {dataJson.advice.scheme && dataJson.advice.scheme.length > 0 &&

治疗方案

} { dataJson.advice.scheme && dataJson.advice.scheme.map((item, index) => { return

{item.treatment.map((it, ii) => { return (it.treatmentStr && it.treatmentStr.length > 0 ?

{it.treatmentStr}
: '') })}

}) } { dataJson.advice.adviceInput &&
{dataJson.advice.adviceInput}
}

医生签名:{baseObj ? baseObj.doctorName : (noData ? '' : preInfo.doctorName)}

{ this.surePrint(dataStr) }} className={style.printBtn} style={{ display: show ? 'inline-block' : 'none', }}>打印
} } export default PreviewBody;