379 lines
15 KiB
Go
379 lines
15 KiB
Go
package dto
|
||
|
||
import (
|
||
"fmt"
|
||
"hospital-admin-api/api/model"
|
||
)
|
||
|
||
type OrderInquiryDto struct {
|
||
OrderInquiryId string `json:"order_inquiry_id"` // 主键id
|
||
UserId string `json:"user_id"` // 用户id-患者
|
||
PatientId string `json:"patient_id"` // 患者id
|
||
DoctorId string `json:"doctor_id"` // 医生id(未分配时为null)
|
||
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
||
InquiryType int `json:"inquiry_type"` // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测)
|
||
InquiryMode int `json:"inquiry_mode"` // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||
InquiryStatus int `json:"inquiry_status"` // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||
IsDelete int `json:"is_delete"` // 删除状态(0:否 1:是)
|
||
InquiryRefundStatus int `json:"inquiry_refund_status"` // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
||
InquiryPayChannel int `json:"inquiry_pay_channel"` // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||
InquiryPayStatus int `json:"inquiry_pay_status"` // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||
InquiryNo string `json:"inquiry_no"` // 系统订单编号
|
||
EscrowTradeNo string `json:"escrow_trade_no"` // 第三方支付流水号
|
||
AmountTotal float64 `json:"amount_total"` // 订单金额
|
||
CouponAmountTotal float64 `json:"coupon_amount_total"` // 优惠卷总金额
|
||
PaymentAmountTotal float64 `json:"payment_amount_total"` // 实际付款金额
|
||
PayTime model.LocalTime `json:"pay_time"` // 支付时间
|
||
ReceptionTime model.LocalTime `json:"reception_time"` // 接诊时间(已接诊)
|
||
CompleteTime model.LocalTime `json:"complete_time"` // 订单完成时间(问诊完成时间)
|
||
FinishTime model.LocalTime `json:"finish_time"` // 订单结束时间
|
||
StatisticsStatus int `json:"statistics_status"` // 订单统计状态(0:未统计 1:已统计 2:统计失败)
|
||
StatisticsTime model.LocalTime `json:"statistics_time"` // 订单统计时间
|
||
IsWithdrawal int `json:"is_withdrawal"` // 是否提现(0:否 1:是 2:提现中)
|
||
WithdrawalTime model.LocalTime `json:"withdrawal_time"` // 提现时间
|
||
CancelTime model.LocalTime `json:"cancel_time"` // 订单取消时间
|
||
CancelReason int `json:"cancel_reason"` // 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||
CancelRemarks string `json:"cancel_remarks"` // 取消订单备注(自动添加)
|
||
PatientName string `json:"patient_name"` // 患者姓名-就诊人
|
||
PatientNameMask string `json:"patient_name_mask"` // 患者姓名-就诊人(掩码)
|
||
PatientSex int `json:"patient_sex"` // 患者性别-就诊人(0:未知 1:男 2:女)
|
||
PatientAge int `json:"patient_age"` // 患者年龄-就诊人
|
||
PatientMobile string `json:"patient_mobile"` // 患者电话
|
||
DoctorName string `json:"doctor_name"` // 医生姓名
|
||
UserName string `json:"user_name"` // 用户姓名(患者)
|
||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||
OrderInquiryCoupon *OrderInquiryCouponDto `json:"order_inquiry_coupon"` // 订单优惠卷
|
||
OrderInquiryCase *OrderInquiryCaseDto `json:"order_inquiry_case"` // 问诊病例
|
||
OrderInquiryRefund *OrderInquiryRefundDto `json:"order_inquiry_refund"` // 退款数据
|
||
OrderEvaluation *OrderEvaluationDto `json:"order_evaluation"` // 订单评价
|
||
UserDoctor *UserDoctorDto `json:"user_doctor"` // 医生数据
|
||
MessageIm []*MessageImDto `json:"message_im"` // 聊天记录
|
||
EntryStatus *int `json:"entry_status"` // 入账状态(0:未入账 1:已入账 2:入账中 3:入账失败)
|
||
}
|
||
|
||
// GetOrderInquiryDto 问诊订单详情
|
||
func GetOrderInquiryDto(m *model.OrderInquiry) *OrderInquiryDto {
|
||
var doctorId string
|
||
if m.DoctorId != 0 {
|
||
doctorId = fmt.Sprintf("%v", m.DoctorId)
|
||
}
|
||
|
||
return &OrderInquiryDto{
|
||
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
||
UserId: fmt.Sprintf("%d", m.UserId),
|
||
DoctorId: doctorId,
|
||
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||
FamilyId: fmt.Sprintf("%d", m.FamilyId),
|
||
InquiryType: m.InquiryType,
|
||
InquiryMode: m.InquiryMode,
|
||
InquiryStatus: m.InquiryStatus,
|
||
IsDelete: m.IsDelete,
|
||
InquiryRefundStatus: m.InquiryRefundStatus,
|
||
InquiryPayChannel: m.InquiryPayChannel,
|
||
InquiryPayStatus: m.InquiryPayStatus,
|
||
InquiryNo: m.InquiryNo,
|
||
EscrowTradeNo: m.EscrowTradeNo,
|
||
AmountTotal: m.AmountTotal,
|
||
CouponAmountTotal: m.CouponAmountTotal,
|
||
PaymentAmountTotal: m.PaymentAmountTotal,
|
||
PayTime: m.PayTime,
|
||
ReceptionTime: m.ReceptionTime,
|
||
CompleteTime: m.CompleteTime,
|
||
FinishTime: m.FinishTime,
|
||
StatisticsStatus: m.StatisticsStatus,
|
||
StatisticsTime: m.StatisticsTime,
|
||
IsWithdrawal: m.IsWithdrawal,
|
||
WithdrawalTime: m.WithdrawalTime,
|
||
CancelTime: m.CancelTime,
|
||
CancelReason: m.CancelReason,
|
||
CancelRemarks: m.CancelRemarks,
|
||
PatientName: m.PatientName,
|
||
PatientNameMask: m.PatientNameMask,
|
||
PatientSex: m.PatientSex,
|
||
PatientAge: m.PatientAge,
|
||
CreatedAt: m.CreatedAt,
|
||
UpdatedAt: m.UpdatedAt,
|
||
}
|
||
}
|
||
|
||
// GetOrderInquiryListDto 问诊订单列表
|
||
func GetOrderInquiryListDto(m []*model.OrderInquiry) []*OrderInquiryDto {
|
||
// 处理返回值
|
||
responses := make([]*OrderInquiryDto, len(m))
|
||
|
||
if len(m) > 0 {
|
||
for i, v := range m {
|
||
response := &OrderInquiryDto{
|
||
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
||
UserId: fmt.Sprintf("%d", v.UserId),
|
||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||
InquiryType: v.InquiryType,
|
||
InquiryMode: v.InquiryMode,
|
||
InquiryStatus: v.InquiryStatus,
|
||
IsDelete: v.IsDelete,
|
||
InquiryRefundStatus: v.InquiryRefundStatus,
|
||
InquiryPayChannel: v.InquiryPayChannel,
|
||
InquiryPayStatus: v.InquiryPayStatus,
|
||
InquiryNo: v.InquiryNo,
|
||
EscrowTradeNo: v.EscrowTradeNo,
|
||
AmountTotal: v.AmountTotal,
|
||
CouponAmountTotal: v.CouponAmountTotal,
|
||
PaymentAmountTotal: v.PaymentAmountTotal,
|
||
PayTime: v.PayTime,
|
||
ReceptionTime: v.ReceptionTime,
|
||
CompleteTime: v.CompleteTime,
|
||
FinishTime: v.FinishTime,
|
||
StatisticsStatus: v.StatisticsStatus,
|
||
StatisticsTime: v.StatisticsTime,
|
||
IsWithdrawal: v.IsWithdrawal,
|
||
WithdrawalTime: v.WithdrawalTime,
|
||
CancelTime: v.CancelTime,
|
||
CancelReason: v.CancelReason,
|
||
CancelRemarks: v.CancelRemarks,
|
||
PatientName: v.PatientName,
|
||
PatientNameMask: v.PatientNameMask,
|
||
PatientSex: v.PatientSex,
|
||
PatientAge: v.PatientAge,
|
||
PatientMobile: v.User.Mobile,
|
||
CreatedAt: v.CreatedAt,
|
||
UpdatedAt: v.UpdatedAt,
|
||
}
|
||
|
||
// 加载医生名称
|
||
if v.UserDoctor != nil {
|
||
response = response.LoadDoctorName(v.UserDoctor)
|
||
}
|
||
|
||
// 将转换后的结构体添加到新切片中
|
||
responses[i] = response
|
||
}
|
||
}
|
||
|
||
return responses
|
||
}
|
||
|
||
// GetOrderInquiryRecordListDto 问诊记录列表
|
||
func GetOrderInquiryRecordListDto(m []*model.OrderInquiry) []*OrderInquiryDto {
|
||
// 处理返回值
|
||
responses := make([]*OrderInquiryDto, len(m))
|
||
|
||
if len(m) > 0 {
|
||
for i, v := range m {
|
||
response := &OrderInquiryDto{
|
||
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
||
UserId: fmt.Sprintf("%d", v.UserId),
|
||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||
InquiryType: v.InquiryType,
|
||
InquiryMode: v.InquiryMode,
|
||
InquiryStatus: v.InquiryStatus,
|
||
IsDelete: v.IsDelete,
|
||
InquiryRefundStatus: v.InquiryRefundStatus,
|
||
InquiryPayChannel: v.InquiryPayChannel,
|
||
InquiryPayStatus: v.InquiryPayStatus,
|
||
InquiryNo: v.InquiryNo,
|
||
EscrowTradeNo: v.EscrowTradeNo,
|
||
ReceptionTime: v.ReceptionTime,
|
||
CompleteTime: v.CompleteTime,
|
||
FinishTime: v.FinishTime,
|
||
CancelTime: v.CancelTime,
|
||
CancelReason: v.CancelReason,
|
||
CancelRemarks: v.CancelRemarks,
|
||
PatientName: v.PatientName,
|
||
PatientNameMask: v.PatientNameMask,
|
||
PatientSex: v.PatientSex,
|
||
PatientAge: v.PatientAge,
|
||
PatientMobile: v.User.Mobile,
|
||
CreatedAt: v.CreatedAt,
|
||
UpdatedAt: v.UpdatedAt,
|
||
}
|
||
|
||
// 加载医生名称
|
||
if v.UserDoctor != nil {
|
||
response = response.LoadDoctorName(v.UserDoctor)
|
||
}
|
||
|
||
// 加载用户姓名(患者)
|
||
if v.User != nil {
|
||
response = response.LoadUserName(v.User)
|
||
}
|
||
|
||
// 将转换后的结构体添加到新切片中
|
||
responses[i] = response
|
||
}
|
||
}
|
||
|
||
return responses
|
||
}
|
||
|
||
// GetOrderInquiryForAccountListDto 账户关联问诊订单列表
|
||
func GetOrderInquiryForAccountListDto(m []*model.OrderInquiry) []*OrderInquiryDto {
|
||
// 处理返回值
|
||
responses := make([]*OrderInquiryDto, len(m))
|
||
|
||
if len(m) > 0 {
|
||
for i, v := range m {
|
||
response := &OrderInquiryDto{
|
||
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
||
UserId: fmt.Sprintf("%d", v.UserId),
|
||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||
InquiryType: v.InquiryType,
|
||
InquiryMode: v.InquiryMode,
|
||
InquiryStatus: v.InquiryStatus,
|
||
IsDelete: v.IsDelete,
|
||
InquiryRefundStatus: v.InquiryRefundStatus,
|
||
InquiryPayChannel: v.InquiryPayChannel,
|
||
InquiryPayStatus: v.InquiryPayStatus,
|
||
InquiryNo: v.InquiryNo,
|
||
EscrowTradeNo: v.EscrowTradeNo,
|
||
AmountTotal: v.AmountTotal,
|
||
CouponAmountTotal: v.CouponAmountTotal,
|
||
PaymentAmountTotal: v.PaymentAmountTotal,
|
||
PayTime: v.PayTime,
|
||
ReceptionTime: v.ReceptionTime,
|
||
CompleteTime: v.CompleteTime,
|
||
FinishTime: v.FinishTime,
|
||
StatisticsStatus: v.StatisticsStatus,
|
||
StatisticsTime: v.StatisticsTime,
|
||
IsWithdrawal: v.IsWithdrawal,
|
||
WithdrawalTime: v.WithdrawalTime,
|
||
CancelTime: v.CancelTime,
|
||
CancelReason: v.CancelReason,
|
||
CancelRemarks: v.CancelRemarks,
|
||
PatientNameMask: v.PatientNameMask,
|
||
PatientSex: v.PatientSex,
|
||
PatientAge: v.PatientAge,
|
||
CreatedAt: v.CreatedAt,
|
||
UpdatedAt: v.UpdatedAt,
|
||
}
|
||
|
||
// 加载医生名称
|
||
if v.UserDoctor != nil {
|
||
response = response.LoadDoctorName(v.UserDoctor)
|
||
}
|
||
|
||
// 将转换后的结构体添加到新切片中
|
||
responses[i] = response
|
||
}
|
||
}
|
||
|
||
return responses
|
||
}
|
||
|
||
// GetOrderInquiryRecordDto 问诊记录详情
|
||
func GetOrderInquiryRecordDto(m *model.OrderInquiry) *OrderInquiryDto {
|
||
var doctorId string
|
||
if m.DoctorId != 0 {
|
||
doctorId = fmt.Sprintf("%v", m.DoctorId)
|
||
}
|
||
|
||
return &OrderInquiryDto{
|
||
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
||
UserId: fmt.Sprintf("%d", m.UserId),
|
||
DoctorId: doctorId,
|
||
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||
FamilyId: fmt.Sprintf("%d", m.FamilyId),
|
||
InquiryType: m.InquiryType,
|
||
InquiryMode: m.InquiryMode,
|
||
InquiryStatus: m.InquiryStatus,
|
||
IsDelete: m.IsDelete,
|
||
InquiryRefundStatus: m.InquiryRefundStatus,
|
||
InquiryPayChannel: m.InquiryPayChannel,
|
||
InquiryPayStatus: m.InquiryPayStatus,
|
||
InquiryNo: m.InquiryNo,
|
||
EscrowTradeNo: m.EscrowTradeNo,
|
||
AmountTotal: m.AmountTotal,
|
||
CouponAmountTotal: m.CouponAmountTotal,
|
||
PaymentAmountTotal: m.PaymentAmountTotal,
|
||
PayTime: m.PayTime,
|
||
ReceptionTime: m.ReceptionTime,
|
||
CompleteTime: m.CompleteTime,
|
||
FinishTime: m.FinishTime,
|
||
StatisticsStatus: m.StatisticsStatus,
|
||
StatisticsTime: m.StatisticsTime,
|
||
IsWithdrawal: m.IsWithdrawal,
|
||
WithdrawalTime: m.WithdrawalTime,
|
||
CancelTime: m.CancelTime,
|
||
CancelReason: m.CancelReason,
|
||
CancelRemarks: m.CancelRemarks,
|
||
PatientName: m.PatientName,
|
||
PatientNameMask: m.PatientNameMask,
|
||
PatientSex: m.PatientSex,
|
||
PatientAge: m.PatientAge,
|
||
CreatedAt: m.CreatedAt,
|
||
UpdatedAt: m.UpdatedAt,
|
||
}
|
||
}
|
||
|
||
// LoadDoctorName 加载医生名称
|
||
func (r *OrderInquiryDto) LoadDoctorName(m *model.UserDoctor) *OrderInquiryDto {
|
||
if m != nil {
|
||
r.DoctorName = m.UserName
|
||
}
|
||
return r
|
||
}
|
||
|
||
// LoadUserName 加载用户姓名(患者)
|
||
func (r *OrderInquiryDto) LoadUserName(m *model.User) *OrderInquiryDto {
|
||
if m != nil {
|
||
r.UserName = m.UserName
|
||
}
|
||
return r
|
||
}
|
||
|
||
// LoadOrderInquiryRefund 加载订单退款数据
|
||
func (r *OrderInquiryDto) LoadOrderInquiryRefund(m *model.OrderInquiryRefund) *OrderInquiryDto {
|
||
if m != nil {
|
||
d := GetOrderInquiryRefundBankDto(m)
|
||
|
||
r.OrderInquiryRefund = d
|
||
}
|
||
return r
|
||
}
|
||
|
||
// LoadOrderInquiryCoupon 加载问诊订单优惠卷
|
||
func (r *OrderInquiryDto) LoadOrderInquiryCoupon(m *model.OrderInquiryCoupon) *OrderInquiryDto {
|
||
if m != nil {
|
||
d := GetOrderInquiryCouponDto(m)
|
||
|
||
r.OrderInquiryCoupon = d
|
||
}
|
||
return r
|
||
}
|
||
|
||
// LoadMaskOrderInquiryCase 加载问诊病例
|
||
func (r *OrderInquiryDto) LoadMaskOrderInquiryCase(m *model.OrderInquiryCase) *OrderInquiryDto {
|
||
if m != nil {
|
||
d := GetMaskOrderInquiryCaseDto(m)
|
||
|
||
r.OrderInquiryCase = d
|
||
}
|
||
return r
|
||
}
|
||
|
||
// LoadOrderEvaluation 加载订单评价
|
||
func (r *OrderInquiryDto) LoadOrderEvaluation(m *model.OrderEvaluation) *OrderInquiryDto {
|
||
if m != nil {
|
||
d := GetOrderEvaluationDto(m)
|
||
|
||
r.OrderEvaluation = d
|
||
}
|
||
return r
|
||
}
|
||
|
||
// LoadMessageIm 加载聊天记录
|
||
func (r *OrderInquiryDto) LoadMessageIm(m []*model.MessageIm) *OrderInquiryDto {
|
||
if len(m) > 0 {
|
||
d := GetMessageImListDto(m)
|
||
|
||
r.MessageIm = d
|
||
}
|
||
return r
|
||
}
|