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 307a74426..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 @@ -366,7 +366,11 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService { .getRecords().get(0); // 查询患者当前科室(从就诊记录获取) Encounter encounter = iEncounterService.getById(encounterId); - Long currentOrgId = encounter != null ? encounter.getOrganizationId() : activityAdviceBaseDto.getPositionId(); + Long currentOrgId = encounter != null ? encounter.getOrganizationId() : null; + if (currentOrgId == null) { + log.warn("转科医嘱:就诊记录 organizationId 为空, encounterId={}, 回退到医嘱定义默认科室", encounterId); + currentOrgId = activityAdviceBaseDto.getPositionId(); + } // 查询转入科室名称,用于医嘱名称拼接 String targetOrgName = ""; @@ -375,8 +379,13 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService { 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(); 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 a01d9cff1..ba79d6f4d 100755 --- a/healthlink-his-ui/src/views/doctorstation/components/prescription/prescriptionlist.vue +++ b/healthlink-his-ui/src/views/doctorstation/components/prescription/prescriptionlist.vue @@ -1750,10 +1750,8 @@ onMounted(() => { createNewPrescription(); handleAddPrescription(null, false); } - // 默认展开个人:只请求个人组套 - if (props.patientInfo?.orgId) { - fetchOrderGroups('personal'); - } + // 默认展开个人:个人组套不依赖 orgId(使用 practitionerId 查询) + fetchOrderGroups('personal'); }); onBeforeUnmount(() => { @@ -1802,12 +1800,14 @@ watch( watch( () => props.patientInfo?.orgId, (orgId) => { - if (!orgId) return; + // 🔧 Bug #730 修复:个人组套不依赖 orgId,只需 practitionerId(登录用户自带) if (!orderGroupLoaded.value.personal) { fetchOrderGroups('personal'); } // 预加载医嘱基础数据,提升搜索响应速度 - preloadAdviceData(); + if (orgId) { + preloadAdviceData(); + } }, { immediate: true } ); @@ -5056,8 +5056,9 @@ async function fetchOrderGroups(scope, { force = false } = {}) { const orgId = props.patientInfo?.orgId; console.log('[fetchOrderGroups] orgId:', orgId); - if (!orgId) { - console.log('[fetchOrderGroups] orgId 为空,返回'); + // 🔧 Bug #730 修复:个人/科室组套不依赖 orgId,只有全院组套需要 orgId + if (scope === 'hospital' && !orgId) { + console.log('[fetchOrderGroups] 全院组套需要 orgId 但为空,返回'); return; } diff --git a/healthlink-his-ui/src/views/inpatientDoctor/home/components/order/applicationForm/transferOrganizationDialog.vue b/healthlink-his-ui/src/views/inpatientDoctor/home/components/order/applicationForm/transferOrganizationDialog.vue index aeed5c3c7..121b03945 100755 --- a/healthlink-his-ui/src/views/inpatientDoctor/home/components/order/applicationForm/transferOrganizationDialog.vue +++ b/healthlink-his-ui/src/views/inpatientDoctor/home/components/order/applicationForm/transferOrganizationDialog.vue @@ -97,6 +97,7 @@ import {transferOrganization} from './api.js'; import {getOrgList, getWardList} from '@/api/public.js'; import {patientInfo} from '../../../store/patient.js'; +const emit = defineEmits(['success']); const { proxy } = getCurrentInstance(); const dialogVisible = ref(false); const deptList = ref([]); // 科室列表 @@ -151,6 +152,7 @@ function submitApplicationForm() { if (res.code == 200) { proxy.$modal.msgSuccess('转科申请已提交'); dialogVisible.value = false; + emit('success'); } }); } else { diff --git a/healthlink-his-ui/src/views/inpatientDoctor/home/components/order/index.vue b/healthlink-his-ui/src/views/inpatientDoctor/home/components/order/index.vue index 215914be1..20d25bd5f 100755 --- a/healthlink-his-ui/src/views/inpatientDoctor/home/components/order/index.vue +++ b/healthlink-his-ui/src/views/inpatientDoctor/home/components/order/index.vue @@ -396,7 +396,7 @@ :encounter-diagnosis-id="encounterDiagnosisId" @success="handleLeaveHospitalSuccess" /> - +