fix(prescription): 解决处方列表患者信息不完整导致保存失败的问题 BUG#220

- 在前端处方组件中添加患者信息完整性校验
- 当患者信息缺失时显示错误提示并阻止保存操作
- 确保处方项目正确携带patientId和encounterId信息
- 在后端服务中验证并自动补全缺失的patientId信息
- 当encounterId为空时返回相应错误提示
- 添加详细的日志记录以便问题追踪
This commit is contained in:
2026-03-24 11:53:04 +08:00
parent cc51d0b345
commit e1dc5c895f
2 changed files with 47 additions and 1 deletions

View File

@@ -674,6 +674,7 @@
:controls="false"
style="width: 60px"
size="small"
@change="calculateTotalPrice(scope.row, scope.$index)"
/>
<span style="margin-left: 4px">{{ scope.row.unitCode_dictText }}</span>
</template>
@@ -2154,6 +2155,13 @@ function handleSave(prescriptionId) {
finalAccountId = null;
}
// 🔧 Bug Fix: 校验患者信息完整性
if (!props.patientInfo || !props.patientInfo.patientId || !props.patientInfo.encounterId) {
console.error('患者信息不完整:', props.patientInfo);
proxy.$modal.msgError('患者信息不完整,请重新选择患者后再试');
return;
}
saveList.forEach((item) => {
item.patientId = props.patientInfo.patientId;
item.encounterId = props.patientInfo.encounterId;
@@ -2686,6 +2694,13 @@ function handleSaveBatch(prescriptionId) {
return;
}
// 🔧 Bug Fix: 校验患者信息完整性
if (!props.patientInfo || !props.patientInfo.patientId || !props.patientInfo.encounterId) {
console.error('患者信息不完整:', props.patientInfo);
proxy.$modal.msgError('患者信息不完整,请重新选择患者后再试');
return;
}
// --- 【修改开始:优先使用选中行】 ---
// 1. 获取表格当前选中的行
@@ -2785,6 +2800,8 @@ function handleSaveBatch(prescriptionId) {
return {
...item,
patientId: props.patientInfo.patientId,
encounterId: props.patientInfo.encounterId,
adviceType: saveAdviceType,
dbOpType: item.requestId ? '2' : '1',
isSaved: true,