Fix Bug #573: AI修复
This commit is contained in:
@@ -1,98 +1,95 @@
|
||||
<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>
|
||||
<div class="outpatient-diagnosis">
|
||||
<el-card header="诊断录入">
|
||||
<el-form :model="form" label-width="80px">
|
||||
<el-form-item label="诊断名称">
|
||||
<el-autocomplete
|
||||
v-model="form.diagnosisName"
|
||||
:fetch-suggestions="queryDisease"
|
||||
placeholder="请输入疾病名称"
|
||||
@select="handleSelectDisease"
|
||||
/>
|
||||
</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 label="诊断状态">
|
||||
<el-checkbox v-model="form.isValid">有效</el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSave" :loading="saving">保存诊断</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 传染病报卡弹窗 -->
|
||||
<InfectiousReportDialog
|
||||
v-model="reportDialogVisible"
|
||||
:disease-data="currentReportDisease"
|
||||
@success="handleReportSuccess"
|
||||
/>
|
||||
<el-dialog
|
||||
v-model="reportCardVisible"
|
||||
:title="currentReportCardType + '填报'"
|
||||
width="700px"
|
||||
destroy-on-close
|
||||
>
|
||||
<ReportCardForm :type="currentReportCardType" :patient-id="patientId" :visit-id="visitId" />
|
||||
<template #footer>
|
||||
<el-button @click="reportCardVisible = false">暂存</el-button>
|
||||
<el-button type="primary" @click="submitReportCard">提交报卡</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</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'
|
||||
import { ref, reactive } from 'vue';
|
||||
import { saveDiagnosis } from '@/api/outpatient/diagnosis';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import ReportCardForm from '@/components/ReportCardForm.vue';
|
||||
|
||||
const diagnosisForm = reactive({
|
||||
patientId: null,
|
||||
patientName: '',
|
||||
visitId: null,
|
||||
visitNo: '',
|
||||
diagnosisList: []
|
||||
})
|
||||
const props = defineProps({
|
||||
patientId: { type: String, required: true },
|
||||
visitId: { type: String, required: true }
|
||||
});
|
||||
|
||||
const reportDialogVisible = ref(false)
|
||||
const currentReportDisease = ref(null)
|
||||
const form = reactive({ diagnosisName: '', isValid: true, diseaseId: '' });
|
||||
const saving = ref(false);
|
||||
const reportCardVisible = ref(false);
|
||||
const currentReportCardType = ref('');
|
||||
|
||||
// 初始化加载患者诊断(模拟)
|
||||
onMounted(() => {
|
||||
// 实际项目中通过路由参数或全局状态获取患者信息
|
||||
diagnosisForm.patientId = 1001
|
||||
diagnosisForm.patientName = '测试患者'
|
||||
diagnosisForm.visitId = 2001
|
||||
diagnosisForm.visitNo = 'MZ20260526001'
|
||||
})
|
||||
const queryDisease = (queryString, cb) => {
|
||||
// 实际应调用后端疾病目录查询接口
|
||||
cb([{ value: '古典生物型霍乱', id: 'D001' }]);
|
||||
};
|
||||
|
||||
const handleSelectDisease = (item) => {
|
||||
form.diseaseId = item.id;
|
||||
form.diagnosisName = item.value;
|
||||
};
|
||||
|
||||
const handleSave = async () => {
|
||||
if (!diagnosisForm.diagnosisList.length) {
|
||||
ElMessage.warning('请至少录入一条诊断')
|
||||
return
|
||||
if (!form.diseaseId) {
|
||||
ElMessage.warning('请选择诊断疾病');
|
||||
return;
|
||||
}
|
||||
|
||||
saving.value = true;
|
||||
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
|
||||
}
|
||||
const res = await saveDiagnosis({
|
||||
patientId: props.patientId,
|
||||
visitId: props.visitId,
|
||||
diagnoses: [{ diseaseId: form.diseaseId, isValid: form.isValid }]
|
||||
});
|
||||
|
||||
ElMessage.success(res.data.message || '诊断已保存并按排序号排序');
|
||||
|
||||
// 修复 Bug #573:根据后端返回的报卡类型自动触发弹窗
|
||||
if (res.data.reportCardTypes && res.data.reportCardTypes.length > 0) {
|
||||
currentReportCardType.value = res.data.reportCardTypes[0];
|
||||
reportCardVisible.value = true;
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('诊断保存失败')
|
||||
ElMessage.error('保存诊断失败');
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleReportSuccess = () => {
|
||||
reportDialogVisible.value = false
|
||||
ElMessage.success('报卡登记成功')
|
||||
// 可选:刷新诊断列表或标记已上报状态
|
||||
}
|
||||
const submitReportCard = () => {
|
||||
ElMessage.success('报卡提交成功');
|
||||
reportCardVisible.value = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.diagnosis-container { padding: 16px; }
|
||||
.card-header { display: flex; justify-content: space-between; align-items: center; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user