hospital-admin-api/api/model/userPharmacist.go

45 lines
2.3 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-admin-api/global"
"time"
)
// UserPharmacist 用户-药师表
type UserPharmacist struct {
PharmacistId int64 `gorm:"column:pharmacist_id;type:bigint(19);primary_key;comment:主键id" json:"pharmacist_id"`
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id" json:"user_id"`
UserName string `gorm:"column:user_name;type:varchar(50);comment:用户名称" json:"user_name"`
OpenId string `gorm:"column:open_id;type:varchar(100);comment:微信open_id" json:"open_id"`
UnionId string `gorm:"column:union_id;type:varchar(100);comment:微信开放平台唯一标识" json:"union_id"`
WxSessionKey string `gorm:"column:wx_session_key;type:varchar(255);comment:微信会话密钥" json:"wx_session_key"`
Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态0:禁用 1:正常 2:删除)" json:"status"`
Avatar string `gorm:"column:avatar;type:varchar(255);comment:头像" json:"avatar"`
PharmacistTitle int `gorm:"column:pharmacist_title;type:tinyint(1);comment:职称" json:"pharmacist_title"`
DepartmentCustomId int64 `gorm:"column:department_custom_id;type:bigint(19);comment:科室id-自定义" json:"department_custom_id"`
DepartmentCustomName string `gorm:"column:department_custom_name;type:varchar(100);comment:科室名称(如未自己输入,填入标准科室名称)" json:"department_custom_name"`
DepartmentCustomMobile string `gorm:"column:department_custom_mobile;type:varchar(30);comment:科室电话" json:"department_custom_mobile"`
MedicalInstitution string `gorm:"column:medical_institution;type:varchar(255);comment:医疗机构名称" json:"medical_institution"`
WorkerDate string `gorm:"column:worker_date;type:varchar(255);comment:医龄" json:"worker_date"`
Model
}
func (m *UserPharmacist) TableName() string {
return "gdxz_user_pharmacist"
}
func (m *UserPharmacist) BeforeCreate(tx *gorm.DB) error {
if m.PharmacistId == 0 {
m.PharmacistId = 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
}