You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
145 lines
5.3 KiB
145 lines
5.3 KiB
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// ConstitutionAssessment 体质测评记录
|
|
type ConstitutionAssessment struct {
|
|
gorm.Model
|
|
UserID uint `gorm:"index" json:"user_id"`
|
|
AssessedAt time.Time `json:"assessed_at"`
|
|
Scores string `gorm:"type:text" json:"scores"` // JSON: 各体质得分
|
|
PrimaryConstitution string `gorm:"size:20" json:"primary_constitution"` // 主要体质
|
|
SecondaryConstitutions string `gorm:"type:text" json:"secondary_constitutions"` // JSON: 次要体质
|
|
Recommendations string `gorm:"type:text" json:"recommendations"` // JSON: 调养建议
|
|
}
|
|
|
|
// AssessmentAnswer 问卷答案
|
|
type AssessmentAnswer struct {
|
|
gorm.Model
|
|
AssessmentID uint `gorm:"index" json:"assessment_id"`
|
|
QuestionID uint `json:"question_id"`
|
|
Score int `json:"score"` // 1-5
|
|
}
|
|
|
|
// QuestionBank 问卷题库
|
|
type QuestionBank struct {
|
|
gorm.Model
|
|
ConstitutionType string `gorm:"size:20;index" json:"constitution_type"` // 体质类型
|
|
QuestionText string `gorm:"type:text" json:"question_text"`
|
|
Options string `gorm:"type:text" json:"options"` // JSON: 选项
|
|
OrderNum int `json:"order_num"`
|
|
}
|
|
|
|
// ConstitutionType 体质类型常量
|
|
const (
|
|
ConstitutionPinghe = "pinghe" // 平和质
|
|
ConstitutionQixu = "qixu" // 气虚质
|
|
ConstitutionYangxu = "yangxu" // 阳虚质
|
|
ConstitutionYinxu = "yinxu" // 阴虚质
|
|
ConstitutionTanshi = "tanshi" // 痰湿质
|
|
ConstitutionShire = "shire" // 湿热质
|
|
ConstitutionXueyu = "xueyu" // 血瘀质
|
|
ConstitutionQiyu = "qiyu" // 气郁质
|
|
ConstitutionTebing = "tebing" // 特禀质
|
|
)
|
|
|
|
// ConstitutionNames 体质名称映射
|
|
var ConstitutionNames = map[string]string{
|
|
ConstitutionPinghe: "平和质",
|
|
ConstitutionQixu: "气虚质",
|
|
ConstitutionYangxu: "阳虚质",
|
|
ConstitutionYinxu: "阴虚质",
|
|
ConstitutionTanshi: "痰湿质",
|
|
ConstitutionShire: "湿热质",
|
|
ConstitutionXueyu: "血瘀质",
|
|
ConstitutionQiyu: "气郁质",
|
|
ConstitutionTebing: "特禀质",
|
|
}
|
|
|
|
// ConstitutionDescriptions 体质特征描述
|
|
var ConstitutionDescriptions = map[string]string{
|
|
ConstitutionPinghe: "阴阳气血调和,体态适中,面色红润,精力充沛",
|
|
ConstitutionQixu: "元气不足,容易疲劳,气短懒言,易出汗",
|
|
ConstitutionYangxu: "阳气不足,畏寒怕冷,手脚冰凉,喜热饮",
|
|
ConstitutionYinxu: "阴液亏少,口燥咽干,手足心热,盗汗",
|
|
ConstitutionTanshi: "痰湿凝聚,形体肥胖,腹部肥满,痰多",
|
|
ConstitutionShire: "湿热内蕴,面垢油光,口苦口干,大便黏滞",
|
|
ConstitutionXueyu: "血行不畅,肤色晦暗,易生斑点,健忘",
|
|
ConstitutionQiyu: "气机郁滞,情绪低落,多愁善感,胸闷",
|
|
ConstitutionTebing: "先天失常,过敏体质,易打喷嚏,皮肤易过敏",
|
|
}
|
|
|
|
// ConstitutionRecommendations 体质调养建议
|
|
var ConstitutionRecommendations = map[string]map[string]string{
|
|
ConstitutionPinghe: {
|
|
"diet": "饮食均衡,不偏食,粗细搭配",
|
|
"lifestyle": "起居有常,劳逸结合",
|
|
"exercise": "可进行各种运动,量力而行",
|
|
"emotion": "保持乐观积极的心态",
|
|
},
|
|
ConstitutionQixu: {
|
|
"diet": "宜食益气健脾食物,如山药、大枣、小米",
|
|
"lifestyle": "避免劳累,保证充足睡眠",
|
|
"exercise": "宜柔和运动,如太极拳、散步",
|
|
"emotion": "避免过度思虑",
|
|
},
|
|
ConstitutionYangxu: {
|
|
"diet": "宜食温阳食物,如羊肉、韭菜、生姜",
|
|
"lifestyle": "注意保暖,避免受寒",
|
|
"exercise": "宜温和运动,避免大汗",
|
|
"emotion": "保持积极乐观",
|
|
},
|
|
ConstitutionYinxu: {
|
|
"diet": "宜食滋阴食物,如百合、银耳、枸杞",
|
|
"lifestyle": "避免熬夜,保持环境湿润",
|
|
"exercise": "宜静养,避免剧烈运动",
|
|
"emotion": "避免急躁易怒",
|
|
},
|
|
ConstitutionTanshi: {
|
|
"diet": "饮食清淡,少食肥甘厚味,宜食薏米、冬瓜",
|
|
"lifestyle": "居住环境宜干燥通风",
|
|
"exercise": "坚持运动,促进代谢",
|
|
"emotion": "保持心情舒畅",
|
|
},
|
|
ConstitutionShire: {
|
|
"diet": "饮食清淡,宜食苦瓜、绿豆、薏米",
|
|
"lifestyle": "避免湿热环境,保持皮肤清洁",
|
|
"exercise": "适当运动,出汗排湿",
|
|
"emotion": "保持平和心态",
|
|
},
|
|
ConstitutionXueyu: {
|
|
"diet": "宜食活血化瘀食物,如山楂、黑木耳",
|
|
"lifestyle": "避免久坐,适当活动",
|
|
"exercise": "坚持有氧运动,促进血液循环",
|
|
"emotion": "保持心情愉快",
|
|
},
|
|
ConstitutionQiyu: {
|
|
"diet": "宜食行气解郁食物,如玫瑰花、佛手",
|
|
"lifestyle": "多参加社交活动",
|
|
"exercise": "宜户外运动,舒展身心",
|
|
"emotion": "学会疏导情绪,培养兴趣爱好",
|
|
},
|
|
ConstitutionTebing: {
|
|
"diet": "避免食用过敏食物,饮食清淡",
|
|
"lifestyle": "避免接触过敏原,保持环境清洁",
|
|
"exercise": "适度运动,增强体质",
|
|
"emotion": "保持心态平和",
|
|
},
|
|
}
|
|
|
|
// TableName 指定表名
|
|
func (ConstitutionAssessment) TableName() string {
|
|
return "constitution_assessments"
|
|
}
|
|
|
|
func (AssessmentAnswer) TableName() string {
|
|
return "assessment_answers"
|
|
}
|
|
|
|
func (QuestionBank) TableName() string {
|
|
return "question_banks"
|
|
}
|
|
|