This commit is contained in:
lxd 2025-07-15 16:32:52 +08:00
commit 2c21ec062f
2 changed files with 244 additions and 53 deletions

View File

@ -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>

View File

@ -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