新增:提现详情
This commit is contained in:
parent
a26cd2cef3
commit
bf108857d7
@ -6,8 +6,10 @@ import (
|
|||||||
"hospital-admin-api/api/dto"
|
"hospital-admin-api/api/dto"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/api/responses"
|
"hospital-admin-api/api/responses"
|
||||||
|
"hospital-admin-api/api/service"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DoctorWithdrawal 医生提现
|
// DoctorWithdrawal 医生提现
|
||||||
@ -53,3 +55,29 @@ func (r *DoctorWithdrawal) GetDoctorWithdrawalPage(c *gin.Context) {
|
|||||||
result["data"] = res
|
result["data"] = res
|
||||||
responses.OkWithData(result, c)
|
responses.OkWithData(result, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDoctorWithdrawal 提现详情
|
||||||
|
func (r *DoctorWithdrawal) GetDoctorWithdrawal(c *gin.Context) {
|
||||||
|
id := c.Param("withdrawal_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
withdrawalId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
doctorWithdrawaService := service.DoctorWithdrawaService{}
|
||||||
|
res, err := doctorWithdrawaService.GetDoctorWithdrawal(withdrawalId)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(res, c)
|
||||||
|
}
|
||||||
|
|||||||
@ -9,6 +9,15 @@ import (
|
|||||||
type DoctorBankCardDao struct {
|
type DoctorBankCardDao struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDoctorBankCardById 获取医生银行卡数据-id
|
||||||
|
func (r *DoctorBankCardDao) GetDoctorBankCardById(bankCardId int64) (m *model.DoctorBankCard, err error) {
|
||||||
|
err = global.Db.First(&m, bankCardId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetDoctorBankCardByDoctorId 获取医生银行卡数据-医生id
|
// GetDoctorBankCardByDoctorId 获取医生银行卡数据-医生id
|
||||||
func (r *DoctorBankCardDao) GetDoctorBankCardByDoctorId(doctorId int64) (m *model.DoctorBankCard, err error) {
|
func (r *DoctorBankCardDao) GetDoctorBankCardByDoctorId(doctorId int64) (m *model.DoctorBankCard, err error) {
|
||||||
err = global.Db.Where("doctor_id = ?", doctorId).First(&m).Error
|
err = global.Db.Where("doctor_id = ?", doctorId).First(&m).Error
|
||||||
|
|||||||
@ -77,6 +77,12 @@ func (r *DoctorWithdrawalDao) GetDoctorWithdrawalPageSearch(req requests.GetDoct
|
|||||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 提现关联银行卡
|
||||||
|
query = query.Preload("DoctorWithdrawalBank")
|
||||||
|
|
||||||
|
// 基础银行卡
|
||||||
|
query = query.Preload("DoctorWithdrawalBank.BasicBank")
|
||||||
|
|
||||||
// 医生姓名
|
// 医生姓名
|
||||||
if req.UserName != "" {
|
if req.UserName != "" {
|
||||||
subQuery := global.Db.Model(&model.UserDoctor{}).
|
subQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
|
|||||||
27
api/dao/doctorWithdrawalBank.go
Normal file
27
api/dao/doctorWithdrawalBank.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DoctorWithdrawalBankDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorWithdrawalBankById 获取医生提现关联银行数据-id
|
||||||
|
func (r *DoctorWithdrawalBankDao) GetDoctorWithdrawalBankById(withdrawalBankId int64) (m *model.DoctorWithdrawalBank, err error) {
|
||||||
|
err = global.Db.First(&m, withdrawalBankId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorWithdrawalBankByWithdrawalId 获取医生提现关联银行数据-提现id
|
||||||
|
func (r *DoctorWithdrawalBankDao) GetDoctorWithdrawalBankByWithdrawalId(withdrawalId int64) (m *model.DoctorWithdrawalBank, err error) {
|
||||||
|
err = global.Db.Where("withdrawal_id = ?", withdrawalId).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
@ -7,32 +7,35 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type DoctorWithdrawalDto struct {
|
type DoctorWithdrawalDto struct {
|
||||||
WithdrawalId string `json:"withdrawal_id"` // 主键id
|
WithdrawalId string `json:"withdrawal_id"` // 主键id
|
||||||
DoctorId string `json:"doctor_id"` // 医生id;NOT NULL
|
DoctorId string `json:"doctor_id"` // 医生id;NOT NULL
|
||||||
BankId string `json:"bank_id"` // 银行id
|
AccountName string `json:"account_name"` // 银行卡姓名;NOT NULL
|
||||||
AccountName string `json:"account_name"` // 银行卡姓名;NOT NULL
|
BankCardCode string `json:"bank_card_code"` // 银行卡号
|
||||||
BankCardCode string `json:"bank_card_code"` // 银行卡号
|
BankCardCodeFour string `json:"bank_card_code_four"` // 银行卡号(后四位);NOT NULL
|
||||||
BankCardCodeFour string `json:"bank_card_code_four"` // 银行卡号(后四位);NOT NULL
|
AppliedWithdrawalAmount float64 `json:"applied_withdrawal_amount"` // 提现金额
|
||||||
AppliedWithdrawalAmount float64 `json:"applied_withdrawal_amount"` // 提现金额
|
ActualWithdrawalAmount float64 `json:"actual_withdrawal_amount"` // 实际提现金额
|
||||||
ActualWithdrawalAmount float64 `json:"actual_withdrawal_amount"` // 实际提现金额
|
IncomeTax float64 `json:"income_tax"` // 提现所得税金额
|
||||||
IncomeTax float64 `json:"income_tax"` // 提现所得税金额
|
ExamineStatus int `json:"examine_status"` // 审核状态(1:审核中 2:审核通过 3:审核未通过)
|
||||||
ExamineStatus int `json:"examine_status"` // 审核状态(1:审核中 2:审核通过 3:审核未通过)
|
ExamineFailReason string `json:"examine_fail_reason"` // 审核失败原因
|
||||||
ExamineFailReason string `json:"examine_fail_reason"` // 审核失败原因
|
ExamineTime model.LocalTime `json:"examine_time"` // 审核日期
|
||||||
ExamineTime model.LocalTime `json:"examine_time"` // 审核日期
|
ExamineBy string `json:"examine_by"` // 审核人员id(后台用户id)
|
||||||
ExamineBy string `json:"examine_by"` // 审核人员id(后台用户id)
|
PaymentStatus int `json:"payment_status"` // 财务打款状态(0:否 1:是)
|
||||||
PaymentStatus int `json:"payment_status"` // 财务打款状态(0:否 1:是)
|
PaymentTime model.LocalTime `json:"payment_time"` // 财务打款时间
|
||||||
PaymentTime model.LocalTime `json:"payment_time"` // 财务打款时间
|
PaymentBy string `json:"payment_by"` // 财务打款人员id(后台用户id)
|
||||||
PaymentBy string `json:"payment_by"` // 财务打款人员id(后台用户id)
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
DoctorName string `json:"doctor_name"` // 医生姓名
|
||||||
DoctorName string `json:"doctor_name"` // 医生姓名
|
DoctorCardNumMask string `json:"doctor_card_num_mask"` // 医生证件号码(掩码)
|
||||||
|
DoctorBankCard *DoctorBankCardDto `json:"doctor_bank_card"` // 加载医生银行卡数据
|
||||||
|
DoctorWithdrawalBank *DoctorWithdrawalBankDto `json:"doctor_withdrawal_bank"` // 医生提现表-关联银行
|
||||||
|
BankName string `json:"bank_name"` // 提现银行名称
|
||||||
|
BankCity string `json:"bank_city"` // 提现银行开户行城市
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDoctorWithdrawalDto(m *model.DoctorWithdrawal) *DoctorWithdrawalDto {
|
func GetDoctorWithdrawalDto(m *model.DoctorWithdrawal) *DoctorWithdrawalDto {
|
||||||
return &DoctorWithdrawalDto{
|
return &DoctorWithdrawalDto{
|
||||||
WithdrawalId: fmt.Sprintf("%d", m.WithdrawalId),
|
WithdrawalId: fmt.Sprintf("%d", m.WithdrawalId),
|
||||||
DoctorId: fmt.Sprintf("%d", m.DoctorId),
|
DoctorId: fmt.Sprintf("%d", m.DoctorId),
|
||||||
BankId: fmt.Sprintf("%d", m.BankId),
|
|
||||||
AccountName: m.AccountName,
|
AccountName: m.AccountName,
|
||||||
BankCardCode: m.BankCardCode,
|
BankCardCode: m.BankCardCode,
|
||||||
BankCardCodeFour: m.BankCardCodeFour,
|
BankCardCodeFour: m.BankCardCodeFour,
|
||||||
@ -60,7 +63,6 @@ func GetDoctorWithdrawalListDto(m []*model.DoctorWithdrawal) []*DoctorWithdrawal
|
|||||||
response := &DoctorWithdrawalDto{
|
response := &DoctorWithdrawalDto{
|
||||||
WithdrawalId: fmt.Sprintf("%d", v.WithdrawalId),
|
WithdrawalId: fmt.Sprintf("%d", v.WithdrawalId),
|
||||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||||
BankId: fmt.Sprintf("%d", v.BankId),
|
|
||||||
AccountName: v.AccountName,
|
AccountName: v.AccountName,
|
||||||
BankCardCode: v.BankCardCode,
|
BankCardCode: v.BankCardCode,
|
||||||
BankCardCodeFour: v.BankCardCodeFour,
|
BankCardCodeFour: v.BankCardCodeFour,
|
||||||
@ -70,10 +72,10 @@ func GetDoctorWithdrawalListDto(m []*model.DoctorWithdrawal) []*DoctorWithdrawal
|
|||||||
ExamineStatus: v.ExamineStatus,
|
ExamineStatus: v.ExamineStatus,
|
||||||
ExamineFailReason: v.ExamineFailReason,
|
ExamineFailReason: v.ExamineFailReason,
|
||||||
ExamineTime: v.ExamineTime,
|
ExamineTime: v.ExamineTime,
|
||||||
ExamineBy: fmt.Sprintf("%d", v.ExamineBy),
|
ExamineBy: "",
|
||||||
PaymentStatus: v.PaymentStatus,
|
PaymentStatus: v.PaymentStatus,
|
||||||
PaymentTime: v.PaymentTime,
|
PaymentTime: v.PaymentTime,
|
||||||
PaymentBy: fmt.Sprintf("%d", v.PaymentBy),
|
PaymentBy: "",
|
||||||
CreatedAt: v.CreatedAt,
|
CreatedAt: v.CreatedAt,
|
||||||
UpdatedAt: v.UpdatedAt,
|
UpdatedAt: v.UpdatedAt,
|
||||||
}
|
}
|
||||||
@ -93,6 +95,16 @@ func GetDoctorWithdrawalListDto(m []*model.DoctorWithdrawal) []*DoctorWithdrawal
|
|||||||
response.LoadPaymentByName(v.PaymentBy)
|
response.LoadPaymentByName(v.PaymentBy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.DoctorWithdrawalBank != nil {
|
||||||
|
// 加载提现银行名称
|
||||||
|
if v.DoctorWithdrawalBank.BasicBank != nil {
|
||||||
|
response.LoadBankName(v.DoctorWithdrawalBank.BasicBank)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载开户行城市名称
|
||||||
|
response.LoadBankCity(v.DoctorWithdrawalBank)
|
||||||
|
}
|
||||||
|
|
||||||
// 将转换后的结构体添加到新切片中
|
// 将转换后的结构体添加到新切片中
|
||||||
responses[i] = response
|
responses[i] = response
|
||||||
}
|
}
|
||||||
@ -111,6 +123,7 @@ func (r *DoctorWithdrawalDto) LoadDoctorName(m *model.UserDoctor) *DoctorWithdra
|
|||||||
|
|
||||||
// LoadExamineByName 加载审核人员名称
|
// LoadExamineByName 加载审核人员名称
|
||||||
func (r *DoctorWithdrawalDto) LoadExamineByName(examineBy int64) *DoctorWithdrawalDto {
|
func (r *DoctorWithdrawalDto) LoadExamineByName(examineBy int64) *DoctorWithdrawalDto {
|
||||||
|
r.ExamineBy = ""
|
||||||
if examineBy != 0 {
|
if examineBy != 0 {
|
||||||
adminUserDao := dao.AdminUserDao{}
|
adminUserDao := dao.AdminUserDao{}
|
||||||
adminUser, err := adminUserDao.GetAdminUserFirstById(examineBy)
|
adminUser, err := adminUserDao.GetAdminUserFirstById(examineBy)
|
||||||
@ -123,6 +136,7 @@ func (r *DoctorWithdrawalDto) LoadExamineByName(examineBy int64) *DoctorWithdraw
|
|||||||
|
|
||||||
// LoadPaymentByName 加载打款人员名称
|
// LoadPaymentByName 加载打款人员名称
|
||||||
func (r *DoctorWithdrawalDto) LoadPaymentByName(paymentBy int64) *DoctorWithdrawalDto {
|
func (r *DoctorWithdrawalDto) LoadPaymentByName(paymentBy int64) *DoctorWithdrawalDto {
|
||||||
|
r.PaymentBy = ""
|
||||||
if paymentBy != 0 {
|
if paymentBy != 0 {
|
||||||
adminUserDao := dao.AdminUserDao{}
|
adminUserDao := dao.AdminUserDao{}
|
||||||
adminUser, err := adminUserDao.GetAdminUserFirstById(paymentBy)
|
adminUser, err := adminUserDao.GetAdminUserFirstById(paymentBy)
|
||||||
@ -132,3 +146,43 @@ func (r *DoctorWithdrawalDto) LoadPaymentByName(paymentBy int64) *DoctorWithdraw
|
|||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadDoctorCardNumMask 加载医生证件号码(掩码)
|
||||||
|
func (r *DoctorWithdrawalDto) LoadDoctorCardNumMask(m *model.UserDoctorInfo) *DoctorWithdrawalDto {
|
||||||
|
if m != nil {
|
||||||
|
r.DoctorCardNumMask = m.CardNumMask
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadBankName 加载提现银行名称
|
||||||
|
func (r *DoctorWithdrawalDto) LoadBankName(m *model.BasicBank) *DoctorWithdrawalDto {
|
||||||
|
if m != nil {
|
||||||
|
r.BankName = m.BankName
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadBankCity 加载开户行城市名称
|
||||||
|
func (r *DoctorWithdrawalDto) LoadBankCity(m *model.DoctorWithdrawalBank) *DoctorWithdrawalDto {
|
||||||
|
if m != nil {
|
||||||
|
r.BankCity = m.Province + m.City + m.County
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadDoctorWithdrawalBank 加载提现关联银行数据
|
||||||
|
func (r *DoctorWithdrawalDto) LoadDoctorWithdrawalBank(m *model.DoctorWithdrawalBank) *DoctorWithdrawalDto {
|
||||||
|
if m != nil {
|
||||||
|
r.DoctorWithdrawalBank = GetDoctorWithdrawalBankDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadBasicBank 加载基础银行数据
|
||||||
|
func (r *DoctorWithdrawalDto) LoadBasicBank(m *model.BasicBank) *DoctorWithdrawalDto {
|
||||||
|
if m != nil {
|
||||||
|
r.DoctorWithdrawalBank.BasicBank = GetBasicBankDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|||||||
68
api/dto/doctorWithdrawalBank.go
Normal file
68
api/dto/doctorWithdrawalBank.go
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DoctorWithdrawalBankDto struct {
|
||||||
|
WithdrawalBankId string `json:"withdrawal_bank_id"` // 主键id
|
||||||
|
WithdrawalId string `json:"withdrawal_id"` // 提现id
|
||||||
|
BankId string `json:"bank_id"` // 银行id
|
||||||
|
BankCardCode string `json:"bank_card_code"` // 银行卡号
|
||||||
|
ProvinceId int `json:"province_id"` // 省份id
|
||||||
|
Province string `json:"province"` // 省份
|
||||||
|
CityId int `json:"city_id"` // 城市id
|
||||||
|
City string `json:"city"` // 城市
|
||||||
|
CountyId int `json:"county_id"` // 区县id
|
||||||
|
County string `json:"county"` // 区县
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
BasicBank *BasicBankDto `json:"basic_bank"` // 基础-银行数据
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDoctorWithdrawalBankDto(m *model.DoctorWithdrawalBank) *DoctorWithdrawalBankDto {
|
||||||
|
return &DoctorWithdrawalBankDto{
|
||||||
|
WithdrawalBankId: fmt.Sprintf("%d", m.WithdrawalBankId),
|
||||||
|
WithdrawalId: fmt.Sprintf("%d", m.WithdrawalId),
|
||||||
|
BankId: fmt.Sprintf("%d", m.BankId),
|
||||||
|
BankCardCode: m.BankCardCode,
|
||||||
|
ProvinceId: m.ProvinceId,
|
||||||
|
Province: m.Province,
|
||||||
|
CityId: m.CityId,
|
||||||
|
City: m.City,
|
||||||
|
CountyId: m.CountyId,
|
||||||
|
County: m.County,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDoctorWithdrawalBankListDto(m []*model.DoctorWithdrawalBank) []*DoctorWithdrawalBankDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*DoctorWithdrawalBankDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &DoctorWithdrawalBankDto{
|
||||||
|
WithdrawalBankId: fmt.Sprintf("%d", v.WithdrawalBankId),
|
||||||
|
WithdrawalId: fmt.Sprintf("%d", v.WithdrawalId),
|
||||||
|
BankId: fmt.Sprintf("%d", v.BankId),
|
||||||
|
BankCardCode: v.BankCardCode,
|
||||||
|
ProvinceId: v.ProvinceId,
|
||||||
|
Province: v.Province,
|
||||||
|
CityId: v.CityId,
|
||||||
|
City: v.City,
|
||||||
|
CountyId: v.CountyId,
|
||||||
|
County: v.County,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
@ -8,23 +8,23 @@ import (
|
|||||||
|
|
||||||
// DoctorWithdrawal 医生提现表
|
// DoctorWithdrawal 医生提现表
|
||||||
type DoctorWithdrawal struct {
|
type DoctorWithdrawal struct {
|
||||||
WithdrawalId int64 `gorm:"column:withdrawal_id;type:bigint(19);primary_key;comment:主键id" json:"withdrawal_id"`
|
WithdrawalId int64 `gorm:"column:withdrawal_id;type:bigint(19);primary_key;comment:主键id" json:"withdrawal_id"`
|
||||||
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
|
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
|
||||||
BankId int64 `gorm:"column:bank_id;type:bigint(19);comment:银行id" json:"bank_id"`
|
AccountName string `gorm:"column:account_name;type:varchar(50);comment:银行卡姓名;NOT NULL" json:"account_name"`
|
||||||
AccountName string `gorm:"column:account_name;type:varchar(50);comment:银行卡姓名;NOT NULL" json:"account_name"`
|
BankCardCode string `gorm:"column:bank_card_code;type:varchar(100);comment:银行卡号" json:"bank_card_code"`
|
||||||
BankCardCode string `gorm:"column:bank_card_code;type:varchar(100);comment:银行卡号" json:"bank_card_code"`
|
BankCardCodeFour string `gorm:"column:bank_card_code_four;type:varchar(10);comment:银行卡号(后四位);NOT NULL" json:"bank_card_code_four"`
|
||||||
BankCardCodeFour string `gorm:"column:bank_card_code_four;type:varchar(10);comment:银行卡号(后四位);NOT NULL" json:"bank_card_code_four"`
|
AppliedWithdrawalAmount float64 `gorm:"column:applied_withdrawal_amount;type:decimal(10,2);default:0.00;comment:提现金额" json:"applied_withdrawal_amount"`
|
||||||
AppliedWithdrawalAmount float64 `gorm:"column:applied_withdrawal_amount;type:decimal(10,2);default:0.00;comment:提现金额" json:"applied_withdrawal_amount"`
|
ActualWithdrawalAmount float64 `gorm:"column:actual_withdrawal_amount;type:decimal(10,2);default:0.00;comment:实际提现金额" json:"actual_withdrawal_amount"`
|
||||||
ActualWithdrawalAmount float64 `gorm:"column:actual_withdrawal_amount;type:decimal(10,2);default:0.00;comment:实际提现金额" json:"actual_withdrawal_amount"`
|
IncomeTax float64 `gorm:"column:income_tax;type:decimal(10,2);default:0.00;comment:提现所得税金额" json:"income_tax"`
|
||||||
IncomeTax float64 `gorm:"column:income_tax;type:decimal(10,2);default:0.00;comment:提现所得税金额" json:"income_tax"`
|
ExamineStatus int `gorm:"column:examine_status;type:tinyint(4);default:0;comment:审核状态(1:审核中 2:审核通过 3:审核未通过)" json:"examine_status"`
|
||||||
ExamineStatus int `gorm:"column:examine_status;type:tinyint(4);default:0;comment:审核状态(1:审核中 2:审核通过 3:审核未通过)" json:"examine_status"`
|
ExamineFailReason string `gorm:"column:examine_fail_reason;type:varchar(255);comment:审核失败原因" json:"examine_fail_reason"`
|
||||||
ExamineFailReason string `gorm:"column:examine_fail_reason;type:varchar(255);comment:审核失败原因" json:"examine_fail_reason"`
|
ExamineTime LocalTime `gorm:"column:examine_time;type:datetime;comment:审核日期" json:"examine_time"`
|
||||||
ExamineTime LocalTime `gorm:"column:examine_time;type:datetime;comment:审核日期" json:"examine_time"`
|
ExamineBy int64 `gorm:"column:examine_by;type:bigint(19);comment:审核人员id(后台用户id)" json:"examine_by"`
|
||||||
ExamineBy int64 `gorm:"column:examine_by;type:bigint(19);comment:审核人员id(后台用户id)" json:"examine_by"`
|
PaymentStatus int `gorm:"column:payment_status;type:tinyint(1);default:0;comment:财务打款状态(0:否 1:是)" json:"payment_status"`
|
||||||
PaymentStatus int `gorm:"column:payment_status;type:tinyint(1);default:0;comment:财务打款状态(0:否 1:是)" json:"payment_status"`
|
PaymentTime LocalTime `gorm:"column:payment_time;type:datetime;comment:财务打款时间" json:"payment_time"`
|
||||||
PaymentTime LocalTime `gorm:"column:payment_time;type:datetime;comment:财务打款时间" json:"payment_time"`
|
PaymentBy int64 `gorm:"column:payment_by;type:bigint(19);comment:财务打款人员id(后台用户id)" json:"payment_by"`
|
||||||
PaymentBy int64 `gorm:"column:payment_by;type:bigint(19);comment:财务打款人员id(后台用户id)" json:"payment_by"`
|
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
||||||
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
DoctorWithdrawalBank *DoctorWithdrawalBank `gorm:"foreignKey:WithdrawalId;references:withdrawal_id" json:"doctor_withdrawal_bank"` // 医生提现表-关联银行
|
||||||
Model
|
Model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
41
api/model/doctorWithdrawalBank.go
Normal file
41
api/model/doctorWithdrawalBank.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DoctorWithdrawalBank 医生提现表-关联银行
|
||||||
|
type DoctorWithdrawalBank struct {
|
||||||
|
WithdrawalBankId int64 `gorm:"column:withdrawal_bank_id;type:bigint(19);primary_key;comment:主键id" json:"withdrawal_bank_id"`
|
||||||
|
WithdrawalId int64 `gorm:"column:withdrawal_id;type:bigint(19)" json:"withdrawal_id"`
|
||||||
|
BankId int64 `gorm:"column:bank_id;type:bigint(19);comment:银行id" json:"bank_id"`
|
||||||
|
BankCardCode string `gorm:"column:bank_card_code;type:varchar(100);comment:银行卡号" json:"bank_card_code"`
|
||||||
|
ProvinceId int `gorm:"column:province_id;type:int(11);comment:省份id" json:"province_id"`
|
||||||
|
Province string `gorm:"column:province;type:varchar(40);comment:省份" json:"province"`
|
||||||
|
CityId int `gorm:"column:city_id;type:int(11);comment:城市id" json:"city_id"`
|
||||||
|
City string `gorm:"column:city;type:varchar(40);comment:城市" json:"city"`
|
||||||
|
CountyId int `gorm:"column:county_id;type:int(11);comment:区县id" json:"county_id"`
|
||||||
|
County string `gorm:"column:county;type:varchar(255);comment:区县" json:"county"`
|
||||||
|
BasicBank *BasicBank `gorm:"foreignKey:BankId;references:bank_id" json:"basic_bank"` // 银行
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DoctorWithdrawalBank) TableName() string {
|
||||||
|
return "gdxz_doctor_withdrawal_bank"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DoctorWithdrawalBank) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.WithdrawalBankId == 0 {
|
||||||
|
m.WithdrawalBankId = 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
|
||||||
|
}
|
||||||
@ -515,7 +515,7 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
|||||||
withdrawalGroup.GET("", api.DoctorWithdrawal.GetDoctorWithdrawalPage)
|
withdrawalGroup.GET("", api.DoctorWithdrawal.GetDoctorWithdrawalPage)
|
||||||
|
|
||||||
// 提现详情
|
// 提现详情
|
||||||
withdrawalGroup.GET("/:withdrawal_id", api.OrderPrescription.GetOrderPrescriptionPage)
|
withdrawalGroup.GET("/:withdrawal_id", api.DoctorWithdrawal.GetDoctorWithdrawal)
|
||||||
|
|
||||||
// 提现详情-关联订单列表-分页
|
// 提现详情-关联订单列表-分页
|
||||||
withdrawalGroup.GET("/order/:withdrawal_id", api.OrderPrescription.GetOrderPrescriptionPage)
|
withdrawalGroup.GET("/order/:withdrawal_id", api.OrderPrescription.GetOrderPrescriptionPage)
|
||||||
|
|||||||
70
api/service/doctorWithdrawa.go
Normal file
70
api/service/doctorWithdrawa.go
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"hospital-admin-api/api/dao"
|
||||||
|
"hospital-admin-api/api/dto"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DoctorWithdrawaService struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorWithdrawal 提现详情
|
||||||
|
func (r *DoctorWithdrawaService) GetDoctorWithdrawal(withdrawalId int64) (g *dto.DoctorWithdrawalDto, err error) {
|
||||||
|
doctorWithdrawalDao := dao.DoctorWithdrawalDao{}
|
||||||
|
doctorWithdrawal, err := doctorWithdrawalDao.GetDoctorWithdrawalById(withdrawalId)
|
||||||
|
if doctorWithdrawal == nil {
|
||||||
|
return nil, errors.New("数据错误")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取医生数据
|
||||||
|
userDoctorDao := dao.UserDoctorDao{}
|
||||||
|
userDoctor, err := userDoctorDao.GetUserDoctorById(doctorWithdrawal.DoctorId)
|
||||||
|
if err != nil || userDoctor == nil {
|
||||||
|
return nil, errors.New("医生数据错误")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取医生详情数据
|
||||||
|
userDoctorInfoDao := dao.UserDoctorInfoDao{}
|
||||||
|
userDoctorInfo, err := userDoctorInfoDao.GetUserDoctorInfoByUserId(userDoctor.UserId)
|
||||||
|
if err != nil || userDoctorInfo == nil {
|
||||||
|
return nil, errors.New("医生详情数据错误")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取提现关联银行数据
|
||||||
|
doctorWithdrawalBankDao := dao.DoctorWithdrawalBankDao{}
|
||||||
|
doctorWithdrawalBank, err := doctorWithdrawalBankDao.GetDoctorWithdrawalBankByWithdrawalId(doctorWithdrawal.WithdrawalId)
|
||||||
|
if err != nil || doctorWithdrawalBank == nil {
|
||||||
|
return nil, errors.New("银行卡数据错误")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取基础银行数据
|
||||||
|
basicBankDao := dao.BasicBankDao{}
|
||||||
|
basicBank, err := basicBankDao.GetBasicBankById(doctorWithdrawalBank.BankId)
|
||||||
|
if err != nil || basicBank == nil {
|
||||||
|
return nil, errors.New("银行数据错误")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
g = dto.GetDoctorWithdrawalDto(doctorWithdrawal)
|
||||||
|
|
||||||
|
// 加载医生名称
|
||||||
|
g.LoadDoctorName(userDoctor)
|
||||||
|
|
||||||
|
// 加载医生证件号码(掩码)
|
||||||
|
g.LoadDoctorCardNumMask(userDoctorInfo)
|
||||||
|
|
||||||
|
// 加载审核人员名称
|
||||||
|
g.LoadExamineByName(doctorWithdrawal.ExamineBy)
|
||||||
|
|
||||||
|
// 加载打款人员名称
|
||||||
|
g.LoadPaymentByName(doctorWithdrawal.ExamineBy)
|
||||||
|
|
||||||
|
// 加载提现关联银行数据
|
||||||
|
g.LoadDoctorWithdrawalBank(doctorWithdrawalBank)
|
||||||
|
|
||||||
|
// 加载基础银行数据
|
||||||
|
g.LoadBasicBank(basicBank)
|
||||||
|
|
||||||
|
return g, nil
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user