From 91f0f6693bcc332605a46e6fca929ce88d4c452b Mon Sep 17 00:00:00 2001 From: Euni4U <958079825@qq.com> Date: Fri, 21 Mar 2025 10:08:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=82=E5=B8=B8=E5=80=BC?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Medical-examination-vehicle.vue | 156 ++++++------------ 1 file changed, 53 insertions(+), 103 deletions(-) diff --git a/src/views/Department-entry/Medical-examination-vehicle.vue b/src/views/Department-entry/Medical-examination-vehicle.vue index 2998578..6c0da00 100644 --- a/src/views/Department-entry/Medical-examination-vehicle.vue +++ b/src/views/Department-entry/Medical-examination-vehicle.vue @@ -680,114 +680,64 @@ const loadPatientData = async (patient) => { } // 新增PACS数据获取 - const pacsTypes = { - blood: 'cbc', - urine: 'rt', - biochemical: 'bt' - } - - // 并行获取所有PACS数据 - const pacsRequests = Object.entries(pacsTypes).map(async ([tabKey, pacsType]) => { - try { - const res = await PacsDataApi.getPacsDataDetail(patient.medicalSn) - if (res && res.length > 0) { - // 将多个item用分号连接 - const combinedItems = res.map(r => r.item).join('') - return { tabKey, data: combinedItems } - } - return null - } catch (error) { - console.error(`获取${pacsType}数据失败:`, error) - return null - } - }) - - const pacsResults = await Promise.all(pacsRequests) - - // 处理PACS数据到对应标签页 - pacsResults.forEach(result => { - if (!result) return - const { tabKey, data } = result - const tabData = conclusionData.value[tabKey] + try { + // 直接获取所有PACS数据 + const res = await PacsDataApi.getPacsDataDetail(patient.medicalSn) + console.log('PACS数据:', res) - if (tabData) { - // 将合并后的数据存入summary字段 - tabData.summary = data || '' + if (res && res.length > 0) { + // 按type分组处理数据 + const typeGroups = {} - // 更新对应检查项目(示例血常规) - if (tabKey === 'blood' && examItems.value.blood) { - examItems.value.blood.forEach(item => { - if (item.name === '血常规') { - item.value = data || '' - item.itemStatus = '1' + // 遍历所有返回的数据,按type分组 + res.forEach(item => { + if (item.type && item.item) { + if (!typeGroups[item.type]) { + typeGroups[item.type] = [] } - }) - } - // 同样处理尿常规和生化 - if (tabKey === 'urine' && examItems.value.urine) { - examItems.value.urine.forEach(item => { - if (item.name === '尿常规') { - item.value = data || '' - item.itemStatus = '1' - } - }) - } - if (tabKey === 'biochemical' && examItems.value.biochemical) { - examItems.value.biochemical.forEach(item => { - if (item.name === '生化') { - item.value = data || '' - item.itemStatus = '1' - } - }) - } - } - }) - - // 获取所有PACS数据 - const pacsRes = await PacsDataApi.getPacsDataDetail(patient.medicalSn) - - // 按type分类处理数据 - if (pacsRes && pacsRes.length > 0) { - // 创建分类容器 - const typeMap = { - cbc: { items: [], tabKey: 'blood', name: '血常规' }, - rt: { items: [], tabKey: 'urine', name: '尿常规' }, - bt: { items: [], tabKey: 'biochemical', name: '生化' } - } - - // 分类数据 - pacsRes.forEach(item => { - switch(item.type.toLowerCase()) { - case 'cbc': - typeMap.cbc.items.push(item.item) - break - case 'rt': - typeMap.rt.items.push(item.item) - break - case 'bt': - typeMap.bt.items.push(item.item) - break - } - }) - - // 处理每个类型 - Object.values(typeMap).forEach(({ items, tabKey, name }) => { - if (items.length > 0) { - const combined = items.join(';') - // 更新小结 - conclusionData.value[tabKey].summary = combined - - // 更新检查项目 - if (examItems.value[tabKey]) { - examItems.value[tabKey].forEach(examItem => { - if (examItem.name === name) { - examItem.value = combined - examItem.itemStatus = '1' - } - }) + typeGroups[item.type].push(item.item) } + }) + + console.log('按类型分组的PACS数据:', typeGroups) + + // 处理不同类型的数据到对应标签页 + // 类型映射关系 + const typeToTabMapping = { + 'cbc': 'blood', // 血常规 + 'rt': 'urine', // 尿常规 + 'bt': 'biochemical', // 生化 } - }) + + // 遍历所有类型组 + Object.entries(typeGroups).forEach(([type, items]) => { + // 转换为小写以便匹配 + const lowerType = type.toLowerCase() + // 获取对应的标签页 + const tabKey = typeToTabMapping[lowerType] + + if (tabKey) { + // 将该类型的所有项目合并 + const combinedData = items.join(';') + + // 其他类型直接赋值到summary + conclusionData.value[tabKey].summary = combinedData + + // 更新对应检查项目 + if (examItems.value[tabKey]) { + examItems.value[tabKey].forEach(item => { + // 根据项目名称匹配 + if (item.name.toLowerCase().includes(tabKey)) { + item.value = combinedData + item.itemStatus = '1' // 设置为已检查状态 + } + }) + } + } + }) + } + } catch (error) { + console.error('获取PACS数据失败:', error) } } catch (error) {