package model import ( "gorm.io/gorm" "hospital-admin-api/global" "time" ) type DoctorInquiryConfigService struct { ConfigServiceId int64 `gorm:"column:config_service_id;type:bigint(19);primary_key;comment:主键id" json:"config_service_id"` DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"` InquiryType int `gorm:"column:inquiry_type;type:tinyint(1);comment:接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药);NOT NULL" json:"inquiry_type"` InquiryMode int `gorm:"column:inquiry_mode;type:tinyint(1);comment:接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊 7:附赠);NOT NULL" json:"inquiry_mode"` ServiceContent string `gorm:"column:service_content;type:text;comment:服务内容" json:"service_content"` ServiceProcess string `gorm:"column:service_process;type:text;comment:服务流程" json:"service_process"` ServicePeriod uint `gorm:"column:service_period;type:int(10) unsigned;comment:服务周期;NOT NULL" json:"service_period"` ServiceRounds uint `gorm:"column:service_rounds;type:int(1) unsigned;default:0;comment:服务回合数(0表示不限次)" json:"service_rounds"` Model } func (m *DoctorInquiryConfigService) TableName() string { return "gdxz_doctor_inquiry_config_service" } func (m *DoctorInquiryConfigService) BeforeCreate(tx *gorm.DB) error { if m.ConfigServiceId == 0 { m.ConfigServiceId = 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 }