修正返回目录
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// OrderPrescriptionProduct 订单-处方药品表
|
||||
type OrderPrescriptionProduct struct {
|
||||
PrescriptionProductId int64 `gorm:"column:prescription_product_id;type:bigint(19);primary_key;comment:主键id" json:"prescription_product_id"`
|
||||
OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);comment:订单-处方id;NOT NULL" json:"order_prescription_id"`
|
||||
ProductId int64 `gorm:"column:product_id;type:bigint(19);comment:商品id;NOT NULL" json:"product_id"`
|
||||
UseStatus int `gorm:"column:use_status;type:tinyint(1);default:0;comment:使用状态(1:已使用 0:未使用)" json:"use_status"`
|
||||
PrescriptionProductNum int `gorm:"column:prescription_product_num;type:int(11);default:1;comment:商品数量" json:"prescription_product_num"`
|
||||
ProductName string `gorm:"column:product_name;type:varchar(255);comment:商品名称" json:"product_name"`
|
||||
ProductSpec string `gorm:"column:product_spec;type:varchar(255);comment:商品规格" json:"product_spec"`
|
||||
LicenseNumber string `gorm:"column:license_number;type:varchar(30);comment:批准文号" json:"license_number"`
|
||||
Manufacturer string `gorm:"column:manufacturer;type:varchar(255);comment:生产厂家" json:"manufacturer"`
|
||||
SingleUnit string `gorm:"column:single_unit;type:varchar(50);comment:单次剂量(例:1次1包)" json:"single_unit"`
|
||||
SingleUse string `gorm:"column:single_use;type:varchar(50);comment:单次用法(例:口服)" json:"single_use"`
|
||||
PackagingUnit string `gorm:"column:packaging_unit;type:varchar(20);comment:基本包装单位(例:盒/瓶)" json:"packaging_unit"`
|
||||
FrequencyUse string `gorm:"column:frequency_use;type:varchar(50);comment:使用频率(例:1天3次)" json:"frequency_use"`
|
||||
AvailableDays int `gorm:"column:available_days;type:int(11);comment:可用天数(3)" json:"available_days"`
|
||||
Model
|
||||
}
|
||||
|
||||
func (m *OrderPrescriptionProduct) TableName() string {
|
||||
return "gdxz_order_prescription_product"
|
||||
}
|
||||
|
||||
func (m *OrderPrescriptionProduct) BeforeCreate(tx *gorm.DB) error {
|
||||
if m.PrescriptionProductId == 0 {
|
||||
m.PrescriptionProductId = 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
|
||||
}
|
||||
Reference in New Issue
Block a user