新增获取医生提现列表-分页
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/model"
|
||||
)
|
||||
|
||||
type DoctorWithdrawalDto struct {
|
||||
WithdrawalId string `json:"withdrawal_id"` // 主键id
|
||||
DoctorId string `json:"doctor_id"` // 医生id;NOT NULL
|
||||
BankId string `json:"bank_id"` // 银行id
|
||||
AccountName string `json:"account_name"` // 银行卡姓名;NOT NULL
|
||||
BankCardCode string `json:"bank_card_code"` // 银行卡号
|
||||
BankCardCodeFour string `json:"bank_card_code_four"` // 银行卡号(后四位);NOT NULL
|
||||
AppliedWithdrawalAmount float64 `json:"applied_withdrawal_amount"` // 提现金额
|
||||
ActualWithdrawalAmount float64 `json:"actual_withdrawal_amount"` // 实际提现金额
|
||||
IncomeTax float64 `json:"income_tax"` // 提现所得税金额
|
||||
ExamineStatus int `json:"examine_status"` // 审核状态(1:审核中 2:审核通过 3:审核未通过)
|
||||
ExamineFailReason string `json:"examine_fail_reason"` // 审核失败原因
|
||||
ExamineTime model.LocalTime `json:"examine_time"` // 审核日期
|
||||
ExamineBy string `json:"examine_by"` // 审核人员id(后台用户id)
|
||||
PaymentStatus int `json:"payment_status"` // 财务打款状态(0:否 1:是)
|
||||
PaymentTime model.LocalTime `json:"payment_time"` // 财务打款时间
|
||||
PaymentBy string `json:"payment_by"` // 财务打款人员id(后台用户id)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
DoctorName string `json:"doctor_name"` // 医生姓名
|
||||
}
|
||||
|
||||
func GetDoctorWithdrawalDto(m *model.DoctorWithdrawal) *DoctorWithdrawalDto {
|
||||
return &DoctorWithdrawalDto{
|
||||
WithdrawalId: fmt.Sprintf("%d", m.WithdrawalId),
|
||||
DoctorId: fmt.Sprintf("%d", m.DoctorId),
|
||||
BankId: fmt.Sprintf("%d", m.BankId),
|
||||
AccountName: m.AccountName,
|
||||
BankCardCode: m.BankCardCode,
|
||||
BankCardCodeFour: m.BankCardCodeFour,
|
||||
AppliedWithdrawalAmount: m.AppliedWithdrawalAmount,
|
||||
ActualWithdrawalAmount: m.ActualWithdrawalAmount,
|
||||
IncomeTax: m.IncomeTax,
|
||||
ExamineStatus: m.ExamineStatus,
|
||||
ExamineFailReason: m.ExamineFailReason,
|
||||
ExamineTime: m.ExamineTime,
|
||||
ExamineBy: fmt.Sprintf("%d", m.ExamineBy),
|
||||
PaymentStatus: m.PaymentStatus,
|
||||
PaymentTime: m.PaymentTime,
|
||||
PaymentBy: fmt.Sprintf("%d", m.PaymentBy),
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func GetDoctorWithdrawalListDto(m []*model.DoctorWithdrawal) []*DoctorWithdrawalDto {
|
||||
// 处理返回值
|
||||
responses := make([]*DoctorWithdrawalDto, len(m))
|
||||
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
response := &DoctorWithdrawalDto{
|
||||
WithdrawalId: fmt.Sprintf("%d", v.WithdrawalId),
|
||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||
BankId: fmt.Sprintf("%d", v.BankId),
|
||||
AccountName: v.AccountName,
|
||||
BankCardCode: v.BankCardCode,
|
||||
BankCardCodeFour: v.BankCardCodeFour,
|
||||
AppliedWithdrawalAmount: v.AppliedWithdrawalAmount,
|
||||
ActualWithdrawalAmount: v.ActualWithdrawalAmount,
|
||||
IncomeTax: v.IncomeTax,
|
||||
ExamineStatus: v.ExamineStatus,
|
||||
ExamineFailReason: v.ExamineFailReason,
|
||||
ExamineTime: v.ExamineTime,
|
||||
ExamineBy: fmt.Sprintf("%d", v.ExamineBy),
|
||||
PaymentStatus: v.PaymentStatus,
|
||||
PaymentTime: v.PaymentTime,
|
||||
PaymentBy: fmt.Sprintf("%d", v.PaymentBy),
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 加载医生名称
|
||||
if v.UserDoctor != nil {
|
||||
response.LoadDoctorName(v.UserDoctor)
|
||||
}
|
||||
|
||||
// 加载审核人员
|
||||
if v.ExamineBy != 0 {
|
||||
response.LoadExamineByName(v.ExamineBy)
|
||||
}
|
||||
|
||||
// 加载打款人员
|
||||
if v.PaymentBy != 0 {
|
||||
response.LoadPaymentByName(v.PaymentBy)
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
}
|
||||
|
||||
return responses
|
||||
}
|
||||
|
||||
// LoadDoctorName 加载医生名称
|
||||
func (r *DoctorWithdrawalDto) LoadDoctorName(m *model.UserDoctor) *DoctorWithdrawalDto {
|
||||
if m != nil {
|
||||
r.DoctorName = m.UserName
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadExamineByName 加载审核人员名称
|
||||
func (r *DoctorWithdrawalDto) LoadExamineByName(examineBy int64) *DoctorWithdrawalDto {
|
||||
if examineBy != 0 {
|
||||
adminUserDao := dao.AdminUserDao{}
|
||||
adminUser, err := adminUserDao.GetAdminUserFirstById(examineBy)
|
||||
if err == nil && adminUser != nil {
|
||||
r.ExamineBy = adminUser.NickName
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadPaymentByName 加载打款人员名称
|
||||
func (r *DoctorWithdrawalDto) LoadPaymentByName(paymentBy int64) *DoctorWithdrawalDto {
|
||||
if paymentBy != 0 {
|
||||
adminUserDao := dao.AdminUserDao{}
|
||||
adminUser, err := adminUserDao.GetAdminUserFirstById(paymentBy)
|
||||
if err == nil && adminUser != nil {
|
||||
r.PaymentBy = adminUser.NickName
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
Reference in New Issue
Block a user