From 821737dcc6ab01d444af6f431bbd97f02c309836 Mon Sep 17 00:00:00 2001 From: guanyu Date: Sat, 13 Jun 2026 19:45:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(#Bug#730):=20guanyu=20(=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=88=E5=85=A5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ATDManageAppServiceImpl.java | 2 + .../impl/SpecialAdviceAppServiceImpl.java | 47 +- .../inpatientmanage/PatientHomeAppMapper.xml | 5 + .../prescription/prescriptionlist.vue | 23 +- .../transferOrganizationDialog.vue | 2 + .../home/components/order/index.vue | 667 +++++------------- 6 files changed, 230 insertions(+), 516 deletions(-) diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/ATDManageAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/ATDManageAppServiceImpl.java index 1220b336c..51b406aa3 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/ATDManageAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/ATDManageAppServiceImpl.java @@ -606,6 +606,7 @@ public class ATDManageAppServiceImpl implements IATDManageAppService { * @return 结果 */ @Override + @Transactional(rollbackFor = Exception.class) public R transferDepartment(Long encounterId) { if (encounterId == null) { return R.fail("转科失败,请选择有效的患者"); @@ -663,6 +664,7 @@ public class ATDManageAppServiceImpl implements IATDManageAppService { // 更新住院信息 encounter.setOrganizationId(orderProcess.getTargetOrganizationId()) .setStatusEnum(EncounterZyStatus.REGISTERED.getValue()); + encounterService.saveOrUpdateEncounter(encounter); return R.ok("转科成功"); } 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..eeba13636 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,29 @@ 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() : null; + if (currentOrgId == null) { + log.warn("转科医嘱:就诊记录 organizationId 为空, encounterId={}, 回退到医嘱定义默认科室", encounterId); + currentOrgId = 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(); + } else { + log.warn("转科医嘱:查询转入科室失败, targetOrgId={}, 尝试通过 orgId 直接查", targetOrgId); + } + } + if (StringUtils.isEmpty(targetOrgName) && targetOrgId != null) { + log.warn("转科医嘱:转入科室名称为空, targetOrgId={}, contentJson 中 adviceName 将缺少科室名", targetOrgId); + } + // 保存转科医嘱请求 ServiceRequest serviceRequest = new ServiceRequest(); serviceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态 @@ -366,9 +402,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/inpatientmanage/PatientHomeAppMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inpatientmanage/PatientHomeAppMapper.xml index 23b59e544..42f456886 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inpatientmanage/PatientHomeAppMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inpatientmanage/PatientHomeAppMapper.xml @@ -190,6 +190,11 @@ AND T9.status_enum = 2 + -- 待转科 + + AND T2.status_enum = 6 + + -- 待出院 AND T2.status_enum = 4 diff --git a/healthlink-his-ui/src/views/doctorstation/components/prescription/prescriptionlist.vue b/healthlink-his-ui/src/views/doctorstation/components/prescription/prescriptionlist.vue index 8fde53f79..ba79d6f4d 100755 --- a/healthlink-his-ui/src/views/doctorstation/components/prescription/prescriptionlist.vue +++ b/healthlink-his-ui/src/views/doctorstation/components/prescription/prescriptionlist.vue @@ -394,7 +394,7 @@ > 皮试: @@ -837,7 +837,7 @@ > 皮试: @@ -1332,7 +1332,7 @@