hospital-admin-api/api/dto/OrderProductRefund.go
2023-09-28 08:40:43 +08:00

68 lines
2.7 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 dto
import (
"fmt"
"hospital-admin-api/api/model"
)
type OrderProductRefundDto struct {
ProductRefundId string `json:"product_refund_id"` // 主键id
PatientId string `json:"patient_id"` // 患者id
OrderProductId string `json:"order_product_id"` // 订单-药品订单id
OrderProductNo string `json:"order_product_no"` // 系统订单编号
ProductRefundNo string `json:"product_refund_no"` // 系统退款编号
RefundId string `json:"refund_id"` // 第三方退款单号
ProductRefundStatus int `json:"product_refund_status"` // 商品订单退款状态0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
RefundTotal float64 `json:"refund_total"` // 退款金额
RefundReason string `json:"refund_reason"` // 退款原因
SuccessTime model.LocalTime `json:"success_time"` // 退款成功时间
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
}
func GetOrderProductRefundDto(m *model.OrderProductRefund) *OrderProductRefundDto {
return &OrderProductRefundDto{
ProductRefundId: fmt.Sprintf("%d", m.ProductRefundId),
PatientId: fmt.Sprintf("%d", m.PatientId),
OrderProductId: fmt.Sprintf("%d", m.OrderProductId),
OrderProductNo: m.OrderProductNo,
ProductRefundNo: m.ProductRefundNo,
RefundId: m.RefundId,
ProductRefundStatus: m.ProductRefundStatus,
RefundTotal: m.RefundTotal,
RefundReason: m.RefundReason,
SuccessTime: m.SuccessTime,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
}
}
func GetOrderProductRefundListDto(m []*model.OrderProductRefund) []OrderProductRefundDto {
// 处理返回值
responses := make([]OrderProductRefundDto, len(m))
if len(m) > 0 {
for i, v := range m {
response := OrderProductRefundDto{
ProductRefundId: fmt.Sprintf("%d", v.ProductRefundId),
PatientId: fmt.Sprintf("%d", v.PatientId),
OrderProductId: fmt.Sprintf("%d", v.OrderProductId),
OrderProductNo: v.OrderProductNo,
ProductRefundNo: v.ProductRefundNo,
RefundId: v.RefundId,
ProductRefundStatus: v.ProductRefundStatus,
RefundTotal: v.RefundTotal,
RefundReason: v.RefundReason,
SuccessTime: v.SuccessTime,
CreatedAt: v.CreatedAt,
UpdatedAt: v.UpdatedAt,
}
// 将转换后的结构体添加到新切片中
responses[i] = response
}
}
return responses
}