新增了 退还用户优惠卷、新增了处理用户处方图片

This commit is contained in:
2024-05-21 09:13:14 +08:00
parent 63ee23e60f
commit 2db307941e
19 changed files with 690 additions and 18 deletions
+51
View File
@@ -0,0 +1,51 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// Order 订单表
type Order struct {
OrderId int64 `gorm:"column:order_id;type:bigint(19);primary_key;comment:主键id" 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(存在为null的情况)" json:"doctor_id"`
OrderType int `gorm:"column:order_type;type:tinyint(1);comment:订单类型(1:问诊订单 2:药品订单 3:检测订单 4:随访包订单 5:健康包订单);NOT NULL" json:"order_type"`
IsDelete int `gorm:"column:is_delete;type:tinyint(1);default:0;comment:删除状态(0:否 1:是)" json:"is_delete"`
PayChannel int `gorm:"column:pay_channel;type:tinyint(1);default: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"`
PayTime LocalTime `gorm:"column:pay_time;type:datetime;comment:支付时间" json:"pay_time"`
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"`
OrderNo string `gorm:"column:order_no;type:varchar(30);comment:系统订单编号;NOT NULL" json:"order_no"`
EscrowTradeNo string `gorm:"column:escrow_trade_no;type:varchar(100);comment:第三方支付流水号" json:"escrow_trade_no"`
AmountTotal float64 `gorm:"column:amount_total;type:decimal(10,2) unsigned;default:0.00;comment:订单金额" json:"amount_total"`
CouponAmountTotal float64 `gorm:"column:coupon_amount_total;type:decimal(10,2) unsigned;default:0.00;comment:优惠卷总金额" json:"coupon_amount_total"`
PaymentAmountTotal float64 `gorm:"column:payment_amount_total;type:decimal(10,2) unsigned;default:0.00;comment:实际付款金额" json:"payment_amount_total"`
CancelStatus int `gorm:"column:cancel_status;type:tinyint(1);default:0;comment:取消状态(0:否 1:是)" json:"cancel_status"`
CancelTime LocalTime `gorm:"column:cancel_time;type:datetime;comment:订单取消时间" json:"cancel_time"`
CancelRemarks string `gorm:"column:cancel_remarks;type:varchar(255);comment:取消订单备注" json:"cancel_remarks"`
OrderRemarks string `gorm:"column:order_remarks;type:varchar(255);comment:订单备注" json:"order_remarks"`
IsWithdrawal int `gorm:"column:is_withdrawal;type:tinyint(1);default:0;comment:是否提现(0:否 1:是 2:提现中 3:无需提现)" json:"is_withdrawal"`
WithdrawalTime LocalTime `gorm:"column:withdrawal_time;type:datetime;comment:提现时间" json:"withdrawal_time"`
Model
}
func (m *Order) TableName() string {
return "gdxz_order"
}
func (m *Order) BeforeCreate(tx *gorm.DB) error {
if m.OrderId == 0 {
m.OrderId = 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"
)
type OrderCoupon struct {
OrderCouponId int64 `gorm:"column:order_coupon_id;type:bigint(19);primary_key;comment:主键id" json:"order_coupon_id"`
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id;NOT NULL" json:"order_id"`
UserCouponId int64 `gorm:"column:user_coupon_id;type:bigint(19);comment:用户优惠卷表id;NOT NULL" json:"user_coupon_id"`
CouponName string `gorm:"column:coupon_name;type:varchar(255);comment:优惠卷名称" json:"coupon_name"`
CouponUsePrice float64 `gorm:"column:coupon_use_price;type:decimal(10,2);default:0.00;comment:优惠卷使用金额" json:"coupon_use_price"`
Model
}
func (m *OrderCoupon) TableName() string {
return "gdxz_order_coupon"
}
func (m *OrderCoupon) BeforeCreate(tx *gorm.DB) error {
if m.OrderCouponId == 0 {
m.OrderCouponId = 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
}
+1
View File
@@ -9,6 +9,7 @@ import (
// OrderInquiry 订单-问诊表
type OrderInquiry struct {
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);primary_key;comment:主键id" json:"order_inquiry_id"`
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id" 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(未分配时为null" json:"doctor_id"`
+37
View File
@@ -0,0 +1,37 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// OrderPrescriptionFile 订单-处方表-ca处方文件
type OrderPrescriptionFile struct {
PrescriptionFileId int64 `gorm:"column:prescription_file_id;type:bigint(19);primary_key;comment:主键id" json:"prescription_file_id"`
OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);comment:订单-处方id" json:"order_prescription_id"`
DoctorCaFileId string `gorm:"column:doctor_ca_file_id;type:varchar(100);comment:医生签章pdf文件id(可请求ca下载)" json:"doctor_ca_file_id"`
HospitalCaFileId string `gorm:"column:hospital_ca_file_id;type:varchar(100);comment:医院签章pdf文件id(可请求ca下载)" json:"hospital_ca_file_id"`
PrescriptionImgOssPath string `gorm:"column:prescription_img_oss_path;type:varchar(255);comment:签章img文件oss路径" json:"prescription_img_oss_path"`
PrescriptionPdfOssPath string `gorm:"column:prescription_pdf_oss_path;type:varchar(255);comment:签章pdf文件oss路径" json:"prescription_pdf_oss_path"`
IsConvertedPdf int `gorm:"column:is_converted_pdf;type:tinyint(1);default:0;comment:是否已转换pdf为图片(0:否 1:是)" json:"is_converted_pdf"`
Model
}
func (m *OrderPrescriptionFile) TableName() string {
return "gdxz_order_prescription_file"
}
func (m *OrderPrescriptionFile) BeforeCreate(tx *gorm.DB) error {
if m.PrescriptionFileId == 0 {
m.PrescriptionFileId = 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
}
+1
View File
@@ -11,6 +11,7 @@ type OrderProduct struct {
OrderProductId int64 `gorm:"column:order_product_id;type:bigint(20);primary_key;comment:主键id" json:"order_product_id"`
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);comment:订单-处方id;NOT NULL" json:"order_prescription_id"`
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id" json:"order_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id(就诊用户)" json:"family_id"`
+40
View File
@@ -0,0 +1,40 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// OrderRefund 订单-退款表
type OrderRefund struct {
OrderRefundId int64 `gorm:"column:order_refund_id;type:bigint(19);primary_key;comment:主键id" json:"order_refund_id"`
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id;NOT NULL" json:"order_id"`
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
OrderNo string `gorm:"column:order_no;type:varchar(40);comment:系统订单编号" json:"order_no"`
RefundNo string `gorm:"column:refund_no;type:varchar(50);comment:系统退款编号;NOT NULL" json:"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 *OrderRefund) TableName() string {
return "gdxz_order_refund"
}
func (m *OrderRefund) BeforeCreate(tx *gorm.DB) error {
if m.OrderRefundId == 0 {
m.OrderRefundId = 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
}