汇总结果保存逻辑

This commit is contained in:
Euni4U 2025-03-18 13:07:31 +08:00
parent 151622972e
commit 301e4657f7
2 changed files with 56 additions and 0 deletions

View File

@ -146,6 +146,7 @@
:patient="selectedPatient"
:report-data="reportData"
:conclusion-data="conclusionData"
ref="summaryRef"
/>
<!-- 特殊检查类型 -->
@ -1693,6 +1694,11 @@ const handleSaveAllResults = async () => {
//
await refreshExamData()
//
if (summaryRef.value) {
await summaryRef.value.saveSummary()
}
} catch (error) {
ElMessage.error(`保存失败: ${error.message || '请检查数据是否完整'}`)
}

View File

@ -31,6 +31,7 @@
<script setup>
import { ref, onMounted, watch } from 'vue'
import { PatientitemsApi } from '@/api/inspect/inspectpatientitems'
import { PatientApi } from '@/api/inspect/inspectpatient'
import { ElLoading, ElMessage } from 'element-plus'
import { Refresh } from '@element-plus/icons-vue'
@ -49,6 +50,9 @@ const props = defineProps({
}
})
// emit便
const emit = defineEmits(['save-summary'])
//
const summaryData = ref({
general: { summary: '' },
@ -307,6 +311,52 @@ const loadPatientItems = async () => {
}
}
// PatientApisummaryResult
const saveSummary = async () => {
if (!props.patient || !props.patient.medicalSn) {
ElMessage.warning('患者信息不完整,无法保存汇总数据')
return
}
try {
saving.value = true
//
const saveData = {
medicalSn: props.patient.medicalSn,
summaryResult: editableSummary.value
}
console.log('保存汇总数据:', saveData)
// API
const response = await PatientApi.updateSummaryResult(saveData)
if (response && response.code === 200) {
ElMessage.success('体检汇总保存成功')
//
emit('save-summary', editableSummary.value)
//
if (window.parent && typeof window.parent.handleSaveAllResults === 'function') {
try {
window.parent.handleSaveAllResults()
} catch (err) {
console.log('调用父窗口保存方法失败:', err)
}
}
} else {
ElMessage.error('保存失败: ' + (response?.message || '未知错误'))
}
} catch (error) {
console.error('保存汇总数据失败:', error)
ElMessage.error('保存汇总数据失败: ' + error.message)
} finally {
saving.value = false
}
}
// onMounted
// loadPatientItems
</script>