From edeb37be35dd7670e9e666440f2a7161cc90937b Mon Sep 17 00:00:00 2001 From: Euni4U <958079825@qq.com> Date: Mon, 14 Apr 2025 16:18:16 +0800 Subject: [PATCH] =?UTF-8?q?BMI=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Medical-examination-vehicle.vue | 224 +++++++----------- 1 file changed, 90 insertions(+), 134 deletions(-) diff --git a/src/views/Department-entry/Medical-examination-vehicle.vue b/src/views/Department-entry/Medical-examination-vehicle.vue index 1d26e28..c03d2b9 100644 --- a/src/views/Department-entry/Medical-examination-vehicle.vue +++ b/src/views/Department-entry/Medical-examination-vehicle.vue @@ -565,7 +565,7 @@ const switchTab = async (tabId) => { const conclusionData = ref({ general: { summary: '未见异常' }, ultrasound: { finding: '未见异常', diagnosis: '未见异常' }, - ecg: { finding: '未见异常', diagnosis: '未见异常' }, + ecg: { finding: '详见报告单', diagnosis: '详见报告单' }, blood: { summary: '未见异常' }, urine: { summary: '未见异常' }, biochemical: { summary: '未见异常' }, @@ -754,148 +754,104 @@ const getpatientitemData = async (medicalSn) => { // 修改 loadPatientData 函数,确保正确加载已检查患者的医生和日期 const loadPatientData = async (patient) => { try { - const loading = ElLoading.service({ - lock: true, - text: '加载中...', - background: 'rgba(255, 255, 255, 0.7)' + // 清除缓存 + patientDataCache.value.clear() + + // 获取患者基本信息 + const patientInfo = await PatientApi.getPatient(patient.id) + reportData.value = patientInfo + + // 获取患者检查项目 + const itemsRes = await PatientitemsApi.getPatientitemsPage({ + medicalSn: patient.medicalSn, + pageNo: 1, + pageSize: 100 }) - - try { - // 获取患者基本信息 - const patientData = await PatientApi.getPatient(patient.id) - reportData.value = patientData - - // 重置检查医生和日期 - inspectDoctor.value = '' - inspectTime.value = '' - - // 检查患者状态,如果已检查则设置检查完成状态为true - isExamCompleted.value = patient.status === '1' || patient.status === 1 - - // 获取检查项目 - const itemsRes = await PatientitemsApi.getPatientitemsPage({ - medicalSn: patient.medicalSn, - pageNo: 1, - pageSize: 100 + + if (itemsRes.list && itemsRes.list.length > 0) { + // 按科室分类处理项目数据 + const categorizedItems = {} + itemsRes.list.forEach(item => { + const category = getCategoryByItemName(item.itemName) + if (!categorizedItems[category]) { + categorizedItems[category] = [] + } + categorizedItems[category].push(processItemData(item)) }) - - // 处理检查项目数据 - if (itemsRes.list && itemsRes.list.length > 0) { - // 按照类别分组 - const groupedItems = {} - - // 根据不同类型的检查项目,加载对应的小结 - const conclusions = { - general: { summary: '未见异常' }, - ultrasound: { finding: '未见异常', diagnosis: '未见异常' }, - ecg: { finding: '未见异常', diagnosis: '未见异常' }, - blood: { summary: '' }, - urine: { summary: '' }, - biochemical: { summary: '' } - } - - // 查找已检查的项目,获取检查医生和日期 - const checkedItems = itemsRes.list.filter((item) => item.itemStatus === '1') - - if (checkedItems.length > 0) { - // 使用第一个已检查项目的检查医生和日期 - const firstCheckedItem = checkedItems[0] - - // 设置检查医生 - if (firstCheckedItem.inspectdoctor) { - inspectDoctor.value = firstCheckedItem.inspectdoctor - } - - // 格式化检查时间 - if (firstCheckedItem.inspecttime) { - const inspectDate = new Date(Number(firstCheckedItem.inspecttime)) - inspectTime.value = formatDate(inspectDate) + + // 更新检查项目数据 + examItems.value = categorizedItems + + // 处理血压和BMI判断 + const allItems = Object.values(examItems.value).flat() + + // 用于存储异常信息 + let abnormalSummary = [] + + // 处理BMI项目 + const bmiItem = allItems.find(item => + item.name && item.name.includes('体质指数') && item.name.includes('BMI') && + item.value + ) + + if (bmiItem) { + const bmiValue = parseFloat(bmiItem.value) + if (!isNaN(bmiValue)) { + if (bmiValue < 18.5) { + bmiItem.note = '↓' + bmiItem.risk = '偏瘦' + bmiItem.status = 'danger' + abnormalSummary.push('【BMI】' + bmiValue + ',偏瘦') + } else if (bmiValue >= 24) { + bmiItem.note = '↑' + bmiItem.risk = '超重' + bmiItem.status = 'danger' + abnormalSummary.push('【BMI】' + bmiValue + ',超重') + } else { + bmiItem.note = '-' + bmiItem.risk = '正常' + bmiItem.status = '' } } - - itemsRes.list.forEach((item) => { - // 处理项目分类 - const category = getCategoryByItemName(item.itemName || '') - - if (!groupedItems[category]) { - groupedItems[category] = [] - } - - // 处理项目数据 - const processedItem = processItemData(item) - groupedItems[category].push(processedItem) - - // 处理小结数据 - processConclusion(item, category, conclusions) - }) - - examItems.value = groupedItems - conclusionData.value = conclusions } - - // 新增PACS数据获取 - try { - // 直接获取所有PACS数据 - const res = await PacsDataApi.getPacsDataDetail(patient.medicalSn) - - if (res && res.length > 0) { - // 按type分组处理数据 - const typeGroups = {} - - // 遍历所有返回的数据,按type分组 - res.forEach((item) => { - if (item.type && item.item) { - if (!typeGroups[item.type]) { - typeGroups[item.type] = [] - } - typeGroups[item.type].push(item.item) + + // 处理血压项目 + const bpItem = allItems.find(item => + item.name && item.name.includes('血压') && + item.value + ) + + if (bpItem) { + const bpMatch = bpItem.value.match(/(\d+)\/(\d+)/) + if (bpMatch) { + const systolic = parseInt(bpMatch[1]) // 收缩压 + const diastolic = parseInt(bpMatch[2]) // 舒张压 + + if (!isNaN(systolic) && !isNaN(diastolic)) { + if (systolic >= 130 || diastolic >= 85) { + bpItem.note = '↑' + bpItem.risk = '血压偏高' + bpItem.status = 'danger' + abnormalSummary.push('【血压】' + bpItem.value + ',偏高') + } else { + bpItem.note = '-' + bpItem.risk = '正常' + bpItem.status = '' } - }) - // 处理不同类型的数据到对应标签页 - // 类型映射关系 - 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) { - console.error('加载患者数据失败:', error) - ElMessage.error('加载患者数据失败') - } finally { - loading.close() + + // 如果患者状态是待检查且当前小结是"未见异常",则更新小结 + if (patient.status !== '1' && patient.status !== 1 && + conclusionData.value.general.summary === '未见异常' && + abnormalSummary.length > 0) { + conclusionData.value.general.summary = abnormalSummary.join(';') + } } } catch (error) { console.error('加载患者数据失败:', error) - ElMessage.error('加载患者数据失败') + message.error('加载患者数据失败') } } @@ -909,7 +865,7 @@ const handlePatientSelect = async (patient) => { conclusionData.value = { general: { summary: '未见异常' }, ultrasound: { finding: '未见异常', diagnosis: '未见异常' }, - ecg: { finding: '未见异常', diagnosis: '未见异常' }, + ecg: { finding: '详见报告单', diagnosis: '详见报告单' }, blood: { summary: '' }, urine: { summary: '' }, biochemical: { summary: '' }, @@ -1629,7 +1585,7 @@ const handleRefresh = async (e) => { // 重置小结数据 general: { summary: '未见异常' }, ultrasound: { finding: '未见异常', diagnosis: '未见异常' }, - ecg: { finding: '未见异常', diagnosis: '未见异常' }, + ecg: { finding: '详见报告单', diagnosis: '详见报告单' }, blood: { summary: '' }, urine: { summary: '' }, biochemical: { summary: '' } @@ -2174,7 +2130,7 @@ const handleSummarySave = async () => { if (conclusionData.value.ultrasound?.finding || conclusionData.value.ultrasound?.diagnosis) { summaryContent += '【超声】\n' if (conclusionData.value.ultrasound.finding) { - summaryContent += '检查所见:' + conclusionData.value.ultrasound.finding + '\n' + summaryContent += '检查所见:' +'\n'+ conclusionData.value.ultrasound.finding + '\n' } if (conclusionData.value.ultrasound.diagnosis) { summaryContent += '检查结果:' + conclusionData.value.ultrasound.diagnosis + '\n'