refactor: data analyze.

This commit is contained in:
2025-04-01 10:13:38 +08:00
parent 22dc82e052
commit 7b9e870bf9
3 changed files with 105 additions and 8 deletions

View File

@ -18,6 +18,20 @@ type Belt struct {
Name string `gorm:"size:100" json:"name"`
}
// 分析结果存储实体
type BeltAnalysis struct {
gorm.Model
TrainID uint `gorm:"index;not null"` // 关联训练记录
BeltID uint `gorm:"index;not null"` // 腰带唯一标识
RunType string `gorm:"size:100" json:"RunType"`
Avg2min float64 `gorm:"type:double precision"` // 第2分钟平均心率
Avg4min float64 `gorm:"type:double precision"` // 第4分钟平均心率
Avg6min float64 `gorm:"type:double precision"` // 第6分钟平均心率
CurveParamA float64 `gorm:"type:double precision"` // 拟合参数a值
}
// 中间计算结构(无需持久化)
// 对应Flutter的HeartRate结构
type HeartRate struct {
gorm.Model
@ -37,6 +51,7 @@ type TrainRecord struct {
StartTime int64 `gorm:"type:bigint" json:"time"` // 开始时间戳
EndTime int64 `gorm:"type:bigint" json:"endTime"` // 结束时间戳[3](@ref)
Name string `gorm:"size:100" json:"name"`
RunType string `gorm:"size:100" json:"RunType"`
MaxHeartRate int `gorm:"type:int" json:"maxHeartRate"`
Duration int `gorm:"type:int" json:"duration"` // 持续时间(秒)
PeopleNum int `gorm:"type:int" json:"peopleNum"`