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

42 lines
1.7 KiB
Go

package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// DoctorBankCard 医生银行卡
type DoctorBankCard struct {
BankCardId int64 `gorm:"column:bank_card_id;type:bigint(19);primary_key;comment:主键id" json:"bank_card_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
BankId int64 `gorm:"column:bank_id;type:bigint(19);comment:银行id" json:"bank_id"`
BankCardCode string `gorm:"column:bank_card_code;type:varchar(100);comment:银行卡号" json:"bank_card_code"`
BankCardCodeMask string `gorm:"column:bank_card_code_mask;type:varchar(100);comment:银行卡号(掩码)" json:"bank_card_code_mask"`
ProvinceId int `gorm:"column:province_id;type:int(11);comment:省份id" json:"province_id"`
Province string `gorm:"column:province;type:varchar(40);comment:省份" json:"province"`
CityId int `gorm:"column:city_id;type:int(11);comment:城市id" json:"city_id"`
City string `gorm:"column:city;type:varchar(40);comment:城市" json:"city"`
CountyId int `gorm:"column:county_id;type:int(11);comment:区县id" json:"county_id"`
County string `gorm:"column:county;type:varchar(255);comment:区县" json:"county"`
Model
}
func (m *DoctorBankCard) TableName() string {
return "gdxz_doctor_bank_card"
}
func (m *DoctorBankCard) BeforeCreate(tx *gorm.DB) error {
if m.BankCardId == 0 {
m.BankCardId = 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
}