package model import ( "time" "gorm.io/gorm" ) // MedicalHistory 既往病史 type MedicalHistory struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"` HealthProfileID uint `gorm:"index" json:"health_profile_id"` DiseaseName string `gorm:"size:100" json:"disease_name"` DiseaseType string `gorm:"size:50" json:"disease_type"` // chronic, surgery, other DiagnosedDate string `gorm:"size:20" json:"diagnosed_date"` Status string `gorm:"size:20" json:"status"` // cured, treating, controlled Notes string `gorm:"type:text" json:"notes"` } // FamilyHistory 家族病史 type FamilyHistory struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"` HealthProfileID uint `gorm:"index" json:"health_profile_id"` Relation string `gorm:"size:20" json:"relation"` // father, mother, grandparent DiseaseName string `gorm:"size:100" json:"disease_name"` Notes string `gorm:"type:text" json:"notes"` } // AllergyRecord 过敏记录 type AllergyRecord struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"` HealthProfileID uint `gorm:"index" json:"health_profile_id"` AllergyType string `gorm:"size:20" json:"allergy_type"` // drug, food, other Allergen string `gorm:"size:100" json:"allergen"` Severity string `gorm:"size:20" json:"severity"` // mild, moderate, severe ReactionDesc string `gorm:"type:text" json:"reaction_desc"` } // TableName 指定表名 func (MedicalHistory) TableName() string { return "medical_histories" } func (FamilyHistory) TableName() string { return "family_histories" } func (AllergyRecord) TableName() string { return "allergy_records" }