修改异常值逻辑
This commit is contained in:
parent
cb1d23a5d6
commit
91f0f6693b
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user