From cb82f8d5bf107db73d20eff87590d9d5d89a28d6 Mon Sep 17 00:00:00 2001 From: Ranyunqiao <2499115710@qq.com> Date: Tue, 16 Jun 2026 16:16:09 +0800 Subject: [PATCH] bug 673 761 719 754 728 727 763 --- .../impl/AdviceProcessAppServiceImpl.java | 11 ++-- .../impl/MedicineSummaryAppServiceImpl.java | 4 +- .../dto/MedicineSummaryParam.java | 6 +-- .../impl/AdviceManageAppServiceImpl.java | 53 ++++++++++++++----- .../AdviceProcessAppMapper.xml | 8 +-- .../MedicineSummaryAppMapper.xml | 2 +- .../src/components/TableLayout/Table.vue | 5 +- .../transferOrganizationDialog.vue | 4 +- .../home/components/order/index.vue | 28 ++++++---- .../components/prescriptionList.vue | 18 +++---- 10 files changed, 89 insertions(+), 50 deletions(-) diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java index e34baee4d..745c25eb4 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java @@ -461,12 +461,15 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { } // 处理转科/出院等特殊医嘱 for (ServiceRequest serviceRequest : allServiceRequests) { + // Bug #718: 延迟状态变更时机。核对通过时不立即变更患者就诊状态, + // 而是等到护士在【入出转管理】中手动点击“转科”或“清床”时再处理。 + // 这样可以确保护士在真正转出前,依然能在在科列表中选中患者并处理遗留医嘱。 if (ActivityDefCategory.TRANSFER.getValue().equals(serviceRequest.getCategoryEnum())) { - encounterService.updateEncounterStatus(serviceRequest.getEncounterId(), - EncounterZyStatus.PENDING_TRANSFER.getValue()); + // encounterService.updateEncounterStatus(serviceRequest.getEncounterId(), + // EncounterZyStatus.PENDING_TRANSFER.getValue()); } else if (ActivityDefCategory.DISCHARGE.getValue().equals(serviceRequest.getCategoryEnum())) { - encounterService.updateEncounterStatus(serviceRequest.getEncounterId(), - EncounterZyStatus.AWAITING_DISCHARGE.getValue()); + // encounterService.updateEncounterStatus(serviceRequest.getEncounterId(), + // EncounterZyStatus.AWAITING_DISCHARGE.getValue()); } } } diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/MedicineSummaryAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/MedicineSummaryAppServiceImpl.java index a6a79698d..0c51cf5fb 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/MedicineSummaryAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/MedicineSummaryAppServiceImpl.java @@ -206,8 +206,8 @@ public class MedicineSummaryAppServiceImpl implements IMedicineSummaryAppService // 领药人 Long receiverId = medicineSummaryParamList.get(0).getReceiverId(); // 申请时间(优先使用前端传递的操作时间,确保与实际操作时间一致) - Date now = medicineSummaryParamList.get(0).getDispenseTime() != null - ? medicineSummaryParamList.get(0).getDispenseTime() : DateUtils.getNowDate(); + Date now = medicineSummaryParamList.get(0).getExecuteTime() != null + ? medicineSummaryParamList.get(0).getExecuteTime() : DateUtils.getNowDate(); // 申请人 Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId(); // 药品发放id diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/dto/MedicineSummaryParam.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/dto/MedicineSummaryParam.java index 2ed5b896a..99ffe5c32 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/dto/MedicineSummaryParam.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/dto/MedicineSummaryParam.java @@ -22,10 +22,10 @@ import java.util.Date; public class MedicineSummaryParam { /** - * 领药时间 + * 实际执行时间 */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") - private Date dispenseTime; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date executeTime; /** * 发放id diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java index 83735f589..35d8fada0 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java @@ -322,33 +322,60 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { try { // 根据adviceType判断删除哪种类型的医嘱 - if (ItemType.MEDICINE.getValue().equals(adviceType)) { - // 药品删除 - iMedicationRequestService.removeById(requestId); - iMedicationDispenseService.deleteMedicationDispense(requestId); - iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.MED_MEDICATION_REQUEST, requestId); - log.info("删除药品医嘱成功,requestId: {}", requestId); + if (ItemType.MEDICINE.getValue().equals(adviceType) || (adviceType != null && adviceType == 7)) { + // 药品删除 (7表示出院带药,也按药品逻辑删除) + MedicationRequest medRequest = iMedicationRequestService.getById(requestId); + if (medRequest != null) { + if (!RequestStatus.DRAFT.getValue().equals(medRequest.getStatusEnum())) { + throw new ServiceException("仅待签发状态的医嘱允许删除"); + } + iMedicationRequestService.removeById(requestId); + iMedicationDispenseService.deleteMedicationDispense(requestId); + iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.MED_MEDICATION_REQUEST, requestId); + log.info("删除药品医嘱成功,requestId: {}", requestId); + } } else if (ItemType.DEVICE.getValue().equals(adviceType)) { // 耗材删除 - iDeviceRequestService.removeById(requestId); - iDeviceDispenseService.deleteDeviceDispense(requestId); - iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.WOR_DEVICE_REQUEST, requestId); - log.info("删除耗材医嘱成功,requestId: {}", requestId); + DeviceRequest deviceRequest = iDeviceRequestService.getById(requestId); + if (deviceRequest != null) { + if (!RequestStatus.DRAFT.getValue().equals(deviceRequest.getStatusEnum())) { + throw new ServiceException("仅待签发状态的医嘱允许删除"); + } + iDeviceRequestService.removeById(requestId); + iDeviceDispenseService.deleteDeviceDispense(requestId); + iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.WOR_DEVICE_REQUEST, requestId); + log.info("删除耗材医嘱成功,requestId: {}", requestId); + } } else if (ItemType.ACTIVITY.getValue().equals(adviceType) || (adviceType != null && (adviceType == 26 || adviceType == 31))) { // 诊疗活动删除(包括护理type=26和未知类型type=31) - iServiceRequestService.removeById(requestId); - iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.WOR_SERVICE_REQUEST, requestId); - log.info("删除诊疗/护理医嘱成功,requestId: {}, adviceType: {}", requestId, adviceType); + ServiceRequest serviceRequest = iServiceRequestService.getById(requestId); + if (serviceRequest != null) { + if (!RequestStatus.DRAFT.getValue().equals(serviceRequest.getStatusEnum())) { + throw new ServiceException("仅待签发状态的医嘱允许删除"); + } + iServiceRequestService.removeById(requestId); + iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.WOR_SERVICE_REQUEST, requestId); + log.info("删除诊疗/护理医嘱成功,requestId: {}, adviceType: {}", requestId, adviceType); + } } else { // 未知类型,尝试按诊疗活动删除(兜底策略) log.warn("未知的adviceType: {},尝试按诊疗活动删除,requestId: {}", adviceType, requestId); + ServiceRequest serviceRequest = iServiceRequestService.getById(requestId); + if (serviceRequest != null) { + if (!RequestStatus.DRAFT.getValue().equals(serviceRequest.getStatusEnum())) { + throw new ServiceException("仅待签发状态的医嘱允许删除"); + } + } iServiceRequestService.removeById(requestId); iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.WOR_SERVICE_REQUEST, requestId); } + } catch (ServiceException e) { + // 业务校验异常,直接向上抛出,中断并回滚事务 + throw e; } catch (Exception e) { log.error("删除医嘱失败,requestId: {}, adviceType: {}", requestId, adviceType, e); // 继续处理其他记录,不中断整个流程 diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml index 66e9f1c2d..be50dffd7 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml @@ -211,7 +211,7 @@ NULL::numeric AS unit_price, NULL::numeric AS total_price, NULL::bigint AS stopper_id, - NULL::varchar AS stopper_name + CASE WHEN T1.status_enum IN (6, 13) THEN T1.update_by ELSE NULL END AS stopper_name FROM med_medication_request AS T1 LEFT JOIN med_medication_definition AS T2 ON T2.id = T1.medication_id @@ -331,7 +331,7 @@ T1.unit_code AS unit_code, T1.status_enum AS request_status, NULL::varchar AS method_code, - NULL::varchar AS rate_code, + T1.rate_code AS rate_code, NULL::numeric AS dose, NULL::varchar AS dose_unit_code, ao1.id AS position_id, @@ -359,7 +359,7 @@ NULL::numeric AS unit_price, NULL::numeric AS total_price, NULL::bigint AS stopper_id, - NULL::varchar AS stopper_name + CASE WHEN T1.status_enum IN (6, 13) THEN T1.update_by ELSE NULL END AS stopper_name FROM wor_service_request AS T1 LEFT JOIN wor_activity_definition AS T2 ON T2.id = T1.activity_id @@ -496,7 +496,7 @@ NULL::numeric AS unit_price, NULL::numeric AS total_price, NULL::bigint AS stopper_id, - NULL::varchar AS stopper_name + CASE WHEN T1.status_enum IN (6, 13) THEN T1.update_by ELSE NULL END AS stopper_name FROM wor_device_request AS T1 LEFT JOIN adm_device_definition AS T2 ON T2.id = T1.device_def_id diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/MedicineSummaryAppMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/MedicineSummaryAppMapper.xml index 7e0749e01..466e5859d 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/MedicineSummaryAppMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/MedicineSummaryAppMapper.xml @@ -36,7 +36,7 @@ - + diff --git a/healthlink-his-ui/src/components/TableLayout/Table.vue b/healthlink-his-ui/src/components/TableLayout/Table.vue index e8e906951..d2666837d 100755 --- a/healthlink-his-ui/src/components/TableLayout/Table.vue +++ b/healthlink-his-ui/src/components/TableLayout/Table.vue @@ -1,4 +1,4 @@ -