Merge branch 'main' of http://121.37.111.42:3000/ThbTech/BodyBalanceEvaluation into main
This commit is contained in:
commit
c6e88c5c7a
@ -60,7 +60,7 @@ from devices.utils.config_manager import ConfigManager
|
|||||||
class AppServer:
|
class AppServer:
|
||||||
"""主应用服务器类"""
|
"""主应用服务器类"""
|
||||||
|
|
||||||
def __init__(self, host='localhost', port=5000, debug=False):
|
def __init__(self, host='0.0.0.0', port=5000, debug=False):
|
||||||
"""
|
"""
|
||||||
初始化应用服务器
|
初始化应用服务器
|
||||||
|
|
||||||
|
@ -601,6 +601,21 @@ export const downloadFile = (url, filename) => {
|
|||||||
window.URL.revokeObjectURL(downloadUrl)
|
window.URL.revokeObjectURL(downloadUrl)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
export const historyAPI = {
|
||||||
|
// 获取检测会话历史
|
||||||
|
sessionsPage(params) {
|
||||||
|
return api.get('/api/history/sessions', { params })
|
||||||
|
},
|
||||||
|
// 获取检测数据历史
|
||||||
|
detectionDelById(id) {
|
||||||
|
return api.delete(`/api/detection/data/${id}`, {})
|
||||||
|
},
|
||||||
|
// 获取检测会话历史
|
||||||
|
sessionById(id) {
|
||||||
|
return api.get(`/api/history/sessions/${id}`)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
// 获取后端URL的函数
|
// 获取后端URL的函数
|
||||||
export const getBackendUrl = () => {
|
export const getBackendUrl = () => {
|
||||||
|
@ -21,37 +21,41 @@
|
|||||||
<!-- 患者基本信息 -->
|
<!-- 患者基本信息 -->
|
||||||
<div v-for="(item, index) in profileInfo" :key="index" class="content-info">
|
<div v-for="(item, index) in profileInfo" :key="index" class="content-info">
|
||||||
<div class="content-left">
|
<div class="content-left">
|
||||||
<el-checkbox v-model="item.checked" label="" />
|
<!-- <el-checkbox v-model="item.checked" label="" /> -->
|
||||||
<div class="content-left-text1">{{ index + 1 }}</div>
|
<div class="content-left-text1">{{ index + 1 }}</div>
|
||||||
<div class="content-left-text2">2025/04/01 14:35</div>
|
<div class="content-left-text2">{{ item.created_at }}</div>
|
||||||
<div class="content-left-text3">初次就诊</div>
|
<div class="content-left-text3" v-if="index==0">最近会诊</div>
|
||||||
|
<div class="content-left-text3" v-else>{{ calculateExactDaysDifference(item.created_at) }}</div>
|
||||||
|
<!-- <el-button type="danger" style="margin-top: 20px;" @click="deleteClick(item,index)">删除</el-button> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="content-center">
|
<div class="content-center">
|
||||||
|
<video ref="videoPlayerRef" :src=" BACKEND_URL+'/' + item.screen_video_path" controls width="100%" height="100%">
|
||||||
|
您的浏览器不支持视频播放
|
||||||
|
</video>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-right">
|
<div class="content-right">
|
||||||
<div class="content-right-top">
|
<div class="content-right-top">
|
||||||
<div class="content-right-top-title">
|
<div class="content-right-top-title">
|
||||||
<div class="content-right-top-text">诊断信息:</div>
|
<div class="content-right-top-text">诊断信息:</div>
|
||||||
<div style="display: flex;align-items: center;">
|
<div style="display: flex;align-items: center;">
|
||||||
<div class="content-right-top-text2">未处理</div>
|
<div class="content-right-top-text2" v-if="item.status != 'completed'">未处理</div>
|
||||||
<div style="margin-left: 10px;" @click="editClick">
|
<div class="content-right-top-text3" v-if="item.status == 'completed'">已处理</div>
|
||||||
<img src="@/assets/svg/edit.svg" alt="">
|
<img v-if="item.status != 'completed'" src="@/assets/svg/edit.svg" alt="" style="margin-left: 10px;cursor: pointer;" @click="editClick(item,index)">
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-right-top-content">
|
<div class="content-right-top-content">
|
||||||
<el-form :model="diagnosticForm" label-width="50px">
|
<el-form :model="item" label-width="50px">
|
||||||
<el-form-item label="记录">
|
<el-form-item label="记录">
|
||||||
<el-input v-model="diagnosticForm.diagnosis_info" disabled :rows="6" type="textarea"
|
<el-input v-model="item.diagnosis_info" disabled :rows="6" type="textarea"
|
||||||
placeholder="请输入" />
|
placeholder="请输入" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="处理">
|
<el-form-item label="处理">
|
||||||
<el-input v-model="diagnosticForm.treatment_info" disabled :rows="6" type="textarea"
|
<el-input v-model="item.treatment_info" disabled :rows="6" type="textarea"
|
||||||
placeholder="请输入" />
|
placeholder="请输入" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="建议">
|
<el-form-item label="建议">
|
||||||
<el-input v-model="diagnosticForm.suggestion_info" disabled :rows="6" type="textarea"
|
<el-input v-model="item.suggestion_info" disabled :rows="6" type="textarea"
|
||||||
placeholder="请输入" />
|
placeholder="请输入" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -324,9 +328,10 @@
|
|||||||
import { ref, reactive, computed, onMounted } from 'vue'
|
import { ref, reactive, computed, onMounted } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { patientAPI, detectionAPI } from '../services/api.js'
|
import { patientAPI, detectionAPI,historyAPI } from '../services/api.js'
|
||||||
import Header from '@/views/Header.vue'
|
import Header from '@/views/Header.vue'
|
||||||
|
import { getBackendUrl } from '../services/api.js'
|
||||||
|
const BACKEND_URL = getBackendUrl()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
@ -359,6 +364,57 @@ const diagnosticForm = ref({
|
|||||||
treatment_info: '',
|
treatment_info: '',
|
||||||
suggestion_info: ''
|
suggestion_info: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const calculateExactDaysDifference = (date2) => {
|
||||||
|
// 解析日期字符串
|
||||||
|
const parseDate = (dateStr) => {
|
||||||
|
if (!dateStr) return new Date();
|
||||||
|
const parts = dateStr.split(' ');
|
||||||
|
const datePart = parts[0].split('-');
|
||||||
|
const timePart = parts[1].split(':');
|
||||||
|
|
||||||
|
return new Date(
|
||||||
|
parseInt(datePart[0]), // 年
|
||||||
|
parseInt(datePart[1]) - 1, // 月 (0-indexed)
|
||||||
|
parseInt(datePart[2]), // 日
|
||||||
|
parseInt(timePart[0]), // 小时
|
||||||
|
parseInt(timePart[1]), // 分钟
|
||||||
|
parseInt(timePart[2]) // 秒
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const d1 = new Date();
|
||||||
|
const d2 = parseDate(date2);
|
||||||
|
|
||||||
|
// 计算时间差(毫秒)
|
||||||
|
const timeDiff = Math.abs(d1.getTime() - d2.getTime());
|
||||||
|
|
||||||
|
// 转换为天数
|
||||||
|
const daysDiff = Math.floor(timeDiff / (1000 * 3600 * 24));
|
||||||
|
return daysDiff + "天";
|
||||||
|
}
|
||||||
|
|
||||||
|
const sessionsInit = async () => {
|
||||||
|
try {
|
||||||
|
let params ={
|
||||||
|
patient_id: route.params.id
|
||||||
|
}
|
||||||
|
// 导出报告逻辑
|
||||||
|
const response = await historyAPI.sessionsPage(params)
|
||||||
|
if (response.success) {
|
||||||
|
response.data.sessions.forEach(element => {
|
||||||
|
element.list = [{}]
|
||||||
|
});
|
||||||
|
profileInfo.value = response.data.sessions
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('获取失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
@ -598,7 +654,15 @@ const loadDetectionRecords = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//修改诊断信息
|
//修改诊断信息
|
||||||
function editClick() {
|
function editClick(row,index) {
|
||||||
|
diagnosticForm.value = {
|
||||||
|
id: row.id,
|
||||||
|
diagnosis_info: row.diagnosis_info,
|
||||||
|
treatment_info: row.treatment_info,
|
||||||
|
suggestion_info: row.suggestion_info,
|
||||||
|
status: row.status,
|
||||||
|
index: index
|
||||||
|
}
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
//数据详情
|
//数据详情
|
||||||
@ -607,52 +671,148 @@ function patientdetails() {
|
|||||||
}
|
}
|
||||||
async function handleDiagnosticInfo(status) {
|
async function handleDiagnosticInfo(status) {
|
||||||
try {
|
try {
|
||||||
// // 检查是否有活跃的会话ID
|
// 检查是否有活跃的会话ID
|
||||||
// if (!patientInfo.value.sessionId) {
|
if (!diagnosticForm.value.id) {
|
||||||
// throw new Error('缺少会话Id')
|
throw new Error('缺少会话Id')
|
||||||
// }
|
}
|
||||||
// // 调用后端API采集检测数据
|
// 调用后端API采集检测数据
|
||||||
// const response = await fetch(`${BACKEND_URL}/api/detection/${patientInfo.value.sessionId}/save-info`, {
|
const response = await fetch(`${BACKEND_URL}/api/detection/${diagnosticForm.value.id}/save-info`, {
|
||||||
// method: 'POST',
|
method: 'POST',
|
||||||
// headers: {
|
headers: {
|
||||||
// 'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
// },
|
},
|
||||||
// body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
// diagnosis_info:diagnosticForm.diagnosis_info,
|
diagnosis_info:diagnosticForm.value.diagnosis_info,
|
||||||
// treatment_info:diagnosticForm.treatment_info,
|
treatment_info:diagnosticForm.value.treatment_info,
|
||||||
// suggestion_info:diagnosticForm.suggestion_info,
|
suggestion_info:diagnosticForm.value.suggestion_info,
|
||||||
// status:status,
|
status:status,
|
||||||
// session_id:patientInfo.value.sessionId,
|
id:diagnosticForm.value.id,
|
||||||
// })
|
})
|
||||||
// })
|
})
|
||||||
// if (!response.ok) {
|
if (!response.ok) {
|
||||||
// throw new Error(`HTTP ${response.status}: ${response.statusText}`)
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const result = await response.json()
|
const result = await response.json()
|
||||||
// if (result.success) {
|
if (result.success) {
|
||||||
// // 显示成功消息
|
profileInfo.value[diagnosticForm.value.index].diagnosis_info = diagnosticForm.value.diagnosis_info
|
||||||
// ElMessage.success({
|
profileInfo.value[diagnosticForm.value.index].treatment_info = diagnosticForm.value.treatment_info
|
||||||
// message: status + '诊断信息成功',
|
profileInfo.value[diagnosticForm.value.index].suggestion_info = diagnosticForm.value.suggestion_info
|
||||||
// duration: 5000
|
profileInfo.value[diagnosticForm.value.index].status = status
|
||||||
// })
|
ElMessage.success({
|
||||||
// patientInfo.value.sessionId = null
|
message: '诊断信息成功',
|
||||||
// } else {
|
duration: 5000
|
||||||
// throw new Error(result.message || '诊断信息失败')
|
})
|
||||||
// }
|
dialogVisible.value =false
|
||||||
|
} else {
|
||||||
|
throw new Error(result.message || '诊断信息失败')
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// ElMessage.error({
|
ElMessage.error({
|
||||||
// message: errorMessage,
|
message: errorMessage,
|
||||||
// duration: 5000
|
duration: 5000
|
||||||
// })
|
})
|
||||||
// patientInfo.value.sessionId = null
|
|
||||||
} finally {
|
} finally {
|
||||||
// patientInfo.value.sessionId = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 暂停视频
|
||||||
|
const pauseVideo = (index) => {
|
||||||
|
if (videoPlayerRef.value) {
|
||||||
|
videoPlayerRef.value[index].pause()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 播放视频
|
||||||
|
const playNewVideo = () => {
|
||||||
|
if (videoPlayerRef.value) {
|
||||||
|
videoPlayerRef.value[index].play()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteClick = async (row) => {
|
||||||
|
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'确定义删除此条数据?',
|
||||||
|
'提示',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
historyAPI.detectionDelById(row.id).then((response)=>{
|
||||||
|
console.log(response.data)
|
||||||
|
}).catch(()=>{
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// // 检查是否有活跃的会话ID
|
||||||
|
// if (!row.id) {
|
||||||
|
// throw new Error('缺少会话Id');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 显示确认对话框
|
||||||
|
// await ElMessageBox.confirm(
|
||||||
|
// '确定要删除此条数据?',
|
||||||
|
// '警告',
|
||||||
|
// {
|
||||||
|
// confirmButtonText: '确定',
|
||||||
|
// cancelButtonText: '取消',
|
||||||
|
// type: 'warning',
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
// // 调用后端API删除数据
|
||||||
|
// const response = await fetch(`${BACKEND_URL}/api/detection/data/${row.id}`, {
|
||||||
|
// method: 'DELETE',
|
||||||
|
// headers: {
|
||||||
|
// 'Content-Type': 'application/json'
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
|
||||||
|
// if (!response.ok) {
|
||||||
|
// throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const result = await response.json();
|
||||||
|
// if (result.success) {
|
||||||
|
// ElMessage.success({
|
||||||
|
// message: '删除成功',
|
||||||
|
// duration: 5000
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// throw new Error(result.message || '删除失败');
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// // 如果是用户取消操作,不显示错误
|
||||||
|
// if (error === 'cancel' || error === 'close') {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// ElMessage.error({
|
||||||
|
// message: error.message || '删除过程中发生错误',
|
||||||
|
// duration: 5000
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// // 其他控制方法
|
||||||
|
// const togglePlayPause = () => {
|
||||||
|
// if (videoPlayerRef.value) {
|
||||||
|
// if (videoPlayerRef.value.paused) {
|
||||||
|
// videoPlayerRef.value.play()
|
||||||
|
// } else {
|
||||||
|
// videoPlayerRef.value.pause()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
// 生命周期
|
// 生命周期
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadPatientInfo()
|
loadPatientInfo()
|
||||||
|
sessionsInit()
|
||||||
// loadDetectionRecords()
|
// loadDetectionRecords()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@ -734,7 +894,19 @@ onMounted(() => {
|
|||||||
color: #E6A23C;
|
color: #E6A23C;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
border: 1px solid rgba(230, 162, 60, 0.3);
|
||||||
}
|
}
|
||||||
|
.content-right-top-text3 {
|
||||||
|
width: 62px;
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
background: rgba(103, 194, 58, 0.1);
|
||||||
|
color: rgb(103, 194, 58);
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: 1px solid rgba(103, 194, 58, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.content-right-top-content {
|
.content-right-top-content {
|
||||||
height: calc(100% - 75px);
|
height: calc(100% - 75px);
|
||||||
@ -819,6 +991,13 @@ onMounted(() => {
|
|||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.el-checkbox__inner) {
|
||||||
|
width:20px;
|
||||||
|
height: 20px;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.patient-profile-container {
|
.patient-profile-container {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
Loading…
Reference in New Issue
Block a user