From d28ac34ae0947930874b3d78072c49b60a21df6a Mon Sep 17 00:00:00 2001 From: chenqi Date: Mon, 23 Mar 2026 16:32:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(doctorstation):=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=AF=8A=E7=96=97=E5=8C=BB=E5=98=B1=E6=97=B6?= =?UTF-8?q?=E8=B4=B9=E7=94=A8=E9=A1=B9=E4=B8=8D=E5=AD=98=E5=9C=A8=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加费用项存在性检查逻辑 - 在删除前先查询费用项是否存在于数据库中 - 添加详细的操作日志记录便于问题追踪 - 避免因费用项不存在导致的删除操作失败 --- .../impl/DoctorStationAdviceAppServiceImpl.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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 908517e2..f5530839 100644 --- 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 @@ -1058,9 +1058,20 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp iServiceRequestService.remove( new LambdaQueryWrapper().eq(ServiceRequest::getParentId, adviceSaveDto.getRequestId()));// 删除诊疗套餐对应的子项 - // 删除费用项 - iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.WOR_SERVICE_REQUEST, - adviceSaveDto.getRequestId()); + // 🔧 Bug Fix #219: 删除费用项前查询确认 + Long requestId = adviceSaveDto.getRequestId(); + String serviceTable = CommonConstants.TableName.WOR_SERVICE_REQUEST; + // 先查询费用项是否存在 + List existingChargeItems = iChargeItemService.getChargeItemInfoByReqId(Arrays.asList(requestId)); + if (existingChargeItems == null || existingChargeItems.isEmpty()) { + log.warn("BugFix#219: 删除诊疗医嘱时未找到费用项, requestId={}, serviceTable={}", requestId, serviceTable); + } else { + log.info("BugFix#219: 找到 {} 个费用项, 准备删除, requestId={}, serviceTable={}", + existingChargeItems.size(), requestId, serviceTable); + // 删除费用项 + iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId); + log.info("BugFix#219: 费用项删除完成, requestId={}", requestId); + } } for (AdviceSaveDto adviceSaveDto : insertOrUpdateList) {