提交修改

This commit is contained in:
zhaozilong12 2025-07-29 17:04:51 +08:00
parent dd695cfcca
commit bfdba3e91f
11 changed files with 137 additions and 24 deletions

View File

@ -5,7 +5,7 @@ debug = false
log_level = INFO
[SERVER]
host = 127.0.0.1
host = 0.0.0.0
port = 5000
cors_origins = *

View File

@ -53,7 +53,7 @@ class Config:
# 服务器配置
self.config['SERVER'] = {
'host': '127.0.0.1',
'host': '0.0.0.0',
'port': '5000',
'cors_origins': '*'
}

View File

@ -5,7 +5,7 @@ debug = false
log_level = INFO
[SERVER]
host = 127.0.0.1
host = 0.0.0.0
port = 5000
cors_origins = *

View File

@ -22,7 +22,7 @@
}
},
"server": {
"host": "127.0.0.1",
"host": "0.0.0.0",
"port": 5000,
"debug": false,
"cors": {

View File

@ -7,7 +7,8 @@ const log = require('electron-log');
let mainWindow;
let pythonProcess;
const BACKEND_PORT = 5000;
const BACKEND_URL = `http://127.0.0.1:${BACKEND_PORT}`;
const BACKEND_HOST = process.env.BACKEND_HOST || '0.0.0.0';
const BACKEND_URL = `http://${BACKEND_HOST}:${BACKEND_PORT}`;
// 配置日志
log.transports.file.resolvePathFn = () => path.join(app.getPath('userData'), 'logs', 'main.log');

View File

@ -13,7 +13,7 @@
</el-avatar>
<span class="username">{{ userInfo.username }}</span>
<el-dropdown @command="handleUserCommand">
<el-button type="text" class="user-dropdown">
<el-button link class="user-dropdown">
<el-icon><ArrowDown /></el-icon>
</el-button>
<template #dropdown>
@ -65,7 +65,7 @@
<div class="patient-detail-box" >
<div class="detail-header">
<div class="module-title">身体姿态</div>
<el-button type="text" @click="editPatient">
<el-button link @click="editPatient">
<el-icon><Edit /></el-icon>
</el-button>
</div>
@ -267,7 +267,14 @@ const loadPatients = async () => {
try {
const response = await patientAPI.getPatients()
if (response.success) {
patients.value = response.data
// patients
if (response.data && Array.isArray(response.data.patients)) {
patients.value = response.data.patients
} else if (Array.isArray(response.data)) {
patients.value = response.data
} else {
patients.value = []
}
}
} catch (error) {
console.error('加载患者列表失败:', error)

View File

@ -3,7 +3,7 @@
<!-- 顶部导航 -->
<div class="header">
<div class="header-left">
<el-button type="text" @click="goBack" class="back-btn">
<el-button link @click="goBack" class="back-btn">
<el-icon><ArrowLeft /></el-icon>
返回
</el-button>

View File

@ -3,7 +3,7 @@
<!-- 顶部导航 -->
<div class="header">
<div class="header-left">
<el-button type="text" @click="goBack" class="back-btn">
<el-button link @click="goBack" class="back-btn">
<el-icon><ArrowLeft /></el-icon>
返回
</el-button>
@ -22,7 +22,7 @@
<div class="patient-info-card">
<div class="card-header">
<h2>基本信息</h2>
<el-button type="text" @click="editPatient">
<el-button link @click="editPatient">
<el-icon><Edit /></el-icon>
编辑
</el-button>
@ -111,15 +111,15 @@
</div>
</div>
<div class="record-actions">
<el-button type="text" @click.stop="playVideo(record)">
<el-button link @click.stop="playVideo(record)">
<el-icon><VideoPlay /></el-icon>
回放视频
</el-button>
<el-button type="text" @click.stop="viewScreenshots(record)">
<el-button link @click.stop="viewScreenshots(record)">
<el-icon><Picture /></el-icon>
查看截图
</el-button>
<el-button type="text" @click.stop="exportReport(record)">
<el-button link @click.stop="exportReport(record)">
<el-icon><Download /></el-icon>
导出报告
</el-button>

View File

@ -3,7 +3,7 @@
<!-- 顶部信息栏 -->
<div class="header">
<div class="header-left">
<el-button type="text" @click="goBack" class="back-btn">
<el-button link @click="goBack" class="back-btn">
<el-icon><ArrowLeft /></el-icon>
返回检测
</el-button>
@ -155,13 +155,13 @@
<div class="item-time">{{ formatTime(record.createdAt) }}</div>
</div>
<div class="item-actions">
<el-button type="text" size="small" @click.stop="playRecording(record)">
<el-button link size="small" @click.stop="playRecording(record)">
<el-icon><VideoPlay /></el-icon>
</el-button>
<el-button type="text" size="small" @click.stop="downloadRecording(record)">
<el-button link size="small" @click.stop="downloadRecording(record)">
<el-icon><Download /></el-icon>
</el-button>
<el-button type="text" size="small" @click.stop="deleteRecording(record)">
<el-button link size="small" @click.stop="deleteRecording(record)">
<el-icon><Delete /></el-icon>
</el-button>
</div>
@ -227,7 +227,7 @@
</div>
<div class="timeline-controls">
<el-button
type="text"
link
size="small"
@click="seekToStart"
:disabled="recordingStatus === 'recording'"
@ -235,7 +235,7 @@
<el-icon><DArrowLeft /></el-icon>
</el-button>
<el-button
type="text"
link
size="small"
@click="seekBackward"
:disabled="recordingStatus === 'recording'"
@ -243,7 +243,7 @@
<el-icon><ArrowLeft /></el-icon>
</el-button>
<el-button
type="text"
link
size="small"
@click="togglePlayback"
:disabled="recordingStatus === 'recording' || !currentRecording"
@ -251,7 +251,7 @@
<el-icon><component :is="isPlaying ? 'VideoPause' : 'VideoPlay'" /></el-icon>
</el-button>
<el-button
type="text"
link
size="small"
@click="seekForward"
:disabled="recordingStatus === 'recording'"
@ -259,7 +259,7 @@
<el-icon><ArrowRight /></el-icon>
</el-button>
<el-button
type="text"
link
size="small"
@click="seekToEnd"
:disabled="recordingStatus === 'recording'"

105
init_test_data.py Normal file
View File

@ -0,0 +1,105 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
初始化测试数据脚本
"""
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), 'backend'))
from backend.database import DatabaseManager
import uuid
from datetime import datetime
def init_test_data():
"""初始化测试数据"""
# 初始化数据库
db_manager = DatabaseManager('backend/data/body_balance.db')
db_manager.init_database()
print("数据库初始化完成")
# 检查是否已有患者数据
patients_count = db_manager.get_patients_count()
print(f"当前患者数量: {patients_count}")
if patients_count > 0:
print("数据库中已有患者数据,跳过插入")
return
# 插入测试患者数据
test_patients = [
{
'name': '张三',
'gender': 'male',
'age': 35,
'height': 175,
'weight': 70,
'phone': '13800138001',
'medical_history': '无特殊病史',
'notes': '测试患者1'
},
{
'name': '李四',
'gender': 'female',
'age': 28,
'height': 165,
'weight': 55,
'phone': '13800138002',
'medical_history': '轻微腰椎间盘突出',
'notes': '测试患者2'
},
{
'name': '王五',
'gender': 'male',
'age': 42,
'height': 180,
'weight': 80,
'phone': '13800138003',
'medical_history': '高血压',
'notes': '测试患者3'
},
{
'name': '赵六',
'gender': 'female',
'age': 31,
'height': 160,
'weight': 50,
'phone': '13800138004',
'medical_history': '',
'notes': '测试患者4'
},
{
'name': '钱七',
'gender': 'male',
'age': 55,
'height': 170,
'weight': 75,
'phone': '13800138005',
'medical_history': '糖尿病',
'notes': '测试患者5'
}
]
print("开始插入测试患者数据...")
for i, patient_data in enumerate(test_patients, 1):
try:
patient_id = db_manager.create_patient(patient_data)
print(f"插入患者 {i}: {patient_data['name']} (ID: {patient_id})")
except Exception as e:
print(f"插入患者 {i} 失败: {e}")
# 验证插入结果
final_count = db_manager.get_patients_count()
print(f"\n插入完成,当前患者总数: {final_count}")
# 显示患者列表
patients = db_manager.get_patients(page=1, size=10)
print("\n患者列表:")
for patient in patients:
print(f"- {patient['name']} ({patient['gender']}, {patient['age']}岁) - {patient['phone']}")
if __name__ == '__main__':
init_test_data()

View File

@ -72,7 +72,7 @@
"electron-log": "^4.4.8"
},
"config": {
"backend_host": "127.0.0.1",
"backend_host": "0.0.0.0",
"backend_port": "5000",
"frontend_port": "5173"
},