fix(doctorstation): 解决参数验证和数据获取问题

- 在前端api.js中添加encounterId参数验证,避免无效参数导致的错误
- 在后端服务层添加参数检查,当encounterId为空时返回空数据而非报错
- 修改控制器参数注解,将required设置为false以允许空值传递
- 优化住院办理流程中的错误处理和参数验证
- 改进检验申请单获取时的数据验证和错误提示
- 更新maven编译器插件版本并添加必要的模块参数
- 统一错误处理机制,提供更友好的用户提示信息
This commit is contained in:
2026-01-17 16:07:57 +08:00
parent 64c7db68e8
commit 982ee316f7
18 changed files with 267 additions and 64 deletions

View File

@@ -408,7 +408,10 @@ function handleClick(tab) {
tcmRef.value.getDiagnosisInfo();
break;
case 'inspection':
// 检验tab点击处理逻辑可以在这里添加
// 确保检验组件获取最新的患者信息
if (patientInfo.value && patientInfo.value.encounterId) {
inspectionRef.value.getList();
}
break;
case 'surgery':
surgeryRef.value.getList();
@@ -529,31 +532,74 @@ function openDrawer() {
}
// 判断是否已经入院登记
const onHospitalization = async () => {
const diagnosisRes = await getEncounterDiagnosis(patientInfo.value.encounterId);
const hasDiagnosis = diagnosisRes.data?.length > 0;
if (!hasDiagnosis) {
// 检查是否有有效的就诊ID
if (!patientInfo.value?.encounterId) {
ElMessage({
type: 'error',
message: '患者暂无诊断信息,无法办理住院!',
message: '患者就诊信息不完整,无法办理住院!',
});
return;
}
const mainDiag = diagnosisRes.data.find((item) => item.maindiseFlag === 1);
if (!mainDiag) {
ElMessage({ type: 'error', message: '该患者暂无主诊断信息,无法办理住院!' });
return;
}
mainDiagnosis.value = mainDiag;
const res = await isHospitalization({
encounterId: patientInfo.value.encounterId,
});
if (!res.data) {
openDialog.value = true;
} else {
try {
const diagnosisRes = await getEncounterDiagnosis(patientInfo.value.encounterId);
// 检查API调用是否成功
if (diagnosisRes.code !== 200) {
ElMessage({
type: 'error',
message: diagnosisRes.msg || '获取诊断信息失败,无法办理住院!',
});
return;
}
const hasDiagnosis = diagnosisRes.data?.length > 0;
if (!hasDiagnosis) {
ElMessage({
type: 'error',
message: '该患者暂无诊断信息,无法办理住院!',
});
return;
}
const mainDiag = diagnosisRes.data.find((item) => item.maindiseFlag === 1);
if (!mainDiag) {
ElMessage({
type: 'error',
message: '该患者暂无主诊断信息,无法办理住院!'
});
return;
}
mainDiagnosis.value = mainDiag;
const res = await isHospitalization({
encounterId: patientInfo.value.encounterId,
});
// 检查API调用是否成功
if (res.code !== 200) {
ElMessage({
type: 'error',
message: res.msg || '检查住院状态失败!',
});
return;
}
if (!res.data) {
openDialog.value = true;
} else {
ElMessage({
type: 'error',
message: '该患者,已办理入院,不允许重复办理',
});
}
} catch (error) {
console.error('办理住院检查过程中发生错误:', error);
ElMessage({
type: 'error',
message: '该患者,已办理入院,不允许重复办理',
});
message: '办理住院过程中发生错误,请稍后重试!',
});
}
};
</script>