修改异常值逻辑

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

View File

@ -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) {