hospital-admin-api/api/model/productPlatform.go
2023-12-21 15:16:20 +08:00

44 lines
2.2 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"
)
// ProductPlatform 商品表-处方平台
type ProductPlatform struct {
ProductPlatformId int64 `gorm:"column:product_platform_id;type:bigint(19);primary_key;comment:主键id" json:"product_platform_id"`
ProductName string `gorm:"column:product_name;type:varchar(255);comment:商品名称" json:"product_name"`
ProductPrice float64 `gorm:"column:product_price;type:decimal(10,2);comment:商品价格" json:"product_price"`
ProductType int `gorm:"column:product_type;type:tinyint(4);default:1;comment:药品类型0:未知 1:中成药 2:西药)" json:"product_type"`
ProductPlatformCode string `gorm:"column:product_platform_code;type:varchar(100);comment:处方平台商品编码" json:"product_platform_code"`
ProductPharmacyCode string `gorm:"column:product_pharmacy_code;type:varchar(100);comment:第三方药店商品编码" json:"product_pharmacy_code"`
ProductSpec string `gorm:"column:product_spec;type:varchar(255);comment:商品规格" json:"product_spec"`
LicenseNumber string `gorm:"column:license_number;type:varchar(255);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:单次剂量单位" json:"single_unit"`
PackagingUnit string `gorm:"column:packaging_unit;type:varchar(20);comment:基本包装单位" json:"packaging_unit"`
PackagingCount string `gorm:"column:packaging_count;type:varchar(20);comment:基本包装数量" json:"packaging_count"`
RetailUnit string `gorm:"column:retail_unit;type:varchar(20);comment:零售单位" json:"retail_unit"`
Model
}
func (m *ProductPlatform) TableName() string {
return "gdxz_product_platform"
}
func (m *ProductPlatform) BeforeCreate(tx *gorm.DB) error {
if m.ProductPlatformId == 0 {
m.ProductPlatformId = 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
}