修改异常值逻辑

This commit is contained in:
Euni4U 2025-03-21 10:08:21 +08:00
parent cb1d23a5d6
commit 91f0f6693b

View File

@ -680,115 +680,65 @@ const loadPatientData = async (patient) => {
} }
// PACS // PACS
const pacsTypes = {
blood: 'cbc',
urine: 'rt',
biochemical: 'bt'
}
// PACS
const pacsRequests = Object.entries(pacsTypes).map(async ([tabKey, pacsType]) => {
try { try {
// PACS
const res = await PacsDataApi.getPacsDataDetail(patient.medicalSn) const res = await PacsDataApi.getPacsDataDetail(patient.medicalSn)
console.log('PACS数据:', res)
if (res && res.length > 0) { if (res && res.length > 0) {
// item // type
const combinedItems = res.map(r => r.item).join('') const typeGroups = {}
return { tabKey, data: combinedItems }
// type
res.forEach(item => {
if (item.type && item.item) {
if (!typeGroups[item.type]) {
typeGroups[item.type] = []
} }
return null typeGroups[item.type].push(item.item)
} catch (error) {
console.error(`获取${pacsType}数据失败:`, error)
return null
} }
}) })
const pacsResults = await Promise.all(pacsRequests) console.log('按类型分组的PACS数据:', typeGroups)
// PACS //
pacsResults.forEach(result => { //
if (!result) return const typeToTabMapping = {
const { tabKey, data } = result 'cbc': 'blood', //
const tabData = conclusionData.value[tabKey] 'rt': 'urine', // 尿
'bt': 'biochemical', //
if (tabData) {
// summary
tabData.summary = data || ''
//
if (tabKey === 'blood' && examItems.value.blood) {
examItems.value.blood.forEach(item => {
if (item.name === '血常规') {
item.value = data || ''
item.itemStatus = '1'
}
})
}
// 尿
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 => { Object.entries(typeGroups).forEach(([type, items]) => {
switch(item.type.toLowerCase()) { // 便
case 'cbc': const lowerType = type.toLowerCase()
typeMap.cbc.items.push(item.item) //
break const tabKey = typeToTabMapping[lowerType]
case 'rt':
typeMap.rt.items.push(item.item)
break
case 'bt':
typeMap.bt.items.push(item.item)
break
}
})
// if (tabKey) {
Object.values(typeMap).forEach(({ items, tabKey, name }) => { //
if (items.length > 0) { const combinedData = items.join(';')
const combined = items.join('')
//
conclusionData.value[tabKey].summary = combined
// // summary
conclusionData.value[tabKey].summary = combinedData
//
if (examItems.value[tabKey]) { if (examItems.value[tabKey]) {
examItems.value[tabKey].forEach(examItem => { examItems.value[tabKey].forEach(item => {
if (examItem.name === name) { //
examItem.value = combined if (item.name.toLowerCase().includes(tabKey)) {
examItem.itemStatus = '1' item.value = combinedData
item.itemStatus = '1' //
} }
}) })
} }
} }
}) })
} }
} catch (error) {
console.error('获取PACS数据失败:', error)
}
} catch (error) { } catch (error) {
console.error('加载患者数据失败:', error) console.error('加载患者数据失败:', error)