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