package cygx

import (
	"github.com/beego/beego/v2/client/orm"
	"time"
)

type CygxRaiServeWeekBill struct {
	ServeWeekBillId int       `orm:"column(serve_week_bill_id);pk" description:"服务周账单ID"`
	CompanyId       int       `comment:"公司ID"`
	CompanyName     string    `comment:"公司名称"`
	UserTotal       int       `comment:"用户数量"`
	WeekServeCount  float64   `comment:"周度服务量总计"`
	CoverageRate    float64   `comment:"覆盖率"`
	WeekStartDate   string    `comment:"周一开始日期"`
	WeekEndDate     string    `comment:"周日结束日期"`
	CreateTime      time.Time `comment:"创建时间"`
	ModifyTime      time.Time `comment:"修改时间"`
}

// 最近四周覆盖率列表
func GetCygxRaiServeBillListWeek4(companyId int) (items []*CygxRaiServeWeekBill, err error) {
	o := orm.NewOrmUsingDB("hz_cygx")
	sql := `SELECT  * FROM cygx_rai_serve_week_bill WHERE company_id = ? ORDER BY week_start_date DESC  LIMIT  4  `
	_, err = o.Raw(sql, companyId).QueryRows(&items)
	return
}
