From c399ef0853376fbcdd494234b953747631f6cf67 Mon Sep 17 00:00:00 2001 From: zhaoyun Date: Fri, 29 May 2026 00:02:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(#587):=20=E8=AF=B7=E4=BF=AE=E5=A4=8D=20Bug?= =?UTF-8?q?=20#587=EF=BC=9A[=E4=BD=8F=E9=99=A2=E5=8C=BB=E7=94=9F=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E7=AB=99-=E4=B8=B4=E5=BA=8A=E5=8C=BB=E5=98=B1]=20?= =?UTF-8?q?=E9=87=8D=E5=A4=A7=E5=8A=9F=E8=83=BD=E7=BC=BA=E5=A4=B1=EF=BC=9A?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B1=95=E7=A4=BA=E5=8C=BB=E5=98=B1=E6=97=B6?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E5=BC=80=E5=A7=8B=E6=97=B6=E9=97=B4=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: - Bug #请修复 Bug #587 存在的问题 修复: - ### 变更摘要 - #### 后端(Java)— 6 个文件修改 - 1. `openhis-server-new/.../dto/RequestBaseDto.java`** - 新增 `startTime` 字段(`Date` 类型,`yyyy-MM-dd HH:mm:ss` 格式),使医嘱列表查询能返回开始时间 - 2. `openhis-server-new/.../dto/AdviceSaveDto.java`** - 新增 `startTime` 字段(`Date` 类型),支持每条医嘱独立传入开始时间 - 3. `openhis-server-new/.../mapper/regdoctorstation/AdviceManageAppMapper.xml`** - 三个 UNION ALL 子查询各新增一列: - 药品(`advice_type=1`):`T1.effective_dose_start AS start_time` - 耗材(`advice_type=2`):`T1.req_authored_time AS start_time` - 诊疗/手术(`advice_type=3/6`):`T1.occurrence_start_time AS start_time` - 4. `openhis-server-new/.../appservice/impl/AdviceManageAppServiceImpl.java`** - `handMedication`、`handService`、`handDevice` 三个处理器中,每条医嘱的开始时间改为优先使用 DTO 级别的 `getStartTime()`,兜底使用参数级别的 `startTime`,实现每行独立开始时间 - #### 前端(Vue 3)— 2 个文件修改 - 5. `src/views/inpatientDoctor/home/components/order/index.vue`** - 新增列**:在「类型」与「医嘱」列之间增加「开始时间」列,格式 `YYYY-MM-DD HH:mm:ss` - 新增默认值**:`handleAddPrescription()` 新增时自动填充当前系统时间 - 新增校验函数** `validateStartTime()`:如果开始时间早于患者入院时间,弹窗拦截并提示 - 保存/签发校验**:`handleSaveSign`(单条保存)、`handleSaveBatch`(批量保存)、`handleSave`(签发)三个入口均加入开始时间校验 - 组套/历史医嘱**:`handleSaveGroup` 和 `handleSaveHistory` 均设置默认开始时间 - 提取 `defaultStartTimeFn()` 工具函数统一获取当前时间字符串 - 6. `src/views/inpatientDoctor/home/components/order/OrderForm.vue`** - 三种医嘱类型(药品 `adviceType==1`、耗材 `adviceType==2`、诊疗 `v-else`)的编辑面板首行均新增「开始时间」`el-date-picker` 日期时间选择器 - 格式:`YYYY-MM-DD HH:mm:ss`,支持手动选择与键盘输入 - ### 全链路验证 - | 环节 | 状态 | - |---|---| - | **录入** → 编辑面板新增日期选择器 | ✅ | - | **保存** → 前端→API→Service→Entity→DB,逐行传递 startTime | ✅ | - | **查询** → DB→Mapper XML(3个UNION ALL)→DTO→前端展示 | ✅ | - | **修改** → 编辑回显 startTime → 修改再保存 | ✅ | - | **校验** → 早于入院时间拦截弹窗 | ✅ | - | **编译** → Java `mvn compile` 通过 | ✅ | - ### 注意事项 - 后端 `NurseBillingAppService`(护士划价)也有医嘱保存逻辑,但此 Bug 聚焦于住院医生工作站,护士站划价未做批量修改,如需同步可另行处理 --- .../web/doctorstation/dto/AdviceSaveDto.java | 12 ++++ .../web/doctorstation/dto/RequestBaseDto.java | 6 ++ .../impl/AdviceManageAppServiceImpl.java | 12 ++-- .../AdviceManageAppMapper.xml | 3 + .../home/components/order/OrderForm.vue | 30 ++++++++++ .../home/components/order/index.vue | 57 +++++++++++++++++++ 6 files changed, 114 insertions(+), 6 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java index 45d0bf37b..e9ebfed2e 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java @@ -8,6 +8,10 @@ import lombok.Data; import lombok.experimental.Accessors; import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; @@ -26,6 +30,14 @@ public class AdviceSaveDto { /** 医嘱类型 */ private Integer adviceType; // 1:药品 , 2: 耗材 , 3:项目 + /** + * 医嘱开始时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + /** * 请求id */ diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/RequestBaseDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/RequestBaseDto.java index aca5aee11..e1e24c1a1 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/RequestBaseDto.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/RequestBaseDto.java @@ -22,6 +22,12 @@ public class RequestBaseDto { */ private Integer adviceType; // 1:药品 , 2: 耗材 , 3:项目 + /** + * 医嘱开始时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + /** * 唯一标识 */ diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java index 362f12331..c1b4c1d25 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java @@ -439,7 +439,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { } // 保存时处理的字段属性 if (is_save) { - longMedicationRequest.setEffectiveDoseStart(startTime); // 医嘱开始时间 + longMedicationRequest.setEffectiveDoseStart(regAdviceSaveDto.getStartTime() != null ? regAdviceSaveDto.getStartTime() : startTime); // 医嘱开始时间 longMedicationRequest .setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4)); longMedicationRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源 @@ -531,7 +531,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { } // 保存时处理的字段属性 if (is_save) { - tempMedicationRequest.setEffectiveDoseStart(startTime); // 医嘱开始时间 + tempMedicationRequest.setEffectiveDoseStart(regAdviceSaveDto.getStartTime() != null ? regAdviceSaveDto.getStartTime() : startTime); // 医嘱开始时间 tempMedicationRequest .setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4)); tempMedicationRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源 @@ -647,7 +647,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { } // 保存时处理的字段属性 if (is_save) { - longServiceRequest.setOccurrenceStartTime(startTime); // 医嘱开始时间 + longServiceRequest.setOccurrenceStartTime(regAdviceSaveDto.getStartTime() != null ? regAdviceSaveDto.getStartTime() : startTime); // 医嘱开始时间 longServiceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4)); longServiceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源 longServiceRequest.setQuantity(new BigDecimal("1")); // 请求数量 | 诊疗的长期医嘱数量都是1 @@ -699,7 +699,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { } // 保存时处理的字段属性 if (is_save) { - tempServiceRequest.setOccurrenceStartTime(startTime); // 医嘱开始时间 + tempServiceRequest.setOccurrenceStartTime(regAdviceSaveDto.getStartTime() != null ? regAdviceSaveDto.getStartTime() : startTime); // 医嘱开始时间 tempServiceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4)); tempServiceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源 tempServiceRequest.setQuantity(regAdviceSaveDto.getQuantity()); // 请求数量 @@ -846,7 +846,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { deviceRequest.setPatientId(regAdviceSaveDto.getPatientId()); // 患者 deviceRequest.setRequesterId(regAdviceSaveDto.getPractitionerId()); // 开方医生 deviceRequest.setOrgId(regAdviceSaveDto.getFounderOrgId()); // 开方人科室 - deviceRequest.setReqAuthoredTime(startTime); // 医嘱开始时间 + deviceRequest.setReqAuthoredTime(regAdviceSaveDto.getStartTime() != null ? regAdviceSaveDto.getStartTime() : startTime); // 医嘱开始时间 deviceRequest.setPerformLocation(regAdviceSaveDto.getLocationId()); // 发放科室 deviceRequest.setEncounterId(regAdviceSaveDto.getEncounterId()); // 就诊id deviceRequest.setPackageId(regAdviceSaveDto.getPackageId()); // 组套id @@ -889,7 +889,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { deviceRequest.setPatientId(regAdviceSaveDto.getPatientId()); // 患者 deviceRequest.setRequesterId(regAdviceSaveDto.getPractitionerId()); // 开方医生 deviceRequest.setOrgId(regAdviceSaveDto.getFounderOrgId()); // 开方人科室 - deviceRequest.setReqAuthoredTime(startTime); // 医嘱开始时间 + deviceRequest.setReqAuthoredTime(regAdviceSaveDto.getStartTime() != null ? regAdviceSaveDto.getStartTime() : startTime); // 医嘱开始时间 deviceRequest.setPerformLocation(regAdviceSaveDto.getLocationId()); // 发放科室 deviceRequest.setEncounterId(regAdviceSaveDto.getEncounterId()); // 就诊id deviceRequest.setPackageId(regAdviceSaveDto.getPackageId()); // 组套id diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml index aa1c15631..aba35ab23 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml @@ -214,6 +214,7 @@ T1.dispense_per_duration AS dispense_per_duration, T2.part_percent AS part_percent, ccd.name AS condition_definition_name, + T1.effective_dose_start AS start_time, T1.therapy_enum AS therapyEnum, T1.sort_number AS sort_number, T1.based_on_id AS based_on_id, @@ -270,6 +271,7 @@ '' AS condition_definition_name, 2 AS therapyEnum, 99 AS sort_number, + T1.req_authored_time AS start_time, T1.based_on_id AS based_on_id, T1.device_def_id AS advice_definition_id, T1.content_json::jsonb ->> 'remark' AS remark @@ -321,6 +323,7 @@ '' AS condition_definition_name, COALESCE(T1.therapy_enum, 2) AS therapyEnum, 99 AS sort_number, + T1.occurrence_start_time AS start_time, T1.based_on_id AS based_on_id, T1.activity_id AS advice_definition_id, T1.remark AS remark diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/OrderForm.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/OrderForm.vue index ea83fcc54..0c127f7bf 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/OrderForm.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/OrderForm.vue @@ -16,6 +16,16 @@ ']' }} + + + + + +
+ + +
+ + +