hospital-open-api/api/model/doctorInquiryConfig.go

40 lines
1.9 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// DoctorInquiryConfig 医生接诊配置表
type DoctorInquiryConfig struct {
InquiryConfigId int64 `gorm:"column:inquiry_config_id;type:bigint(19);primary_key;comment:主键id" json:"inquiry_config_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
InquiryType int `gorm:"column:inquiry_type;type:tinyint(1);default:1;comment:接诊类型1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药);NOT NULL" json:"inquiry_type"`
InquiryMode int `gorm:"column:inquiry_mode;type:tinyint(1);default:1;comment:接诊方式1:图文 2:视频 3:语音 4:电话 5:会员);NOT NULL" json:"inquiry_mode"`
IsEnable int `gorm:"column:is_enable;type:tinyint(1);default:0;comment:是否启用0:否 1:是)" json:"is_enable"`
LastEnableMethod int `gorm:"column:last_enable_method;type:tinyint(1);default:1;comment:最后开启方式1:自己 2:后台)" json:"last_enable_method"`
WorkNumDay int `gorm:"column:work_num_day;type:int(10);default:0;comment:每日接诊数量" json:"work_num_day"`
InquiryPrice float64 `gorm:"column:inquiry_price;type:decimal(10,2);comment:接诊价格(专家问诊-公益问诊)" json:"inquiry_price"`
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
Model
}
func (m *DoctorInquiryConfig) TableName() string {
return "gdxz_doctor_inquiry_config"
}
func (m *DoctorInquiryConfig) BeforeCreate(tx *gorm.DB) error {
if m.InquiryConfigId == 0 {
m.InquiryConfigId = 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
}