46 lines
2.7 KiB
Go
46 lines
2.7 KiB
Go
package model
|
||
|
||
import (
|
||
"gorm.io/gorm"
|
||
"hospital-admin-api/global"
|
||
"time"
|
||
)
|
||
|
||
// PatientFamilyPersonal 患者家庭成员信息表-个人情况
|
||
type PatientFamilyPersonal struct {
|
||
FamilyPersonalId int64 `gorm:"column:family_personal_id;type:bigint(19);primary_key;comment:主键id" json:"family_personal_id"`
|
||
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:信息表id" json:"family_id"`
|
||
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
|
||
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(255);comment:过敏史描述" json:"allergy_history"`
|
||
IsFamilyHistory *int `gorm:"column:is_family_history;type:tinyint(1);comment:是否存在家族病史(0:否 1:是)" json:"is_family_history"`
|
||
FamilyHistory string `gorm:"column:family_history;type:varchar(255);comment:家族病史描述" json:"family_history"`
|
||
IsPregnant *int `gorm:"column:is_pregnant;type:tinyint(1);comment:是否备孕、妊娠、哺乳期(0:否 1:是)" json:"is_pregnant"`
|
||
Pregnant string `gorm:"column:pregnant;type:varchar(255);comment:备孕、妊娠、哺乳期描述" json:"pregnant"`
|
||
IsOperation *int `gorm:"column:is_operation;type:tinyint(1);comment:是否存在手术(0:否 1:是)" json:"is_operation"`
|
||
Operation string `gorm:"column:operation;type:varchar(255);comment:手术描述" json:"operation"`
|
||
DrinkWineStatus *int `gorm:"column:drink_wine_status;type:tinyint(1);comment:饮酒状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒酒)" json:"drink_wine_status"`
|
||
SmokeStatus *int `gorm:"column:smoke_status;type:tinyint(1);comment:吸烟状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒烟)" json:"smoke_status"`
|
||
ChemicalCompoundStatus *int `gorm:"column:chemical_compound_status;type:tinyint(1);comment:化合物状态(1:从不 2:偶尔 3:经常 4:每天)" json:"chemical_compound_status"`
|
||
ChemicalCompoundDescribe string `gorm:"column:chemical_compound_describe;type:varchar(255);comment:化合物描述" json:"chemical_compound_describe"`
|
||
Model
|
||
}
|
||
|
||
func (m *PatientFamilyPersonal) TableName() string {
|
||
return "gdxz_patient_family_personal"
|
||
}
|
||
|
||
func (m *PatientFamilyPersonal) BeforeCreate(tx *gorm.DB) error {
|
||
if m.FamilyPersonalId == 0 {
|
||
m.FamilyPersonalId = 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
|
||
}
|