From 0d6f891b47ad9f45f5981d6e3afa7893f6bf23bd Mon Sep 17 00:00:00 2001 From: yangkexiang <1677036288@qq.com> Date: Thu, 14 May 2026 11:48:22 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug434:=E9=97=A8=E8=AF=8A=E6=89=8B?= =?UTF-8?q?=E6=9C=AF=E5=AE=89=E6=8E=92=EF=BC=9A=E7=BC=96=E8=BE=91=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E4=B8=AD=E2=80=9C=E5=88=87=E5=8F=A3=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E2=80=9D=E5=AD=97=E6=AE=B5=E6=9C=AA=E6=AD=A3=E7=A1=AE=E5=9B=9E?= =?UTF-8?q?=E6=98=BE=E6=95=B0=E6=8D=AE=20bug426:=E9=97=A8=E8=AF=8A?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E7=AB=99-=E6=A3=80=E6=9F=A5=E5=BC=80?= =?UTF-8?q?=E7=AB=8B=EF=BC=9A=E5=B7=B2=E9=80=89=E6=8B=A9=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=BA=94=E6=94=AF=E6=8C=81=E6=A0=91=E5=BD=A2=E5=B1=95=E5=BC=80?= =?UTF-8?q?=EF=BC=8C=E6=98=BE=E7=A4=BA=E5=A5=97=E9=A4=90=E6=98=8E=E7=BB=86?= =?UTF-8?q?=20bug439:=E9=A2=86=E7=94=A8=E5=87=BA=E5=BA=93=EF=BC=9A?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E9=A2=86=E7=94=A8=E8=8D=AF=E5=93=81=E5=90=8E?= =?UTF-8?q?=E2=80=9C=E6=80=BB=E5=BA=93=E5=AD=98=E6=95=B0=E9=87=8F=E2=80=9D?= =?UTF-8?q?=E5=88=97=E6=95=B0=E6=8D=AE=E6=9C=AA=E6=98=BE=E7=A4=BA=20bug457?= =?UTF-8?q?:=E9=97=A8=E8=AF=8A=E6=94=B6=E8=B4=B9=EF=BC=9A=E5=B7=B2?= =?UTF-8?q?=E7=AD=BE=E5=8F=91=E7=9A=84=E6=89=8B=E6=9C=AF=E7=B1=BB=E5=8C=BB?= =?UTF-8?q?=E5=98=B1=E5=9C=A8=E9=97=A8=E8=AF=8A=E6=94=B6=E8=B4=B9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=AD=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SurgicalScheduleAppServiceImpl.java | 28 +- .../dto/OpCreateScheduleDto.java | 6 +- .../web/clinicalmanage/dto/OpScheduleDto.java | 11 +- .../DoctorStationAdviceAppServiceImpl.java | 60 +++ .../controller/NursingRecordController.java | 1 + .../OutpatientChargeAppMapper.xml | 22 + .../SurgicalScheduleAppMapper.xml | 6 +- .../examination/examinationApplication.vue | 467 ++++++++++++------ .../prescription/prescriptionlist.vue | 46 +- .../src/views/doctorstation/index.vue | 6 +- .../requisitionManagement/components/list.vue | 15 +- .../requisitionManagement/index.vue | 259 +++++++--- .../src/views/surgicalschedule/index.vue | 9 +- 13 files changed, 689 insertions(+), 247 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/appservice/impl/SurgicalScheduleAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/appservice/impl/SurgicalScheduleAppServiceImpl.java index b96d2c076..abdf1e1b1 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/appservice/impl/SurgicalScheduleAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/appservice/impl/SurgicalScheduleAppServiceImpl.java @@ -7,7 +7,6 @@ import com.core.common.core.domain.R; import com.core.common.core.domain.model.LoginUser; import com.core.common.utils.SecurityUtils; import com.openhis.administration.domain.Patient; -import com.openhis.administration.service.IOrganizationService; import com.openhis.administration.service.IPatientService; import com.openhis.clinical.domain.Surgery; import com.openhis.clinical.service.ISurgeryService; @@ -28,7 +27,6 @@ import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.net.URLEncoder; -import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Date; import java.util.List; @@ -204,6 +202,8 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi return R.fail("新增手术安排失败"); } + syncSurgeryIncisionLevel(opSchedule.getOperCode(), opCreateScheduleDto.getIncisionLevel()); + // Bug #247 修复:更新手术申请单状态为已排期 (1) if (opCreateScheduleDto.getApplyId() != null) { try { @@ -300,6 +300,8 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi return R.fail("修改手术安排失败"); } + syncSurgeryIncisionLevel(opScheduleDto.getOperCode(), opScheduleDto.getIncisionLevel()); + return R.ok("修改手术安排成功"); } @@ -433,6 +435,28 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi return scheduleDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); } + /** + * 同步手术申请表中的切口类型 + */ + private void syncSurgeryIncisionLevel(String surgeryNo, Integer incisionLevel) { + if (surgeryNo == null || surgeryNo.isEmpty() || incisionLevel == null) { + return; + } + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(Surgery::getSurgeryNo, surgeryNo) + .eq(Surgery::getDeleteFlag, "0"); + Surgery surgery = surgeryService.getOne(queryWrapper); + if (surgery == null) { + log.warn("未找到需要同步切口类型的手术申请记录 - surgeryNo: {}", surgeryNo); + return; + } + + surgery.setIncisionLevel(incisionLevel); + surgery.setUpdateTime(new Date()); + surgeryService.updateById(surgery); + } + /** * 填充手术申请中缺失的名称字段 * 在创建手术安排时调用,确保关联的cli_surgery表中的名称字段有值 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpCreateScheduleDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpCreateScheduleDto.java index c23d0217f..05554875e 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpCreateScheduleDto.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpCreateScheduleDto.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.math.BigDecimal; -import java.time.LocalDate; import java.time.LocalDateTime; @Data @@ -85,6 +84,11 @@ public class OpCreateScheduleDto { */ private String surgerySite; + /** + * 切口类型 + */ + private Integer incisionLevel; + /** * 入院时间 */ diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpScheduleDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpScheduleDto.java index 5e5c22744..622a68acb 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpScheduleDto.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpScheduleDto.java @@ -93,6 +93,12 @@ public class OpScheduleDto extends OpSchedule { * 手术类型 */ private String surgeryType; + + /** + * 切口类型 + */ + private Integer incisionLevel; + /** * 申请科室 */ @@ -106,9 +112,4 @@ public class OpScheduleDto extends OpSchedule { * 创建人名称 */ private String createByName; - - /** - * 费用类别 - */ - private String feeType; } 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 f50c30307..912be3f73 100755 --- 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 @@ -35,6 +35,7 @@ import com.openhis.medication.service.IMedicationDispenseService; import com.openhis.medication.service.IMedicationRequestService; import com.openhis.web.chargemanage.mapper.OutpatientRegistrationAppMapper; import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService; +import com.openhis.web.doctorstation.appservice.IDoctorStationInspectionLabApplyService; import com.openhis.web.doctorstation.dto.*; import com.openhis.web.doctorstation.mapper.DoctorStationAdviceAppMapper; import com.openhis.web.doctorstation.utils.AdviceUtils; @@ -47,12 +48,15 @@ import com.openhis.workflow.domain.InventoryItem; import com.openhis.workflow.domain.ServiceRequest; import com.openhis.workflow.service.*; import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; /** @@ -62,6 +66,9 @@ import java.util.stream.Collectors; @Service public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAppService { + private static final Pattern INSPECTION_APPLY_NO_JSON = + Pattern.compile("\"applyNo\"\\s*:\\s*\"([^\"]+)\""); + @Resource AssignSeqUtil assignSeqUtil; @@ -118,6 +125,13 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp @Resource IInventoryItemService inventoryItemService; + /** + * 与检验申请实现存在循环依赖,需延迟注入;删除诊疗医嘱时按 contentJson 级联作废检验申请单。 + */ + @Resource + @Lazy + private IDoctorStationInspectionLabApplyService iDoctorStationInspectionLabApplyService; + // 缓存 key 前缀 private static final String ADVICE_BASE_INFO_CACHE_PREFIX = "advice:base:info:"; // 缓存过期时间(小时) @@ -1695,6 +1709,21 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp } } + /** + * 从诊疗医嘱 contentJson 中解析检验申请单号(检验保存时写入形如 {"applyNo":"..."})。 + */ + private String extractInspectionApplyNoFromContentJson(String contentJson) { + if (StringUtils.isBlank(contentJson) || !contentJson.contains("applyNo")) { + return null; + } + Matcher m = INSPECTION_APPLY_NO_JSON.matcher(contentJson); + if (!m.find()) { + return null; + } + String applyNo = m.group(1).trim(); + return StringUtils.isBlank(applyNo) ? null : applyNo; + } + /** * 处理诊疗 */ @@ -1743,6 +1772,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp } } } + // 检验申请单在医嘱 contentJson 中写入 applyNo;从医嘱删除时需先级联作废检验单,避免检验页签仍显示孤儿申请 + Map> labApplyNoToRequestIds = new LinkedHashMap<>(); for (AdviceSaveDto adviceSaveDto : deleteList) { Long requestId = adviceSaveDto.getRequestId(); // 🔧 Bug #442: 跳过 requestId 为 null 的记录,避免删除不存在的诊疗请求 @@ -1751,6 +1782,35 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp continue; } iServiceRequestService.removeById(requestId);// 删除诊疗 + ServiceRequest existing = iServiceRequestService.getById(adviceSaveDto.getRequestId()); + if (existing == null) { + continue; + } + String applyNo = extractInspectionApplyNoFromContentJson(existing.getContentJson()); + if (StringUtils.isNotBlank(applyNo)) { + labApplyNoToRequestIds.computeIfAbsent(applyNo, k -> new ArrayList<>()) + .add(adviceSaveDto.getRequestId()); + } + } + Set labCascadeSkippedRequestIds = new HashSet<>(); + for (Map.Entry> e : labApplyNoToRequestIds.entrySet()) { + R delLab = iDoctorStationInspectionLabApplyService.deleteInspectionLabApply(e.getKey()); + if (delLab != null && R.isSuccess(delLab)) { + labCascadeSkippedRequestIds.addAll(e.getValue()); + log.info("handService - 级联作废检验申请单 applyNo={},已跳过重复删除的医嘱 requestIds={}", + e.getKey(), e.getValue()); + } else { + String msg = delLab != null && StringUtils.isNotEmpty(delLab.getMsg()) ? delLab.getMsg() : "删除检验申请单失败"; + log.warn("handService - 级联作废检验申请单未成功 applyNo={} msg={},将回退为仅删除当前医嘱记录", + e.getKey(), msg); + } + } + for (AdviceSaveDto adviceSaveDto : deleteList) { + if (labCascadeSkippedRequestIds.contains(adviceSaveDto.getRequestId())) { + continue; + } + Long requestId = adviceSaveDto.getRequestId(); + iServiceRequestService.removeById(requestId);// 删除诊疗 iServiceRequestService.remove( new LambdaQueryWrapper().eq(ServiceRequest::getParentId, requestId));// 删除诊疗套餐对应的子项 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatientmanage/controller/NursingRecordController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatientmanage/controller/NursingRecordController.java index 19450eebf..0fb03f934 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatientmanage/controller/NursingRecordController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatientmanage/controller/NursingRecordController.java @@ -31,6 +31,7 @@ public class NursingRecordController { * 获取住院患者信息 分页显示 * * @param nursingSearchParam 查询参数 + * * @param searchKey 模糊查询 * @param pageNo 当前页码 * @param pageSize 查询条数 diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml index c3d9da2da..30aeee339 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml @@ -97,6 +97,10 @@ CASE WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.surgery_name + WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE( + wsr.content_json::json->>'surgeryName', + wsr.content_json::json->>'adviceName', + T9sr.surgery_name) WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = 6 THEN T2."name" WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") @@ -108,6 +112,7 @@ CASE WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN NULL + WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN NULL WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL WHEN T1.context_enum = 6 THEN T2.yb_no WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL @@ -118,6 +123,7 @@ CASE WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.id + WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE(T9sr.id, wsr.activity_id) WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0 WHEN T1.context_enum = 6 THEN T2.id WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0 @@ -159,6 +165,11 @@ LEFT JOIN med_medication_request AS mmr ON mmr.id = T1.service_id AND mmr.delete_flag = '0' LEFT JOIN wor_device_request AS wdr ON wdr.id = T1.service_id AND wdr.delete_flag = '0' LEFT JOIN wor_service_request AS wsr ON wsr.id = T1.service_id AND wsr.delete_flag = '0' + LEFT JOIN cli_surgery AS T9sr ON T1.context_enum = 6 + AND T1.service_table = 'wor_service_request' + AND wsr.activity_id IS NOT NULL + AND wsr.activity_id = T9sr.id + AND T9sr.delete_flag = '0' LEFT JOIN wor_service_request AS wsrp ON wsrp.id = wsr.parent_id AND wsrp.delete_flag = '0' WHERE T1.encounter_id = #{encounterId} AND T1.status_enum IN (0 @@ -223,6 +234,10 @@ CASE WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.surgery_name + WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE( + wsr.content_json::json->>'surgeryName', + wsr.content_json::json->>'adviceName', + T9sr.surgery_name) WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = 6 THEN T2."name" WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") @@ -234,6 +249,7 @@ CASE WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN NULL + WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN NULL WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL WHEN T1.context_enum = 6 THEN T2.yb_no WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL @@ -244,6 +260,7 @@ CASE WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.id + WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE(T9sr.id, wsr.activity_id) WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0 WHEN T1.context_enum = 6 THEN T2.id WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0 @@ -286,6 +303,11 @@ LEFT JOIN med_medication_request AS mmr ON mmr.id = T1.service_id AND mmr.delete_flag = '0' LEFT JOIN wor_device_request AS wdr ON wdr.id = T1.service_id AND wdr.delete_flag = '0' LEFT JOIN wor_service_request AS wsr ON wsr.id = T1.service_id AND wsr.delete_flag = '0' + LEFT JOIN cli_surgery AS T9sr ON T1.context_enum = 6 + AND T1.service_table = 'wor_service_request' + AND wsr.activity_id IS NOT NULL + AND wsr.activity_id = T9sr.id + AND T9sr.delete_flag = '0' WHERE T1.encounter_id = #{encounterId} AND T1.status_enum IN (0 , #{planned} diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/clinicalmanage/SurgicalScheduleAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/clinicalmanage/SurgicalScheduleAppMapper.xml index 305c3e8e3..74abd7a4f 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/clinicalmanage/SurgicalScheduleAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/clinicalmanage/SurgicalScheduleAppMapper.xml @@ -71,7 +71,7 @@ AND os.delete_flag = '0' - ORDER BY os.create_time DESC + ORDER BY os.create_time DESC, os.schedule_id DESC