新增了基础数据

This commit is contained in:
2024-08-20 16:47:09 +08:00
parent 6dd6172be9
commit 2ad676f9b1
14 changed files with 498 additions and 103 deletions
+9 -9
View File
@@ -7,15 +7,15 @@ import (
)
type BaseArea struct {
Id int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
CreateDate time.Time `gorm:"column:create_date;type:datetime;NOT NULL" json:"create_date"`
ModifyDate time.Time `gorm:"column:modify_date;type:datetime;NOT NULL" json:"modify_date"`
Orders int `gorm:"column:orders;type:int(11)" json:"orders"`
FullName string `gorm:"column:full_name;type:longtext;NOT NULL" json:"full_name"`
Name string `gorm:"column:name;type:varchar(100);NOT NULL" json:"name"`
TreePath string `gorm:"column:tree_path;type:varchar(255);NOT NULL" json:"tree_path"`
Parent int64 `gorm:"column:parent;type:bigint(20)" json:"parent"`
CanClinic int `gorm:"column:can_clinic;type:int(11);default:1" json:"can_clinic"`
Id int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
CreateDate *LocalTime `gorm:"column:create_date;type:datetime;NOT NULL" json:"create_date"`
ModifyDate *LocalTime `gorm:"column:modify_date;type:datetime;NOT NULL" json:"modify_date"`
Orders int `gorm:"column:orders;type:int(11)" json:"orders"`
FullName string `gorm:"column:full_name;type:longtext;NOT NULL" json:"full_name"`
Name string `gorm:"column:name;type:varchar(100);NOT NULL" json:"name"`
TreePath string `gorm:"column:tree_path;type:varchar(255);NOT NULL" json:"tree_path"`
Parent int64 `gorm:"column:parent;type:bigint(20)" json:"parent"`
CanClinic int `gorm:"column:can_clinic;type:int(11);default:1" json:"can_clinic"`
Model
}
+32
View File
@@ -0,0 +1,32 @@
package model
import (
"gorm.io/gorm"
"hepa-calc-api/global"
"time"
)
// BaseChronicDisease 基础-慢性疾病分类
type BaseChronicDisease struct {
ChronicDiseaseId int64 `gorm:"column:chronic_disease_id;type:bigint(19);primary_key;comment:主键id" json:"chronic_disease_id"`
ChronicDiseaseName string `gorm:"column:chronic_disease_name;type:varchar(255);comment:疾病分类名称" json:"chronic_disease_name"`
Model
}
func (m *BaseChronicDisease) TableName() string {
return "base_chronic_disease"
}
func (m *BaseChronicDisease) BeforeCreate(tx *gorm.DB) error {
if m.ChronicDiseaseId == 0 {
m.ChronicDiseaseId = 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
}