Fix Bug #454: 门诊医生站-医嘱页签:删除"待签发"状态的检验项目时,错误触发"执行科室"校验导致删除失败

在handService的执行科室校验中增加dbOpType DELETE跳过条件,作为BugFix#454过滤器的第二层防御。
同时修复handMedication和handService中重复声明requestId变量导致的编译错误。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
关羽
2026-05-13 16:12:16 +08:00
parent 8c03559c87
commit 63a3f63380

View File

@@ -967,7 +967,6 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// 删除已经产生的药品发放信息 // 删除已经产生的药品发放信息
iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId()); iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId());
// 🔧 Bug Fix #219: 删除费用项 // 🔧 Bug Fix #219: 删除费用项
Long requestId = adviceSaveDto.getRequestId();
String serviceTable = CommonConstants.TableName.MED_MEDICATION_REQUEST; String serviceTable = CommonConstants.TableName.MED_MEDICATION_REQUEST;
// 直接删除费用项 // 直接删除费用项
iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId); iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId);
@@ -1743,7 +1742,6 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getParentId, new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getParentId,
requestId));// 删除诊疗套餐对应的子项 requestId));// 删除诊疗套餐对应的子项
// 🔧 Bug Fix #219: 删除费用项 // 🔧 Bug Fix #219: 删除费用项
Long requestId = adviceSaveDto.getRequestId();
String serviceTable = CommonConstants.TableName.WOR_SERVICE_REQUEST; String serviceTable = CommonConstants.TableName.WOR_SERVICE_REQUEST;
// 直接删除费用项 // 直接删除费用项
iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId); iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId);
@@ -1800,8 +1798,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
log.info("handService - 自动补全founderOrgId: founderOrgId={}", adviceSaveDto.getFounderOrgId()); log.info("handService - 自动补全founderOrgId: founderOrgId={}", adviceSaveDto.getFounderOrgId());
} }
// 🔧 Bug Fix #238: 诊疗项目执行科室非空校验 // 🔧 Bug Fix #238/#454: 诊疗项目执行科室非空校验(删除操作跳过校验)
if (adviceSaveDto.getAdviceType() != null && adviceSaveDto.getAdviceType() == 3) { if (adviceSaveDto.getAdviceType() != null && adviceSaveDto.getAdviceType() == 3
&& !DbOpType.DELETE.getCode().equals(adviceSaveDto.getDbOpType())) {
Long effectiveOrgId = adviceSaveDto.getEffectiveOrgId(); Long effectiveOrgId = adviceSaveDto.getEffectiveOrgId();
if (effectiveOrgId == null) { if (effectiveOrgId == null) {
throw new ServiceException("诊疗项目必须选择执行科室"); throw new ServiceException("诊疗项目必须选择执行科室");