hospital-open-api/api/model/doctorIdenFail.go
2023-08-31 17:32:45 +08:00

35 lines
996 B
Go

package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// DoctorIdenFail 医生身份审核失败原因表
type DoctorIdenFail struct {
IdenFailId int64 `gorm:"column:iden_fail_id;type:bigint(19);primary_key;comment:主键id" json:"iden_fail_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
FieldName string `gorm:"column:field_name;type:varchar(50);comment:字段名称" json:"field_name"`
FailReason string `gorm:"column:fail_reason;type:varchar(255);comment:失败原因" json:"fail_reason"`
Model
}
func (m *DoctorIdenFail) TableName() string {
return "gdxz_doctor_iden_fail"
}
func (m *DoctorIdenFail) BeforeCreate(tx *gorm.DB) error {
if m.IdenFailId == 0 {
m.IdenFailId = 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
}