68 lines
2.7 KiB
Go
68 lines
2.7 KiB
Go
package dto
|
|
|
|
import (
|
|
"fmt"
|
|
"hospital-admin-api/api/model"
|
|
)
|
|
|
|
type OrderInquiryRefundDto struct {
|
|
InquiryRefundId string `json:"inquiry_refund_id"` // 主键id
|
|
PatientId string `json:"patient_id"` // 患者id
|
|
OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id
|
|
InquiryNo string `json:"inquiry_no"` // 系统订单编号
|
|
InquiryRefundNo string `json:"inquiry_refund_no"` // 系统退款编号
|
|
RefundId string `json:"refund_id"` // 第三方退款单号
|
|
InquiryRefundStatus int `json:"inquiry_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 GetOrderInquiryRefundDto(m *model.OrderInquiryRefund) *OrderInquiryRefundDto {
|
|
return &OrderInquiryRefundDto{
|
|
InquiryRefundId: fmt.Sprintf("%d", m.InquiryRefundId),
|
|
PatientId: fmt.Sprintf("%d", m.PatientId),
|
|
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
|
InquiryNo: m.InquiryNo,
|
|
InquiryRefundNo: m.InquiryRefundNo,
|
|
RefundId: m.RefundId,
|
|
InquiryRefundStatus: m.InquiryRefundStatus,
|
|
RefundTotal: m.RefundTotal,
|
|
RefundReason: m.RefundReason,
|
|
SuccessTime: m.SuccessTime,
|
|
CreatedAt: m.CreatedAt,
|
|
UpdatedAt: m.UpdatedAt,
|
|
}
|
|
}
|
|
|
|
func GetOrderInquiryRefundListDto(m []*model.OrderInquiryRefund) []OrderInquiryRefundDto {
|
|
// 处理返回值
|
|
responses := make([]OrderInquiryRefundDto, len(m))
|
|
|
|
if len(m) > 0 {
|
|
for i, v := range m {
|
|
response := OrderInquiryRefundDto{
|
|
InquiryRefundId: fmt.Sprintf("%d", v.InquiryRefundId),
|
|
PatientId: fmt.Sprintf("%d", v.PatientId),
|
|
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
|
InquiryNo: v.InquiryNo,
|
|
InquiryRefundNo: v.InquiryRefundNo,
|
|
RefundId: v.RefundId,
|
|
InquiryRefundStatus: v.InquiryRefundStatus,
|
|
RefundTotal: v.RefundTotal,
|
|
RefundReason: v.RefundReason,
|
|
SuccessTime: v.SuccessTime,
|
|
CreatedAt: v.CreatedAt,
|
|
UpdatedAt: v.UpdatedAt,
|
|
}
|
|
|
|
// 将转换后的结构体添加到新切片中
|
|
responses[i] = response
|
|
}
|
|
}
|
|
|
|
return responses
|
|
}
|