feat(emr): 添加EMR数据同步页面
- 新增同步统计显示(病历总数、修订历史、搜索索引) - 新增一键同步按钮,从doc_emr同步真实数据到修订历史和搜索索引 - 同步前有确认提示,防止误操作
This commit is contained in:
85
healthlink-his-ui/src/views/emr/sync/index.vue
Normal file
85
healthlink-his-ui/src/views/emr/sync/index.vue
Normal file
@@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<div style="padding:16px">
|
||||
<div style="margin-bottom:16px;display:flex;justify-content:space-between;align-items:center">
|
||||
<span style="font-size:18px;font-weight:bold">EMR数据同步</span>
|
||||
</div>
|
||||
|
||||
<el-card shadow="hover" style="margin-bottom:16px">
|
||||
<template #header>
|
||||
<span>同步统计</span>
|
||||
</template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-statistic title="病历总数" :value="stats.emrCount||0" />
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-statistic title="修订历史" :value="stats.revisionCount||0" />
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-statistic title="搜索索引" :value="stats.searchIndexCount||0" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="hover">
|
||||
<template #header>
|
||||
<span>数据同步操作</span>
|
||||
</template>
|
||||
<el-alert
|
||||
type="warning"
|
||||
show-icon
|
||||
style="margin-bottom:16px"
|
||||
>
|
||||
<template #title>
|
||||
同步操作将清空现有的修订历史和搜索索引数据,然后从门诊/住院病历表(doc_emr)重新生成。
|
||||
</template>
|
||||
</el-alert>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="syncing"
|
||||
@click="handleSync"
|
||||
>
|
||||
{{ syncing ? '同步中...' : '开始同步' }}
|
||||
</el-button>
|
||||
<el-button @click="loadStats">
|
||||
刷新统计
|
||||
</el-button>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref, onMounted} from 'vue'
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
import request from '@/utils/request'
|
||||
|
||||
const syncing = ref(false)
|
||||
const stats = ref({})
|
||||
|
||||
const loadStats = async () => {
|
||||
const res = await request({url: '/emr-sync/stats', method: 'get'})
|
||||
stats.value = res.data || {}
|
||||
}
|
||||
|
||||
const handleSync = async () => {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
'确定要同步EMR数据吗?这将清空现有的修订历史和搜索索引,然后从病历表重新生成。',
|
||||
'确认同步',
|
||||
{type: 'warning'}
|
||||
)
|
||||
syncing.value = true
|
||||
const res = await request({url: '/emr-sync/sync', method: 'post'})
|
||||
ElMessage.success(res.data || '同步完成')
|
||||
loadStats()
|
||||
} catch (e) {
|
||||
if (e !== 'cancel') {
|
||||
ElMessage.error('同步失败: ' + (e.message || '未知错误'))
|
||||
}
|
||||
} finally {
|
||||
syncing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => loadStats())
|
||||
</script>
|
||||
Reference in New Issue
Block a user