Fix Bug #573: AI修复
This commit is contained in:
@@ -1,168 +1,98 @@
|
||||
<template>
|
||||
<div class="outpatient-diagnosis-container">
|
||||
<el-card>
|
||||
<div class="diagnosis-container">
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="title">门诊医生工作站 - 诊断录入</span>
|
||||
<span>门诊诊断录入</span>
|
||||
<el-button type="primary" @click="handleSave">保存诊断</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form :model="form" label-width="100px">
|
||||
<el-form :model="diagnosisForm" label-width="80px">
|
||||
<el-form-item label="患者信息">
|
||||
<el-input v-model="form.patientName" disabled placeholder="请选择患者" />
|
||||
<span>{{ diagnosisForm.patientName }} ({{ diagnosisForm.visitNo }})</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="诊断列表">
|
||||
<el-table :data="form.diagnoses" border style="width: 100%">
|
||||
<el-table :data="diagnosisForm.diagnosisList" border style="width: 100%">
|
||||
<el-table-column prop="diseaseName" label="疾病名称" />
|
||||
<el-table-column prop="isValid" label="有效" width="80" align="center">
|
||||
<el-table-column prop="status" label="状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-checkbox v-model="row.isValid" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default="{ $index }">
|
||||
<el-button type="danger" size="small" @click="removeDiagnosis($index)">删除</el-button>
|
||||
<el-tag :type="row.status === 1 ? 'success' : 'info'">
|
||||
{{ row.status === 1 ? '有效' : '无效' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-autocomplete
|
||||
v-model="searchKeyword"
|
||||
:fetch-suggestions="queryDisease"
|
||||
placeholder="输入疾病名称搜索"
|
||||
@select="handleSelectDisease"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="footer-actions">
|
||||
<el-button type="primary" @click="handleSave" :loading="saving">保存诊断</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 传染病报卡弹窗 -->
|
||||
<el-dialog
|
||||
v-model="reportCardVisible"
|
||||
:title="currentReportCard?.diseaseName + ' - 传染病报告卡'"
|
||||
width="800px"
|
||||
destroy-on-close
|
||||
class="report-card-dialog"
|
||||
>
|
||||
<div class="report-card-content">
|
||||
<p>疾病编码:{{ currentReportCard?.diseaseId }}</p>
|
||||
<p>报卡类型:{{ currentReportCard?.reportType }}</p>
|
||||
<!-- 此处可嵌入实际报卡表单组件 -->
|
||||
<el-alert title="请按要求填写传染病报告卡信息" type="info" show-icon />
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="reportCardVisible = false">暂存</el-button>
|
||||
<el-button type="primary" @click="submitReportCard">提交报卡</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<InfectiousReportDialog
|
||||
v-model="reportDialogVisible"
|
||||
:disease-data="currentReportDisease"
|
||||
@success="handleReportSuccess"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import request from '@/utils/request'
|
||||
import { saveDiagnosis, getPatientDiagnosis } from '@/api/outpatient'
|
||||
import InfectiousReportDialog from '@/components/InfectiousReportDialog.vue'
|
||||
|
||||
const form = reactive({
|
||||
const diagnosisForm = reactive({
|
||||
patientId: null,
|
||||
visitId: null,
|
||||
patientName: '',
|
||||
diagnoses: []
|
||||
visitId: null,
|
||||
visitNo: '',
|
||||
diagnosisList: []
|
||||
})
|
||||
const searchKeyword = ref('')
|
||||
const saving = ref(false)
|
||||
const reportCardVisible = ref(false)
|
||||
const currentReportCard = ref(null)
|
||||
|
||||
const queryDisease = (queryString, cb) => {
|
||||
// 模拟疾病搜索接口
|
||||
const results = [
|
||||
{ value: '古典生物型霍乱', id: 101 },
|
||||
{ value: '流行性感冒', id: 102 }
|
||||
]
|
||||
cb(results.filter(item => item.value.includes(queryString)))
|
||||
}
|
||||
const reportDialogVisible = ref(false)
|
||||
const currentReportDisease = ref(null)
|
||||
|
||||
const handleSelectDisease = (item) => {
|
||||
form.diagnoses.push({
|
||||
diseaseId: item.id,
|
||||
diseaseName: item.value,
|
||||
isValid: true
|
||||
})
|
||||
searchKeyword.value = ''
|
||||
}
|
||||
// 初始化加载患者诊断(模拟)
|
||||
onMounted(() => {
|
||||
// 实际项目中通过路由参数或全局状态获取患者信息
|
||||
diagnosisForm.patientId = 1001
|
||||
diagnosisForm.patientName = '测试患者'
|
||||
diagnosisForm.visitId = 2001
|
||||
diagnosisForm.visitNo = 'MZ20260526001'
|
||||
})
|
||||
|
||||
const removeDiagnosis = (index) => {
|
||||
form.diagnoses.splice(index, 1)
|
||||
}
|
||||
|
||||
/**
|
||||
* Bug #573 Fix: 保存诊断并处理报卡弹窗逻辑
|
||||
* 1. 调用保存接口
|
||||
* 2. 解析返回的 pendingReportCards
|
||||
* 3. 若存在待报卡数据,自动依次触发弹窗;否则仅提示保存成功
|
||||
*/
|
||||
const handleSave = async () => {
|
||||
if (form.diagnoses.length === 0) {
|
||||
ElMessage.warning('请至少录入一项诊断')
|
||||
if (!diagnosisForm.diagnosisList.length) {
|
||||
ElMessage.warning('请至少录入一条诊断')
|
||||
return
|
||||
}
|
||||
|
||||
saving.value = true
|
||||
try {
|
||||
const res = await request.post('/outpatient/diagnosis/save', {
|
||||
patientId: form.patientId,
|
||||
visitId: form.visitId,
|
||||
diagnoses: form.diagnoses
|
||||
})
|
||||
|
||||
const res = await saveDiagnosis(diagnosisForm)
|
||||
if (res.code === 200) {
|
||||
ElMessage.success(res.msg)
|
||||
|
||||
// 核心修复:根据后端返回的待报卡列表自动触发弹窗
|
||||
if (res.data?.pendingReportCards && res.data.pendingReportCards.length > 0) {
|
||||
// 依次弹出(实际业务中可改为队列或合并弹窗,此处按需求单条触发)
|
||||
for (const card of res.data.pendingReportCards) {
|
||||
currentReportCard.value = card
|
||||
reportCardVisible.value = true
|
||||
// 等待当前弹窗关闭后再处理下一个(可选优化)
|
||||
await new Promise(resolve => {
|
||||
const unwatch = watch(reportCardVisible, (val) => {
|
||||
if (!val) {
|
||||
unwatch()
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// 修复 Bug #573:根据后端返回的 needReportList 自动触发报卡弹窗
|
||||
if (res.data?.needReportList && res.data.needReportList.length > 0) {
|
||||
currentReportDisease.value = res.data.needReportList[0]
|
||||
reportDialogVisible.value = true
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(res.msg || '保存失败')
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('网络异常,保存失败')
|
||||
} finally {
|
||||
saving.value = false
|
||||
ElMessage.error('诊断保存失败')
|
||||
}
|
||||
}
|
||||
|
||||
const submitReportCard = () => {
|
||||
// 模拟提交报卡逻辑
|
||||
ElMessage.success('报卡已提交')
|
||||
reportCardVisible.value = false
|
||||
const handleReportSuccess = () => {
|
||||
reportDialogVisible.value = false
|
||||
ElMessage.success('报卡登记成功')
|
||||
// 可选:刷新诊断列表或标记已上报状态
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.outpatient-diagnosis-container { padding: 20px; }
|
||||
.diagnosis-container { padding: 16px; }
|
||||
.card-header { display: flex; justify-content: space-between; align-items: center; }
|
||||
.title { font-size: 18px; font-weight: bold; }
|
||||
.footer-actions { margin-top: 20px; text-align: right; }
|
||||
.report-card-content { padding: 10px 0; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user