修改诊断信息提交问题
This commit is contained in:
parent
1861025f2f
commit
52a387437f
@ -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已清空')
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user