48 lines
3.2 KiB
Go
48 lines
3.2 KiB
Go
package model
|
||
|
||
import (
|
||
"gorm.io/gorm"
|
||
"hospital-admin-api/global"
|
||
"time"
|
||
)
|
||
|
||
// DoctorWithdrawal 医生提现表
|
||
type DoctorWithdrawal struct {
|
||
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"`
|
||
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"`
|
||
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"`
|
||
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"`
|
||
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"`
|
||
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"`
|
||
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"`
|
||
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"` // 医生
|
||
DoctorWithdrawalBank *DoctorWithdrawalBank `gorm:"foreignKey:WithdrawalId;references:withdrawal_id" json:"doctor_withdrawal_bank"` // 医生提现表-关联银行
|
||
Model
|
||
}
|
||
|
||
func (m *DoctorWithdrawal) TableName() string {
|
||
return "gdxz_doctor_withdrawal"
|
||
}
|
||
|
||
func (m *DoctorWithdrawal) BeforeCreate(tx *gorm.DB) error {
|
||
if m.WithdrawalId == 0 {
|
||
m.WithdrawalId = 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
|
||
}
|