diff --git a/public/spo2-report-template.html b/public/spo2-report-template.html new file mode 100644 index 0000000..d1a453e --- /dev/null +++ b/public/spo2-report-template.html @@ -0,0 +1,527 @@ + + + + + + 动态血氧监测报告 + + + +
加载中...
+ +
+
+

动态血氧监测报告

+
+
姓名:--
+
性别:--
+
年龄:--
+
检查日期:--
+
设备:--
+
检查ID:--
+
+
+
+
平均血氧饱和度:--%
+
最低血氧饱和度:--%
+
最高血氧饱和度:--%
+
低氧时间:--
+
+
+
+

血氧饱和度分布统计

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
时间段优秀 (≥95%)良好 (90-94%)偏低 (85-89%)危险 (<85%)
全天--------
白天--------
夜间--------
+
+
+

极值统计

+ + + + + + + + + + + + + + + + + + + + +
类型血氧值发生时间
最低血氧值----
最高血氧值----
+
+
+
+

诊断结论

+
+
--
+
+ +
+
+

血氧分布饼状图

+
+
+
全天血氧分布 (24小时)
+
+
+ +
+
--
+
平均血氧
+
+
+
+
+
+
+
+
白天血氧分布 (8:00-22:00)
+
+
+ +
+
--
+
白天
+
+
+
+
+
+
+
夜间血氧分布 (22:00-8:00)
+
+
+ +
+
--
+
夜间
+
+
+
+
+
+
+
+
+
+ + + diff --git a/src/api/spo2info/index.ts b/src/api/spo2info/index.ts index bf23655..c6840ae 100644 --- a/src/api/spo2info/index.ts +++ b/src/api/spo2info/index.ts @@ -17,6 +17,7 @@ export interface Spo2infoVO { superiorrequest: number // 上级请求 createtime: Date // 创建时间 updatetime: Date // 更新时间 + diagnosis: string // 诊断结论 } // 血氧信息 API @@ -77,6 +78,14 @@ export const Spo2infoApi = { }) }, + //更新诊断结果 + upSpoInfoDiagnosis: async (data: any) => { + return await request.put({ + url: `/system/spo2info/update-diagnosis`, + data + }) + }, + // 获取血氧信息统计数据 getSpO2Analysis: async (regid: string, examid: string, weartime: string) => { return await request.get({ diff --git a/src/components/SpO2AnalysisDialog/index.vue b/src/components/SpO2AnalysisDialog/index.vue index b5cbd78..3804e52 100644 --- a/src/components/SpO2AnalysisDialog/index.vue +++ b/src/components/SpO2AnalysisDialog/index.vue @@ -225,6 +225,33 @@
+ +
+

血氧等级分类说明

+
+
+ 优秀 + ≥95% + 血氧饱和度正常,状态良好 +
+
+ 良好 + 90-94% + 血氧饱和度轻度偏低,需要关注 +
+
+ 偏低 + 85-89% + 血氧饱和度明显偏低,需要干预 +
+
+ 危险 + <85% + 血氧饱和度严重不足,需要紧急处理 +
+
+
+

监测数据列表

@@ -253,9 +280,14 @@ + + + @@ -351,7 +383,6 @@ const props = withDefaults(defineProps(), { // Emits const emit = defineEmits<{ 'update:modelValue': [value: boolean] - save: [data: any] }>() // 响应式数据 @@ -365,13 +396,15 @@ const saving = ref(false) // 患者信息 const patientInfo = ref({ + id: 0, // 患者记录ID name: '', gender: '', age: '', regid: '', examid: '', weartime: '', - devicename: '' + devicename: '', + diagnosis: '' // 新增诊断结论字段 }) // 血氧统计数据 @@ -499,21 +532,19 @@ const handleSave = async () => { saving.value = true try { - await new Promise((resolve) => setTimeout(resolve, 1000)) - - const saveData = { - patientId: patientInfo.value.examid, - diagnosis: diagnosisForm, - stats: { - spo2: spo2Stats.value, - data: dataStats.value - } + // 调用更新诊断结果接口 + const updateData = { + id: patientInfo.value.id, // 患者记录ID + diagnosis: diagnosisForm.conclusion // 诊断结论 } - emit('save', saveData) - ElMessage.success('保存成功') + console.log('更新诊断结果参数:', updateData) + await Spo2infoApi.upSpoInfoDiagnosis(updateData) + + ElMessage.success('诊断结果保存成功') visible.value = false } catch (error) { + console.error('保存诊断结果失败:', error) ElMessage.error('保存失败') } finally { saving.value = false @@ -541,6 +572,22 @@ const getSpO2Class = (value: number) => { return 'spo2-danger' } +// 获取血氧等级文本 +const getSpO2LevelText = (value: number) => { + if (value >= 95) return '优秀' + if (value >= 90) return '良好' + if (value >= 85) return '偏低' + return '危险' +} + +// 获取血氧等级标签类型 +const getSpO2TagType = (value: number) => { + if (value >= 95) return 'success' + if (value >= 90) return 'primary' + if (value >= 85) return 'warning' + return 'danger' +} + // 获取数据表格数据 const getDataTableList = async () => { // 确保有患者数据 @@ -739,6 +786,43 @@ const getAnalysisData = async () => { // 重置时间段选择 selectedTimePeriod.value = 'all' + + // 自动生成诊断结论 + const generateDiagnosisText = (stats, timePeriodData) => { + // 计算分析建议 + const getSimpleAnalysis = () => { + const day = timePeriodData.daytime + const night = timePeriodData.nighttime + let result: string[] = [] + if (day.warning.percentage > 10 || day.danger.percentage > 0) { + result.push('白天偏低或危险占比高,建议关注白天血氧变化。') + } else { + result.push('白天血氧整体良好。') + } + if (night.warning.percentage > 10 || night.danger.percentage > 0) { + result.push('夜间偏低或危险占比高,建议夜间加强监测。') + } else { + result.push('夜间血氧整体良好。') + } + return result.join(' ') + } + return [ + `全程共测量${stats.totalRecords || '--'}次,有效率100%;`, + `平均血氧饱和度:${stats.averageSpO2 || '--'}%;最低血氧饱和度:${stats.minSpO2 || '--'}%;最高血氧饱和度:${stats.maxSpO2 || '--'}%;低氧时间:${stats.lowOxygenTime > 0 ? stats.lowOxygenTime + '分钟' : '无低氧'};`, + `全天分布:优秀${timePeriodData.all.excellent.value || 0}次(${timePeriodData.all.excellent.percentage || 0}% ),良好${timePeriodData.all.good.value || 0}次(${timePeriodData.all.good.percentage || 0}% ),偏低${timePeriodData.all.warning.value || 0}次(${timePeriodData.all.warning.percentage || 0}% ),危险${timePeriodData.all.danger.value || 0}次(${timePeriodData.all.danger.percentage || 0}% );`, + `白天分布:优秀${timePeriodData.daytime.excellent.value || 0}次(${timePeriodData.daytime.excellent.percentage || 0}% ),良好${timePeriodData.daytime.good.value || 0}次(${timePeriodData.daytime.good.percentage || 0}% ),偏低${timePeriodData.daytime.warning.value || 0}次(${timePeriodData.daytime.warning.percentage || 0}% ),危险${timePeriodData.daytime.danger.value || 0}次(${timePeriodData.daytime.danger.percentage || 0}% );`, + `夜间分布:优秀${timePeriodData.nighttime.excellent.value || 0}次(${timePeriodData.nighttime.excellent.percentage || 0}% ),良好${timePeriodData.nighttime.good.value || 0}次(${timePeriodData.nighttime.good.percentage || 0}% ),偏低${timePeriodData.nighttime.warning.value || 0}次(${timePeriodData.nighttime.warning.percentage || 0}% ),危险${timePeriodData.nighttime.danger.value || 0}次(${timePeriodData.nighttime.danger.percentage || 0}% );`, + `分析:${getSimpleAnalysis()}`, + `建议:请结合患者实际情况综合分析。` + ].join('\n') + } + // 如果诊断结论为空,自动填充 + if (!diagnosisForm.conclusion) { + diagnosisForm.conclusion = generateDiagnosisText( + { ...spo2Stats.value, totalRecords: response.totalRecords }, + timePeriodData.value + ) + } } catch (error) { console.error('获取血氧分析数据失败:', error) ElMessage.error('获取分析数据失败') @@ -751,6 +835,12 @@ const getAnalysisData = async () => { const updatePatientInfo = () => { if (props.patientData) { patientInfo.value = { ...props.patientData } + // 优先加载表里的诊断结论 + if (patientInfo.value.diagnosis) { + diagnosisForm.conclusion = patientInfo.value.diagnosis + } else { + diagnosisForm.conclusion = '' + } // 患者信息更新后,自动获取分析数据 getAnalysisData() } @@ -1281,6 +1371,51 @@ defineExpose({ } } + // 等级分类说明样式 + .level-classification-info { + background: white; + border-radius: 12px; + padding: 20px; + margin-bottom: 20px; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); + border: 1px solid #e4e7ed; + + h4 { + margin: 0 0 16px 0; + font-size: 16px; + font-weight: 600; + color: #303133; + } + + .level-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); + gap: 16px; + + .level-item { + display: flex; + align-items: center; + gap: 12px; + padding: 12px 16px; + background: #f8f9fa; + border-radius: 8px; + border-left: 4px solid #409eff; + + .level-range { + font-weight: 600; + color: #303133; + min-width: 60px; + } + + .level-desc { + font-size: 13px; + color: #606266; + flex: 1; + } + } + } + } + // 数据表格样式 .data-table-container { height: 100%; @@ -1344,29 +1479,8 @@ defineExpose({ .spo2-value { font-weight: 600; - padding: 4px 8px; - border-radius: 4px; font-size: 13px; - - &.spo2-excellent { - background: #f0f9ff; - color: #0ea5e9; - } - - &.spo2-good { - background: #f0fdf4; - color: #16a34a; - } - - &.spo2-warning { - background: #fefce8; - color: #ca8a04; - } - - &.spo2-danger { - background: #fef2f2; - color: #dc2626; - } + color: #303133; } .pulse-value { diff --git a/src/views/analysis/SpO₂.vue b/src/views/analysis/SpO₂.vue index 0a2c0fb..ebe54ce 100644 --- a/src/views/analysis/SpO₂.vue +++ b/src/views/analysis/SpO₂.vue @@ -290,6 +290,26 @@ :patient-data="currentPatient" @save="handleAnalysisSave" /> + + + + +