Compare commits

...

2 Commits

Author SHA1 Message Date
关羽
c012974fd0 Fix Bug #405: 住院医生工作站:临床医嘱保存成功后,医嘱条目仍处于可编辑状态(未锁定展示)
- getListInfo: 增加 getPrescriptionList 的 .catch() 处理,API失败时锁定所有行(isEdit=false)
  防止列表加载静默失败导致医嘱永久处于可编辑状态
- handleSaveBatch: 在 .catch() 中增加 isEdit=false 重置,保存失败时也锁定行
- 与之前的修复配合:保存成功时先设置 isEdit=false 再调用 getListInfo 刷新数据

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 14:27:31 +08:00
赵云
5a83ff2aca Fix Bug #403: 住院医生工作站:应用医嘱组套后,药品明细字段内容丢失未正确引入表格
修复 handleSaveGroup 中 mergedDetail 和 newRow 构建时的空值处理问题:
1. mergedDetail 中 dose/doseQuantity/dispensePerDuration 使用严格 null 检查,
   避免组套中值为 null 时错误回退到 orderDetailInfos
2. newRow 中关键字段增加 mergedDetail 回退(?? 操作符),
   确保当 item 中字段为 null/undefined 时能从 setValue 填充的完整数据中获取

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 14:27:31 +08:00

View File

@@ -631,6 +631,12 @@ function getListInfo(addNewRow) {
handleAddPrescription(); handleAddPrescription();
} }
}); });
}).catch((err) => {
console.error('处方列表加载失败:', err);
// 🔧 Bug #405 修复列表加载失败时确保所有行被锁定isEdit=false
// 防止行永久处于可编辑状态
prescriptionList.value.forEach(item => { item.isEdit = false; });
loadingInstance.close();
}); });
getContract({ encounterId: patientInfo.value.encounterId }).then((res) => { getContract({ encounterId: patientInfo.value.encounterId }).then((res) => {
contractList.value = res.data; contractList.value = res.data;
@@ -1443,6 +1449,12 @@ function handleSaveBatch() {
}) })
.catch((error) => { .catch((error) => {
isSaving.value = false; isSaving.value = false;
// 🔧 Bug #405 修复:保存失败时也锁定行,防止行永久处于可编辑状态
filterPrescriptionList.value.forEach(item => {
if (item.statusEnum == 1 && !item.requestId) {
item.isEdit = false;
}
});
proxy.$modal.msgError(error?.msg || '保存失败,请重试'); proxy.$modal.msgError(error?.msg || '保存失败,请重试');
}); });
} }
@@ -1571,17 +1583,21 @@ function handleSaveGroup(orderGroupList) {
// 🔥 新版组件已经预处理了数据,优先使用 mergedDetail // 🔥 新版组件已经预处理了数据,优先使用 mergedDetail
const mergedDetail = item.mergedDetail || { const mergedDetail = item.mergedDetail || {
...(item.orderDetailInfos || {}), ...(item.orderDetailInfos || {}),
adviceName: item.orderDetailInfos?.adviceName || item.orderDefinitionName || '未知项目', adviceName: item.orderDefinitionName || item.orderDetailInfos?.adviceName || '未知项目',
adviceType: item.orderDetailInfos?.adviceType, adviceType: item.orderDetailInfos?.adviceType,
adviceDefinitionId: item.orderDefinitionId || item.orderDetailInfos?.adviceDefinitionId, adviceDefinitionId: item.orderDefinitionId || item.orderDetailInfos?.adviceDefinitionId,
quantity: item.quantity, quantity: item.quantity,
unitCode: item.unitCode || item.orderDetailInfos?.unitCode, unitCode: item.unitCode || item.orderDetailInfos?.unitCode,
unitCodeName: item.unitCodeName, unitCodeName: item.unitCodeName,
dose: item.dose || item.orderDetailInfos?.dose, // 🔧 Bug #403 修复dose/doseQuantity/dispensePerDuration 需用 null 检查,
// 避免组套中值为 null 时回退到医嘱库的 orderDetailInfos
dose: item.dose !== undefined && item.dose !== null ? item.dose : item.orderDetailInfos?.dose,
rateCode: item.rateCode || item.orderDetailInfos?.rateCode, rateCode: item.rateCode || item.orderDetailInfos?.rateCode,
methodCode: item.methodCode || item.orderDetailInfos?.methodCode, methodCode: item.methodCode || item.orderDetailInfos?.methodCode,
dispensePerDuration: item.dispensePerDuration || item.orderDetailInfos?.dispensePerDuration, dispensePerDuration: item.dispensePerDuration !== undefined && item.dispensePerDuration !== null
doseQuantity: item.doseQuantity, ? item.dispensePerDuration : item.orderDetailInfos?.dispensePerDuration,
doseQuantity: item.doseQuantity !== undefined && item.doseQuantity !== null
? item.doseQuantity : item.orderDetailInfos?.doseQuantity,
inventoryList: item.orderDetailInfos?.inventoryList || [], inventoryList: item.orderDetailInfos?.inventoryList || [],
priceList: item.orderDetailInfos?.priceList || [], priceList: item.orderDetailInfos?.priceList || [],
partPercent: item.orderDetailInfos?.partPercent || 1, partPercent: item.orderDetailInfos?.partPercent || 1,
@@ -1600,20 +1616,21 @@ function handleSaveGroup(orderGroupList) {
setValue(mergedDetail); setValue(mergedDetail);
// 创建新的处方项目 // 创建新的处方项目
// 🔧 Bug #403 修复:关键字段使用 null-safe 回退到 mergedDetail已由 setValue 填充完整数据)
const newRow = { const newRow = {
...prescriptionList.value[rowIndex.value], ...prescriptionList.value[rowIndex.value],
patientId: patientInfo.value.patientId, patientId: patientInfo.value.patientId,
encounterId: patientInfo.value.encounterId, encounterId: patientInfo.value.encounterId,
accountId: accountId.value, accountId: accountId.value,
quantity: item.quantity, quantity: item.quantity ?? mergedDetail.quantity,
methodCode: item.methodCode, methodCode: item.methodCode ?? mergedDetail.methodCode,
rateCode: item.rateCode, rateCode: item.rateCode ?? mergedDetail.rateCode,
dispensePerDuration: item.dispensePerDuration, dispensePerDuration: item.dispensePerDuration ?? mergedDetail.dispensePerDuration,
dose: item.dose, dose: item.dose ?? mergedDetail.dose,
doseQuantity: item.doseQuantity, doseQuantity: item.doseQuantity ?? mergedDetail.doseQuantity,
executeNum: 1, executeNum: 1,
unitCode: item.unitCode, unitCode: item.unitCode ?? mergedDetail.unitCode,
unitCode_dictText: item.unitCodeName || '', unitCode_dictText: item.unitCodeName || mergedDetail.unitCodeName || '',
statusEnum: 1, statusEnum: 1,
orgId: resolveOrgId(item.orderDetailInfos?.orgId || mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || '', orgId: resolveOrgId(item.orderDetailInfos?.orgId || mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || '',
// 🔧 修复:同时保存 orgName确保树匹配不到时仍有中文名称可显示 // 🔧 修复:同时保存 orgName确保树匹配不到时仍有中文名称可显示