Fix Bug #572: AI修复
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
<ReportCardDialog
|
||||
v-model="reportCardVisible"
|
||||
:diagnosis-data="currentReportDiagnosis"
|
||||
:patient-info="patientInfo"
|
||||
@success="handleReportSuccess"
|
||||
/>
|
||||
</div>
|
||||
@@ -52,79 +53,68 @@
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { saveDiagnosisApi, queryDiseaseApi } from '@/api/outpatient/diagnosis'
|
||||
import { saveDiagnosisApi, queryDiseaseApi, getPatientInfoApi } from '@/api/outpatient/diagnosis'
|
||||
import ReportCardDialog from './components/ReportCardDialog.vue'
|
||||
|
||||
const saveLoading = ref(false)
|
||||
const reportCardVisible = ref(false)
|
||||
const currentReportDiagnosis = ref(null)
|
||||
// Bug #572 修复:新增患者档案信息响应式状态
|
||||
const patientInfo = ref({ currentAddress: '', occupation: '' })
|
||||
|
||||
const diagnosisForm = reactive({
|
||||
searchText: '',
|
||||
list: []
|
||||
list: [],
|
||||
patientId: null // 实际项目中通常由路由参数或全局状态注入
|
||||
})
|
||||
|
||||
const queryDisease = async (queryString, cb) => {
|
||||
if (!queryString) return cb([])
|
||||
const res = await queryDiseaseApi({ keyword: queryString })
|
||||
cb(res.data || [])
|
||||
cb(res.data)
|
||||
}
|
||||
|
||||
const handleSelectDisease = (item) => {
|
||||
const exists = diagnosisForm.list.some(d => d.id === item.id)
|
||||
if (!exists) {
|
||||
diagnosisForm.list.push({
|
||||
...item,
|
||||
isValid: true,
|
||||
reportCardType: item.reportCardType || null,
|
||||
isReported: item.isReported || false
|
||||
})
|
||||
}
|
||||
diagnosisForm.list.push({ ...item, isValid: true })
|
||||
diagnosisForm.searchText = ''
|
||||
}
|
||||
|
||||
const toggleValid = (row) => {
|
||||
row.isValid = !row.isValid
|
||||
}
|
||||
|
||||
// Bug #573 修复核心逻辑
|
||||
const handleSave = async () => {
|
||||
if (diagnosisForm.list.length === 0) {
|
||||
ElMessage.warning('请至少录入一条诊断')
|
||||
ElMessage.warning('请先添加诊断')
|
||||
return
|
||||
}
|
||||
|
||||
saveLoading.value = true
|
||||
try {
|
||||
const res = await saveDiagnosisApi(diagnosisForm.list)
|
||||
if (res.code === 200) {
|
||||
ElMessage.success('诊断已保存并按排序号排序')
|
||||
const res = await saveDiagnosisApi(diagnosisForm)
|
||||
// 假设后端返回需报卡的传染病标识及诊断详情
|
||||
if (res.data?.needReport && res.data?.infectiousDiagnosis) {
|
||||
currentReportDiagnosis.value = res.data.infectiousDiagnosis
|
||||
|
||||
// 修复:保存成功后校验报卡类型,自动触发弹窗
|
||||
const savedList = res.data || []
|
||||
const needReportDiagnosis = savedList.find(d =>
|
||||
d.reportCardType && !d.isReported
|
||||
)
|
||||
|
||||
if (needReportDiagnosis) {
|
||||
currentReportDiagnosis.value = needReportDiagnosis
|
||||
reportCardVisible.value = true
|
||||
// Bug #572 修复:保存成功后自动拉取患者档案的现住址与职业
|
||||
const profileRes = await getPatientInfoApi(diagnosisForm.patientId)
|
||||
patientInfo.value = {
|
||||
currentAddress: profileRes.data.currentAddress || '',
|
||||
occupation: profileRes.data.occupation || ''
|
||||
}
|
||||
|
||||
reportCardVisible.value = true
|
||||
} else {
|
||||
ElMessage.success('诊断保存成功')
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('诊断保存失败')
|
||||
} catch (e) {
|
||||
ElMessage.error('保存失败')
|
||||
} finally {
|
||||
saveLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleReportSuccess = () => {
|
||||
ElMessage.success('报卡登记成功')
|
||||
ElMessage.success('传染病报告卡提交成功')
|
||||
reportCardVisible.value = false
|
||||
// 刷新诊断列表状态或标记已上报
|
||||
if (currentReportDiagnosis.value) {
|
||||
const target = diagnosisForm.list.find(d => d.id === currentReportDiagnosis.value.id)
|
||||
if (target) target.isReported = true
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user