fix(#Bug#730): guanyu (文件合入)

This commit is contained in:
2026-06-13 19:45:48 +08:00
committed by 华佗
parent 201378b1dc
commit 821737dcc6
6 changed files with 230 additions and 516 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

@@ -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);
// 保存转科医嘱请求的过程数据

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

@@ -394,7 +394,7 @@
>
皮试<el-checkbox
v-model="scope.row.skinTestFlag"
:true-value="1"
:true-value="true"
:false-value="0"
@change="handleSkinTestChange(scope.row, scope.rowIndex)"
>
@@ -837,7 +837,7 @@
>
皮试<el-checkbox
v-model="scope.row.skinTestFlag"
:true-value="1"
:true-value="true"
:false-value="0"
@change="handleSkinTestChange(scope.row, scope.rowIndex)"
>
@@ -1332,7 +1332,7 @@
<template v-if="scope.row.isEdit">
<el-checkbox
v-model="scope.row.skinTestFlag"
:true-value="1"
:true-value="true"
:false-value="0"
@change="handleSkinTestChange(scope.row, scope.rowIndex)"
>
@@ -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 {