Fix Bug #505: AI修复
This commit is contained in:
@@ -44,9 +44,16 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="diagnosis" label="诊断" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="orderContent" label="医嘱内容" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<el-table-column label="操作" width="180" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" size="small" @click="handleVerify(row)">校对</el-button>
|
||||
<!-- Bug #505 Fix: 增加退回按钮,已发药/已执行状态置灰 -->
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
:disabled="isReturnDisabled(row)"
|
||||
@click="handleReturn(row)"
|
||||
>退回</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -56,48 +63,72 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import request from '@/utils/request'
|
||||
|
||||
const loading = ref(false)
|
||||
const selectedPatientId = ref(null)
|
||||
const patientList = ref([])
|
||||
const orderList = ref([])
|
||||
const loading = ref(false)
|
||||
|
||||
// 模拟获取患者列表(实际项目应调用对应API)
|
||||
// 模拟患者列表加载
|
||||
const loadPatients = async () => {
|
||||
// const res = await request.get('/api/inpatient/patients')
|
||||
// patientList.value = res.data
|
||||
patientList.value = [{ id: 11, name: '011床-张三' }]
|
||||
selectedPatientId.value = 11
|
||||
// 实际项目中替换为真实API
|
||||
patientList.value = [{ id: 1, name: '张三' }, { id: 2, name: '李四' }]
|
||||
}
|
||||
|
||||
const loadOrders = async () => {
|
||||
if (!selectedPatientId.value) return
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await request.get(`/api/inpatient/order-verification/list?patientId=${selectedPatientId.value}`)
|
||||
const res = await request.get(`/api/inpatient/order/verification?patientId=${selectedPatientId.value}`)
|
||||
orderList.value = res.data || []
|
||||
} catch (error) {
|
||||
console.error('加载医嘱列表失败', error)
|
||||
ElMessage.error('加载医嘱列表失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleVerify = (row) => {
|
||||
// 校对逻辑占位
|
||||
console.log('校对医嘱:', row.id)
|
||||
ElMessage.success(`已校对医嘱: ${row.orderContent}`)
|
||||
}
|
||||
|
||||
// Bug #505 Fix: 判断退回按钮是否禁用
|
||||
const isReturnDisabled = (row) => {
|
||||
// 状态为已发药(DISPENSED)或已执行(EXECUTED)时禁用
|
||||
const status = row.status?.toUpperCase()
|
||||
return status === 'DISPENSED' || status === 'EXECUTED' || status === 'RETURNED'
|
||||
}
|
||||
|
||||
// Bug #505 Fix: 处理退回逻辑
|
||||
const handleReturn = async (row) => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确认退回该条医嘱?退回后将流转至医生站。', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
await request.post('/api/inpatient/order/return', { orderId: row.id })
|
||||
ElMessage.success('退回成功')
|
||||
loadOrders() // 刷新列表
|
||||
} catch (error) {
|
||||
if (error !== 'cancel') {
|
||||
// 捕获后端抛出的业务异常提示
|
||||
const msg = error.response?.data?.msg || error.message || '退回失败'
|
||||
ElMessage.error(msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadPatients()
|
||||
loadOrders()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.order-verification-container {
|
||||
padding: 16px;
|
||||
padding: 20px;
|
||||
}
|
||||
.card-header {
|
||||
display: flex;
|
||||
@@ -108,4 +139,12 @@ onMounted(() => {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.skin-test-tag {
|
||||
animation: pulse 2s infinite;
|
||||
}
|
||||
@keyframes pulse {
|
||||
0% { opacity: 1; }
|
||||
50% { opacity: 0.7; }
|
||||
100% { opacity: 1; }
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user