99 lines
3.0 KiB
Vue
99 lines
3.0 KiB
Vue
<template>
|
||
<div class="diagnosis-container">
|
||
<el-card shadow="never">
|
||
<template #header>
|
||
<div class="card-header">
|
||
<span>门诊诊断录入</span>
|
||
<el-button type="primary" @click="handleSave">保存诊断</el-button>
|
||
</div>
|
||
</template>
|
||
|
||
<el-form :model="diagnosisForm" label-width="80px">
|
||
<el-form-item label="患者信息">
|
||
<span>{{ diagnosisForm.patientName }} ({{ diagnosisForm.visitNo }})</span>
|
||
</el-form-item>
|
||
|
||
<el-form-item label="诊断列表">
|
||
<el-table :data="diagnosisForm.diagnosisList" border style="width: 100%">
|
||
<el-table-column prop="diseaseName" label="疾病名称" />
|
||
<el-table-column prop="status" label="状态" width="100">
|
||
<template #default="{ row }">
|
||
<el-tag :type="row.status === 1 ? 'success' : 'info'">
|
||
{{ row.status === 1 ? '有效' : '无效' }}
|
||
</el-tag>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
</el-form-item>
|
||
</el-form>
|
||
</el-card>
|
||
|
||
<!-- 传染病报卡弹窗 -->
|
||
<InfectiousReportDialog
|
||
v-model="reportDialogVisible"
|
||
:disease-data="currentReportDisease"
|
||
@success="handleReportSuccess"
|
||
/>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, reactive, onMounted } from 'vue'
|
||
import { ElMessage } from 'element-plus'
|
||
import { saveDiagnosis, getPatientDiagnosis } from '@/api/outpatient'
|
||
import InfectiousReportDialog from '@/components/InfectiousReportDialog.vue'
|
||
|
||
const diagnosisForm = reactive({
|
||
patientId: null,
|
||
patientName: '',
|
||
visitId: null,
|
||
visitNo: '',
|
||
diagnosisList: []
|
||
})
|
||
|
||
const reportDialogVisible = ref(false)
|
||
const currentReportDisease = ref(null)
|
||
|
||
// 初始化加载患者诊断(模拟)
|
||
onMounted(() => {
|
||
// 实际项目中通过路由参数或全局状态获取患者信息
|
||
diagnosisForm.patientId = 1001
|
||
diagnosisForm.patientName = '测试患者'
|
||
diagnosisForm.visitId = 2001
|
||
diagnosisForm.visitNo = 'MZ20260526001'
|
||
})
|
||
|
||
const handleSave = async () => {
|
||
if (!diagnosisForm.diagnosisList.length) {
|
||
ElMessage.warning('请至少录入一条诊断')
|
||
return
|
||
}
|
||
|
||
try {
|
||
const res = await saveDiagnosis(diagnosisForm)
|
||
if (res.code === 200) {
|
||
ElMessage.success(res.msg)
|
||
|
||
// 修复 Bug #573:根据后端返回的 needReportList 自动触发报卡弹窗
|
||
if (res.data?.needReportList && res.data.needReportList.length > 0) {
|
||
currentReportDisease.value = res.data.needReportList[0]
|
||
reportDialogVisible.value = true
|
||
}
|
||
}
|
||
} catch (error) {
|
||
ElMessage.error('诊断保存失败')
|
||
}
|
||
}
|
||
|
||
const handleReportSuccess = () => {
|
||
reportDialogVisible.value = false
|
||
ElMessage.success('报卡登记成功')
|
||
// 可选:刷新诊断列表或标记已上报状态
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.diagnosis-container { padding: 16px; }
|
||
.card-header { display: flex; justify-content: space-between; align-items: center; }
|
||
</style>
|