38 lines
1.7 KiB
Go
38 lines
1.7 KiB
Go
package model
|
||
|
||
import (
|
||
"gorm.io/gorm"
|
||
"hospital-admin-api/global"
|
||
"time"
|
||
)
|
||
|
||
// OrderPrescriptionFile 订单-处方表-ca处方文件
|
||
type OrderPrescriptionFile struct {
|
||
PrescriptionFileId int64 `gorm:"column:prescription_file_id;type:bigint(19);primary_key;comment:主键id" json:"prescription_file_id"`
|
||
OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);comment:订单-处方id" json:"order_prescription_id"`
|
||
DoctorCaFileId string `gorm:"column:doctor_ca_file_id;type:varchar(100);comment:医生签章pdf文件id(可请求ca下载)" json:"doctor_ca_file_id"`
|
||
HospitalCaFileId string `gorm:"column:hospital_ca_file_id;type:varchar(100);comment:医院签章pdf文件id(可请求ca下载)" json:"hospital_ca_file_id"`
|
||
PrescriptionImgOssPath string `gorm:"column:prescription_img_oss_path;type:varchar(255);comment:签章img文件oss路径" json:"prescription_img_oss_path"`
|
||
PrescriptionPdfOssPath string `gorm:"column:prescription_pdf_oss_path;type:varchar(255);comment:签章pdf文件oss路径" json:"prescription_pdf_oss_path"`
|
||
IsConvertedPdf int `gorm:"column:is_converted_pdf;type:tinyint(1);default:0;comment:是否已转换pdf为图片(0:否 1:是)" json:"is_converted_pdf"`
|
||
Model
|
||
}
|
||
|
||
func (m *OrderPrescriptionFile) TableName() string {
|
||
return "gdxz_order_prescription_file"
|
||
}
|
||
|
||
func (m *OrderPrescriptionFile) BeforeCreate(tx *gorm.DB) error {
|
||
if m.PrescriptionFileId == 0 {
|
||
m.PrescriptionFileId = 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
|
||
}
|