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

41 lines
2.0 KiB
Go
Raw Permalink 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"
)
// OrderServicePackageDetail 订单-服务包详情表
type OrderServicePackageDetail struct {
OrderServiceDetailId int64 `gorm:"column:order_service_detail_id;type:bigint(19);primary_key;comment:主键id" json:"order_service_detail_id"`
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);comment:服务包订单id" json:"order_service_id"`
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id" json:"order_id"`
PackageId int64 `gorm:"column:package_id;type:bigint(19);comment:健康包配置id随访包时为空" json:"package_id"`
OrderServiceNo string `gorm:"column:order_service_no;type:varchar(30);comment:系统订单编号" json:"order_service_no"`
ServicePeriod int `gorm:"column:service_period;type:int(1);comment:服务周期(天)" json:"service_period"`
ServiceCount int `gorm:"column:service_count;type:int(1);comment:总服务次数0表示不限次" json:"service_count"`
MonthlyFrequency int `gorm:"column:monthly_frequency;type:int(1);comment:每月次数0表示不限次" json:"monthly_frequency"`
SingleInquiryPrice float64 `gorm:"column:single_inquiry_price;type:decimal(10,2);default:0.00;comment:单次图文问诊价格" json:"single_inquiry_price"`
ServicePrice float64 `gorm:"column:service_price;type:decimal(10,2);default:0.00;comment:总服务价格" json:"service_price"`
Model
}
func (m *OrderServicePackageDetail) TableName() string {
return "gdxz_order_service_package_detail"
}
func (m *OrderServicePackageDetail) BeforeCreate(tx *gorm.DB) error {
if m.OrderServiceDetailId == 0 {
m.OrderServiceDetailId = 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
}