fix(#626): 请修复 Bug #626:【门诊医生工作站-待写病历】操作字段的列表下的按钮功能未实现

根因:
- Bug #请修复 Bug #626 存在的问题

修复:
- 修改文件:2 个**
- | 文件 | 修改内容 |
- |---|---|
- | `src/views/doctorstation/pendingEmr.vue` | 重写两个按钮的实际逻辑 + 新增患者详情弹窗 |
- | `src/views/doctorstation/index.vue` | 支持从待写病历页面跳转时自动选中患者 |
- "写病历"按钮** (`pendingEmr.vue:225-232`)
- 通过 `router.push` 跳转到 `/doctorstation/index?encounterId=XXX`
- 传递患者的 `encounterId`,让医生工作站自动加载该患者并打开病历编辑
- "查看患者"按钮** (`pendingEmr.vue:235-255`)
- 调用 `getPatientDetails(encounterId)` API 获取患者详情
- 弹出 `el-dialog` 展示患者信息(姓名、性别、年龄、病历号、身份证、电话、地址、挂号时间、就诊科室)
- API 异常时降级使用列表行数据展示
- 医生工作站自动选中** (`doctorstation/index.vue:626-639`)
- `getPatientList` 加载完成后,检查 URL 中的 `encounterId` 参数
- 自动调用 `handleCardClick` 选中对应患者
- 选中后清除 URL 参数,避免刷新时重复触发
- ### 全链路 6 环分析
- | 环节 | 状态 | 说明 |
- |---|---|---|
- | ① 录入 |  正常 | 待写病历列表正确展示患者数据 |
- | ② 保存 |  正常 | 不涉及数据写入,仅页面跳转/弹窗 |
- | ③ 查询 |  正常 | `getPatientDetails` API 已存在,调用正常 |
- | ④ 修改 |  不涉及 | 不涉及数据修改 |
- | ⑤ 删除 |  不涉及 | 不涉及数据删除 |
- | ⑥ 关联 |  正常 | 跳转到医生工作站后可正常写病历,不影响其他模块 |
- ### 验证结果
-  Vite build 成功(1m 51s,无新增错误)
-  ESLint 通过(0 errors, 0 warnings)
This commit is contained in:
2026-05-31 10:28:27 +08:00
parent f051dfe896
commit a139b790e0
2 changed files with 106 additions and 34 deletions

View File

@@ -443,7 +443,7 @@ import { nextTick } from 'vue';
import { updatePatientInfo } from './components/store/patient.js'; import { updatePatientInfo } from './components/store/patient.js';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElMessage, ElMessageBox } from 'element-plus';
import { useRoute } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
// // 监听路由离开事件 // // 监听路由离开事件
// onBeforeRouteLeave((to, from, next) => { // onBeforeRouteLeave((to, from, next) => {
@@ -460,6 +460,7 @@ defineOptions({
}); });
const route = useRoute(); const route = useRoute();
const router = useRouter();
// 监听路由参数变化 // 监听路由参数变化
watch( watch(
@@ -621,6 +622,21 @@ function getPatientList() {
active: currentEncounterId.value ? item.encounterId == currentEncounterId.value : false, active: currentEncounterId.value ? item.encounterId == currentEncounterId.value : false,
}; };
}); });
// Bug #626: 从待写病历页面跳转过来时,自动选中对应患者
const targetEncounterId = route.query.encounterId;
if (targetEncounterId && patientList.value.length > 0) {
const targetIndex = patientList.value.findIndex(
(item) => String(item.encounterId) === String(targetEncounterId)
);
if (targetIndex !== -1) {
handleCardClick(patientList.value[targetIndex], targetIndex);
}
// 清除URL参数避免刷新时重复选中
if (route.query.encounterId) {
router.replace({ query: {} });
}
}
}); });
} }
function setVisitType(type) { function setVisitType(type) {

View File

@@ -129,23 +129,79 @@
:total="total" :total="total"
@pagination="getList" @pagination="getList"
/> />
<!-- 患者详情弹窗 -->
<el-dialog
v-model="patientDetailVisible"
title="患者详情"
width="700px"
destroy-on-close
>
<el-descriptions
v-if="patientDetailData"
:column="2"
border
>
<el-descriptions-item label="患者姓名">
{{ patientDetailData.patientName || '-' }}
</el-descriptions-item>
<el-descriptions-item label="性别">
{{ getGenderText(patientDetailData.gender) }}
</el-descriptions-item>
<el-descriptions-item label="年龄">
{{ patientDetailData.age || '-' }}
</el-descriptions-item>
<el-descriptions-item label="病历号">
{{ patientDetailData.busNo || '-' }}
</el-descriptions-item>
<el-descriptions-item label="身份证号">
{{ patientDetailData.idCard || '-' }}
</el-descriptions-item>
<el-descriptions-item label="联系电话">
{{ patientDetailData.phone || '-' }}
</el-descriptions-item>
<el-descriptions-item
label="地址"
:span="2"
>
{{ patientDetailData.address || '-' }}
</el-descriptions-item>
<el-descriptions-item label="挂号时间">
{{ parseTime(patientDetailData.registerTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
</el-descriptions-item>
<el-descriptions-item label="就诊科室">
{{ patientDetailData.organizationName || '-' }}
</el-descriptions-item>
</el-descriptions>
<template #footer>
<el-button @click="patientDetailVisible = false">
关闭
</el-button>
</template>
</el-dialog>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted } from 'vue' import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { useRouter } from 'vue-router'
import { listPendingEmr, getPendingEmrCount } from '@/views/doctorstation/components/api.js' import { ElMessage } from 'element-plus'
import { listPendingEmr, getPatientDetails } from '@/views/doctorstation/components/api.js'
import { parseTime } from '@/utils/index.js' import { parseTime } from '@/utils/index.js'
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import { Document, Refresh, Search, Delete } from '@element-plus/icons-vue' import { Document, Refresh, Search, Delete } from '@element-plus/icons-vue'
import { ElDivider } from 'element-plus'
const router = useRouter()
// 响应式数据 // 响应式数据
const loading = ref(true) const loading = ref(true)
const total = ref(0) const total = ref(0)
const emrList = ref([]) const emrList = ref([])
// 患者详情弹窗
const patientDetailVisible = ref(false)
const patientDetailData = ref(null)
// 查询参数 // 查询参数
const queryParams = reactive({ const queryParams = reactive({
pageNum: 1, pageNum: 1,
@@ -208,40 +264,40 @@ const handleRowClick = (row) => {
console.log('点击行:', row) console.log('点击行:', row)
} }
// 写病历 // 写病历 - 跳转到医生工作站并自动选中该患者
const handleWriteEmr = (row) => { const handleWriteEmr = (row) => {
console.log('写病历:', row) if (!row.encounterId) {
// 弹出写病历弹窗 ElMessage.error('患者就诊信息不完整,无法写病历')
ElMessageBox.confirm('确定要为患者 ' + row.patientName + ' 写病历吗?', '确认', { return
confirmButtonText: '确定', }
cancelButtonText: '取消', router.push({
type: 'info' path: '/doctorstation/index',
}).then(() => { query: { encounterId: row.encounterId }
// 这里可以跳转到病历编辑页面或弹出病历编辑弹窗
ElMessage.success('正在打开病历编辑页面...')
// TODO: 实现写病历的具体逻辑
// 例如router.push({ path: '/doctorstation/emr', query: { encounterId: row.encounterId } })
}).catch(() => {
// 取消操作
}) })
} }
// 查看患者 // 查看患者 - 弹窗显示患者详情
const handleViewPatient = (row) => { const handleViewPatient = async (row) => {
console.log('查看患者:', row) if (!row.encounterId) {
// 弹出查看患者弹窗 ElMessage.error('患者就诊信息不完整')
ElMessageBox.confirm('确定要查看患者 ' + row.patientName + ' 的详细信息吗?', '确认', { return
confirmButtonText: '确定', }
cancelButtonText: '取消', try {
type: 'info' const response = await getPatientDetails(row.encounterId)
}).then(() => { if (response.code === 200) {
// 这里可以跳转到患者详情页面或弹出患者详情弹窗 patientDetailData.value = response.data || row
ElMessage.success('正在打开患者详情页面...') patientDetailVisible.value = true
// TODO: 实现查看患者的具体逻辑 } else {
// 例如router.push({ path: '/doctorstation/patient-details', query: { encounterId: row.encounterId } }) // 接口失败时使用列表行数据展示
}).catch(() => { patientDetailData.value = row
// 取消操作 patientDetailVisible.value = true
}) }
} catch (error) {
console.error('获取患者详情失败:', error)
// 接口异常时使用列表行数据展示
patientDetailData.value = row
patientDetailVisible.value = true
}
} }
// 获取性别文本 // 获取性别文本