diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue index e944cca8..470da838 100644 --- a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue +++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue @@ -1155,7 +1155,10 @@ function getHealthcare(data) { form.value.organizationId = data.organizationId; getHealthcareMetadata(param).then((response) => { - healthcareList.value = response.data.records; + // 对数据进行去重处理,name去重 + const uniqueRecords = removeDuplicateHealthcareItems(response.data.records); + healthcareList.value = uniqueRecords; + console.log('去重后的数据列表,healthcareList', healthcareList.value) console.log('getHealthcareMetadata', 'response', response.data); // 使用 nextTick 确保数据更新后再过滤 nextTick(() => { @@ -1167,6 +1170,21 @@ function getHealthcare(data) { }); } +/** 根据name对挂号类型数据进行去重 */ +function removeDuplicateHealthcareItems(records) { + const seenNames = new Set(); + const uniqueRecords = []; + + for (const item of records) { + if (item.name && !seenNames.has(item.name)) { + seenNames.add(item.name); + uniqueRecords.push(item); + } + } + + return uniqueRecords; +} + /** 根据就诊科室和挂号类型过滤医生列表 */ function filterDoctorsByHealthcare() { // 如果没有医生列表,直接返回