fix(#730): 请修复 Bug #730

由 AI Agent (guanyu) 自动修复,请查看 diff 确认变更内容。
This commit is contained in:
2026-06-11 13:41:52 +08:00
parent d4e1a22c10
commit 7e37193e85
6 changed files with 32 additions and 10 deletions

View File

@@ -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("转科成功");
}

View File

@@ -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();

View File

@@ -190,6 +190,11 @@
AND T9.status_enum = 2
</if>
-- 待转科
<if test="statusEnum == 2">
AND T2.status_enum = 6
</if>
-- 待出院
<if test="statusEnum == 3">
AND T2.status_enum = 4

View File

@@ -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;
}

View File

@@ -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 {

View File

@@ -396,7 +396,7 @@
:encounter-diagnosis-id="encounterDiagnosisId"
@success="handleLeaveHospitalSuccess"
/>
<TransferOrganizationDialog ref="transferOrganizationRef" />
<TransferOrganizationDialog ref="transferOrganizationRef" @success="handleTransferOrgSuccess" />
</div>
<!-- <el-drawer v-model="openDrawer" size="100%">
<template #default>
@@ -2817,6 +2817,9 @@ function handleLeaveHospitalSuccess() {
function handleTransferOrg() {
proxy.$refs['transferOrganizationRef'].openDialog();
}
function handleTransferOrgSuccess() {
getListInfo(false);
}
// 校验每个组号数量是否大于5和对应分组金额是否大于500
function validateGroups(saveList) {