From d4e1a22c10462f9c2d7cb0aaf035e65e712593f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BD=97?= Date: Thu, 11 Jun 2026 12:44:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(#739):=20=E8=AF=B7=E4=BF=AE=E5=A4=8D=20Bug?= =?UTF-8?q?=20#739?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由 AI Agent (guanyu) 自动修复,请查看 diff 确认变更内容。 --- .../impl/SpecialAdviceAppServiceImpl.java | 38 ++++++++++++++++++- .../AdviceManageAppMapper.xml | 2 +- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/appservice/impl/SpecialAdviceAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/appservice/impl/SpecialAdviceAppServiceImpl.java index 7b75908b3..307a74426 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/appservice/impl/SpecialAdviceAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/appservice/impl/SpecialAdviceAppServiceImpl.java @@ -6,6 +6,7 @@ import com.core.common.core.domain.R; import com.core.common.utils.AssignSeqUtil; import com.core.common.utils.MessageUtils; import com.core.common.utils.SecurityUtils; +import com.core.common.utils.StringUtils; import com.healthlink.his.common.constant.CommonConstants; import com.healthlink.his.common.constant.PromptMsgConstant; import com.healthlink.his.common.enums.*; @@ -18,7 +19,13 @@ import com.healthlink.his.web.regdoctorstation.dto.*; import com.healthlink.his.web.regdoctorstation.mapper.SpecialAdviceAppMapper; import com.healthlink.his.workflow.domain.ServiceRequest; import com.healthlink.his.workflow.service.IActivityDefinitionService; +import com.healthlink.his.administration.domain.Encounter; +import com.healthlink.his.administration.domain.Organization; +import com.healthlink.his.administration.service.IEncounterService; +import com.healthlink.his.administration.service.IOrganizationService; import com.healthlink.his.workflow.service.IServiceRequestService; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -56,6 +63,12 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService { @Resource IOrderProcessService iOrderProcessService; + @Resource + IEncounterService iEncounterService; + + @Resource + IOrganizationService iOrganizationService; + /** * 查询护理医嘱信息 * @@ -351,6 +364,20 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService { AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService .getAdviceBaseInfo(adviceBaseDto, null, null, null, null, 1, 1, null, List.of(3), null, null, null) .getRecords().get(0); + // 查询患者当前科室(从就诊记录获取) + Encounter encounter = iEncounterService.getById(encounterId); + Long currentOrgId = encounter != null ? encounter.getOrganizationId() : activityAdviceBaseDto.getPositionId(); + + // 查询转入科室名称,用于医嘱名称拼接 + String targetOrgName = ""; + Long targetOrgId = transferOrganizationParam.getTargetOrganizationId(); + if (targetOrgId != null) { + Organization targetOrg = iOrganizationService.getById(targetOrgId); + if (targetOrg != null && StringUtils.isNotEmpty(targetOrg.getName())) { + targetOrgName = targetOrg.getName(); + } + } + // 保存转科医嘱请求 ServiceRequest serviceRequest = new ServiceRequest(); serviceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态 @@ -366,9 +393,18 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService { serviceRequest.setPatientId(patientId); // 患者 serviceRequest.setRequesterId(practitionerId); // 开方医生 serviceRequest.setEncounterId(encounterId); // 就诊id - serviceRequest.setOrgId(activityAdviceBaseDto.getPositionId()); // 执行科室 + serviceRequest.setOrgId(currentOrgId); // 执行科室(患者当前科室) serviceRequest.setConditionId(conditionId); // 诊断id serviceRequest.setEncounterDiagnosisId(encounterDiagnosisId); // 就诊诊断id + // 设置医嘱名称:转科-转入科室名称 + try { + ObjectMapper objectMapper = new ObjectMapper(); + ObjectNode contentNode = objectMapper.createObjectNode(); + contentNode.put("adviceName", "转科" + (StringUtils.isNotEmpty(targetOrgName) ? "-" + targetOrgName : "")); + serviceRequest.setContentJson(objectMapper.writeValueAsString(contentNode)); + } catch (Exception e) { + log.warn("设置转科医嘱名称失败", e); + } iServiceRequestService.save(serviceRequest); // 保存转科医嘱请求的过程数据 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 f122d7c68..0476e14e6 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 @@ -306,7 +306,7 @@ null AS skin_test_flag, null AS inject_flag, null AS group_id, - COALESCE(T2.NAME, T1.content_json::jsonb->>'surgeryName', T1.content_json::jsonb->>'adviceName') AS advice_name, + COALESCE(T1.content_json::jsonb->>'adviceName', T2.NAME, T1.content_json::jsonb->>'surgeryName') AS advice_name, '' AS volume, '' AS lot_number, T1.quantity AS quantity,