37 lines
1.5 KiB
Go
37 lines
1.5 KiB
Go
package model
|
||
|
||
import (
|
||
"gorm.io/gorm"
|
||
"hospital-admin-api/global"
|
||
"time"
|
||
)
|
||
|
||
// DoctorConfigDifficultConsultation 医生配置-疑难会诊
|
||
type DoctorConfigDifficultConsultation struct {
|
||
DifficultConsultationId int64 `gorm:"column:difficult_consultation_id;type:bigint(19);primary_key;comment:主键id" json:"difficult_consultation_id"`
|
||
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
|
||
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 *DoctorConfigDifficultConsultation) TableName() string {
|
||
return "gdxz_doctor_config_difficult_consultation"
|
||
}
|
||
|
||
func (m *DoctorConfigDifficultConsultation) BeforeCreate(tx *gorm.DB) error {
|
||
if m.DifficultConsultationId == 0 {
|
||
m.DifficultConsultationId = 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
|
||
}
|