From ae12cb2135e724b80af26d931b2e2658029abcbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BD=97?= Date: Thu, 11 Jun 2026 09:26:51 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix(#735):=20=E5=81=9C=E5=98=B1=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E5=AD=97=E6=AE=B5=E4=BF=AE=E5=A4=8D=EF=BC=88=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=20PatientManageMapper=20=E5=86=B2=E7=AA=81=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/regdoctorstation/AdviceManageAppMapper.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml index f1df52205..35bfef5b5 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml @@ -222,8 +222,8 @@ T1.based_on_id AS based_on_id, T1.medication_id AS advice_definition_id, T1.content_json::jsonb ->> 'remark' AS remark, - T1.effective_dose_end AS stop_time, - T1.update_by AS stop_user_name + CASE WHEN T1.status_enum = 6 THEN T1.effective_dose_end ELSE NULL END AS stop_time, + CASE WHEN T1.status_enum = 6 THEN T1.update_by ELSE NULL END AS stop_user_name FROM med_medication_request AS T1 LEFT JOIN adm_practitioner AS ap ON ap.id = T1.practitioner_id AND ap.delete_flag = '0' LEFT JOIN med_medication_definition AS T2 ON T2.ID = T1.medication_id @@ -339,8 +339,8 @@ T1.based_on_id AS based_on_id, T1.activity_id AS advice_definition_id, T1.remark AS remark, - T1.occurrence_end_time AS stop_time, - T1.update_by AS stop_user_name + CASE WHEN T1.status_enum = 6 THEN T1.occurrence_end_time ELSE NULL END AS stop_time, + CASE WHEN T1.status_enum = 6 THEN T1.update_by ELSE NULL END AS stop_user_name FROM wor_service_request AS T1 LEFT JOIN adm_practitioner AS ap ON ap.id = T1.requester_id AND ap.delete_flag = '0' LEFT JOIN wor_activity_definition AS T2 From ca812421d243a9a3104bc80d18a42588eb49cf10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BD=97?= Date: Thu, 11 Jun 2026 02:56:45 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(#665):=20=E8=AF=B7=E4=BF=AE=E5=A4=8D=20?= =?UTF-8?q?Bug=20#665?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由 AI Agent (guanyu) 自动修复,请查看 diff 确认变更内容。 --- .../appservice/impl/TicketAppServiceImpl.java | 2 +- .../OutpatientRegistrationAppServiceImpl.java | 21 +++++++++---------- .../OutpatientRegistrationAppMapper.java | 5 ++++- .../impl/AdviceProcessAppServiceImpl.java | 13 ++++++++++++ .../OutpatientRegistrationAppMapper.xml | 5 +++++ .../domain/TicketSlotDTO.java | 1 + .../administration/ScheduleSlotMapper.xml | 2 ++ .../src/views/charge/cliniccharge/index.vue | 5 +++-- .../charge/outpatientregistration/index.vue | 12 ++++++++++- .../components/prescriptionList.vue | 15 ++++++------- 10 files changed, 56 insertions(+), 25 deletions(-) diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/appointmentmanage/appservice/impl/TicketAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/appointmentmanage/appservice/impl/TicketAppServiceImpl.java index 21d6421b2..6c0e861ae 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/appointmentmanage/appservice/impl/TicketAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/appointmentmanage/appservice/impl/TicketAppServiceImpl.java @@ -153,7 +153,7 @@ public class TicketAppServiceImpl implements ITicketAppService { dto.setIdCard(raw.getIdCard()); dto.setDoctorId(raw.getDoctorId()); dto.setDepartmentId(raw.getDepartmentId()); - dto.setRealPatientId(raw.getPatientId()); + dto.setRealPatientId(raw.getRealPatientId() != null ? raw.getRealPatientId() : raw.getPatientId()); dto.setOrderId(raw.getOrderId()); dto.setOrderNo(raw.getOrderNo()); diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java index 4e514c699..a5b05ae76 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java @@ -515,29 +515,28 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra // 构建查询条件 QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey, new HashSet<>(Arrays.asList("patient_name", "organization_name", "practitioner_name", "healthcare_name", "identifier_no")), - request); + null); // registerTimeSTime/ETime 已下推到 SQL 内层 WHERE,跳过 buildQueryWrapper 的自动 *STime/*ETime 处理 - // 手动处理 statusEnum 参数(用于过滤退号记录) + // 提取statusEnum参数,下推到内层WHERE(避免外层重复过滤) + Integer statusFilter = null; String statusEnumParam = request.getParameter("statusEnum"); if (statusEnumParam != null && !statusEnumParam.isEmpty()) { try { - Integer statusEnum = Integer.parseInt(statusEnumParam); - if (statusEnum == -1) { - // -1 表示排除退号记录(正常挂号) - queryWrapper.ne("status_enum", 6); - } else { - // 其他值表示精确匹配 - queryWrapper.eq("status_enum", statusEnum); - } + statusFilter = Integer.parseInt(statusEnumParam); } catch (NumberFormatException e) { // 忽略无效的参数值 } } + // 提取日期范围参数,下推到内层WHERE以优化性能(避免全表JOIN后再过滤) + String registerTimeSTime = request.getParameter("registerTimeSTime"); + String registerTimeETime = request.getParameter("registerTimeETime"); + IPage currentDayEncounter = outpatientRegistrationAppMapper.getCurrentDayEncounter( new Page<>(pageNo, pageSize), EncounterClass.AMB.getValue(), EncounterStatus.IN_PROGRESS.getValue(), ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode(), queryWrapper, - ChargeItemContext.REGISTER.getValue(), PaymentStatus.SUCCESS.getValue()); + ChargeItemContext.REGISTER.getValue(), PaymentStatus.SUCCESS.getValue(), + registerTimeSTime, registerTimeETime, statusFilter); // 过滤候选池排除列表 // 仅当调用方显式传 excludeFromCandidatePool=true 时才过滤,避免非分诊场景(挂号/收费) diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientRegistrationAppMapper.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientRegistrationAppMapper.java index bae16d09c..b364f58aa 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientRegistrationAppMapper.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/chargemanage/mapper/OutpatientRegistrationAppMapper.java @@ -54,7 +54,10 @@ public interface OutpatientRegistrationAppMapper { @Param("classEnum") Integer classEnum, @Param("statusEnum") Integer statusEnum, @Param("participantType1") String participantType1, @Param("participantType2") String participantType2, @Param(Constants.WRAPPER) QueryWrapper queryWrapper, - @Param("register") Integer register, @Param("paymentStatus") Integer paymentStatus); + @Param("register") Integer register, @Param("paymentStatus") Integer paymentStatus, + @Param("registerTimeSTime") String registerTimeSTime, + @Param("registerTimeETime") String registerTimeETime, + @Param("statusFilter") Integer statusFilter); /** * 查询item绑定的信息(耗材或诊疗) 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 adeea9d03..611c04fdc 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 @@ -192,6 +192,9 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { // 提取requestStatus手动处理,支持COMPLETED(3)和CHECK_VERIFIED(10)同时查询 Integer requestStatus = inpatientAdviceParam.getRequestStatus(); inpatientAdviceParam.setRequestStatus(null); + // Bug #714: 提取deadline手动处理,UNION子查询列名为end_time + String deadline = inpatientAdviceParam.getDeadline(); + inpatientAdviceParam.setDeadline(null); // 构建查询条件 QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null); @@ -223,6 +226,16 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { if (therapyEnum != null) { queryWrapper.and(w -> w.eq("therapy_enum", therapyEnum).or().isNull("therapy_enum")); } + // Bug #714: 手动拼接deadline条件,按医嘱截止时间筛选 + if (deadline != null && !deadline.isEmpty()) { + try { + LocalDateTime deadlineTime = LocalDateTime.parse(deadline, + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + queryWrapper.le("end_time", deadlineTime); + } catch (DateTimeParseException e) { + // 忽略无效的日期格式 + } + } // 患者医嘱分页列表 Page inpatientAdvicePage = adviceProcessAppMapper.selectInpatientAdvicePage(new Page<>(pageNo, pageSize), queryWrapper, diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml index 3f0642c6c..441bba15e 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml @@ -217,6 +217,11 @@ WHERE T1.delete_flag = '0' AND T1.class_enum = #{classEnum} AND T10.context_enum = #{register} + AND (#{registerTimeSTime} IS NULL OR T1.create_time >= CAST(#{registerTimeSTime} AS TIMESTAMP)) + AND (#{registerTimeETime} IS NULL OR T1.create_time <= CAST(#{registerTimeETime} AS TIMESTAMP)) + AND (#{statusFilter} IS NULL + OR (#{statusFilter} >= 0 AND T1.status_enum = #{statusFilter}) + OR (#{statusFilter} = -1 AND T1.status_enum != 6)) ) AS T9 ${ew.customSqlSegment} ORDER BY T9.register_time DESC diff --git a/healthlink-his-server/healthlink-his-domain/src/main/java/com/healthlink/his/appointmentmanage/domain/TicketSlotDTO.java b/healthlink-his-server/healthlink-his-domain/src/main/java/com/healthlink/his/appointmentmanage/domain/TicketSlotDTO.java index 9a7f859cc..23ea73e6d 100755 --- a/healthlink-his-server/healthlink-his-domain/src/main/java/com/healthlink/his/appointmentmanage/domain/TicketSlotDTO.java +++ b/healthlink-his-server/healthlink-his-domain/src/main/java/com/healthlink/his/appointmentmanage/domain/TicketSlotDTO.java @@ -21,6 +21,7 @@ public class TicketSlotDTO { private String patientName; private String medicalCard; private Long patientId; + private Long realPatientId; private String phone; private Integer orderStatus; private Long orderId; diff --git a/healthlink-his-server/healthlink-his-domain/src/main/resources/mapper/administration/ScheduleSlotMapper.xml b/healthlink-his-server/healthlink-his-domain/src/main/resources/mapper/administration/ScheduleSlotMapper.xml index 393207c15..21a1fefb4 100755 --- a/healthlink-his-server/healthlink-his-domain/src/main/resources/mapper/administration/ScheduleSlotMapper.xml +++ b/healthlink-his-server/healthlink-his-domain/src/main/resources/mapper/administration/ScheduleSlotMapper.xml @@ -111,6 +111,7 @@ o.order_no AS orderNo, COALESCE(CAST(o.gender AS VARCHAR), CAST(pinfo.gender_enum AS VARCHAR)) AS patientGender, pinfo.gender_enum AS genderEnum, + pinfo.id AS realPatientId, pinfo.id_card AS idCard, o.appointment_time AS appointmentTime, AS orderStatus, @@ -230,6 +231,7 @@ o.order_no AS orderNo, COALESCE(CAST(o.gender AS VARCHAR), CAST(pinfo.gender_enum AS VARCHAR)) AS patientGender, pinfo.gender_enum AS genderEnum, + pinfo.id AS realPatientId, pinfo.id_card AS idCard, o.appointment_time AS appointmentTime, AS orderStatus, diff --git a/healthlink-his-ui/src/views/charge/cliniccharge/index.vue b/healthlink-his-ui/src/views/charge/cliniccharge/index.vue index b7391a383..d5d7c2f9d 100755 --- a/healthlink-his-ui/src/views/charge/cliniccharge/index.vue +++ b/healthlink-his-ui/src/views/charge/cliniccharge/index.vue @@ -61,7 +61,7 @@ ref="patientListRef" height="620" :data="patientList" - :row-config="{ keyField: 'encounterId', keyField: 'id' }" + :row-config="{ keyField: 'encounterId' }" @cell-click="clickRow" > - + 全部 @@ -26,15 +26,13 @@ 临时 - 截止时间: { From f75133369aeed7ae6816b57cb3f81c3eae4a0a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BD=97?= Date: Thu, 11 Jun 2026 00:40:16 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix(#697):=20=E8=AF=B7=E4=BF=AE=E5=A4=8D=20?= =?UTF-8?q?Bug=20#697?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由 AI Agent (guanyu) 自动修复,请查看 diff 确认变更内容。 --- ...orStationChineseMedicalAppServiceImpl.java | 34 +++++++++---------- ...V41__bug735_add_stopper_id_to_requests.sql | 9 +++++ .../charge/outpatientregistration/index.vue | 5 +-- 3 files changed, 28 insertions(+), 20 deletions(-) create mode 100644 healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V41__bug735_add_stopper_id_to_requests.sql diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationChineseMedicalAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationChineseMedicalAppServiceImpl.java index 30e69da75..aec78d7cc 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationChineseMedicalAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationChineseMedicalAppServiceImpl.java @@ -451,10 +451,12 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation // 删除费用项 iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.MED_MEDICATION_REQUEST, adviceSaveDto.getRequestId()); - // 删除代煎费 - iChargeItemService.remove(new LambdaQueryWrapper() - .eq(ChargeItem::getPrescriptionNo, adviceSaveDto.getPrescriptionNo()) - .eq(ChargeItem::getProductId, sufferingDefinitionId)); + // 删除代煎费(按处方号精确清理) + if (adviceSaveDto.getPrescriptionNo() != null) { + iChargeItemService.remove(new LambdaQueryWrapper() + .eq(ChargeItem::getPrescriptionNo, adviceSaveDto.getPrescriptionNo()) + .eq(ChargeItem::getProductId, sufferingDefinitionId)); + } } @@ -614,7 +616,7 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation Long encounterDiagnosisId = medicineList.get(0).getEncounterDiagnosisId(); // 中药付数 BigDecimal chineseHerbsDoseQuantity = medicineList.get(0).getChineseHerbsDoseQuantity(); - // 🔧 Bug Fix #668: 收集所有处方号(不同分组可能有不同处方号) + // 收集所有处方号(不同分组可能有不同处方号) List prescriptionNos = insertOrUpdateList.stream() .map(AdviceSaveDto::getPrescriptionNo) .filter(Objects::nonNull) @@ -628,12 +630,10 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation AdviceBaseDto adviceBaseDto = new AdviceBaseDto(); adviceBaseDto.setAdviceDefinitionId(sufferingDefinitionId); // 医嘱定义id - // 🔧 Bug Fix #668: 先删除所有处方号关联的中药代煎账单 - if (!prescriptionNos.isEmpty()) { - iChargeItemService.remove(new LambdaQueryWrapper() - .in(ChargeItem::getPrescriptionNo, prescriptionNos) - .eq(ChargeItem::getProductId, sufferingDefinitionId)); - } + // 先删除该就诊关联的所有中药代煎账单 + iChargeItemService.remove(new LambdaQueryWrapper() + .eq(ChargeItem::getEncounterId, encounterId) + .eq(ChargeItem::getProductId, sufferingDefinitionId)); // 对应的诊疗医嘱信息 AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, @@ -642,7 +642,7 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation // 费用定价 AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0); if (advicePriceDto != null) { - // 🔧 Bug Fix #668: 为每个处方号分别生成代煎账单 + // 为每个处方号分别生成代煎账单 for (String prescriptionNo : prescriptionNos) { chargeItem = new ChargeItem(); chargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源 @@ -674,12 +674,10 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation } } } else if (Whether.NO.getValue().equals(sufferingFlag)) { - // 🔧 Bug Fix #668: 删除所有处方号关联的中药代煎账单 - if (!prescriptionNos.isEmpty()) { - iChargeItemService.remove(new LambdaQueryWrapper() - .in(ChargeItem::getPrescriptionNo, prescriptionNos) - .eq(ChargeItem::getProductId, sufferingDefinitionId)); - } + // 删除该就诊关联的所有中药代煎账单 + iChargeItemService.remove(new LambdaQueryWrapper() + .eq(ChargeItem::getEncounterId, encounterId) + .eq(ChargeItem::getProductId, sufferingDefinitionId)); } // 签发时,把草稿状态的账单更新为待收费[中医] diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V41__bug735_add_stopper_id_to_requests.sql b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V41__bug735_add_stopper_id_to_requests.sql new file mode 100644 index 000000000..da7e0dd0f --- /dev/null +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V41__bug735_add_stopper_id_to_requests.sql @@ -0,0 +1,9 @@ +-- Bug #735: 新医嘱签发后"停嘱医生"字段错误生成数据 +-- 原因:stopper_name 映射到 update_by 字段,签发时 MyBatis-Plus 自动填充导致错误赋值 +-- 修复:添加专用 stopper_id 字段,仅在停嘱操作时设置 + +-- 药品请求表添加停嘱医生ID字段 +ALTER TABLE med_medication_request ADD COLUMN IF NOT EXISTS stopper_id BIGINT; + +-- 服务请求表添加停嘱医生ID字段 +ALTER TABLE wor_service_request ADD COLUMN IF NOT EXISTS stopper_id BIGINT; diff --git a/healthlink-his-ui/src/views/charge/outpatientregistration/index.vue b/healthlink-his-ui/src/views/charge/outpatientregistration/index.vue index dad4080c7..4510c642f 100755 --- a/healthlink-his-ui/src/views/charge/outpatientregistration/index.vue +++ b/healthlink-his-ui/src/views/charge/outpatientregistration/index.vue @@ -1,4 +1,4 @@ -