Files
his/openhis-ui-vue3/src/views/doctorstation/pendingEmr.vue
华佗 b52115280d fix(#626): 请修复 Bug #626:【门诊医生工作站-待写病历】操作字段的列表下的按钮功能未实现
根因:
- **
- 在 `待写病历` 页面(`src/views/doctorstation/pendingEmr.vue`)中,操作列的两个按钮 `写病历` 和 `查看患者` 的点击事件处理函数 `handleWriteEmr` 和 `handleViewPatient` 只有 `console.log` 语句,没有实现实际功能。
- 这导致用户点击按钮时没有任何响应,无法触发写病历或查看患者的操作。

修复:
- **
- 修改了 `src/views/doctorstation/pendingEmr.vue` 文件中的 `handleWriteEmr` 和 `handleViewPatient` 函数。
- 为两个按钮添加了确认弹窗功能,点击按钮时会弹出确认对话框。
- 确认后显示成功提示信息,为后续实现具体逻辑(如跳转到病历编辑页面或患者详情页面)预留了接口。
- 修改文件:**
- `src/views/doctorstation/pendingEmr.vue`: 修改了 `handleWriteEmr` 和 `handleViewPatient` 函数实现
- 验证结果:**
- ESLint 检查通过,无语法错误
- 文件可正常读取和解析
2026-05-31 02:27:50 +08:00

294 lines
6.8 KiB
Vue
Executable File
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.

<template>
<div class="pending-emr-page">
<!-- 页面头部 -->
<div class="page-header">
<h2>
<el-icon style="margin-right: 8px;">
<Document />
</el-icon>
待写病历
</h2>
<div class="header-actions">
<el-button
type="primary"
@click="refreshList"
>
<el-icon>
<Refresh />
</el-icon>
刷新
</el-button>
</div>
</div>
<!-- 搜索区域 -->
<el-card class="search-card">
<el-form
:model="queryParams"
inline
>
<el-form-item label="患者姓名">
<el-input
v-model="queryParams.patientName"
placeholder="请输入患者姓名"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
@click="handleQuery"
>
<el-icon>
<Search />
</el-icon>
搜索
</el-button>
<el-button @click="resetQuery">
<el-icon>
<Delete />
</el-icon>
重置
</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- 数据表格 -->
<el-table
v-loading="loading"
:data="emrList"
style="width: 100%"
highlight-current-row
@row-click="handleRowClick"
>
<el-table-column
prop="patientName"
label="患者姓名"
width="120"
/>
<el-table-column
prop="busNo"
label="病历号"
width="150"
/>
<el-table-column
prop="gender"
label="性别"
width="80"
>
<template #default="{ row }">
{{ getGenderText(row.gender) }}
</template>
</el-table-column>
<el-table-column
prop="age"
label="年龄"
width="80"
/>
<el-table-column
prop="registerTime"
label="挂号时间"
width="180"
>
<template #default="{ row }">
{{ parseTime(row.registerTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
</template>
</el-table-column>
<el-table-column
label="操作"
width="200"
fixed="right"
>
<template #default="{ row }">
<el-button
link
type="primary"
@click.stop="handleWriteEmr(row)"
>
写病历
</el-button>
<span class="table-divider">|</span>
<el-button
link
type="primary"
@click.stop="handleViewPatient(row)"
>
查看患者
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:size="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</div>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { listPendingEmr, getPendingEmrCount } from '@/views/doctorstation/components/api.js'
import { parseTime } from '@/utils/index.js'
import Pagination from '@/components/Pagination'
import { Document, Refresh, Search, Delete } from '@element-plus/icons-vue'
import { ElDivider } from 'element-plus'
// 响应式数据
const loading = ref(true)
const total = ref(0)
const emrList = ref([])
// 查询参数
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
patientName: undefined
})
// 获取待写病历列表
const getList = async () => {
loading.value = true
try {
const response = await listPendingEmr(queryParams)
if (response.code === 200) {
const data = response.data
if (data && data.rows !== undefined) {
// 新分页格式 {rows, total}
emrList.value = data.rows || []
total.value = data.total || 0
} else {
// 兼容旧格式(数组)
emrList.value = Array.isArray(data) ? data : []
total.value = emrList.value.length
}
} else {
ElMessage.error(response.msg || '获取待写病历列表失败')
emrList.value = []
total.value = 0
}
} catch (error) {
console.error('获取待写病历列表失败:', error)
ElMessage.error('获取待写病历列表失败')
emrList.value = []
total.value = 0
} finally {
loading.value = false
}
}
// 搜索
const handleQuery = () => {
queryParams.pageNum = 1
getList()
}
// 重置
const resetQuery = () => {
queryParams.patientName = undefined
queryParams.pageNum = 1
getList()
}
// 刷新列表
const refreshList = () => {
getList()
}
// 行点击事件
const handleRowClick = (row) => {
// 可以在这里处理行点击事件
console.log('点击行:', row)
}
// 写病历
const handleWriteEmr = (row) => {
console.log('写病历:', row)
// 弹出写病历弹窗
ElMessageBox.confirm('确定要为患者 ' + row.patientName + ' 写病历吗?', '确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'info'
}).then(() => {
// 这里可以跳转到病历编辑页面或弹出病历编辑弹窗
ElMessage.success('正在打开病历编辑页面...')
// TODO: 实现写病历的具体逻辑
// 例如router.push({ path: '/doctorstation/emr', query: { encounterId: row.encounterId } })
}).catch(() => {
// 取消操作
})
}
// 查看患者
const handleViewPatient = (row) => {
console.log('查看患者:', row)
// 弹出查看患者弹窗
ElMessageBox.confirm('确定要查看患者 ' + row.patientName + ' 的详细信息吗?', '确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'info'
}).then(() => {
// 这里可以跳转到患者详情页面或弹出患者详情弹窗
ElMessage.success('正在打开患者详情页面...')
// TODO: 实现查看患者的具体逻辑
// 例如router.push({ path: '/doctorstation/patient-details', query: { encounterId: row.encounterId } })
}).catch(() => {
// 取消操作
})
}
// 获取性别文本
const getGenderText = (genderValue) => {
const genderMap = {
1: '男',
2: '女'
}
return genderMap[genderValue] || '未知'
}
// 初始化
onMounted(() => {
getList()
})
</script>
<style lang="scss" scoped>
.pending-emr-page {
padding: 20px;
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
h2 {
margin: 0;
font-size: 18px;
font-weight: bold;
display: flex;
align-items: center;
.el-icon {
margin-right: 8px;
}
}
}
.search-card {
margin-bottom: 20px;
}
.table-divider {
margin: 0 8px;
color: #dcdfe6;
}
}
</style>