修改诊断信息提交问题

This commit is contained in:
jingna 2025-08-06 17:42:12 +08:00
parent 1861025f2f
commit 52a387437f

View File

@ -320,13 +320,13 @@
<div>
<el-form :model="diagnosticForm" label-width="50px">
<el-form-item label="记录">
<el-input v-model="diagnosticForm.textarea" :rows="6" type="textarea" placeholder="请输入" />
<el-input v-model="diagnosticForm.diagnosis_info" :rows="6" type="textarea" placeholder="请输入" />
</el-form-item>
<el-form-item label="处理">
<el-input v-model="diagnosticForm.textarea" :rows="6" type="textarea" placeholder="请输入" />
<el-input v-model="diagnosticForm.treatment_info" :rows="6" type="textarea" placeholder="请输入" />
</el-form-item>
<el-form-item label="建议">
<el-input v-model="diagnosticForm.textarea" :rows="6" type="textarea" placeholder="请输入" />
<el-input v-model="diagnosticForm.suggestion_info" :rows="6" type="textarea" placeholder="请输入" />
</el-form-item>
</el-form>
</div>
@ -335,8 +335,8 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button @click="handleDataCollection">暂存</el-button>
<el-button type="primary" @click="handleDataCollection">
<el-button @click="handleDiagnosticInfo('diagnosed')">暂存</el-button>
<el-button type="primary" @click="handleDiagnosticInfo('completed')">
保存
</el-button>
</span>
@ -398,7 +398,11 @@ const dialogVisible = ref(false)
const handleClose = () => {
dialogVisible.value = false
}
const diagnosticForm = ref({})
const diagnosticForm = ref({
diagnosis_info:'',
treatment_info:'',
suggestion_info:''
})
//
const historyData = ref([
// { id: 3, rotLeft: '-55.2°', rotRight: '54.2°', tiltLeft: '-17.7°', tiltRight: '18.2°', pitchDown: '-20.2°', pitchUp: '10.5°' },
@ -1064,7 +1068,51 @@ function stopPressureStreaming() {
}
}
async function handleDiagnosticInfo(status){
try {
// ID
if (!patientInfo.value.sessionId) {
throw new Error('缺少会话Id')
}
// API
const response = await fetch(`${BACKEND_URL}/api/detection/${patientInfo.value.sessionId}/save-info`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
diagnosis_info:diagnosticForm.diagnosis_info,
treatment_info:diagnosticForm.treatment_info,
suggestion_info:diagnosticForm.suggestion_info,
status:status,
session_id:patientInfo.value.sessionId,
})
})
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`)
}
const result = await response.json()
if (result.success) {
//
ElMessage.success({
message: status + '诊断信息成功',
duration: 5000
})
patientInfo.value.sessionId = null
} else {
throw new Error(result.message || '诊断信息失败')
}
} catch (error) {
ElMessage.error({
message: errorMessage,
duration: 5000
})
patientInfo.value.sessionId = null
} finally {
patientInfo.value.sessionId = null
}
}
//
async function handleDataCollection() {
@ -1238,7 +1286,6 @@ async function saveDetectionData() {
// API
async function sendDetectionData(data) {
try {
const response = await fetch(`${BACKEND_URL}/api/detection/${patientInfo.value.sessionId}/collect`
, {
@ -1495,7 +1542,6 @@ async function saveRecording() {
const result = await response.json()
if (result.success) {
//
dialogVisible.value = true
console.log('🎬 录像保存成功:', result.filepath)
ElMessage.success({
message: `录像保存成功!文件路径: ${result.filepath}`,
@ -1518,6 +1564,12 @@ async function saveRecording() {
// ID
// patientInfo.value.sessionId = null
console.log('✅ 会话正式结束会话ID已清空')
diagnosticForm.value = {
diagnosis_info:'',
treatment_info:'',
suggestion_info:''
}
dialogVisible.value = true
} else {
throw new Error(result.message || '保存失败')
}
@ -1529,7 +1581,7 @@ async function saveRecording() {
duration: 5000
})
// 使ID
patientInfo.value.sessionId = null
// patientInfo.value.sessionId = null
console.log('⚠️ 录像保存失败但会话已结束会话ID已清空')
}
}
@ -1542,9 +1594,6 @@ async function saveRecording() {
} catch (error) {
console.error('❌ 保存录像失败:', error)
ElMessage.error(`保存录像失败: ${error.message}`)
// 使ID
patientInfo.value.sessionId = null
console.log('⚠️ 录像保存失败但会话已结束会话ID已清空')
}
}