新增了获取用户数据-详情信息,获取用户数据-病例。修改了获取用户列表-基本信息-分页,用户信息是否完善字段
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hepa-calc-admin-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
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hepa-calc-admin-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"`
|
||||
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id;NOT NULL" json:"user_id"`
|
||||
IsHospital *int `gorm:"column:is_hospital;type:tinyint(1);comment:是否医院就诊(0:否 1:是)" json:"is_hospital"`
|
||||
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"`
|
||||
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
|
||||
UserCaseDiseaseItem []*UserCaseDiseaseItem `gorm:"foreignKey:UserCaseId;references:user_case_id" json:"user_case_disease_item"`
|
||||
}
|
||||
|
||||
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,37 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hepa-calc-admin-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
|
||||
BaseDiseaseClass *BaseDiseaseClass `gorm:"foreignKey:DiseaseClassId;references:disease_class_id" json:"disease_class"`
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
+14
-13
@@ -8,19 +8,20 @@ import (
|
||||
|
||||
// UserInfo 用户表-基础信息
|
||||
type UserInfo struct {
|
||||
UserInfoId int64 `gorm:"column:user_info_id;type:bigint(19);primary_key;comment:主键id" json:"user_info_id"`
|
||||
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id" json:"user_id"`
|
||||
Height string `gorm:"column:height;type:varchar(20);comment:身高(cm)" json:"height"`
|
||||
Weight string `gorm:"column:weight;type:varchar(20);comment:体重(kg)" json:"weight"`
|
||||
NationId int64 `gorm:"column:nation_id;type:bigint(19);comment:民族id" json:"nation_id"`
|
||||
FamilyHistoryId int64 `gorm:"column:family_history_id;type:bigint(19);comment:家族病史id" json:"family_history_id"`
|
||||
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(50);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"`
|
||||
DiseaseClassId int64 `gorm:"column:disease_class_id;type:bigint(19);comment:疾病分类id" json:"disease_class_id"`
|
||||
UserInfoId int64 `gorm:"column:user_info_id;type:bigint(19);primary_key;comment:主键id" json:"user_info_id"`
|
||||
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id" json:"user_id"`
|
||||
Height string `gorm:"column:height;type:varchar(20);comment:身高(cm)" json:"height"`
|
||||
Weight string `gorm:"column:weight;type:varchar(20);comment:体重(kg)" json:"weight"`
|
||||
NationId *int64 `gorm:"column:nation_id;type:bigint(19);comment:民族id" json:"nation_id"`
|
||||
IsFamilyHistory *int `gorm:"column:is_family_history;type:tinyint(1);comment:是否存在家族病史(0:未知 1:是 2:否)" json:"is_family_history"`
|
||||
IsPregnant *int `gorm:"column:is_pregnant;type:tinyint(1);comment:是否怀孕(1:无计划 2:计划中 3:已怀孕 4:家有宝宝)" json:"is_pregnant"`
|
||||
ExpectedDate *LocalTime `gorm:"column:expected_date;type:datetime;comment:预产期" json:"expected_date"`
|
||||
ProvinceId string `gorm:"column:province_id;type:int(11);comment:省份id" json:"province_id"`
|
||||
Province string `gorm:"column:province;type:varchar(40);comment:省份" json:"province"`
|
||||
CityId string `gorm:"column:city_id;type:int(11);comment:城市id" json:"city_id"`
|
||||
City string `gorm:"column:city;type:varchar(50);comment:城市" json:"city"`
|
||||
CountyId string `gorm:"column:county_id;type:int(11);comment:区县id" json:"county_id"`
|
||||
County string `gorm:"column:county;type:varchar(255);comment:区县" json:"county"`
|
||||
Model
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user