From 838f717df425969f12aedc73a5abef87813b0677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BD=97?= <华佗@gentronhealth.com> Date: Sun, 17 May 2026 13:15:08 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#516:=20[=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E7=AB=99-=E4=B8=B4=E5=BA=8A=E5=8C=BB?= =?UTF-8?q?=E5=98=B1-=E6=A3=80=E9=AA=8C=E7=94=B3=E8=AF=B7]=20=E6=A3=80?= =?UTF-8?q?=E9=AA=8C=E7=94=B3=E8=AF=B7=E5=8D=95=E6=89=8B=E5=8A=A8=E5=A1=AB?= =?UTF-8?q?=E5=86=99=E7=9A=84"=E5=8F=91=E5=BE=80=E7=A7=91=E5=AE=A4"?= =?UTF-8?q?=E4=B8=8E=E7=94=9F=E6=88=90=E7=9A=84=E5=8C=BB=E5=98=B1=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E7=A7=91=E5=AE=A4=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: 前端 projectWithDepartment 函数缺少 type 参数声明,导致用户手动选择的发往科室被清空;后端完全忽略前端传来的 positionId,始终使用配置表中的默认科室。 修复: 1) 前端添加 type 参数 + 提交前保存用户选择并在校验后恢复;2) 后端优先使用前端 positionId,配置表仅作为兜底。 Co-Authored-By: Claude Opus 4.7 --- .../impl/RequestFormManageAppServiceImpl.java | 12 ++++++++---- .../order/applicationForm/laboratoryTests.vue | 8 ++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java index 1ad8ec3c6..18736f832 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java @@ -162,11 +162,15 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer serviceRequest.setEncounterId(encounterId); // 就诊id serviceRequest.setAuthoredTime(curDate); // 请求签发时间 - Long positionId = activityOrganizationConfig.stream() - .filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId())) - .map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null); + // 优先使用前端传来的 positionId(用户手动选择的发往科室),未传时从配置表查找 + Long positionId = activitySaveDto.getPositionId(); if (positionId == null) { - throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室"); + positionId = activityOrganizationConfig.stream() + .filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId())) + .map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null); + if (positionId == null) { + throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室"); + } } serviceRequest.setOrgId(positionId); // 执行科室 diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue index 03d3a205d..4324bd8b8 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue @@ -164,7 +164,7 @@ onMounted(() => { * type(1:watch监听类型 2:点击保存类型) * selectProjectIds(选中项目的id数组) * */ -const projectWithDepartment = (selectProjectIds) => { +const projectWithDepartment = (selectProjectIds, type) => { //1.获取选中的项目 2.判断项目的执行科室是否相同 3.判断执行科室是否配置 4.将项目的执行科室复值到执行科室下拉选位置 let isRelease = true; // 选中项目的数组 @@ -225,9 +225,13 @@ const submit = () => { if (transferValue.value.length == 0) { return proxy.$message.error('请选择申请单'); } + // 🔧 Bug #516: 捕获用户手动选择的发往科室,避免 projectWithDepartment 将其覆盖为默认科室 + const savedTargetDept = form.targetDepartment; if (!projectWithDepartment(transferValue.value, 2)) { return; } + // 用户手动选择的发往科室优先于项目默认执行科室 + const targetDept = savedTargetDept || form.targetDepartment; let applicationListAllFilter = applicationListAll.value.filter((item) => { return transferValue.value.includes(item.adviceDefinitionId); }); @@ -238,7 +242,7 @@ const submit = () => { unitCode: item.priceList[0].unitCode /** 请求单位编码 */, unitPrice: item.priceList[0].price /** 单价 */, totalPrice: item.priceList[0].price /** 总价 */, - positionId: item.positionId || form.targetDepartment, //执行科室id,未配置时使用用户手动选择的科室 + positionId: targetDept || item.positionId, // 用户指定发往科室优先于项目默认执行科室 ybClassEnum: item.ybClassEnum, //类别医保编码 conditionId: item.conditionId, //诊断ID encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id