package model import ( "time" "gorm.io/datatypes" ) // 健康记录类型 const ( RecordWeight = "weight" RecordPoop = "poop" RecordFood = "food" RecordSymptom = "symptom" RecordMedicine = "medicine" RecordVaccine = "vaccine" RecordDeworm = "deworm" RecordCost = "cost" RecordPhoto = "photo" ) // HealthRecord 统一健康/时间轴记录表,type 区分 9 类。 // NumValue 存体重/金额,Category 存消费类别/便便状态等,Extra 存各类型专有字段。 type HealthRecord struct { Base PetID string `gorm:"size:24;index" json:"pet_id"` UserID string `gorm:"size:24;index" json:"user_id"` Type string `gorm:"size:16;index" json:"type"` Icon string `gorm:"size:16" json:"icon"` Title string `gorm:"size:128" json:"title"` Description string `gorm:"size:512" json:"description"` NumValue float64 `gorm:"type:decimal(10,2)" json:"num_value"` Category string `gorm:"size:32" json:"category"` ImageURL string `gorm:"size:512" json:"image_url"` ImageFileID string `gorm:"size:24" json:"image_file_id"` // 关联 files 表:记录附图 Extra datatypes.JSON `json:"extra"` OccurredAt time.Time `gorm:"size:24;index" json:"occurred_at"` }