Files
his/MD/design/EMR_MODULE_INTEGRATION_PLAN.md
chenqi 2a9f47bc5c chore(config): 更新开发环境配置并添加EMR集成文档
- 更新数据库连接URL从测试服务器切换到本地开发环境
- 修改Druid监控台登录用户名从healthlink-his到openhiss
- 更新Redis配置从集群模式切换到单机模式并调整端口设置
- 移除Flyway数据库迁移配置以简化开发环境初始化
- 删除应用上下文路径配置以使用根路径访问
- 添加医院信息系统技术对比分析文档
- 添加EMR模块集成实施计划文档
- 添加EMR数据同步使用指南文档
- 添加HIS系统选型对比文章文档
2026-06-22 09:00:54 +08:00

570 lines
16 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# EMR管理模块与门诊/住院病历打通 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use compose:subagent (recommended) or compose:execute to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 打通电子病历管理(归档/修订/时效/检索/完整性检查)与门诊医生工作站、住院医生工作站的数据流,实现自动触发和关联查看。
**Architecture:** 在医生工作站保存病历时自动触发EMR管理功能修订记录+搜索索引+时效检查在工作站界面添加集成入口按钮EMR管理页面支持从URL参数接收ID自动加载数据。
**Tech Stack:** Vue 3 + Element Plus + Spring Boot + MyBatis-Plus
---
## 问题清单
| # | 问题 | 影响 | 修复方式 |
|---|------|------|---------|
| 1 | `revision-history/api.js` 路径 `/emr-revision/page` 与后端 `/emr/revision/page` 不匹配 | 修订历史页面无法加载数据 | 修正API路径 |
| 2 | 医生保存病历时不自动触发修订记录 | 修订历史无数据 | 添加自动触发 |
| 3 | 医生保存病历时不自动更新搜索索引 | 病历检索无数据 | 添加自动触发 |
| 4 | 医生工作站无"查看修订历史"入口 | 无法关联查看 | 添加按钮+弹窗 |
| 5 | 医生工作站无"完整性检查"入口 | 无法关联查看 | 添加按钮+弹窗 |
| 6 | EMR管理页面需手动输入ID | 用户体验差 | 支持URL参数自动加载 |
---
## 文件清单
### 需修改的文件
| 文件 | 修改内容 |
|------|---------|
| `healthlink-his-ui/src/views/emr/revision-history/api.js` | 修正API路径 |
| `healthlink-his-server/.../emr/controller/EmrRevisionController.java` | 确认路径一致 |
| `healthlink-his-server/.../emr/controller/EmrSearchController.java` | 确认路径一致 |
| `healthlink-his-server/.../doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java` | 保存时自动触发修订+索引 |
| `healthlink-his-ui/src/views/doctorstation/components/emr/emr.vue` | 添加集成入口按钮 |
| `healthlink-his-ui/src/views/emr/revision-history/index.vue` | 支持URL参数 |
| `healthlink-his-ui/src/views/emr/archive/index.vue` | 支持URL参数 |
| `healthlink-his-ui/src/views/emr/timeliness/index.vue` | 支持URL参数 |
| `healthlink-his-ui/src/views/emr/completeness-check/index.vue` | 支持URL参数 |
| `healthlink-his-ui/src/views/emrsearch/index.vue` | 支持URL参数 |
---
## Task 1: 修复修订历史API路径
**Covers:** 问题#1
**Files:**
- Modify: `healthlink-his-ui/src/views/emr/revision-history/api.js`
- [ ] **Step 1: 读取当前文件确认问题**
```javascript
// 当前错误路径
export function getRevisionPage(p){return request({url:'/emr-revision/page',method:'get',params:p})}
export function getRevisionList(p){return request({url:'/emr-revision/list',method:'get',params:p})}
export function recordRevision(d){return request({url:'/emr-revision/record',method:'post',data:d})}
export function compareRevisions(id1,id2){return request({url:'/emr-revision/compare',method:'get',params:{revisionId1:id1,revisionId2:id2}})}
```
- [ ] **Step 2: 修正API路径**
```javascript
import request from '@/utils/request'
export function getRevisionPage(p){return request({url:'/emr/revision/page',method:'get',params:p})}
export function getRevisionList(emrId){return request({url:'/emr/revision/list/'+emrId,method:'get'})}
export function recordRevision(d){return request({url:'/emr/revision/record',method:'post',data:d})}
export function compareRevisions(id1,id2){return request({url:'/emr/revision/compare',method:'get',params:{revisionId1:id1,revisionId2:id2}})}
```
- [ ] **Step 3: 验证后端路径一致**
确认 `EmrRevisionController.java` 中:
- `@RequestMapping("/emr/revision")`
- `@GetMapping("/page")``/emr/revision/page`
- `@GetMapping("/list/{emrId}")``/emr/revision/list/{emrId}`
- `@PostMapping("/record")``/emr/revision/record`
- `@GetMapping("/compare")``/emr/revision/compare`
- [ ] **Step 4: Commit**
```bash
git add healthlink-his-ui/src/views/emr/revision-history/api.js
git commit -m "fix(emr): 修正修订历史API路径与后端对齐"
```
---
## Task 2: EMR管理页面支持URL参数自动加载
**Covers:** 问题#6
**Files:**
- Modify: `healthlink-his-ui/src/views/emr/revision-history/index.vue`
- Modify: `healthlink-his-ui/src/views/emr/archive/index.vue`
- Modify: `healthlink-his-ui/src/views/emr/timeliness/index.vue`
- Modify: `healthlink-his-ui/src/views/emr/completeness-check/index.vue`
- Modify: `healthlink-his-ui/src/views/emrsearch/index.vue`
- [ ] **Step 1: 修改 revision-history/index.vue 支持URL参数**
`<script setup>` 中添加:
```javascript
import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { getRevisionPage } from './api'
const route = useRoute()
const tableData = ref([])
const total = ref(0)
const q = ref({pageNo:1, pageSize:20, emrId:'', operatorName:''})
const loadData = async () => {
const r = await getRevisionPage(q.value)
tableData.value = r.data?.records || []
total.value = r.data?.total || 0
}
onMounted(() => {
// 支持URL参数自动加载
if (route.query.emrId) {
q.value.emrId = route.query.emrId
}
loadData()
})
```
- [ ] **Step 2: 修改 archive/index.vue 支持URL参数**
```javascript
import { useRoute } from 'vue-router'
const route = useRoute()
onMounted(() => {
if (route.query.encounterId) {
q.value.encounterId = route.query.encounterId
}
if (route.query.patientName) {
q.value.patientName = route.query.patientName
}
loadData()
loadStats()
})
```
- [ ] **Step 3: 修改 timeliness/index.vue 支持URL参数**
```javascript
import { useRoute } from 'vue-router'
const route = useRoute()
onMounted(() => {
if (route.query.encounterId) {
queryParams.encounterId = route.query.encounterId
}
if (route.query.departmentName) {
queryParams.departmentName = route.query.departmentName
}
getList()
})
```
- [ ] **Step 4: 修改 completeness-check/index.vue 支持URL参数**
```javascript
import { useRoute } from 'vue-router'
const route = useRoute()
onMounted(() => {
if (route.query.emrId) {
checkForm.emrId = route.query.emrId
}
if (route.query.encounterId) {
checkForm.encounterId = route.query.encounterId
}
// 如果有参数自动执行检查
if (checkForm.emrId && checkForm.encounterId) {
handleCheck()
}
})
```
- [ ] **Step 5: 修改 emrsearch/index.vue 支持URL参数**
```javascript
import { useRoute } from 'vue-router'
const route = useRoute()
onMounted(() => {
if (route.query.patientName) {
queryParams.patientName = route.query.patientName
}
if (route.query.emrType) {
queryParams.emrType = route.query.emrType
}
handleSearch()
})
```
- [ ] **Step 6: Commit**
```bash
git add healthlink-his-ui/src/views/emr/revision-history/index.vue \
healthlink-his-ui/src/views/emr/archive/index.vue \
healthlink-his-ui/src/views/emr/timeliness/index.vue \
healthlink-his-ui/src/views/emr/completeness-check/index.vue \
healthlink-his-ui/src/views/emrsearch/index.vue
git commit -m "feat(emr): EMR管理页面支持URL参数自动加载"
```
---
## Task 3: 医生工作站添加EMR集成入口
**Covers:** 问题#4, #5
**Files:**
- Modify: `healthlink-his-ui/src/views/doctorstation/components/emr/emr.vue`
- [ ] **Step 1: 读取 emr.vue 确认现有结构**
找到病历详情展示区域,在操作按钮区域添加集成入口。
- [ ] **Step 2: 添加集成按钮**
在病历详情弹窗或操作区域添加:
```vue
<template>
<!-- 在现有病历操作按钮区域添加 -->
<el-button type="info" link @click="viewRevisionHistory">
<el-icon><Document /></el-icon> 修订历史
</el-button>
<el-button type="info" link @click="viewArchiveStatus">
<el-icon><Folder /></el-icon> 归档状态
</el-button>
<el-button type="info" link @click="checkCompleteness">
<el-icon><Checked /></el-icon> 完整性检查
</el-button>
</template>
<script setup>
import { useRouter } from 'vue-router'
import { checkCompleteness as checkEmrCompleteness } from '@/api/emr'
import { ElMessage } from 'element-plus'
const router = useRouter()
// 当前病历数据从父组件传入或从store获取
const currentEmr = defineModel('emr', { type: Object, default: () => ({}) })
const viewRevisionHistory = () => {
if (!currentEmr.value?.id) {
ElMessage.warning('请先选择病历')
return
}
router.push({
path: '/emr/revision-history',
query: { emrId: currentEmr.value.id }
})
}
const viewArchiveStatus = () => {
if (!currentEmr.value?.encounterId) {
ElMessage.warning('请先选择病历')
return
}
router.push({
path: '/emr/archive',
query: {
encounterId: currentEmr.value.encounterId,
patientName: currentEmr.value.patientName
}
})
}
const checkCompleteness = async () => {
if (!currentEmr.value?.id || !currentEmr.value?.encounterId) {
ElMessage.warning('请先选择病历')
return
}
try {
const res = await checkEmrCompleteness(currentEmr.value.id, currentEmr.value.encounterId)
const data = res.data || res
if (data.isComplete) {
ElMessage.success('病历完整性检查通过')
} else {
ElMessage.warning(`病历完整性检查未通过,${data.requiredFailed}项必填项未填写`)
}
} catch (e) {
ElMessage.error('检查失败')
}
}
</script>
```
- [ ] **Step 3: 验证编译**
```bash
cd healthlink-his-ui && npm run build:dev
```
- [ ] **Step 4: Commit**
```bash
git add healthlink-his-ui/src/views/doctorstation/components/emr/emr.vue
git commit -m "feat(emr): 医生工作站添加修订历史/归档/完整性检查入口"
```
---
## Task 4: 住院医生工作站添加EMR集成入口
**Covers:** 问题#4, #5
**Files:**
- Modify: `healthlink-his-ui/src/views/inpatientDoctor/home/emr/index.vue`
- [ ] **Step 1: 读取住院EMR页面确认结构**
- [ ] **Step 2: 添加集成按钮**
```vue
<template>
<!-- 在现有病历操作按钮区域添加 -->
<el-button type="info" link @click="viewRevisionHistory">
修订历史
</el-button>
<el-button type="info" link @click="viewTimeliness">
时效监控
</el-button>
<el-button type="info" link @click="checkCompleteness">
完整性检查
</el-button>
</template>
<script setup>
import { useRouter } from 'vue-router'
import { checkCompleteness as checkEmrCompleteness } from '@/api/emr'
import { ElMessage } from 'element-plus'
const router = useRouter()
const currentEmr = defineModel('emr', { type: Object, default: () => ({}) })
const viewRevisionHistory = () => {
if (!currentEmr.value?.id) {
ElMessage.warning('请先选择病历')
return
}
router.push({
path: '/emr/revision-history',
query: { emrId: currentEmr.value.id }
})
}
const viewTimeliness = () => {
if (!currentEmr.value?.encounterId) {
ElMessage.warning('请先选择病历')
return
}
router.push({
path: '/emr/timeliness',
query: { encounterId: currentEmr.value.encounterId }
})
}
const checkCompleteness = async () => {
if (!currentEmr.value?.id || !currentEmr.value?.encounterId) {
ElMessage.warning('请先选择病历')
return
}
try {
const res = await checkEmrCompleteness(currentEmr.value.id, currentEmr.value.encounterId)
const data = res.data || res
if (data.isComplete) {
ElMessage.success('病历完整性检查通过')
} else {
ElMessage.warning(`病历完整性检查未通过,${data.requiredFailed}项必填项未填写`)
}
} catch (e) {
ElMessage.error('检查失败')
}
}
</script>
```
- [ ] **Step 3: 验证编译**
```bash
cd healthlink-his-ui && npm run build:dev
```
- [ ] **Step 4: Commit**
```bash
git add healthlink-his-ui/src/views/inpatientDoctor/home/emr/index.vue
git commit -m "feat(emr): 住院医生工作站添加修订历史/时效/完整性检查入口"
```
---
## Task 5: 保存病历时自动触发修订记录
**Covers:** 问题#2
**Files:**
- Modify: `healthlink-his-server/.../doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java`
- [ ] **Step 1: 读取现有保存逻辑**
找到 `saveEmr` 或类似方法,确认保存流程。
- [ ] **Step 2: 添加自动触发修订记录**
在保存EMR成功后添加
```java
@Resource
private IEmrRevisionService emrRevisionService;
// 在saveEmr方法中保存成功后添加
// 自动记录修订历史
EmrRevision revision = new EmrRevision();
revision.setEmrId(savedEmr.getId());
revision.setEncounterId(savedEmr.getEncounterId());
revision.setOperatorName(operatorName); // 从SecurityUtils获取
revision.setOperationType("SAVE");
revision.setSnapshotContent(savedEmr.getContextJson());
revision.setCreateTime(new Date());
emrRevisionService.save(revision);
```
- [ ] **Step 3: 验证编译**
```bash
mvn clean compile -DskipTests -pl healthlink-his-application
```
- [ ] **Step 4: Commit**
```bash
git add healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java
git commit -m "feat(emr): 保存病历时自动创建修订记录"
```
---
## Task 6: 保存病历时自动更新搜索索引
**Covers:** 问题#3
**Files:**
- Modify: `healthlink-his-server/.../doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java`
- [ ] **Step 1: 添加搜索索引服务注入**
```java
@Resource
private IEmrSearchIndexService emrSearchIndexService;
```
- [ ] **Step 2: 保存成功后自动更新索引**
```java
// 在saveEmr方法中保存成功后添加
// 自动更新搜索索引
EmrSearchIndex searchIndex = new EmrSearchIndex();
searchIndex.setEmrId(savedEmr.getId());
searchIndex.setEncounterId(savedEmr.getEncounterId());
searchIndex.setPatientName(patientName);
searchIndex.setEmrType(emrType);
searchIndex.setEmrTitle(title);
searchIndex.setDiagnosisText(diagnosis);
searchIndex.setDoctorName(doctorName);
searchIndex.setDepartmentName(departmentName);
searchIndex.setCreateTime(new Date());
// 检查是否已存在索引
LambdaQueryWrapper<EmrSearchIndex> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EmrSearchIndex::getEmrId, savedEmr.getId());
EmrSearchIndex existing = emrSearchIndexService.getOne(wrapper);
if (existing != null) {
existing.setPatientName(patientName);
existing.setEmrType(emrType);
existing.setEmrTitle(title);
existing.setDiagnosisText(diagnosis);
existing.setDoctorName(doctorName);
existing.setDepartmentName(departmentName);
existing.setUpdateTime(new Date());
emrSearchIndexService.updateById(existing);
} else {
emrSearchIndexService.save(searchIndex);
}
```
- [ ] **Step 3: 验证编译**
```bash
mvn clean compile -DskipTests -pl healthlink-his-application
```
- [ ] **Step 4: Commit**
```bash
git add healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java
git commit -m "feat(emr): 保存病历时自动更新搜索索引"
```
---
## Task 7: 全量验证
**Covers:** 全部问题
- [ ] **Step 1: 后端编译验证**
```bash
mvn clean compile -DskipTests
```
Expected: BUILD SUCCESS
- [ ] **Step 2: 前端编译验证**
```bash
cd healthlink-his-ui && npm run build:dev
```
Expected: Build successful
- [ ] **Step 3: 接口测试**
```bash
# 测试修订历史接口
curl http://localhost:18082/emr/revision/page?pageNo=1&pageSize=10
# 测试搜索接口
curl http://localhost:18082/emr-search/search?keyword=test
# 测试归档接口
curl http://localhost:18082/emr-archive/page?pageNo=1&pageSize=10
```
Expected: 返回 `{code:200, data:...}`
- [ ] **Step 4: 提交代码**
```bash
git add -A
git commit -m "feat(emr): 打通EMR管理模块与门诊/住院病历集成"
git push origin develop
```
---
## 验证检查清单
| 检查项 | 验证方式 | 预期结果 |
|--------|---------|---------|
| 修订历史API路径 | 访问 `/emr/revision/page` | 返回数据 |
| URL参数支持 | 访问 `/emr/revision-history?emrId=1` | 自动加载该病历修订记录 |
| 医生工作站入口 | 打开病历详情 | 显示修订历史/归档/完整性检查按钮 |
| 保存自动触发 | 保存病历后查询 `emr_revision` 表 | 有新记录 |
| 搜索索引更新 | 保存病历后查询 `emr_search_index` 表 | 有新记录 |
| 完整性检查 | 点击完整性检查按钮 | 显示检查结果 |
---
> **Plan Version:** v1.0
> **Created:** 2026-06-21
> **Estimated Effort:** 2-3小时