提交修改
This commit is contained in:
parent
dd695cfcca
commit
bfdba3e91f
@ -5,7 +5,7 @@ debug = false
|
|||||||
log_level = INFO
|
log_level = INFO
|
||||||
|
|
||||||
[SERVER]
|
[SERVER]
|
||||||
host = 127.0.0.1
|
host = 0.0.0.0
|
||||||
port = 5000
|
port = 5000
|
||||||
cors_origins = *
|
cors_origins = *
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class Config:
|
|||||||
|
|
||||||
# 服务器配置
|
# 服务器配置
|
||||||
self.config['SERVER'] = {
|
self.config['SERVER'] = {
|
||||||
'host': '127.0.0.1',
|
'host': '0.0.0.0',
|
||||||
'port': '5000',
|
'port': '5000',
|
||||||
'cors_origins': '*'
|
'cors_origins': '*'
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ debug = false
|
|||||||
log_level = INFO
|
log_level = INFO
|
||||||
|
|
||||||
[SERVER]
|
[SERVER]
|
||||||
host = 127.0.0.1
|
host = 0.0.0.0
|
||||||
port = 5000
|
port = 5000
|
||||||
cors_origins = *
|
cors_origins = *
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"server": {
|
"server": {
|
||||||
"host": "127.0.0.1",
|
"host": "0.0.0.0",
|
||||||
"port": 5000,
|
"port": 5000,
|
||||||
"debug": false,
|
"debug": false,
|
||||||
"cors": {
|
"cors": {
|
||||||
|
@ -7,7 +7,8 @@ const log = require('electron-log');
|
|||||||
let mainWindow;
|
let mainWindow;
|
||||||
let pythonProcess;
|
let pythonProcess;
|
||||||
const BACKEND_PORT = 5000;
|
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');
|
log.transports.file.resolvePathFn = () => path.join(app.getPath('userData'), 'logs', 'main.log');
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</el-avatar>
|
</el-avatar>
|
||||||
<span class="username">{{ userInfo.username }}</span>
|
<span class="username">{{ userInfo.username }}</span>
|
||||||
<el-dropdown @command="handleUserCommand">
|
<el-dropdown @command="handleUserCommand">
|
||||||
<el-button type="text" class="user-dropdown">
|
<el-button link class="user-dropdown">
|
||||||
<el-icon><ArrowDown /></el-icon>
|
<el-icon><ArrowDown /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
@ -65,7 +65,7 @@
|
|||||||
<div class="patient-detail-box" >
|
<div class="patient-detail-box" >
|
||||||
<div class="detail-header">
|
<div class="detail-header">
|
||||||
<div class="module-title">身体姿态</div>
|
<div class="module-title">身体姿态</div>
|
||||||
<el-button type="text" @click="editPatient">
|
<el-button link @click="editPatient">
|
||||||
<el-icon><Edit /></el-icon>
|
<el-icon><Edit /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -267,7 +267,14 @@ const loadPatients = async () => {
|
|||||||
try {
|
try {
|
||||||
const response = await patientAPI.getPatients()
|
const response = await patientAPI.getPatients()
|
||||||
if (response.success) {
|
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) {
|
} catch (error) {
|
||||||
console.error('加载患者列表失败:', error)
|
console.error('加载患者列表失败:', error)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<!-- 顶部导航 -->
|
<!-- 顶部导航 -->
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="header-left">
|
<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-icon><ArrowLeft /></el-icon>
|
||||||
返回
|
返回
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<!-- 顶部导航 -->
|
<!-- 顶部导航 -->
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="header-left">
|
<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-icon><ArrowLeft /></el-icon>
|
||||||
返回
|
返回
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
<div class="patient-info-card">
|
<div class="patient-info-card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h2>基本信息</h2>
|
<h2>基本信息</h2>
|
||||||
<el-button type="text" @click="editPatient">
|
<el-button link @click="editPatient">
|
||||||
<el-icon><Edit /></el-icon>
|
<el-icon><Edit /></el-icon>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -111,15 +111,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="record-actions">
|
<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-icon><VideoPlay /></el-icon>
|
||||||
回放视频
|
回放视频
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="text" @click.stop="viewScreenshots(record)">
|
<el-button link @click.stop="viewScreenshots(record)">
|
||||||
<el-icon><Picture /></el-icon>
|
<el-icon><Picture /></el-icon>
|
||||||
查看截图
|
查看截图
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="text" @click.stop="exportReport(record)">
|
<el-button link @click.stop="exportReport(record)">
|
||||||
<el-icon><Download /></el-icon>
|
<el-icon><Download /></el-icon>
|
||||||
导出报告
|
导出报告
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<!-- 顶部信息栏 -->
|
<!-- 顶部信息栏 -->
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="header-left">
|
<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-icon><ArrowLeft /></el-icon>
|
||||||
返回检测
|
返回检测
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -155,13 +155,13 @@
|
|||||||
<div class="item-time">{{ formatTime(record.createdAt) }}</div>
|
<div class="item-time">{{ formatTime(record.createdAt) }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-actions">
|
<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-icon><VideoPlay /></el-icon>
|
||||||
</el-button>
|
</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-icon><Download /></el-icon>
|
||||||
</el-button>
|
</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-icon><Delete /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -227,7 +227,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="timeline-controls">
|
<div class="timeline-controls">
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
link
|
||||||
size="small"
|
size="small"
|
||||||
@click="seekToStart"
|
@click="seekToStart"
|
||||||
:disabled="recordingStatus === 'recording'"
|
:disabled="recordingStatus === 'recording'"
|
||||||
@ -235,7 +235,7 @@
|
|||||||
<el-icon><DArrowLeft /></el-icon>
|
<el-icon><DArrowLeft /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
link
|
||||||
size="small"
|
size="small"
|
||||||
@click="seekBackward"
|
@click="seekBackward"
|
||||||
:disabled="recordingStatus === 'recording'"
|
:disabled="recordingStatus === 'recording'"
|
||||||
@ -243,7 +243,7 @@
|
|||||||
<el-icon><ArrowLeft /></el-icon>
|
<el-icon><ArrowLeft /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
link
|
||||||
size="small"
|
size="small"
|
||||||
@click="togglePlayback"
|
@click="togglePlayback"
|
||||||
:disabled="recordingStatus === 'recording' || !currentRecording"
|
:disabled="recordingStatus === 'recording' || !currentRecording"
|
||||||
@ -251,7 +251,7 @@
|
|||||||
<el-icon><component :is="isPlaying ? 'VideoPause' : 'VideoPlay'" /></el-icon>
|
<el-icon><component :is="isPlaying ? 'VideoPause' : 'VideoPlay'" /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
link
|
||||||
size="small"
|
size="small"
|
||||||
@click="seekForward"
|
@click="seekForward"
|
||||||
:disabled="recordingStatus === 'recording'"
|
:disabled="recordingStatus === 'recording'"
|
||||||
@ -259,7 +259,7 @@
|
|||||||
<el-icon><ArrowRight /></el-icon>
|
<el-icon><ArrowRight /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
link
|
||||||
size="small"
|
size="small"
|
||||||
@click="seekToEnd"
|
@click="seekToEnd"
|
||||||
:disabled="recordingStatus === 'recording'"
|
:disabled="recordingStatus === 'recording'"
|
||||||
|
105
init_test_data.py
Normal file
105
init_test_data.py
Normal 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()
|
@ -72,7 +72,7 @@
|
|||||||
"electron-log": "^4.4.8"
|
"electron-log": "^4.4.8"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"backend_host": "127.0.0.1",
|
"backend_host": "0.0.0.0",
|
||||||
"backend_port": "5000",
|
"backend_port": "5000",
|
||||||
"frontend_port": "5173"
|
"frontend_port": "5173"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user