新增:获取服务包订单列表-分页

This commit is contained in:
2024-05-24 10:20:17 +08:00
parent 22e50153de
commit 626542394d
18 changed files with 1034 additions and 3 deletions
@@ -0,0 +1,36 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// DoctorConfigDifficultConsultation 医生配置-疑难会诊
type DoctorConfigDifficultConsultation struct {
DifficultConsultationId int64 `gorm:"column:difficult_consultation_id;type:bigint(19);primary_key;comment:主键id" json:"difficult_consultation_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
ServiceContent string `gorm:"column:service_content;type:text;comment:服务内容" json:"service_content"`
ServiceProcess string `gorm:"column:service_process;type:text;comment:服务流程" json:"service_process"`
ServicePeriod uint `gorm:"column:service_period;type:int(10) unsigned;comment:服务周期;NOT NULL" json:"service_period"`
ServiceRounds uint `gorm:"column:service_rounds;type:int(1) unsigned;default:0;comment:服务回合数(0表示不限次)" json:"service_rounds"`
Model
}
func (m *DoctorConfigDifficultConsultation) TableName() string {
return "gdxz_doctor_config_difficult_consultation"
}
func (m *DoctorConfigDifficultConsultation) BeforeCreate(tx *gorm.DB) error {
if m.DifficultConsultationId == 0 {
m.DifficultConsultationId = 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
}
+34
View File
@@ -0,0 +1,34 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// DoctorConfigFollowPackage 医生配置-随访包
type DoctorConfigFollowPackage struct {
FollowPackageId int64 `gorm:"column:follow_package_id;type:bigint(19);primary_key;comment:主键id" json:"follow_package_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
MonthlyFrequency int `gorm:"column:monthly_frequency;type:int(1);default:0;comment:每月次数(0表示不限次)" json:"monthly_frequency"`
ServiceRounds int `gorm:"column:service_rounds;type:int(1);default:0;comment:服务回合数(0表示不限次)" json:"service_rounds"`
Model
}
func (m *DoctorConfigFollowPackage) TableName() string {
return "gdxz_doctor_config_follow_package"
}
func (m *DoctorConfigFollowPackage) BeforeCreate(tx *gorm.DB) error {
if m.FollowPackageId == 0 {
m.FollowPackageId = 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
}
@@ -0,0 +1,34 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// DoctorConfigFollowPackageItem 医生配置-随访包-明细
type DoctorConfigFollowPackageItem struct {
FollowPackageItemId int64 `gorm:"column:follow_package_item_id;type:bigint(19);primary_key;comment:主键id" json:"follow_package_item_id"`
FollowPackageId int64 `gorm:"column:follow_package_id;type:bigint(19);comment:医生随访包id;NOT NULL" json:"follow_package_id"`
ServicePeriod int `gorm:"column:service_period;type:int(5);comment:服务周期(天)" json:"service_period"`
ServicePrice float64 `gorm:"column:service_price;type:decimal(10,2);comment:服务价格" json:"service_price"`
Model
}
func (m *DoctorConfigFollowPackageItem) TableName() string {
return "gdxz_doctor_config_follow_package_item"
}
func (m *DoctorConfigFollowPackageItem) BeforeCreate(tx *gorm.DB) error {
if m.FollowPackageItemId == 0 {
m.FollowPackageItemId = 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
}
+34
View File
@@ -0,0 +1,34 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// DoctorConfigHealthPackage 医生配置-健康包
type DoctorConfigHealthPackage struct {
HealthPackageId int64 `gorm:"column:health_package_id;type:bigint(19);primary_key;comment:主键id" json:"health_package_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
PackageId int64 `gorm:"column:package_id;type:bigint(19);comment:健康包配置id;NOT NULL" json:"package_id"`
ServicePrice float64 `gorm:"column:service_price;type:decimal(10,2);comment:服务价格(根据图文问诊价格计算)" json:"service_price"`
Model
}
func (m *DoctorConfigHealthPackage) TableName() string {
return "gdxz_doctor_config_health_package"
}
func (m *DoctorConfigHealthPackage) BeforeCreate(tx *gorm.DB) error {
if m.HealthPackageId == 0 {
m.HealthPackageId = 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
}
+36
View File
@@ -0,0 +1,36 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// HealthPackage 健康包
type HealthPackage struct {
PackageId int64 `gorm:"column:package_id;type:bigint(20);primary_key;comment:主键id" json:"package_id"`
ServiceCount int `gorm:"column:service_count;type:int(1);comment:总服务次数" json:"service_count"`
MonthlyFrequency int `gorm:"column:monthly_frequency;type:int(1);comment:每月次数" json:"monthly_frequency"`
EffectiveDays string `gorm:"column:effective_days;type:varchar(20);comment:服务有效天数" json:"effective_days"`
ServiceRate string `gorm:"column:service_rate;type:varchar(20);comment:服务费率。100为满值,表示1,正常费率。" json:"service_rate"`
DiscountProductTotalAmount float64 `gorm:"column:discount_product_total_amount;type:decimal(10,2) unsigned;default:0.00;comment:折扣商品总价格" json:"discount_product_total_amount"`
Model
}
func (m *HealthPackage) TableName() string {
return "gdxz_health_package"
}
func (m *HealthPackage) BeforeCreate(tx *gorm.DB) error {
if m.PackageId == 0 {
m.PackageId = 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
}
+36
View File
@@ -0,0 +1,36 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// HealthPackageProduct 健康包-关联商品
type HealthPackageProduct struct {
PackageProductId int64 `gorm:"column:package_product_id;type:bigint(19);comment:主键id" json:"package_product_id"`
PackageId int64 `gorm:"column:package_id;type:bigint(19);comment:健康包id" json:"package_id"`
ProductId int64 `gorm:"column:product_id;type:bigint(19);primary_key;comment:商品id" json:"product_id"`
ProductName string `gorm:"column:product_name;type:varchar(255);comment:商品名称" json:"product_name"`
Quantity int `gorm:"column:quantity;type:int(1);default:1;comment:数量" json:"quantity"`
DiscountProductPrice float64 `gorm:"column:discount_product_price;type:decimal(10,2) unsigned;default:0.00;comment:折扣商品价格" json:"discount_product_price"`
Model
}
func (m *HealthPackageProduct) TableName() string {
return "gdxz_health_package_product"
}
func (m *HealthPackageProduct) BeforeCreate(tx *gorm.DB) error {
if m.PackageProductId == 0 {
m.PackageProductId = 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
}
+62
View File
@@ -0,0 +1,62 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// OrderServicePackage 订单-服务包表
type OrderServicePackage struct {
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);primary_key;comment:主键id" json:"order_service_id"`
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id;NOT NULL" json:"order_id"`
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id-患者;NOT NULL" json:"user_id"`
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id;NOT NULL" json:"patient_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id(就诊用户);NOT NULL" json:"family_id"`
OrderServiceType int `gorm:"column:order_service_type;type:tinyint(1);comment:服务包类型(1:健康包 2:随访包);NOT NULL" json:"order_service_type"`
OrderServiceStatus int `gorm:"column:order_service_status;type:tinyint(4);comment:订单状态(1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消);NOT NULL" json:"order_service_status"`
IsDelete int `gorm:"column:is_delete;type:tinyint(1);default:0;comment:删除状态(0:否 1:是)" json:"is_delete"`
RefundStatus int `gorm:"column:refund_status;type:tinyint(1);default:0;comment:订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款);NOT NULL" json:"refund_status"`
PayChannel int `gorm:"column:pay_channel;type:tinyint(1);comment:支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付);NOT NULL" json:"pay_channel"`
PayStatus int `gorm:"column:pay_status;type:tinyint(1);default:1;comment:支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款);NOT NULL" json:"pay_status"`
OrderServiceNo string `gorm:"column:order_service_no;type:varchar(30);comment:系统订单编号;NOT NULL" json:"order_service_no"`
EscrowTradeNo string `gorm:"column:escrow_trade_no;type:varchar(100);comment:第三方支付流水号;NOT NULL" json:"escrow_trade_no"`
AmountTotal float64 `gorm:"column:amount_total;type:decimal(10,2);default:0.00;comment:订单金额" json:"amount_total"`
CouponAmountTotal float64 `gorm:"column:coupon_amount_total;type:decimal(10,2);default:0.00;comment:优惠卷总金额" json:"coupon_amount_total"`
PaymentAmountTotal float64 `gorm:"column:payment_amount_total;type:decimal(10,2);default:0.00;comment:实际付款金额" json:"payment_amount_total"`
PayTime LocalTime `gorm:"column:pay_time;type:datetime;comment:支付时间" json:"pay_time"`
StartTime LocalTime `gorm:"column:start_time;type:datetime;comment:开始服务时间" json:"start_time"`
FinishTime LocalTime `gorm:"column:finish_time;type:datetime;comment:结束服务时间" json:"finish_time"`
CancelTime LocalTime `gorm:"column:cancel_time;type:datetime;comment:订单取消时间" json:"cancel_time"`
CancelReason int `gorm:"column:cancel_reason;type:tinyint(1);comment:取消订单原因(1:医生未接受服务 2:主动取消 4:客服取消 5:支付超时)" json:"cancel_reason"`
CancelRemarks string `gorm:"column:cancel_remarks;type:varchar(255);comment:取消订单备注" json:"cancel_remarks"`
AddFinishStatus int `gorm:"column:add_finish_status;type:tinyint(1);default:0;comment:添加完成订单延迟队列状态(0:未添加 1:已添加 2:添加失败)" json:"add_finish_status"`
AddFinishTime LocalTime `gorm:"column:add_finish_time;type:datetime;comment:添加完成订单延迟队列时间" json:"add_finish_time"`
AddFinishFailReason string `gorm:"column:add_finish_fail_reason;type:varchar(255);comment:添加完成订单延迟队列失败原因" json:"add_finish_fail_reason"`
PatientName string `gorm:"column:patient_name;type:varchar(255);comment:患者姓名-就诊人" json:"patient_name"`
PatientNameMask string `gorm:"column:patient_name_mask;type:varchar(255);comment:患者姓名-就诊人(掩码)" json:"patient_name_mask"`
PatientSex int `gorm:"column:patient_sex;type:tinyint(1);default:0;comment:患者性别-就诊人(0:未知 1:男 2:女)" json:"patient_sex"`
PatientAge int `gorm:"column:patient_age;type:int(1);comment:患者年龄-就诊人" json:"patient_age"`
Model
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 患者
}
func (m *OrderServicePackage) TableName() string {
return "gdxz_order_service_package"
}
func (m *OrderServicePackage) BeforeCreate(tx *gorm.DB) error {
if m.OrderServiceId == 0 {
m.OrderServiceId = 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
}
+51
View File
@@ -0,0 +1,51 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
type OrderServicePackageCase struct {
OrderServiceCaseId int64 `gorm:"column:order_service_case_id;type:bigint(19);primary_key;comment:主键id" json:"order_service_case_id"`
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id;NOT NULL" json:"user_id"`
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id;NOT NULL" json:"patient_id"`
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id;NOT NULL" json:"order_id"`
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);comment:订单-服务包id;NOT NULL" json:"order_service_id"`
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id;NOT NULL" json:"family_id"`
DiseaseClassId int64 `gorm:"column:disease_class_id;type:bigint(19);comment:疾病分类id-系统" json:"disease_class_id"`
Relation int `gorm:"column:relation;type:tinyint(1);comment:与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 " json:"relation"`
Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态(1:正常 2:删除)" json:"status"`
Name string `gorm:"column:name;type:varchar(50);comment:患者名称" json:"name"`
Sex int `gorm:"column:sex;type:tinyint(1);default:0;comment:患者性别(0:未知 1:男 2:女)" json:"sex"`
Age int `gorm:"column:age;type:int(11);comment:患者年龄" json:"age"`
DiseaseClassName string `gorm:"column:disease_class_name;type:varchar(255);comment:疾病名称-系统" json:"disease_class_name"`
DiagnosisDate LocalTime `gorm:"column:diagnosis_date;type:datetime;comment:确诊日期" json:"diagnosis_date"`
DiseaseDesc string `gorm:"column:disease_desc;type:text;comment:病情描述(主诉)" json:"disease_desc"`
DiagnoseImages string `gorm:"column:diagnose_images;type:varchar(1000);comment:复诊凭证(多个使用逗号分隔)" json:"diagnose_images"`
IsAllergyHistory int `gorm:"column:is_allergy_history;type:tinyint(1);comment:是否存在过敏史(0:否 1:是)" json:"is_allergy_history"`
AllergyHistory string `gorm:"column:allergy_history;type:varchar(255);comment:过敏史描述" json:"allergy_history"`
IsFamilyHistory int `gorm:"column:is_family_history;type:tinyint(1);comment:是否存在家族病史(0:否 1:是)" json:"is_family_history"`
FamilyHistory string `gorm:"column:family_history;type:varchar(255);comment:家族病史描述" json:"family_history"`
IsPregnant int `gorm:"column:is_pregnant;type:tinyint(1);comment:是否备孕、妊娠、哺乳期(0:否 1:是)" json:"is_pregnant"`
Pregnant string `gorm:"column:pregnant;type:varchar(255);comment:备孕、妊娠、哺乳期描述" json:"pregnant"`
Model
}
func (m *OrderServicePackageCase) TableName() string {
return "gdxz_order_service_package_case"
}
func (m *OrderServicePackageCase) BeforeCreate(tx *gorm.DB) error {
if m.OrderServiceCaseId == 0 {
m.OrderServiceCaseId = 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
}
+40
View File
@@ -0,0 +1,40 @@
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
}
+35
View File
@@ -0,0 +1,35 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// OrderServicePackageInquiry 服务包关联问诊订单表
type OrderServicePackageInquiry struct {
ServiceInquiryId int64 `gorm:"column:service_inquiry_id;type:bigint(19);primary_key;comment:主键id" json:"service_inquiry_id"`
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);comment:订单-服务包id;NOT NULL" json:"order_service_id"`
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
OrderServiceNo string `gorm:"column:order_service_no;type:varchar(30);comment:服务包系统订单编号" json:"order_service_no"`
InquiryNo string `gorm:"column:inquiry_no;type:varchar(30);comment:问诊系统订单编号" json:"inquiry_no"`
Model
}
func (m *OrderServicePackageInquiry) TableName() string {
return "gdxz_order_service_package_inquiry"
}
func (m *OrderServicePackageInquiry) BeforeCreate(tx *gorm.DB) error {
if m.ServiceInquiryId == 0 {
m.ServiceInquiryId = 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
}
+37
View File
@@ -0,0 +1,37 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// OrderServicePackageProduct 订单-服务包-关联商品订单表
type OrderServicePackageProduct struct {
ServiceProductId int64 `gorm:"column:service_product_id;type:bigint(19);primary_key;comment:主键id" json:"service_product_id"`
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);comment:订单-服务包id;NOT NULL" json:"order_service_id"`
OrderProductId int64 `gorm:"column:order_product_id;type:bigint(19);comment:订单-商品id;NOT NULL" json:"order_product_id"`
OrderProductNo string `gorm:"column:order_product_no;type:varchar(100);comment:订单-商品系统编号;NOT NULL" json:"order_product_no"`
ProductItemId int64 `gorm:"column:product_item_id;type:bigint(19);comment:订单-商品明细id;NOT NULL" json:"product_item_id"`
ProductId int64 `gorm:"column:product_id;type:bigint(19);comment:商品id;NOT NULL" json:"product_id"`
UsedQuantity int `gorm:"column:used_quantity;type:int(1);default:0;comment:商品使用数量" json:"used_quantity"`
Model
}
func (m *OrderServicePackageProduct) TableName() string {
return "gdxz_order_service_package_product"
}
func (m *OrderServicePackageProduct) BeforeCreate(tx *gorm.DB) error {
if m.ServiceProductId == 0 {
m.ServiceProductId = 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
}
+40
View File
@@ -0,0 +1,40 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// OrderServicePackageRefund 订单-服务包-退款表
type OrderServicePackageRefund struct {
ServiceRefundId int64 `gorm:"column:service_refund_id;type:bigint(19);primary_key;comment:主键id" json:"service_refund_id"`
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);comment:订单-服务包id" json:"order_service_id"`
OrderServiceNo string `gorm:"column:order_service_no;type:varchar(100);comment:系统订单编号" json:"order_service_no"`
ServiceRefundNo string `gorm:"column:service_refund_no;type:varchar(50);comment:系统退款编号" json:"service_refund_no"`
RefundId string `gorm:"column:refund_id;type:varchar(50);comment:第三方退款单号" json:"refund_id"`
RefundStatus int `gorm:"column:refund_status;type:tinyint(1);default:0;comment:订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)" json:"refund_status"`
RefundTotal float64 `gorm:"column:refund_total;type:decimal(10,2);default:0.00;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 *OrderServicePackageRefund) TableName() string {
return "gdxz_order_service_package_refund"
}
func (m *OrderServicePackageRefund) BeforeCreate(tx *gorm.DB) error {
if m.ServiceRefundId == 0 {
m.ServiceRefundId = 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
}