完成:102 门诊医生站-》诊断TAB页:增加报卡弹框登记界面

疾病报告卡新增功能。
修改诊断疾病的sql查询语句
This commit is contained in:
wangjian963
2026-03-06 16:49:21 +08:00
parent 8af06f6916
commit 2492daa0ad
13 changed files with 1503 additions and 728 deletions

View File

@@ -64,7 +64,7 @@
<el-col :span="20" :xs="24">
<div style="margin-bottom: 10px">
<el-button type="primary" plain @click="handleAddDiagnosis()"> 新增诊断 </el-button>
<el-button type="primary" plain @click="handleSaveDiagnosis()"> 保存诊断 </el-button>
<el-button type="primary" plain @click="handleSaveDiagnosis()" :loading="saveLoading"> 保存诊断 </el-button>
<el-button type="primary" plain @click="handleAddTcmDiagonsis()"> 中医诊断 </el-button>
<el-button type="primary" plain @click="handleImport()"> 导入慢性病诊断 </el-button>
<span style="font-size: 12px; margin-left: 10px"
@@ -279,6 +279,7 @@ const diagnosisOptions = ref([]);
const rowIndex = ref();
const diagnosis = ref();
const orgOrUser = ref();
const saveLoading = ref(false);
const form = ref({
diagnosisList: [],
isDataLoaded: false,
@@ -325,52 +326,52 @@ function refreshData() {
getList();
}
let maxNo = 99;
function getList() {
getEncounterDiagnosis(props.patientInfo.encounterId)
.then((res) => {
if (res.code == 200) {
// 过滤掉中医诊断,只保留西医诊断
form.value.diagnosisList = res.data.filter(item => item.typeName !== '中医诊断');
// 为旧数据添加默认分类
form.value.diagnosisList.forEach(item => {
if (!item.classification) {
item.classification = '西医';
}
});
emits('diagnosisSave', false);
}
maxNo = form.value.diagnosisList.length;
})
.then(() => {
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
if (res.code == 200) {
if (res.data.illness.length > 0) {
res.data.illness.forEach((item, index) => {
if (item.diagSrtNo <= maxNo) {
return;
}
form.value.diagnosisList.push({
name: item.name + '-' + res.data.symptom[index].name,
diagSrtNo: item.diagSrtNo,
ybNo: item.ybNo,
medTypeCode: item.medTypeCode,
syndromeGroupNo: item.syndromeGroupNo,
typeName: '中医诊断',
classification: '中医', // 中医诊断默认分类
onsetDate: item.onsetDate,
updateId:item.encounterDiagnosisId+'-'+res.data.symptom[index].encounterDiagnosisId,
illnessDefinitionId : item.definitionId,
symptomDefinitionId : res.data.symptom[index].definitionId,
symptomYbNo: res.data.symptom[index].ybNo,
});
maxNo = item.diagSrtNo;
});
}
emits('diagnosisSave', false);
async function getList() {
try {
const res = await getEncounterDiagnosis(props.patientInfo.encounterId);
if (res.code == 200) {
// 过滤掉中医诊断,只保留西医诊断
form.value.diagnosisList = res.data.filter(item => item.typeName !== '中医诊断');
// 为旧数据添加默认分类
form.value.diagnosisList.forEach(item => {
if (!item.classification) {
item.classification = '西医';
}
});
});
getTree();
emits('diagnosisSave', false);
}
maxNo = form.value.diagnosisList.length;
const tcmRes = await getTcmDiagnosis({ encounterId: props.patientInfo.encounterId });
if (tcmRes.code == 200) {
if (tcmRes.data.illness.length > 0) {
tcmRes.data.illness.forEach((item, index) => {
if (item.diagSrtNo <= maxNo) {
return;
}
form.value.diagnosisList.push({
name: item.name + '-' + tcmRes.data.symptom[index].name,
diagSrtNo: item.diagSrtNo,
ybNo: item.ybNo,
medTypeCode: item.medTypeCode,
syndromeGroupNo: item.syndromeGroupNo,
typeName: '中医诊断',
classification: '中医', // 中医诊断默认分类
onsetDate: item.onsetDate,
updateId:item.encounterDiagnosisId+'-'+tcmRes.data.symptom[index].encounterDiagnosisId,
illnessDefinitionId : item.definitionId,
symptomDefinitionId : tcmRes.data.symptom[index].definitionId,
symptomYbNo: tcmRes.data.symptom[index].ybNo,
});
maxNo = item.diagSrtNo;
});
}
emits('diagnosisSave', false);
}
getTree();
} catch (error) {
console.error('获取诊断列表失败:', error);
}
}
init();
@@ -574,54 +575,105 @@ function handleMaindise(value, index) {
/**
* 保存诊断
* 使用 async/await 重构,优化错误处理和加载状态
*/
function handleSaveDiagnosis() {
proxy.$refs.formRef.validate((valid) => {
if (valid) {
if (form.value.diagnosisList.length == 0) {
proxy.$modal.msgWarning('诊断不能为空');
return false;
} else if (!form.value.diagnosisList.some((diagnosis) => diagnosis.maindiseFlag === 1)) {
proxy.$modal.msgWarning('至少添加一条主诊断');
return false;
} else {
// 保存前按排序号排序
form.value.diagnosisList.sort((a, b) => (a.diagSrtNo || 0) - (b.diagSrtNo || 0));
saveDiagnosis({
patientId: props.patientInfo.patientId,
encounterId: props.patientInfo.encounterId,
diagnosisChildList: form.value.diagnosisList,
}).then((res) => {
if (res.code == 200) {
getTree();
getList();
emits('diagnosisSave', false);
proxy.$modal.msgSuccess('诊断已保存并按排序号排序');
//食源性疾病病例数据智能采集 ---START---
isFoodDiseasesNew({
encounterId: props.patientInfo.encounterId,
}).then((res) => {
if (res.code == 200) {
let jumpUrl = res.data;
if (jumpUrl) {
window.open(jumpUrl, '_blank');
}
}
});
//食源性疾病病例数据智能采集 ---END---
//传染病报告卡 ---START---
// 获取主诊断数据,弹出传染病报告卡
const mainDiagnosis = form.value.diagnosisList.find(d => d.maindiseFlag === 1);
if (mainDiagnosis) {
proxy.$refs.infectiousDiseaseReportRef.show(mainDiagnosis);
}
//传染病报告卡 ---END---
}
});
}
async function handleSaveDiagnosis() {
try {
// 表单验证
const valid = await proxy.$refs.formRef.validate().catch(() => false);
if (!valid) {
return;
}
});
// 检查诊断列表是否为空
if (form.value.diagnosisList.length === 0) {
proxy.$modal.msgWarning('诊断不能为空');
return;
}
// 检查是否至少有一条主诊断
const hasMainDiagnosis = form.value.diagnosisList.some((diagnosis) => diagnosis.maindiseFlag === 1);
if (!hasMainDiagnosis) {
proxy.$modal.msgWarning('至少添加一条主诊断');
return;
}
// 防护性检查:确保患者信息完整
if (!props.patientInfo?.patientId || !props.patientInfo?.encounterId) {
proxy.$modal.msgWarning('患者信息不完整,无法保存诊断');
return;
}
// 开始加载状态,防止重复提交
saveLoading.value = true;
// 保存前按排序号排序
form.value.diagnosisList.sort((a, b) => (a.diagSrtNo || 0) - (b.diagSrtNo || 0));
// 调用保存诊断接口
const res = await saveDiagnosis({
patientId: props.patientInfo.patientId,
encounterId: props.patientInfo.encounterId,
diagnosisChildList: form.value.diagnosisList,
});
if (res.code === 200) {
// 刷新树和列表数据等待列表数据加载完成确保获取到reportTypeCode
await getList();
getTree();
emits('diagnosisSave', false);
proxy.$modal.msgSuccess('诊断已保存并按排序号排序');
// 食源性疾病病例数据智能采集
await handleFoodDiseasesCheck();
// 传染病报告卡检查诊断的reportTypeCode弹出对应的报告卡界面
handleInfectiousDiseaseReport();
}
} catch (error) {
console.error('保存诊断失败:', error);
proxy.$modal.msgError('保存诊断失败,请稍后重试');
} finally {
// 结束加载状态
saveLoading.value = false;
}
}
/**
* 食源性疾病病例数据智能采集
*/
async function handleFoodDiseasesCheck() {
try {
const res = await isFoodDiseasesNew({
encounterId: props.patientInfo.encounterId,
});
if (res.code === 200 && res.data) {
window.open(res.data, '_blank');
}
} catch (error) {
console.error('食源性疾病检查失败:', error);
}
}
/**
* 传染病报告卡处理
* 通过诊断目录维护的'报卡类型'字段自动识别是否有需要填写的传染病报告卡
* 如果有则弹出诊断对应需登记的报告卡界面
*/
function handleInfectiousDiseaseReport() {
// 查找所有有报卡类型的诊断reportTypeCode不为空
const diagnosesWithReportType = form.value.diagnosisList.filter(d => d.reportTypeCode);
if (diagnosesWithReportType.length === 0) {
return;
}
// 优先使用主诊断,如果没有主诊断有报卡类型则使用第一个有报卡类型的诊断
const mainDiagnosisWithReport = diagnosesWithReportType.find(d => d.maindiseFlag === 1);
const targetDiagnosis = mainDiagnosisWithReport || diagnosesWithReportType[0];
// 弹出传染病报告卡弹窗
proxy.$refs.infectiousDiseaseReportRef?.show(targetDiagnosis);
}
/**