40 lines
1.9 KiB
Go
40 lines
1.9 KiB
Go
package model
|
||
|
||
import (
|
||
"gorm.io/gorm"
|
||
"hospital-admin-api/global"
|
||
"time"
|
||
)
|
||
|
||
// OrderInquiryRefund 订单-问诊-退款表
|
||
type OrderInquiryRefund struct {
|
||
InquiryRefundId int64 `gorm:"column:inquiry_refund_id;type:bigint(19);primary_key;comment:主键id" json:"inquiry_refund_id"`
|
||
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
|
||
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id" json:"order_inquiry_id"`
|
||
InquiryNo string `gorm:"column:inquiry_no;type:varchar(40);comment:系统订单编号" json:"inquiry_no"`
|
||
InquiryRefundNo string `gorm:"column:inquiry_refund_no;type:varchar(50);comment:系统退款编号" json:"inquiry_refund_no"`
|
||
RefundId string `gorm:"column:refund_id;type:varchar(50);comment:第三方退款单号" json:"refund_id"`
|
||
InquiryRefundStatus int `gorm:"column:inquiry_refund_status;type:tinyint(4);comment:问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)" json:"inquiry_refund_status"`
|
||
RefundTotal float64 `gorm:"column:refund_total;type:decimal(10,2);comment:退款金额" json:"refund_total"`
|
||
RefundReason string `gorm:"column:refund_reason;type:varchar(255);comment:退款原因" json:"refund_reason"`
|
||
SuccessTime LocalTime `gorm:"column:success_time;type:datetime;comment:退款成功时间" json:"success_time"`
|
||
Model
|
||
}
|
||
|
||
func (m *OrderInquiryRefund) TableName() string {
|
||
return "gdxz_order_inquiry_refund"
|
||
}
|
||
func (m *OrderInquiryRefund) BeforeCreate(tx *gorm.DB) error {
|
||
if m.InquiryRefundId == 0 {
|
||
m.InquiryRefundId = 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
|
||
}
|