diff --git a/src/api/cgm/index.ts b/src/api/cgm/index.ts index 8d2cb00..7aee33b 100644 --- a/src/api/cgm/index.ts +++ b/src/api/cgm/index.ts @@ -1,4 +1,5 @@ import request from '@/config/axios' +import { patientinfoVO } from '../patientinfo' // CGM数据 VO export interface CgmVO { @@ -50,5 +51,26 @@ export const CgmApi = { // 导出CGM数据 Excel exportCgm: async (params) => { return await request.download({ url: `/system/cgm/export-excel`, params }) + }, + + // 批量新增CGM患者数据 + insertCgmPatientData: async (data: patientinfoVO[]) => { + return await request.post({ url: `/system/cgm/insertCgmPatientData`, data }) + }, + + //根据examid更新CGM动态血糖监测分析结果 + updatecgmanalysis: async (examid: string, analysisResult: string) => { + return await request.put({ + url: `/system/cgm/updatecgmanalysis`, + params: { + examid, + analysisResult + } + }) + }, + + //根据examid查询CGM动态血糖监测分析结果 + getcgmanalysis: async (examid: string) => { + return await request.get({ url: `/system/cgm/getcgmanalysis`, params: { examid } }) } -} \ No newline at end of file +} diff --git a/src/api/cgmdata/index.ts b/src/api/cgmdata/index.ts index 9afe536..3c120e9 100644 --- a/src/api/cgmdata/index.ts +++ b/src/api/cgmdata/index.ts @@ -44,5 +44,9 @@ export const CgmdataApi = { // 导出CGM动态血糖数据 Excel exportCgmdata: async (params) => { return await request.download({ url: `/system/cgmdata/export-excel`, params }) + }, + // 查询CGM数据统计 + getCgmStatistics: async (params: any) => { + return await request.get({ url: `/system/cgmdata/CgmStatistics`, params }) } -} \ No newline at end of file +} diff --git a/src/patientcom/index.vue b/src/patientcom/index.vue index 8137c81..3df3762 100644 --- a/src/patientcom/index.vue +++ b/src/patientcom/index.vue @@ -207,6 +207,7 @@ import { patientinfoApi, patientinfoVO } from '@/api/patientinfo' import { getUserProfile, ProfileVO } from '@/api/system/user/profile' import { Search, Refresh, Delete } from '@element-plus/icons-vue' import { StaticecgApi } from '@/api/staticecg' +import { CgmApi } from '@/api/cgm/index' const message = useMessage() // 消息弹窗 @@ -358,6 +359,10 @@ const handleConfirm = async () => { // 批量新增ECG患者数据 await StaticecgApi.insertEcgPatientData(selectedPatients.value) } + if (props.type === 'cgm') { + // 批量新增CGM患者数据 + await CgmApi.insertCgmPatientData(selectedPatients.value) + } handleCancel() } catch (error) { message.error('操作失败,请重试') diff --git a/src/views/analysis/ABPM/ABPM.vue b/src/views/analysis/ABPM/ABPM.vue index ee11874..5ad0288 100644 --- a/src/views/analysis/ABPM/ABPM.vue +++ b/src/views/analysis/ABPM/ABPM.vue @@ -193,6 +193,8 @@ import PatientSelect from '@/patientcom/index.vue' import { abpmApi, abpmVO } from '@/api/abpm' import { getUserProfile } from '@/api/system/user/profile' import { OrgApi } from '@/api/org' +import { AbpmdataApi } from '@/api/abpmdata' +import dayjs from 'dayjs' const loading = ref(false) const analysisDialogRef = ref() @@ -401,7 +403,7 @@ const cancelEditMeasureTime = (row: any, index: number) => { delete row.originalMeasureTime } -const onAnalyze = (row: any) => { +const onAnalyze = async (row: any) => { // 传递完整的患者信息和检查数据 const params = { examid: row.examid, @@ -415,7 +417,19 @@ const onAnalyze = (row: any) => { age: row.age, orgname: row.orgname } - analysisDialogRef.value?.open(params) + const data = { + examid: row.examid, + regid: row.regid, + deviceid: row.deviceid, + devicename: row.devicename, + weartime: dayjs(row.weartime).format('YYYY-MM-DD HH:mm:ss') + } + const res = await AbpmdataApi.getAbpmdataStatistics(data) + if (res && res.length > 0) { + analysisDialogRef.value?.open(params) + } else { + ElMessage.error('暂无数据') + } } const onViewReport = (row: any) => { ElMessage.success(`查看报告:${row.name}`) diff --git a/src/views/analysis/CGM.vue b/src/views/analysis/CGM.vue deleted file mode 100644 index e69de29..0000000 diff --git a/src/views/analysis/CGM/CGM.vue b/src/views/analysis/CGM/CGM.vue new file mode 100644 index 0000000..562350a --- /dev/null +++ b/src/views/analysis/CGM/CGM.vue @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 搜索 + 重置 + 选择患者 + + + + + + + + + + + + {{ row.gender === '1' ? '男' : row.gender === '2' ? '女' : '未知' }} + + + + + {{ row.age + '岁' }} + + + + + + + + + + + + + + + + + {{ formatTime(row.weartime) }} + + + + + + + + + + + + + + + + + + + + + + + {{ row.devicename }} + + + + + + + + + + 分析 + + + + + 查看 + + + + + 已申请 + 申请 + + + + + + + + + + + + diff --git a/src/views/analysis/CGM/CGM_analysis.vue b/src/views/analysis/CGM/CGM_analysis.vue new file mode 100644 index 0000000..23d845f --- /dev/null +++ b/src/views/analysis/CGM/CGM_analysis.vue @@ -0,0 +1,1472 @@ + + + + + + + 姓名: + {{ patientData.name }} + + + 性别: + {{ patientData.gender }} + + + 年龄: + {{ patientData.age }} + + + 机构: + {{ patientData.orgname }} + + + 设备: + {{ patientData.device }} + + + 佩戴时间: + {{ patientData.wearTime }} + + + + + + + + + + + 白天血糖分布 (8:00-22:00) + + + + + 图表加载中... + + + + + 夜间血糖分布 (22:00-8:00) + + + + + 图表加载中... + + + + + 全天血糖分布 (00:00-24:00) + + + + + 图表加载中... + + + + + + + + + + + + + + + + + {{ scope.row.status }} + + + + + + + + + + + + + + + + + 分析结果 + + + + + 保存 + 关闭 + 报告浏览 + + + + + + + + + diff --git a/src/views/analysis/ECG/ECG.vue b/src/views/analysis/ECG/ECG.vue index d4f948b..93176a5 100644 --- a/src/views/analysis/ECG/ECG.vue +++ b/src/views/analysis/ECG/ECG.vue @@ -88,13 +88,71 @@ - - {{ formatTime(row.weartime) }} + + + + + + + + + + + + + + {{ formatTime(row.weartime) }} + + + + - - {{ row.devicename }} + + + + + + + + + + + + + + + + {{ row.devicename }} + + + + @@ -136,8 +194,9 @@ import ECGWorkstation from './ECG_workstation.vue' import { StaticecgApi, StaticecgVO } from '@/api/staticecg' import { getUserProfile } from '@/api/system/user/profile' import { OrgApi } from '@/api/org' -import { Search, Refresh, Plus } from '@element-plus/icons-vue' +import { Search, Refresh, Plus, Edit, Check, Close } from '@element-plus/icons-vue' import dayjs from 'dayjs' +import { StaticdataApi } from '@/api/staticdata' const loading = ref(false) const total = ref(0) @@ -161,8 +220,12 @@ const tableData = ref([]) const patientSelectRef = ref() const ecgWorkstationRef = ref() +// 设备列表 +const deviceList = ref([]) + onMounted(() => { getList() + getDeviceList() }) // 获取列表数据 @@ -206,6 +269,27 @@ const getList = async () => { } } +// 获取设备列表 +const getDeviceList = async () => { + try { + // 测试数据(如接口不可用时使用) + const testData = [ + { id: '1001', deviceName: '心电设备-1001' }, + { id: '1002', deviceName: '心电设备-1002' }, + { id: '1003', deviceName: '心电设备-1003' } + ] + deviceList.value = testData + } catch (error) { + console.error('获取设备列表失败:', error) + deviceList.value = [ + { id: '1001', deviceName: '心电设备-1001' }, + { id: '1002', deviceName: '心电设备-1002' }, + { id: '1003', deviceName: '心电设备-1003' } + ] + ElMessage.error('获取设备列表失败,已加载测试数据') + } +} + // 查询、重置、选择患者等方法 const handleQuery = () => { queryParams.pageNo = 1 @@ -246,19 +330,26 @@ const handlePatientConfirm = async (selectedPatients: any[]) => { const handlePatientCancel = () => { handleQuery() } - -const onAnalyze = (row: any) => { - // 打开ECG分析工作站 - ecgWorkstationRef.value?.open(row) +// 分析功能 +const onAnalyze = async (row: any) => { + const res = await StaticdataApi.getStaticdataByExamidAndRegid(row.examid, row.regid) + if (res) { + ecgWorkstationRef.value?.open(row) + } else { + ElMessage.error('暂无数据') + } } +// 查看报告功能 const onViewReport = (row: any) => { ElMessage.success(`查看报告:${row.name}`) } +// 申请功能 const handleApply = async (row: any) => { try { - cc + const userinfo = await getUserProfile() + const orginfo = await OrgApi.getOrg(userinfo.orgid) if (orginfo.parentOrgId != null) { const updateData = { ...row, status: 1, managerorg: orginfo.parentOrgId } await StaticecgApi.updateStaticecg(updateData) @@ -279,6 +370,70 @@ const formatTime = (timestamp: number | string) => { const ts = typeof timestamp === 'string' ? parseInt(timestamp) : timestamp return dayjs(ts).isValid() ? dayjs(ts).format('YYYY-MM-DD HH:mm:ss') : timestamp } + +// 编辑佩戴时间 +const editMeasureTime = (row: any, index: number) => { + row.editingMeasureTime = true + row.originalWeartime = row.weartime // 保存原始值 +} + +// 保存佩戴时间 +const saveMeasureTime = async (row: any, index: number) => { + if (!row.weartime) { + ElMessage.error('佩戴时间不能为空') + return + } + try { + // 转换为时间戳(毫秒) + const timestamp = + typeof row.weartime === 'string' ? new Date(row.weartime).getTime() : row.weartime + await StaticecgApi.updateStaticecg({ ...row, weartime: timestamp }) + row.weartime = timestamp // 本地也同步为时间戳 + ElMessage.success('佩戴时间更新成功') + row.editingMeasureTime = false + getList() + } catch (error) { + console.error('更新佩戴时间失败:', error) + ElMessage.error('更新佩戴时间失败,请重试') + row.weartime = row.originalWeartime // 恢复原始值 + } +} + +// 取消编辑佩戴时间 +const cancelEditMeasureTime = (row: any, index: number) => { + row.weartime = row.originalWeartime + row.editingMeasureTime = false +} + +// 编辑设备 +const editDevice = (row: any, index: number) => { + row.editingDevice = true + row.originalDeviceId = row.deviceid // 保存原始值 +} + +// 保存设备 +const saveDevice = async (row: any, index: number) => { + if (!row.deviceid) { + ElMessage.error('设备不能为空') + return + } + try { + await StaticecgApi.updateStaticecg(row) + ElMessage.success('设备更新成功') + row.editingDevice = false + getList() + } catch (error) { + console.error('更新设备失败:', error) + ElMessage.error('更新设备失败,请重试') + row.deviceid = row.originalDeviceId // 恢复原始值 + } +} + +// 取消编辑设备 +const cancelEditDevice = (row: any, index: number) => { + row.deviceid = row.originalDeviceId + row.editingDevice = false +}