修改了手机号登录
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hepa-calc-api/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// BaseDiseaseClass 基础-疾病分类
|
||||
type BaseDiseaseClass struct {
|
||||
DiseaseClassId int64 `gorm:"column:disease_class_id;type:bigint(19);primary_key;comment:主键id" json:"disease_class_id"`
|
||||
AppIden string `gorm:"column:app_iden;type:varchar(50);comment:app唯一标识" json:"app_iden"`
|
||||
DiseaseClassName string `gorm:"column:disease_class_name;type:varchar(255);comment:疾病分类名称" json:"disease_class_name"`
|
||||
Sort int `gorm:"column:sort;type:int(5);default:0;comment:排序值" json:"sort"`
|
||||
Model
|
||||
}
|
||||
|
||||
func (m *BaseDiseaseClass) TableName() string {
|
||||
return "base_disease_class"
|
||||
}
|
||||
|
||||
func (m *BaseDiseaseClass) BeforeCreate(tx *gorm.DB) error {
|
||||
if m.DiseaseClassId == 0 {
|
||||
m.DiseaseClassId = 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
|
||||
}
|
||||
+21
-1
@@ -1,5 +1,11 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hepa-calc-api/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// UserCase 用户表-病例
|
||||
type UserCase struct {
|
||||
UserCaseId int64 `gorm:"column:user_case_id;type:bigint(19);primary_key;comment:主键id" json:"user_case_id"`
|
||||
@@ -8,7 +14,7 @@ type UserCase struct {
|
||||
LiverStatus string `gorm:"column:liver_status;type:varchar(30);comment:肝脏状态" json:"liver_status"`
|
||||
IsMedication *int `gorm:"column:is_medication;type:tinyint(1);comment:是否服药(0:否 1:是)" json:"is_medication"`
|
||||
Medication string `gorm:"column:medication;type:varchar(20);comment:服药名称" json:"medication"`
|
||||
Disease string `gorm:"column:disease;type:varchar(500);comment:慢性疾病名称(逗号分隔)" json:"disease"`
|
||||
ChronicDisease string `gorm:"column:chronic_disease;type:varchar(500);comment:慢性疾病名称(逗号分隔)" json:"chronic_disease"`
|
||||
IsAllergyHistory *int `gorm:"column:is_allergy_history;type:tinyint(1);comment:过敏史(0:否 1:是)" json:"is_allergy_history"`
|
||||
AllergyHistory string `gorm:"column:allergy_history;type:varchar(100);comment:过敏史描述" json:"allergy_history"`
|
||||
Model
|
||||
@@ -17,3 +23,17 @@ type UserCase struct {
|
||||
func (m *UserCase) TableName() string {
|
||||
return "user_case"
|
||||
}
|
||||
|
||||
func (m *UserCase) BeforeCreate(tx *gorm.DB) error {
|
||||
if m.UserCaseId == 0 {
|
||||
m.UserCaseId = 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
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hepa-calc-api/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// UserCaseDiseaseItem 用户-病例-所患疾病列表
|
||||
type UserCaseDiseaseItem struct {
|
||||
ItemId int64 `gorm:"column:item_id;type:bigint(19);primary_key;comment:主键id" json:"item_id"`
|
||||
UserCaseId int64 `gorm:"column:user_case_id;type:bigint(19);comment:用户病例id" json:"user_case_id"`
|
||||
DiseaseClassId int64 `gorm:"column:disease_class_id;type:bigint(19);comment:疾病分类id" json:"disease_class_id"`
|
||||
AppIden string `gorm:"column:app_iden;type:varchar(50);comment:app唯一标识" json:"app_iden"`
|
||||
Duration *int `gorm:"column:duration;type:int(5);comment:患病时长(年)" json:"duration"`
|
||||
Genotype string `gorm:"column:genotype;type:varchar(20);comment:基因型(仅丙肝存在)" json:"genotype"`
|
||||
Model
|
||||
}
|
||||
|
||||
func (m *UserCaseDiseaseItem) TableName() string {
|
||||
return "user_case_disease_item"
|
||||
}
|
||||
|
||||
func (m *UserCaseDiseaseItem) BeforeCreate(tx *gorm.DB) error {
|
||||
if m.ItemId == 0 {
|
||||
m.ItemId = 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
|
||||
}
|
||||
Reference in New Issue
Block a user