package model import ( "gorm.io/gorm" "hospital-admin-api/global" "time" ) // DoctorConfigHealthPackage 医生配置-健康包 type DoctorConfigHealthPackage struct { HealthPackageId int64 `gorm:"column:health_package_id;type:bigint(19);primary_key;comment:主键id" json:"health_package_id"` DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"` PackageId int64 `gorm:"column:package_id;type:bigint(19);comment:健康包配置id;NOT NULL" json:"package_id"` ServicePrice float64 `gorm:"column:service_price;type:decimal(10,2);comment:服务价格(根据图文问诊价格计算)" json:"service_price"` Model } func (m *DoctorConfigHealthPackage) TableName() string { return "gdxz_doctor_config_health_package" } func (m *DoctorConfigHealthPackage) BeforeCreate(tx *gorm.DB) error { if m.HealthPackageId == 0 { m.HealthPackageId = global.Snowflake.Generate().Int64() } m.CreatedAt = LocalTime(time.Now()) tx.Statement.SetColumn("CreatedAt", m.CreatedAt) m.UpdatedAt = LocalTime(time.Now()) tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt) return nil }