hospital-admin-api/api/model/orderServicePackageCase.go

52 lines
3.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
type OrderServicePackageCase struct {
OrderServiceCaseId int64 `gorm:"column:order_service_case_id;type:bigint(19);primary_key;comment:主键id" json:"order_service_case_id"`
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id;NOT NULL" json:"user_id"`
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id;NOT NULL" json:"patient_id"`
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id;NOT NULL" json:"order_id"`
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);comment:订单-服务包id;NOT NULL" json:"order_service_id"`
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id;NOT NULL" json:"family_id"`
DiseaseClassId int64 `gorm:"column:disease_class_id;type:bigint(19);comment:疾病分类id-系统" json:"disease_class_id"`
Relation int `gorm:"column:relation;type:tinyint(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"`
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"`
Model
}
func (m *OrderServicePackageCase) TableName() string {
return "gdxz_order_service_package_case"
}
func (m *OrderServicePackageCase) BeforeCreate(tx *gorm.DB) error {
if m.OrderServiceCaseId == 0 {
m.OrderServiceCaseId = 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
}