55 lines
3.6 KiB
Go
55 lines
3.6 KiB
Go
package model
|
||
|
||
import (
|
||
"gorm.io/gorm"
|
||
"hospital-open-api/global"
|
||
"time"
|
||
)
|
||
|
||
// OrderInquiryCase 订单-问诊病例表
|
||
type OrderInquiryCase struct {
|
||
InquiryCaseId int64 `gorm:"column:inquiry_case_id;type:bigint(19);primary_key;comment:主键id" json:"inquiry_case_id"`
|
||
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id" json:"user_id"`
|
||
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
|
||
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
|
||
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id" json:"family_id"`
|
||
Relation int `gorm:"column:relation;type:tinyint(1);default:1;comment:与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )" json:"relation"`
|
||
Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态(1:正常 2:删除)" json:"status"`
|
||
Name string `gorm:"column:name;type:varchar(50);comment:患者名称" json:"name"`
|
||
Sex int `gorm:"column:sex;type:tinyint(1);default:0;comment:患者性别(0:未知 1:男 2:女)" json:"sex"`
|
||
Age int `gorm:"column:age;type:int(11);comment:患者年龄" json:"age"`
|
||
Height string `gorm:"column:height;type:varchar(100);comment:身高(cm)" json:"height"`
|
||
Weight string `gorm:"column:weight;type:varchar(100);comment:体重(kg)" json:"weight"`
|
||
DiseaseClassId int64 `gorm:"column:disease_class_id;type:bigint(19);comment:疾病分类id-系统" json:"disease_class_id"`
|
||
DiseaseClassName string `gorm:"column:disease_class_name;type:varchar(255);comment:疾病名称-系统" json:"disease_class_name"`
|
||
DiagnosisDate LocalTime `gorm:"column:diagnosis_date;type:datetime;comment:确诊日期" json:"diagnosis_date"`
|
||
DiseaseDesc string `gorm:"column:disease_desc;type:text;comment:病情描述(主诉)" json:"disease_desc"`
|
||
DiagnoseImages string `gorm:"column:diagnose_images;type:varchar(1000);comment:复诊凭证(多个使用逗号分隔)" json:"diagnose_images"`
|
||
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"`
|
||
IsTaboo int `gorm:"column:is_taboo;type:tinyint(1);comment:是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在" json:"is_taboo"`
|
||
Model
|
||
}
|
||
|
||
func (m *OrderInquiryCase) TableName() string {
|
||
return "gdxz_order_inquiry_case"
|
||
}
|
||
|
||
func (m *OrderInquiryCase) BeforeCreate(tx *gorm.DB) error {
|
||
if m.InquiryCaseId == 0 {
|
||
m.InquiryCaseId = 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
|
||
}
|