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