修复Bug125 【住院登记】的入院科室无法选择,入院病区也无法选择;修改科室数据来源
This commit is contained in:
@@ -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,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user