修复Bug125 【住院登记】的入院科室无法选择,入院病区也无法选择;修改科室数据来源

This commit is contained in:
HuangShun
2026-02-02 10:55:04 +08:00
parent 5534a71c7d
commit 063be326eb
2 changed files with 35 additions and 3 deletions

View File

@@ -192,3 +192,17 @@ export function getProvincesAndCities(encounterId) {
method: 'get',
});
}
// 获取所有病区
export function getAllWards(params = {}) {
return request({
url: '/base-data-manage/location/location-page',
method: 'get',
params: {
pageNum: params.pageNum ?? 1,
pageSize: params.pageSize ?? 1000,
formEnum: params.formEnum ?? 4,
...params,
},
});
}

View File

@@ -202,6 +202,7 @@
<script setup>
import {
diagnosisInit,
getAllWards,
getBedInfo,
getContractList,
getDiagnosisDefinitionList,
@@ -423,12 +424,29 @@ function handleWardClick(item) {
}
function getInitOptions() {
getOrgList().then((res) => {
// 直接从records中过滤而不是从records[0].children
organization.value = res.data.records.filter(
// 获取所有科室
const orgPromise = getOrgList();
// 获取所有病区
const wardPromise = getAllWards();
Promise.all([orgPromise, wardPromise]).then(([orgRes, wardRes]) => {
const allOrgs = orgRes.data.records.filter(
(record) => record.typeEnum === 2 && checkClassEnumValue(record.classEnum, 2)
);
const allWards = wardRes.data.records || [];
// 提取所有病区关联的科室ID
const linkedOrgIds = new Set();
allWards.forEach((ward) => {
if (ward.organizationId) {
linkedOrgIds.add(ward.organizationId);
}
});
// 过滤出与病区关联过的科室
organization.value = allOrgs.filter((org) => linkedOrgIds.has(org.id));
});
// if (!props.noFile) {
// wardList().then((res) => {
// wardListOptions.value = res.data;