新增审核多点,修改医生多点处理

This commit is contained in:
2023-07-17 14:20:02 +08:00
parent c9efce7bb6
commit 0bc6cf35d6
9 changed files with 409 additions and 184 deletions
+34
View File
@@ -0,0 +1,34 @@
package model
import (
"github.com/bwmarrin/snowflake"
"gorm.io/gorm"
"hospital-admin-api/config"
)
// HospitalDepartment 医院科室表-标准
type HospitalDepartment struct {
DepartmentId int64 `gorm:"column:department_id;type:bigint(19);primary_key;comment:主键id" json:"department_id"`
DepartmentName string `gorm:"column:department_name;type:varchar(255);comment:科室名称" json:"department_name"`
DepartmentCode string `gorm:"column:department_code;type:varchar(100);comment:科室代码" json:"department_code"`
DepartmentType int `gorm:"column:department_type;type:tinyint(1);default:0;comment:科室类型(0:未知 1:肝脏病)" json:"department_type"`
Model
}
func (m *HospitalDepartment) TableName() string {
return "gdxz_hospital_department"
}
func (m *HospitalDepartment) BeforeCreate(tx *gorm.DB) error {
if m.DepartmentId == 0 {
// 创建雪花算法实例
sf, err := snowflake.NewNode(config.C.Snowflake)
if err != nil {
return err
}
// 生成新的雪花算法 ID
m.DepartmentId = sf.Generate().Int64()
}
return nil
}