38 lines
1.6 KiB
Go
38 lines
1.6 KiB
Go
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"hospital-admin-api/global"
|
|
"time"
|
|
)
|
|
|
|
// DoctorAccount 医生账户总表-已结束订单
|
|
type DoctorAccount struct {
|
|
AccountId int64 `gorm:"column:account_id;type:bigint(19);primary_key;comment:账户id" json:"account_id"`
|
|
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
|
|
TotalAmount float64 `gorm:"column:total_amount;type:decimal(18,8) unsigned;comment:总金额(已结束订单的总金额)" json:"total_amount"`
|
|
BalanceAccount float64 `gorm:"column:balance_account;type:decimal(18,8) unsigned;default:0.00000000;comment:账户余额" json:"balance_account"`
|
|
AppliedWithdrawalAmount float64 `gorm:"column:applied_withdrawal_amount;type:decimal(18,8) unsigned;default:0.00000000;comment:提现金额" json:"applied_withdrawal_amount"`
|
|
ActualWithdrawalAmount float64 `gorm:"column:actual_withdrawal_amount;type:decimal(18,8) unsigned;default:0.00000000;comment:实际提现金额" json:"actual_withdrawal_amount"`
|
|
IncomeTax float64 `gorm:"column:income_tax;type:decimal(18,8) unsigned;default:0.00000000;comment:所得税金额" json:"income_tax"`
|
|
Model
|
|
}
|
|
|
|
func (m *DoctorAccount) TableName() string {
|
|
return "gdxz_doctor_account"
|
|
}
|
|
|
|
func (m *DoctorAccount) BeforeCreate(tx *gorm.DB) error {
|
|
if m.AccountId == 0 {
|
|
m.AccountId = 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
|
|
}
|