Fix Bug #566: fallback修复
This commit is contained in:
14
openhis-ui-vue3/src/api/inpatient/vitalSign.js
Normal file
14
openhis-ui-vue3/src/api/inpatient/vitalSign.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/**
|
||||
* 获取住院体征(体温单)数据
|
||||
* @param {Object} params { registrationId }
|
||||
* @returns {Promise} 返回体征记录列表,前端体温图表使用
|
||||
*/
|
||||
export function getVitalSignsApi(params) {
|
||||
return request({
|
||||
url: '/inpatient/vital-signs',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<div class="temperature-chart">
|
||||
<el-card>
|
||||
<div ref="chartRef" style="height: 400px;"></div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import * as echarts from 'echarts';
|
||||
import { getVitalSignsApi } from '@/api/inpatient/vitalSign';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
const props = defineProps({
|
||||
registrationId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const chartRef = ref(null);
|
||||
let chartInstance = null;
|
||||
|
||||
const loadData = async () => {
|
||||
try {
|
||||
const res = await getVitalSignsApi({ registrationId: props.registrationId });
|
||||
const data = res.data || [];
|
||||
|
||||
const times = data.map(item => item.recordTime);
|
||||
const temps = data.map(item => item.temperature);
|
||||
|
||||
const option = {
|
||||
title: { text: '体温趋势' },
|
||||
tooltip: { trigger: 'axis' },
|
||||
xAxis: { type: 'category', data: times },
|
||||
yAxis: { type: 'value', name: '℃' },
|
||||
series: [
|
||||
{
|
||||
name: '体温',
|
||||
type: 'line',
|
||||
data: temps,
|
||||
smooth: true,
|
||||
itemStyle: { color: '#ff5722' },
|
||||
},
|
||||
],
|
||||
};
|
||||
chartInstance.setOption(option);
|
||||
} catch (e) {
|
||||
ElMessage.error('加载体温数据失败');
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
chartInstance = echarts.init(chartRef.value);
|
||||
loadData();
|
||||
});
|
||||
|
||||
watch(() => props.registrationId, () => {
|
||||
loadData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.temperature-chart {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user