Merge branch 'master' of http://114.55.171.231:3000/Euni4U/shanghai_vue3
This commit is contained in:
commit
2c21ec062f
@ -32,8 +32,8 @@
|
||||
clearable
|
||||
style="width: 100px"
|
||||
>
|
||||
<el-option label="男" value="男" />
|
||||
<el-option label="女" value="女" />
|
||||
<el-option label="男" value="1" />
|
||||
<el-option label="女" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="日期:">
|
||||
@ -47,14 +47,16 @@
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="佩戴时间:">
|
||||
<el-date-picker
|
||||
v-model="queryParams.wearTime"
|
||||
type="datetime"
|
||||
placeholder="选择时间"
|
||||
style="width: 180px"
|
||||
value-format="YYYY-MM-DD HH:mm"
|
||||
/>
|
||||
<el-form-item label="状态:">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
style="width: 140px"
|
||||
>
|
||||
<el-option label="已申请" value="1" />
|
||||
<el-option label="未申请" value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"> <Icon icon="ep:search" />搜索 </el-button>
|
||||
@ -68,10 +70,7 @@
|
||||
|
||||
<!-- 数据表格区 -->
|
||||
<el-card class="table-card" shadow="never" style="margin-top: 16px">
|
||||
<div style="margin-bottom: 16px; color: #666">
|
||||
共找到 <span style="color: #409eff; font-weight: bold">{{ tableData.length }}</span> 条记录
|
||||
</div>
|
||||
<el-table :data="tableData" border stripe style="width: 100%">
|
||||
<el-table v-loading="loading" :data="tableData" border stripe style="width: 100%">
|
||||
<el-table-column type="index" label="序号" align="center" min-width="60" />
|
||||
<el-table-column prop="name" label="姓名" align="center" min-width="90" />
|
||||
<el-table-column prop="gender" label="性别" align="center" min-width="60">
|
||||
@ -80,7 +79,37 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="age" label="年龄" align="center" min-width="60" />
|
||||
<el-table-column prop="wearTime" label="佩戴时间" align="center" min-width="120" />
|
||||
<el-table-column prop="measureTime" label="佩戴时间" align="center" min-width="180">
|
||||
<template #default="{ row, $index }">
|
||||
<!-- 编辑状态 -->
|
||||
<div v-if="row.editingMeasureTime" style="display: flex; align-items: center; gap: 8px">
|
||||
<el-date-picker
|
||||
v-model="row.measureTime"
|
||||
type="datetime"
|
||||
placeholder="选择时间"
|
||||
size="small"
|
||||
style="width: 130px"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
/>
|
||||
<el-button type="primary" size="small" @click="saveMeasureTime(row, $index)" link>
|
||||
<Icon icon="ep:check" />
|
||||
</el-button>
|
||||
<el-button size="small" @click="cancelEditMeasureTime(row, $index)" link>
|
||||
<Icon icon="ep:close" />
|
||||
</el-button>
|
||||
</div>
|
||||
<!-- 显示状态 -->
|
||||
<div
|
||||
v-else
|
||||
style="display: flex; align-items: center; justify-content: center; gap: 8px"
|
||||
>
|
||||
<span>{{ formatMeasureTime(row.measureTime) }}</span>
|
||||
<el-button type="primary" size="small" @click="editMeasureTime(row, $index)" link>
|
||||
<Icon icon="ep:edit" />
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="device" label="设备" align="center" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<!-- 编辑状态 -->
|
||||
@ -111,7 +140,7 @@
|
||||
v-else
|
||||
style="display: flex; align-items: center; justify-content: center; gap: 8px"
|
||||
>
|
||||
<span>{{ getDeviceLabel(row.device) }}</span>
|
||||
<span>{{ getDeviceLabel(row.devicename) }}</span>
|
||||
<el-button type="primary" size="small" @click="editDevice(row, $index)" link>
|
||||
<Icon icon="ep:edit" />
|
||||
</el-button>
|
||||
@ -129,9 +158,12 @@
|
||||
<el-link type="primary" @click="onViewReport(row)">查看</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="申请" align="center" min-width="70">
|
||||
<template #default>
|
||||
<el-link type="success" :underline="false" disabled>已申请</el-link>
|
||||
<el-table-column prop="status" label="状态" align="center" min-width="70">
|
||||
<template #default="{ row }">
|
||||
<el-link v-if="row.status === 1" type="success" :underline="false" disabled>
|
||||
已申请
|
||||
</el-link>
|
||||
<el-link v-else type="primary" @click="handleApply(row)"> 申请 </el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -151,6 +183,7 @@
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Icon } from '@/components/Icon'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import AnalysisDialog from './analysis.vue'
|
||||
import PatientSelect from '@/patientcom/index.vue'
|
||||
import { abpmApi, abpmVO } from '@/api/abpm'
|
||||
@ -167,8 +200,12 @@ const queryParams = reactive({
|
||||
name: '',
|
||||
gender: '',
|
||||
dateRange: [],
|
||||
wearTime: '',
|
||||
device: ''
|
||||
measuretime: '',
|
||||
status: '',
|
||||
device: '',
|
||||
orgid: '',
|
||||
orgname: '',
|
||||
age: ''
|
||||
})
|
||||
|
||||
// 表格数据
|
||||
@ -199,6 +236,21 @@ const getDeviceLabel = (value: string) => {
|
||||
return found ? found.label : value
|
||||
}
|
||||
|
||||
// 时间格式化函数
|
||||
const formatMeasureTime = (time: any) => {
|
||||
if (!time) return ''
|
||||
|
||||
// 如果是时间戳(数字),先转换为Date对象
|
||||
if (typeof time === 'number') {
|
||||
// 判断是否为毫秒时间戳
|
||||
const timestamp = time.toString().length === 13 ? time : time * 1000
|
||||
return formatDate(new Date(timestamp), 'YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
|
||||
// 如果是字符串或已经是Date对象,直接格式化
|
||||
return formatDate(new Date(time), 'YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
|
||||
// 获取列表数据
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
@ -223,11 +275,8 @@ const resetQuery = () => {
|
||||
Object.assign(queryParams, {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: '',
|
||||
gender: '',
|
||||
dateRange: [],
|
||||
wearTime: '',
|
||||
device: ''
|
||||
measuretime: ''
|
||||
})
|
||||
getList()
|
||||
}
|
||||
@ -254,10 +303,23 @@ const editDevice = (row: any, index: number) => {
|
||||
row.editingDevice = true
|
||||
}
|
||||
|
||||
const saveDevice = (row: any, index: number) => {
|
||||
row.editingDevice = false
|
||||
delete row.originalDevice
|
||||
ElMessage.success(`已更新设备为:${getDeviceLabel(row.device)}`)
|
||||
const saveDevice = async (row: any, index: number) => {
|
||||
try {
|
||||
// 调用API更新设备信息
|
||||
const updateData = { ...row }
|
||||
await abpmApi.updateabpm(updateData)
|
||||
|
||||
row.editingDevice = false
|
||||
delete row.originalDevice
|
||||
ElMessage.success(`已更新设备为:${getDeviceLabel(row.device)}`)
|
||||
} catch (error) {
|
||||
console.error('更新设备失败:', error)
|
||||
ElMessage.error('更新设备失败,请重试')
|
||||
// 恢复原始值
|
||||
if (row.originalDevice !== undefined) {
|
||||
row.device = row.originalDevice
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const cancelEditDevice = (row: any, index: number) => {
|
||||
@ -269,9 +331,47 @@ const cancelEditDevice = (row: any, index: number) => {
|
||||
delete row.originalDevice
|
||||
}
|
||||
|
||||
// 佩戴时间编辑相关方法
|
||||
const editMeasureTime = (row: any, index: number) => {
|
||||
// 保存原始值,用于取消时恢复
|
||||
row.originalMeasureTime = row.measureTime
|
||||
row.editingMeasureTime = true
|
||||
}
|
||||
|
||||
const saveMeasureTime = async (row: any, index: number) => {
|
||||
try {
|
||||
// 将佩戴时间转换为时间戳
|
||||
const measureTimeTimestamp = row.measureTime ? new Date(row.measureTime).getTime() : null
|
||||
|
||||
// 调用API更新佩戴时间
|
||||
const updateData = { ...row, measureTime: measureTimeTimestamp }
|
||||
await abpmApi.updateabpm(updateData)
|
||||
|
||||
row.editingMeasureTime = false
|
||||
delete row.originalMeasureTime
|
||||
ElMessage.success(`已更新佩戴时间为:${formatMeasureTime(row.measureTime)}`)
|
||||
} catch (error) {
|
||||
console.error('更新佩戴时间失败:', error)
|
||||
ElMessage.error('更新佩戴时间失败,请重试')
|
||||
// 恢复原始值
|
||||
if (row.originalMeasureTime !== undefined) {
|
||||
row.measureTime = row.originalMeasureTime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const cancelEditMeasureTime = (row: any, index: number) => {
|
||||
// 恢复原始值
|
||||
if (row.originalMeasureTime !== undefined) {
|
||||
row.measureTime = row.originalMeasureTime
|
||||
}
|
||||
row.editingMeasureTime = false
|
||||
delete row.originalMeasureTime
|
||||
}
|
||||
|
||||
const onAnalyze = (row: any) => {
|
||||
// 打开分析弹窗
|
||||
analysisDialogRef.value?.open()
|
||||
// 打开分析弹窗并传递患者数据
|
||||
analysisDialogRef.value?.open(row)
|
||||
}
|
||||
const onViewReport = (row: any) => {
|
||||
ElMessage.success(`查看报告:${row.name}`)
|
||||
@ -279,6 +379,23 @@ const onViewReport = (row: any) => {
|
||||
const onSetting = (row: any) => {
|
||||
ElMessage.success(`设置:${row.name}`)
|
||||
}
|
||||
|
||||
// 申请处理函数
|
||||
const handleApply = async (row: any) => {
|
||||
try {
|
||||
// 更新状态为已申请
|
||||
const updateData = { ...row, status: 1 }
|
||||
await abpmApi.updateabpm(updateData)
|
||||
|
||||
// 更新本地数据
|
||||
row.status = 1
|
||||
|
||||
ElMessage.success(`${row.name} 申请成功`)
|
||||
} catch (error) {
|
||||
console.error('申请失败:', error)
|
||||
ElMessage.error('申请失败,请重试')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@ -12,70 +12,70 @@
|
||||
<div class="info-section">
|
||||
<div class="info-item">
|
||||
<span class="label">姓名:</span>
|
||||
<span class="value">张晓宇</span>
|
||||
<span class="value">{{ patientData.name }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">性别:</span>
|
||||
<span class="value">男</span>
|
||||
<span class="value">{{ patientData.gender }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">年龄:</span>
|
||||
<span class="value">45</span>
|
||||
<span class="value">{{ patientData.age }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">记录开始时间:</span>
|
||||
<span class="value">2025-07-09 10:31</span>
|
||||
<span class="value">{{ patientData.recordStartTime }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">记录结束时间:</span>
|
||||
<span class="value">2025-07-10 09:31</span>
|
||||
<span class="value">{{ patientData.recordEndTime }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">记录总时长:</span>
|
||||
<span class="value">23:00</span>
|
||||
<span class="value">{{ patientData.recordDuration }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">成功读取次数:</span>
|
||||
<span class="value">39</span>
|
||||
<span class="value">{{ patientData.successReadCount }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">成功读取百分比:</span>
|
||||
<span class="value">100%</span>
|
||||
<span class="value">{{ patientData.successReadPercent }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">最高收缩压:</span>
|
||||
<span class="value">245 mmHg</span>
|
||||
<span class="desc">(09日 20:02)</span>
|
||||
<span class="value">{{ patientData.maxSystolic }} mmHg</span>
|
||||
<span class="desc">({{ patientData.maxSystolicTime }})</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">最低收缩压:</span>
|
||||
<span class="value">194 mmHg</span>
|
||||
<span class="desc">(09日 20:02)</span>
|
||||
<span class="value">{{ patientData.minSystolic }} mmHg</span>
|
||||
<span class="desc">({{ patientData.minSystolicTime }})</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">血压变异系数:</span>
|
||||
<span class="value">20.89%</span>
|
||||
<span class="value">{{ patientData.systolicVariability }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">舒张压变异系数:</span>
|
||||
<span class="value">28.16%</span>
|
||||
<span class="value">{{ patientData.diastolicVariability }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">最低舒张压:</span>
|
||||
<span class="value">76 mmHg</span>
|
||||
<span class="desc">(09日 18:42)</span>
|
||||
<span class="value">{{ patientData.minDiastolic }} mmHg</span>
|
||||
<span class="desc">({{ patientData.minDiastolicTime }})</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">平均收缩压:</span>
|
||||
<span class="value">151</span>
|
||||
<span class="value">{{ patientData.avgSystolic }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">平均舒张压:</span>
|
||||
<span class="value">106</span>
|
||||
<span class="value">{{ patientData.avgDiastolic }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">血压高峰概率:</span>
|
||||
<span class="value">56.41%</span>
|
||||
<span class="value">{{ patientData.bloodPressurePeakProbability }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -138,7 +138,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, defineExpose, nextTick } from 'vue'
|
||||
import { ref, defineExpose, nextTick, reactive } from 'vue'
|
||||
import type { EChartsOption } from 'echarts'
|
||||
import { Echart } from '@/components/Echart'
|
||||
import { Loading } from '@element-plus/icons-vue'
|
||||
@ -151,6 +151,32 @@ const showChart = ref(false)
|
||||
// 筛选模式
|
||||
const chartMode = ref<'all' | 'bp' | 'hr'>('all')
|
||||
|
||||
// 患者数据状态
|
||||
const patientData = reactive({
|
||||
name: '张晓宇',
|
||||
gender: '男',
|
||||
age: 45,
|
||||
recordStartTime: '2025-07-09 10:31',
|
||||
recordEndTime: '2025-07-10 09:31',
|
||||
recordDuration: '23:00',
|
||||
successReadCount: 39,
|
||||
successReadPercent: '100%',
|
||||
maxSystolic: 245,
|
||||
maxSystolicTime: '09日 20:02',
|
||||
minSystolic: 194,
|
||||
minSystolicTime: '09日 20:02',
|
||||
systolicVariability: '20.89%',
|
||||
diastolicVariability: '28.16%',
|
||||
minDiastolic: 76,
|
||||
minDiastolicTime: '09日 18:42',
|
||||
avgSystolic: 151,
|
||||
avgDiastolic: 106,
|
||||
bloodPressurePeakProbability: '56.41%',
|
||||
wearTime: '',
|
||||
device: '',
|
||||
orgname: ''
|
||||
})
|
||||
|
||||
// 分析结果内容
|
||||
const analysisResult =
|
||||
ref(`最高收缩压245mmHg,最低收缩压194mmHg,发生于09日 20:02; 最高舒张压119mmHg,发生于09日 10:31;最低舒张压76mmHg,发生于09日 18:42。
|
||||
@ -165,8 +191,13 @@ const analysisResult =
|
||||
4. 建议患者改善生活方式,包括低盐饮食、适量运动、控制体重。
|
||||
5. 定期复查24小时动态血压监测,评估治疗效果。`)
|
||||
|
||||
// 打开弹窗方法
|
||||
const open = () => {
|
||||
// 打开弹窗方法 - 增加数据参数
|
||||
const open = (rowData?: any) => {
|
||||
// 如果传入了数据,则更新患者信息
|
||||
if (rowData) {
|
||||
updatePatientData(rowData)
|
||||
}
|
||||
|
||||
visible.value = true
|
||||
showChart.value = false
|
||||
|
||||
@ -182,6 +213,49 @@ const open = () => {
|
||||
})
|
||||
}
|
||||
|
||||
// 更新患者数据的方法
|
||||
const updatePatientData = (rowData: any) => {
|
||||
// 更新基本信息
|
||||
patientData.name = rowData.name || '未知'
|
||||
patientData.gender = getGenderText(rowData.gender)
|
||||
patientData.age = rowData.age || '未知'
|
||||
patientData.wearTime = rowData.wearTime || '未知'
|
||||
patientData.device = rowData.device || '未知'
|
||||
patientData.orgname = rowData.orgname || '未知'
|
||||
|
||||
// 这里可以根据实际的数据结构来更新其他字段
|
||||
// 如果后端有提供血压数据,则使用真实数据,否则使用默认值
|
||||
if (rowData.abpmData) {
|
||||
patientData.recordStartTime = rowData.abpmData.recordStartTime || patientData.recordStartTime
|
||||
patientData.recordEndTime = rowData.abpmData.recordEndTime || patientData.recordEndTime
|
||||
patientData.recordDuration = rowData.abpmData.recordDuration || patientData.recordDuration
|
||||
patientData.successReadCount = rowData.abpmData.successReadCount || patientData.successReadCount
|
||||
patientData.successReadPercent =
|
||||
rowData.abpmData.successReadPercent || patientData.successReadPercent
|
||||
patientData.maxSystolic = rowData.abpmData.maxSystolic || patientData.maxSystolic
|
||||
patientData.maxSystolicTime = rowData.abpmData.maxSystolicTime || patientData.maxSystolicTime
|
||||
patientData.minSystolic = rowData.abpmData.minSystolic || patientData.minSystolic
|
||||
patientData.minSystolicTime = rowData.abpmData.minSystolicTime || patientData.minSystolicTime
|
||||
patientData.systolicVariability =
|
||||
rowData.abpmData.systolicVariability || patientData.systolicVariability
|
||||
patientData.diastolicVariability =
|
||||
rowData.abpmData.diastolicVariability || patientData.diastolicVariability
|
||||
patientData.minDiastolic = rowData.abpmData.minDiastolic || patientData.minDiastolic
|
||||
patientData.minDiastolicTime = rowData.abpmData.minDiastolicTime || patientData.minDiastolicTime
|
||||
patientData.avgSystolic = rowData.abpmData.avgSystolic || patientData.avgSystolic
|
||||
patientData.avgDiastolic = rowData.abpmData.avgDiastolic || patientData.avgDiastolic
|
||||
patientData.bloodPressurePeakProbability =
|
||||
rowData.abpmData.bloodPressurePeakProbability || patientData.bloodPressurePeakProbability
|
||||
}
|
||||
}
|
||||
|
||||
// 性别转换辅助函数
|
||||
const getGenderText = (gender: string) => {
|
||||
if (gender === '1') return '男'
|
||||
if (gender === '2') return '女'
|
||||
return gender || '未知'
|
||||
}
|
||||
|
||||
// 关闭弹窗方法
|
||||
const close = () => {
|
||||
visible.value = false
|
||||
|
||||
Loading…
Reference in New Issue
Block a user