package models

import "github.com/shopspring/decimal"

type Deposit struct {
	ID           int64           `gorm:"column:id" json:"id" form:"id"`
	UserOrgId    int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`          //机构id
	HisPatientId int64           `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"` //his病人id
	Ctime        int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime        int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
	Status       int64           `gorm:"column:status" json:"status" form:"status"`
	Deposit      decimal.Decimal `gorm:"column:deposit" json:"deposit" form:"deposit"` //押金
}

func (Deposit) TableName() string {
	return "sgj_xt.his_deposit"
}

type DepositHistory struct {
	ID             int64           `gorm:"column:id" json:"id" form:"id"`
	UserOrgId      int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`          //机构id
	HisPatientId   int64           `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"` //his病人id
	DepositCode    string          `gorm:"column:deposit_code" json:"deposit_code" form:"deposit_code"`
	Deposit        decimal.Decimal `gorm:"column:deposit" json:"deposit" form:"deposit"`                         //本次操作金额
	SurplusDeposit decimal.Decimal `gorm:"column:surplus_deposit" json:"surplus_deposit" form:"surplus_deposit"` //剩余金额
	DepositStatus  int64           `gorm:"column:deposit_status" json:"deposit_status" form:"deposit_status"`    //1：充值,2：扣费,3：退款,4：退费
	Status         int64           `gorm:"column:status" json:"status" form:"status"`
	CreateId       int64           `gorm:"column:create_id" json:"create_id" form:"create_id"`
	Ctime          int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime          int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
	TrialStatus    int64           `gorm:"column:trial_status" json:"trial_status" form:"trial_status"` //审核状态0：未审核 ，1：已审核
	Remarks        string          `gorm:"column:remarks" json:"remarks" form:"remarks"`                //备注
}

func (DepositHistory) TableName() string {
	return "sgj_xt.his_deposit_history"
}

type GetHisName struct {
	ID   int64  `gorm:"column:id" json:"id" form:"id"`
	Name string `gorm:"column:name" json:"name" form:"name"`
}

func (GetHisName) TableName() string {
	return "sgj_xt.xt_patients"
}

type DepositHistoryname struct {
	ID             int64           `gorm:"column:id" json:"id" form:"id"`
	UserOrgId      int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`          //机构id
	HisPatientId   int64           `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"` //his病人id
	DepositCode    string          `gorm:"column:deposit_code" json:"deposit_code" form:"deposit_code"`
	Deposit        decimal.Decimal `gorm:"column:deposit" json:"deposit" form:"deposit"`                         //本次操作金额
	SurplusDeposit decimal.Decimal `gorm:"column:surplus_deposit" json:"surplus_deposit" form:"surplus_deposit"` //剩余金额
	DepositStatus  int64           `gorm:"column:deposit_status" json:"deposit_status" form:"deposit_status"`    //1：充值,2：扣费,3：退款,4：退费
	Status         int64           `gorm:"column:status" json:"status" form:"status"`
	CreateId       int64           `gorm:"column:create_id" json:"create_id" form:"create_id"`
	Ctime          int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime          int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
	TrialStatus    int64           `gorm:"column:trial_status" json:"trial_status" form:"trial_status"` //审核状态0：未审核 ，1：已审核
	Remarks        string          `gorm:"column:remarks" json:"remarks" form:"remarks"`                //备注
	Name           string          ` json:"name" `
	HisName        string          `json:"his_name"`
	Starttime      string          `json:"starttime"` //创建时间
}

func (DepositHistoryname) TableName() string {
	return "sgj_xt.his_deposit_history"
}

type RefundList struct {
	ID             int64           `gorm:"column:id" json:"id" form:"id"`
	UserOrgId      int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`          //机构id
	HisPatientId   int64           `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"` //his病人id
	DepositCode    string          `gorm:"column:deposit_code" json:"deposit_code" form:"deposit_code"`
	Deposit        decimal.Decimal `gorm:"column:deposit" json:"deposit" form:"deposit"`                         //本次操作金额
	SurplusDeposit decimal.Decimal `gorm:"column:surplus_deposit" json:"surplus_deposit" form:"surplus_deposit"` //剩余金额
	DepositStatus  int64           `gorm:"column:deposit_status" json:"deposit_status" form:"deposit_status"`    //1：充值,2：扣费,3：退款,4：退费
	Status         int64           `gorm:"column:status" json:"status" form:"status"`
	CreateId       int64           `gorm:"column:create_id" json:"create_id" form:"create_id"`
	Ctime          int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime          int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
	TrialStatus    int64           `gorm:"column:trial_status" json:"trial_status" form:"trial_status"` //审核状态0：未审核 ，1：已审核
	Starttime      string          `json:"starttime"`                                                   //申请时间
	Name           string          ` json:"name" `                                                      //申请人
	HisName        string          `json:"his_name"`
}

func (RefundList) TableName() string {
	return "sgj_xt.his_deposit_history"
}

type CreateUser struct {
	ID   int64  `gorm:"column:id" json:"id" form:"id"`
	Name string `gorm:"column:name" json:"name" form:"name"`
}

func (CreateUser) TableName() string {
	return "sgj_users.sgj_user_admin"
}

type CreateUserNames struct {
	ID       int64  `gorm:"column:id" json:"id" form:"id"`
	UserName string `gorm:"column:user_name" json:"user_name" form:"user_name"`
}

func (CreateUserNames) TableName() string {
	return "sgj_users.sgj_user_admin_role"
}

type Summary struct {
	HisName    string          `json:"his_name"`    //患者姓名
	SumDecimal decimal.Decimal `json:"sum_decimal"` //充值金额
	Decimal    decimal.Decimal `json:"decimal"`     //押金余额
}

type Deposit1 struct {
	ID             int64           `gorm:"column:id" json:"id" form:"id"`
	UserOrgId      int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`          //机构id
	HisPatientId   int64           `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"` //his病人id
	HisPatientName string          `json:"his_patient_name"`
	Ctime          int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime          int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
	Status         int64           `gorm:"column:status" json:"status" form:"status"`
	Deposit        decimal.Decimal `gorm:"column:deposit" json:"deposit" form:"deposit"` //押金
}

func (Deposit1) TableName() string {
	return "sgj_xt.his_deposit"
}

//扣费明细列表
type Details struct {
	ID         int64           `json:"id"`          //原始code
	Code       string          `json:"code"`        //就诊号
	Number     string          `json:"number"`      //批号，用来跳转用的
	NameId     int64           `json:"name_id"`     //患者id
	Name       string          `json:"name"`        //患者名字
	Chargetype string          `json:"chargetype"`  //医收费类型
	Total      decimal.Decimal `json:"total"`       //医疗费总额
	Decimal    decimal.Decimal `json:"decimal"`     //押金支付金额
	ChargeDate string          `json:"charge_date"` //收费日期
	ButtonShow int64           `json:"button_show"` //查看详情按钮是否显示，0隐藏，1显示
}

//扣费汇总
type DeductionSummary struct {
	Name    string          `json:"name"`    //患者名字
	Total   decimal.Decimal `json:"total"`   //医疗费总额
	Decimal decimal.Decimal `json:"decimal"` //押金支付金额
}

type GetorgName struct {
	ID      int64  `json:"id"`
	OrgName string `json:"org_name"`
}

func (GetorgName) TableName() string {
	return "sgj_users.sgj_user_org"
}

//获取就诊号
type GetMdtrtId struct {
	Id      int64  `json:"id"`
	MdtrtId string `json:"mdtrt_id"`
	Number  string `json:"number"`
}

func (GetMdtrtId) TableName() string {
	return "sgj_xt.his_order"
}
