diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java index b43cc4d7a..69471421f 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java @@ -957,7 +957,13 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp } } for (AdviceSaveDto adviceSaveDto : deleteList) { - iMedicationRequestService.removeById(adviceSaveDto.getRequestId()); + Long requestId = adviceSaveDto.getRequestId(); + // 🔧 Bug #442: 跳过 requestId 为 null 的记录,避免删除不存在的药品请求 + if (requestId == null) { + log.warn("BugFix#442: handMedication - 跳过 requestId 为 null 的删除请求"); + continue; + } + iMedicationRequestService.removeById(requestId); // 删除已经产生的药品发放信息 iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId()); // 🔧 Bug Fix #219: 删除费用项 @@ -1417,6 +1423,11 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp log.info("BugFix#219: handDevice - 开始删除循环, deleteList.size={}", deleteList.size()); for (AdviceSaveDto adviceSaveDto : deleteList) { Long requestId = adviceSaveDto.getRequestId(); + // 🔧 Bug #442: 跳过 requestId 为 null 的记录,避免删除不存在的耗材请求 + if (requestId == null) { + log.warn("BugFix#442: handDevice - 跳过 requestId 为 null 的删除请求"); + continue; + } log.info("BugFix#219: handDevice - 删除开始: requestId={}", requestId); // 1. 删除耗材请求 @@ -1721,10 +1732,16 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp } } for (AdviceSaveDto adviceSaveDto : deleteList) { - iServiceRequestService.removeById(adviceSaveDto.getRequestId());// 删除诊疗 + Long requestId = adviceSaveDto.getRequestId(); + // 🔧 Bug #442: 跳过 requestId 为 null 的记录,避免删除不存在的诊疗请求 + if (requestId == null) { + log.warn("BugFix#442: handService - 跳过 requestId 为 null 的删除请求"); + continue; + } + iServiceRequestService.removeById(requestId);// 删除诊疗 iServiceRequestService.remove( new LambdaQueryWrapper().eq(ServiceRequest::getParentId, - adviceSaveDto.getRequestId()));// 删除诊疗套餐对应的子项 + requestId));// 删除诊疗套餐对应的子项 // 🔧 Bug Fix #219: 删除费用项 Long requestId = adviceSaveDto.getRequestId(); String serviceTable = CommonConstants.TableName.WOR_SERVICE_REQUEST; diff --git a/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue b/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue index 480d9795c..b80ded4a3 100755 --- a/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue +++ b/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue @@ -880,19 +880,23 @@ function handleDelete() { proxy.$modal.msgWarning('请选择要删除的项目'); return; } - + let deleteList = groupIndexList.value.map((index) => { const item = prescriptionList.value[index]; // 只删除待签发且未收费的项目 if (item.statusEnum != 1 || item.chargeStatus == 5) { return null; } + // 🔧 Bug #442: 已保存的行必须有有效的 requestId,否则跳过(避免后端删除不存在的记录) + if (item.requestId == null || item.requestId === undefined || item.requestId === '') { + return null; + } return { requestId: item.requestId, dbOpType: '3', adviceType: item.adviceType, }; - }).filter(item => item !== null); // 过滤掉已签发或已收费的项目 + }).filter(item => item !== null); // 过滤掉已签发、已收费或无 requestId 的项目 if (deleteList.length == 0) { proxy.$modal.msgWarning('只能删除待签发且未收费的项目'); diff --git a/sql/bug_434_add_incision_level_to_op_schedule.sql b/sql/bug_434_add_incision_level_to_op_schedule.sql new file mode 100644 index 000000000..6295dab13 --- /dev/null +++ b/sql/bug_434_add_incision_level_to_op_schedule.sql @@ -0,0 +1,5 @@ +-- Bug #434 修复:为 op_schedule 表添加 incision_level 字段 +-- 手术安排表需要存储切口类型,以便在编辑弹窗中正确回显和保存 +ALTER TABLE op_schedule ADD COLUMN IF NOT EXISTS incision_level INT2; + +COMMENT ON COLUMN op_schedule.incision_level IS '手术切口等级 1-I级切口 2-II级切口 3-III级切口 4-IV级切口';