|
|
<template> <div> <div v-show="checkPagePriv(pagePriv.privs, '人员列表')" class="listBtn"> <el-button type="primary" class="commonbutton" @click="prList">人员列表</el-button> </div> <div v-show="checkPagePriv(pagePriv.privs, '医生诊台')" class="listBtn"> <el-button type="primary" class="commonbutton" @click="toDoctorCheck">医生诊台</el-button> </div> <div v-show="checkPagePriv(pagePriv.privs, '导入结果')" class="listBtn"> <el-dropdown @command="btnImportResult"> <el-button type="primary" class="commonbutton"> 导入结果<i class="el-icon-arrow-down el-icon--right"></i> </el-button> <el-dropdown-menu slot="dropdown"> <el-dropdown-item command="pacs" :disabled="sumBtnDisabled('save')" v-show="checkPagePriv(pagePriv.privs, '导入检查结果')">导入检查结果</el-dropdown-item> <el-dropdown-item command="lis" :disabled="sumBtnDisabled('save')" v-show="checkPagePriv(pagePriv.privs, '导入检验结果')">导入检验结果</el-dropdown-item> <el-dropdown-item command="diAn" :disabled="sumBtnDisabled('save')" v-show="checkPagePriv(pagePriv.privs, '导入迪安结果')">导入迪安结果</el-dropdown-item> </el-dropdown-menu> </el-dropdown> </div> <!--AI诊断不控制权限 v-show="checkPagePriv(pagePriv.privs, 'AI诊断')" :disabled="sumBtnDisabled('save')"--> <div class="listBtn"> <el-button slot="reference" class="commonbutton" @click="btnAIdiagnosis(false)">AI诊断</el-button> </div> <div v-show="checkPagePriv(pagePriv.privs, '保存')" class="listBtn"> <el-button type="primary" class="commonbutton" @click="btnSave" :disabled="sumBtnDisabled('save')">保存</el-button> </div> <div v-show="checkPagePriv(pagePriv.privs, '修改')" class="listBtn"> <el-button type="primary" class="commonbutton" @click="btnEdit" :disabled="sumBtnDisabled('edit')">修改</el-button> </div> <div v-show="checkPagePriv(pagePriv.privs, '取消总检')" class="listBtn"> <el-button type="primary" class="commonbutton" @click="btnDel" :disabled="sumBtnDisabled('del')">取消总检</el-button> </div> <div v-show="checkPagePriv(pagePriv.privs, '审核')" class="listBtn"> <el-button type="primary" class="commonbutton" @click="audit" :disabled="sumBtnDisabled('audit')">审核</el-button> </div> <div v-show="checkPagePriv(pagePriv.privs, '取消审核')" class="listBtn"> <el-button type="primary" class="commonbutton" @click="unAudit" :disabled="sumBtnDisabled('unAudit')">取消审核</el-button> </div> <!-- 直接放在 建议旁边 <div class="listBtn"> <el-button type="primary" class="btnClass" @click="addDiagnosis">疾病诊断</el-button> </div> --> <div v-show="checkPagePriv(pagePriv.privs, '体检报告')" class="listBtn"> <el-button type="primary" class="commonbutton" @click="btnReport" :disabled="sumBtnDisabled('report')">体检报告</el-button> </div> <div v-show="checkPagePriv(pagePriv.privs, '复查')" class="listBtn"> <el-button type="primary" class="commonbutton" @click="btnReCheck" :disabled="sumBtnDisabled('reCheck')">复查</el-button> </div> <div v-show="checkPagePriv(pagePriv.privs, '随访')" class="listBtn"> <el-button type="primary" class="commonbutton" @click="btnReCall" :disabled="sumBtnDisabled('reCall')">随访</el-button> </div> <div v-show="false" class="listBtn"> <el-button type="primary" class="commonbutton" @click="btnIntervene" :disabled="sumBtnDisabled('intervene')">干预措施</el-button> </div> <div v-show="checkPagePriv(pagePriv.privs, '职业病')" class="listBtn"> <el-button type="primary" class="commonbutton" @click="btnOcc" :disabled="sumBtnDisabled('btnOcc')">职业病</el-button> </div> <div class="listBtn"> <el-button type="primary" class="commonbutton" @click="btnReset">重置</el-button> </div>
<!-- AI诊断(所有小结信息)--> <div v-show="AI.visible" :style="`z-index:3;border-radius: 10px;border: 1px solid #ddd;background-color:#FFF; position: absolute;top:50px;left:0px;width:${AI.width}px;height: ${AI.height}px;opacity:1;`"> <div v-show="AI.max" style="display: flex;justify-content: space-between;"> <p>AI诊断内容:</p> <el-tooltip content="隐藏 AI诊断内容" placement="top"> <i class="el-icon-minus" @click="btnAImax(AI.max)" style="font-size: 24px;color: red;cursor:pointer;"></i> </el-tooltip> </div> <div v-show="!AI.max"> <el-tooltip content="显示 AI诊断内容" placement="top"> <i class="el-icon-plus" @click="btnAImax(AI.max)" style="font-size: 24px;color: red;cursor:pointer;"></i> </el-tooltip> </div> <!-- <el-input v-show="AI.max" type="textarea" v-model="AI.diagnosis" placeholder="AI诊断内容" :autosize="{ minRows: AIDH, maxRows: AIDH }" style="text-align: right;"> </el-input> --> <div ref="aiContent" v-html="AI.html" :style="`height:${AI.height - 42 - 48}px;overflow-y: auto;display: blockresize:vertical;padding: 5px 5px 5px 20px;line-height: 1.5;box-sizing: border-box;width: 100%;font-size: inherit;background-color: #fff;background-image: none;border: 1px solid #dcdfe6;border-radius: 4px;transition: border-color .2s cubic-bezier(.645, .045, .355, 1);`"></div> <div v-show="AI.max" style="text-align: right; margin-top: 10px;"> <el-button class="commonbutton" @click="AI.visible = false">关闭</el-button> <el-button class="commonbutton" @click="btnAIdiagnosis(true)">AI重新诊断</el-button> </div> </div>
<div v-show="sumDoctorCheck.sumDoctorCheckDialogVisible" :style="`z-index:3;border-radius: 10px;border: 1px solid #ddd;background-color:#FFF; position: absolute;top:50px;right:120px;width:350px;height: ${window.pageHeight - 42 - 10}px;opacity:1;`">
<PatientRegisterList win="sumDoctorCheck" :winAbsolute="true" />
</div>
<el-dialog title="职业病" :visible.sync="dialogWin.OccDisease" width="800px" :close-on-click-modal="false" :append-to-body="true"> <OccDisease /> </el-dialog>
<!-- 抽屉方式,遮罩层不能操作 <el-drawer title="体检人员列表" :visible.sync="sumDoctorCheck.sumDoctorCheckDialogVisible" direction="rtl" :wrapperClosable="false" :modal="false" :size="300"> <PatientRegisterList :win="sumDoctorCheck" :winAbsolute="false"/> </el-drawer> --> <!-- 直接放在 建议旁边 <el-drawer title="诊断列表" :visible.sync="sumDoctorCheck.sumDiagnosisVisible" direction="ltr" :size="300" :wrapperClosable="false"> <SumDiagnosis :patientRegisterId="dataTransOpts.tableS.patient_register.id" /> </el-drawer> --> </div></template><script>
import { mapState } from "vuex";import { getapi, postapi, putapi, deletapi, fetchStream } from "@/api/api";import { getPagePriv, checkPagePriv, deepCopy } from "../../utlis/proFunc";
import PatientRegisterList from "../doctorCheck/PatientRegisterList.vue";import SumDiagnosis from "./SumDiagnosis.vue";import OccDisease from "../../components/occDisease/OccDisease.vue"import moment from "moment";
import MarkdownIt from "markdown-it";const md = new MarkdownIt();export default { components: { PatientRegisterList, SumDiagnosis, OccDisease }, data() { return { pagePriv: { routeUrlorPageName: 'sumDoctorCheck', //当前页面归属路由或归属页面权限名称
privs: [] // 页面权限
}, dialogVisible: false, tableData: [ { col: 'col', details: [{ id: 1, name: '000' }, { id: 2, name: '001' }] } ], summary_check_doctor_alias: ["总检", "审核"],
AI: { width: 500, height: 24, max: true, visible: false, diagnosis: 'AI诊断信息', rawText: '', html: "" }, }; },
created() { //获取用户当前页面的权限
let userPriv = window.sessionStorage.getItem('userPriv') if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName)) this.AI.height = this.frameHeight },
//挂载完成
mounted() { postapi('/api/app/SysParmValue/GetSysParmValueBySysParmId', { sysParmId: "summary_check_doctor_alias" }) .then(res => { if (res.code > -1) { this.summary_check_doctor_alias = JSON.parse(res.data) } }) },
computed: { ...mapState(["window", "dict", "dataTransOpts", "dialogWin", "patientRegister", "doctorCheck", "sumDoctorCheck"]), frameHeight() { return this.window.pageHeight - 42 - 10 }, // AIdiagnosisHeight
AIDH() { return Math.floor((this.AI.height - 24 - 42 - 4) / 21.5) } },
methods: {
checkPagePriv,
prList() { this.sumDoctorCheck.sumDoctorCheckDialogVisible = true },
//诊断列表
addDiagnosis() { this.sumDoctorCheck.sumDiagnosisVisible = true },
//to医生诊台
toDoctorCheck() { // this.doctorCheck.prBase = Object.assign({},this.dataTransOpts.tableS.patient_register)
// this.patientRegister.photo = this.doctorCheck.prBase.photo
this.$router.push({ path: "/doctorCheck", query: { patient_register: this.dataTransOpts.tableS.patient_register } }); },
// 按钮可用
sumBtnDisabled(btnFlagName) { let patientRegister = this.dataTransOpts.tableS.patient_register let ret = true
//' 请选择体检人员'
if (!patientRegister.id) return ret // '人员已锁定,不可执行此操作'
if (patientRegister.isLock && patientRegister.isLock == 'Y') return ret
switch (btnFlagName) { case 'addSuggtion': case 'save': if (patientRegister.completeFlag && patientRegister.completeFlag != '3') ret = false break; case 'edit': case 'del': case 'audit': if (patientRegister.completeFlag && patientRegister.completeFlag == '3' && patientRegister.isAudit != 'Y') ret = false break; case 'unAudit': case 'reCheck': if (patientRegister.completeFlag && patientRegister.completeFlag == '3' && patientRegister.isAudit && patientRegister.isAudit == 'Y') ret = false break; case 'report': ret = false break; case 'intervene': if (patientRegister.completeFlag && patientRegister.completeFlag == '3') ret = false break; case 'btnOcc': if (patientRegister.isPatientOccupationalDisease && patientRegister.isPatientOccupationalDisease == 'Y') ret = false break; default: ret = false break; } console.log('sumBtnDisabled btnFlagName, patientRegister,ret', btnFlagName, patientRegister, ret) return ret },
// 导入结果(检查、检验、迪安)
btnImportResult(checkType) { if (!this.dataTransOpts.tableS.patient_register.id) { this.$message.warning({ showClose: true, message: "请先选择记录!" }) return }
let url = '/api/app/ImportLisResult/ImportResultByPatientRegisterId' let patientRegisterId = this.dataTransOpts.tableS.patient_register.id switch (checkType) { case 'pacs': url = '/api/app/ImportPacsResult/ImportResultByPatientRegisterId' postapi(url, { patientRegisterId }) .then(res => { if (res.code > -1) { // 心电图(格尔木)
return postapi('/api/app/ImportElectrocardiogramResult/ImportElectrocardiogramResultByPatientRegisterId', { patientRegisterId }) } }) .then(res => { if (res && res.code > -1) { this.$message.success({ showClose: true, message: '导入成功!' }) } }) break; case 'diAn': url = "/api/app/ImportLisResult/ImportDianResultByPatientRegisterId"; postapi(url, { patientRegisterId }).then(res => { if (res.code > -1) { this.$message.success({ showClose: true, message: '导入成功!' }) } }) break; default: //lis
postapi(url, { patientRegisterId }).then(res => { if (res.code > -1) { this.$message.success({ showClose: true, message: '导入成功!' }) } }) break; }
},
//保存数据
btnSave() {
let body = { patientRegisterId: this.dataTransOpts.tableS.patient_register.id, summaryDoctorId: this.dataTransOpts.tableS.patient_register.summaryDoctorId || null, summaryDate: this.dataTransOpts.tableS.patient_register.summaryDate || moment(new Date()).format("yyyy-MM-DD HH:mm:ss"), medicalConclusionId: this.dataTransOpts.tableS.patient_register.medicalConclusionId || null, summaryHistoricalReview:this.sumDoctorCheck.historySummary, sumSummarys: this.sumDoctorCheck.summaryList, sumSuggestions: this.sumDoctorCheck.suggestionList }
// 检查综述建议是否同一个人,防止不同人员数据覆盖
let message = '' for (let index = 0; index < this.sumDoctorCheck.summaryList.length; index++) { let e = this.sumDoctorCheck.summaryList[index]; if (!e.patientRegisterId || e.patientRegisterId != this.dataTransOpts.tableS.patient_register.id) { message = "人员ID 与 综述人员ID 不一致" break } }
if (!message) { let male_disable_keywords = ['子宫', '宫颈', '卵巢', '白带', '阴道'] let female_disable_keywords = ['睾丸', '阴茎'] let disable_keywords = []
switch (this.dataTransOpts.tableS.patient_register.sexId) { case 'M': case 'F': disable_keywords = this.dataTransOpts.tableS.patient_register.sexId == 'M' ? male_disable_keywords : female_disable_keywords
disable_keywords.forEach(key => { this.sumDoctorCheck.summaryList.forEach(e => { if (e.summaryTitle && e.summaryTitle.indexOf(key) > -1) message = `当前患者性别为:${this.dataTransOpts.tableS.patient_register.sexName} 报告不应出现 ${key} 字眼` if (e.details) { e.details.forEach(d => { if (d.summaryContent && d.summaryContent.indexOf(key) > -1) message = `当前患者性别为:${this.dataTransOpts.tableS.patient_register.sexName} 报告不应出现 ${key} 字眼` }); } });
this.sumDoctorCheck.suggestionList.forEach(e => { if (e.suggestionTitle && e.suggestionTitle.indexOf(key) > -1) message = `当前患者性别为:${this.dataTransOpts.tableS.patient_register.sexName} 报告不应出现 ${key} 字眼` if (e.diagnosisNames && e.diagnosisNames.indexOf(key) > -1) message = `当前患者性别为:${this.dataTransOpts.tableS.patient_register.sexName} 报告不应出现 ${key} 字眼` }); }); break; default: break; } }
if (message) { this.$message.error({ showClose: true, message }) return }
for (let index = 0; index < this.sumDoctorCheck.suggestionList.length; index++) { let e = this.sumDoctorCheck.suggestionList[index]; if (!e.patientRegisterId || e.patientRegisterId != this.dataTransOpts.tableS.patient_register.id) { message = "人员ID 与 建议人员ID 不一致" break } } if (message) { this.$message.error({ showClose: true, message }) return }
postapi(`/api/app/patientregister/UpdatePatientRegisterSummarySuggestion`, body) .then((res) => { if (res.code > -1) { // this.dataTransOpts.tableS.patient_register.completeFlag = '3';
this.dataTransOpts.refresh.patient_register.S++ } }) },
//修改结果
btnEdit() { this.dataTransOpts.tableS.patient_register.completeFlag = '2' },
//取消总检
async btnDel() { let tips = false // 已打印删除提示
if (this.dataTransOpts.tableS.patient_register.reportPrintTimes > 0) { let sysParmId = "summary_check_cancel_alreay_print_is_prompt" let sysParam = await postapi('/api/app/SysParmValue/GetSysParmValueBySysParmId', { sysParmId }) if (sysParam.data.toUpperCase() == 'Y') tips = true }
let body = { patientRegisterId: this.dataTransOpts.tableS.patient_register.id }
if (tips) { this.$confirm("已打印过报告, 是否继续取消总检?", "提示", { confirmButtonText: "是", cancelButtonText: "否", type: "warning", }) .then(() => { return postapi(`/api/app/patientregister/CancelSumCheck`, body) }) .then((res) => { if (res.code > -1) { this.dataTransOpts.tableS.patient_register.completeFlag = '2'; } }) .catch((err) => { if (err != "cancel") { this.$message.info({ showClose: true, message: err }); } });
} else { postapi(`/api/app/patientregister/CancelSumCheck`, body) .then((res) => { if (res.code > -1) { this.dataTransOpts.tableS.patient_register.completeFlag = '2'; } }) }
},
// AI诊断 AI重新诊断(使用 fetchStream 实现流式实时渲染)
async btnAIdiagnosis(again) { if (!again) { if (this.AI.visible) { this.btnAImax(false); return; } }
let message = ''; let linkStr = ';'; this.sumDoctorCheck.summaryList.forEach(e => { if (message) { linkStr = ';'; } else { linkStr = ''; } message += linkStr + e.summaryTitle + ':'; e.details.forEach((e1, i) => { message += (i + 1) + ')、' + e1.summaryContent; }); }); message = '性别:' + this.doctorCheck.prBase.sexName + ',年龄:' + this.doctorCheck.prBase.age + '岁,检查结果:' + message; this.AI.rawText = ''; this.AI.html = '';
try { await fetchStream('/api/app/AiMessageWs/GetAIMessageResult', { message }, (chunk) => { // 清洗 SSE 风格前缀并移除结束标志
let cleaned = String(chunk).replace(/data:\s*\[DONE\]/g, '').replace(/^data:\s*/gm, ''); if (!cleaned) return; // 首个数据到达时显示弹窗并展开
if (!this.AI.visible) { this.AI.visible = true; this.btnAImax(false); } this.AI.rawText += cleaned; // 实时渲染 Markdown
this.AI.html = md.render(this.AI.rawText); // 滚动到底部
this.$nextTick(() => { try { const el = this.$refs.aiContent; if (el) el.scrollTop = el.scrollHeight; } catch (e) {} }); }); } catch (err) { // 回退:非流式请求(axios/postapi)
try { const res = await postapi('/api/app/AiMessageWs/GetAIMessageResult', { message }); if (res) { let cleaned = String(res).replace(/data:\s*\[DONE\]/g, '').replace(/^data:\s*/gm, ''); if (cleaned) { // 回退响应到达后显示弹窗并展开
if (!this.AI.visible) { this.AI.visible = true; this.btnAImax(false); } this.AI.rawText += cleaned; this.AI.html = md.render(this.AI.rawText); } } } catch (e) { this.$message.error({ showClose: true, message: (err && err.message) || 'AI诊断请求失败' }); } } },
btnAImax(max) { this.AI.max = !max if (this.AI.max) { this.AI.width = 500 this.AI.height = this.frameHeight } else { this.AI.width = 24 this.AI.height = 24 } }, //审核
audit() { // dataTransOpts.tableS.patient_register.summaryDoctorId
// dataTransOpts.tableS.patient_register.auditDoctorId
let auditDoctorId = this.dataTransOpts.tableS.patient_register.auditDoctorId if (!auditDoctorId) auditDoctorId = window.sessionStorage.getItem("userId") let body = { patientRegisterId: this.dataTransOpts.tableS.patient_register.id, auditDoctorId, // 不传时,取当前用户
//auditDate: "string" // 不传时,取当前时间
isAudit: 'Y' }
if (this.dataTransOpts.tableS.patient_register.summaryDoctorId == auditDoctorId) { this.$confirm(`${this.summary_check_doctor_alias[0]}医生与${this.summary_check_doctor_alias[1]}医生相同,一般不允许这样操作, 是否强行操作?`, "提示", { confirmButtonText: "是", cancelButtonText: "否", type: "warning", }).then(() => { this.auditApi(body) }) } else { this.auditApi(body) }
},
//取消审核
unAudit() { let body = { patientRegisterId: this.dataTransOpts.tableS.patient_register.id, //auditDoctor: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
//auditDate: "string" 不传时,取当前时间
isAudit: 'N' } this.auditApi(body) },
// 审核或取消审核接口
auditApi(body) { postapi(`/api/app/patientregister/updatepatientregisterauditordoctor`, body) .then((res) => { console.log("unAudit", res.data); if (res.code != -1) { this.dataTransOpts.tableS.patient_register.isAudit = body.isAudit; } }) .catch((err) => { this.$message({ type: "error", message: `${body.isAudit == 'Y' ? '' : '取消'}总检审核失败,原因:${err}` }); }); },
//体检报告
async btnReport() {
if (!this.$peisAPI) { this.$message.info("此功能,需要在壳客户端才可运行!") return } ///3a0c990e-5756-2dc0-19d5-69a617fe4048
let ReportCode = '0005'; let BusinessCode = this.dataTransOpts.tableS.patient_register.id
if (this.dataTransOpts.tableS.patient_register.isPatientOccupationalDisease == 'Y') ReportCode = '0006'
let token = window.sessionStorage.getItem('token'); let user = window.sessionStorage.getItem('user'); let toOutShell = { ReportCode, token, BusinessCode, isBuildImage: 'N', IsUploadPdf: 'N', preViewCanPrint: 'Y', Parameters: [ { Name: 'printer', Value: user }, { Name: 'LTS', Value: 'Y' }, //Y、N N只看不能打印
{ Name: "firstPage", Value: "pic/peisReportFirstPage.jpg" }, //报告首页主图
{ Name: "pageHeader", Value: "pic/peisReportPageHeader.jpg" }, //报告页眉图片
{ Name: "pageFooter", Value: "pic/peisReportPageFooter.jpg" }, //报告页脚图片
{ Name: "orgSign", Value: this.dataTransOpts.tableS.patient_register.isPatientOccupationalDisease == 'Y' ? "pic/orgSignOcc.png" : "pic/orgSign.png" }, // 体检章
{ Name: 'picExtOne', Value: 'pic/hisLog.jpg' }, // 院徽
{ Name: 'picExtTwo', Value: 'pic/orgSignCom.png' }, // 单位公章
{ Name: 'resultSign', Value: 'pic/resultSign.png' }, // 结果章,如:职业病(本次体检未发现职业性异常)
{ Name: 'picExtThree', Value: 'pic/peisQrCode.jpg' }, // 公众号二维码
{ Name: 'picExtFour', Value: 'pic/peisQrCodeMini.jpg' }, // 小程序二维码
], };
// 总检审核后才能打印
if (this.dataTransOpts.tableS.patient_register.completeFlag != '3') toOutShell.preViewCanPrint = 'N' if (toOutShell.preViewCanPrint == 'Y' && this.dataTransOpts.tableS.patient_register.isAudit == 'N') { let sysParmId = "medical_report_print_after_summary_check_is_audit" let sysParam = await postapi('/api/app/SysParmValue/GetSysParmValueBySysParmId', { sysParmId }) if (sysParam.data.toUpperCase() == 'Y') toOutShell.preViewCanPrint = 'N' }
// postapi(`/api/app/printreport/getpeisreport?PatientRegisterId=${this.dataTransOpts.tableS.patient_register.id}`)
// .then((res) => {
// if (res.code != -1) {
// toOutShell.ReportTable = res.data;
// console.log('JSON.stringify(toOutShell)', JSON.stringify(toOutShell));
// return this.$peisAPI.printPre(JSON.stringify(toOutShell));
// }
// })
let JSONtoOutShell = JSON.stringify(toOutShell) console.log('$peisAPI.printPre', JSONtoOutShell) this.$peisAPI.printPre(JSONtoOutShell) .then(res => { if (res) { let lres = JSON.parse(res) if (lres.code < 0) this.$message.error({ showClose: true, message: lres.message }) } }) .catch(err => { this.$message.warning(err); });
},
//复查
btnReCheck() { console.log("复查") },
btnReCall() { console.log("随访") },
//干预措施
btnIntervene() { console.log("干预措施") },
// 显示职业病
btnOcc() { if (!this.dataTransOpts.tableS.patient_register.id) { this.$message.warning({ showClose: true, message: '人员信息尚未保存!' }) return } this.dataTransOpts.plus.OccDisease++ this.dialogWin.OccDisease = true },
//重置
btnReset(){ location.reload() },
addSummary() { if (!this.dataTransOpts.tableS.patient_register.id) { alert("请选择检查项目") return } this.doctorCheck.checkSummaryList.push({ registerCheckId: this.dataTransOpts.tableS.patient_register.id, summary: '', summaryFlag: 'N', }) this.doctorCheck.checkSuggestionList.push({ registerCheckId: this.dataTransOpts.tableS.patient_register.id, suggestion: '', }) }, },
//监听事件()
watch: {
},};</script><style scoped>@import '../../assets/css/global_button.css';
.listBtn { margin-top: 5px; margin-left: 10px; text-align: center;}</style>
|