package model import ( "fmt" pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow" ) const ( DefaultChangeFilter = -10000 DefaultRuminaFilter = -10000 DefaultChewFilter = -10000 DefaultFilterCorrect = 100 DefaultWeeklyActive = 105 ) type NeckActiveHabit struct { Id int64 `json:"id"` CowId int64 `json:"cowId"` NeckRingNumber string `json:"neckRingNumber"` ActiveTime string `json:"activeTime"` Frameid int32 `json:"frameid"` HeatDate string `json:"heatDate"` Rumina int32 `json:"rumina"` Intake int32 `json:"intake"` Inactive int32 `json:"inactive"` Gasp int32 `json:"gasp"` Other int32 `json:"other"` High int32 `json:"high"` Active int32 `json:"active"` FilterHigh int32 `json:"filterHigh"` FilterRumina int32 `json:"filterRumina"` FilterChew int32 `json:"filterChew"` WeekHigh int32 `json:"weekHigh"` AvgHighHabit int32 `json:"avgHighHabit"` AvgRuminaHabit int32 `json:"avgRuminaHabit"` AvgIntakeHabit int32 `json:"avgIntakeHabit"` AvgChewHabit int32 `json:"avgChewHabit"` AvgInactiveHabit int32 `json:"avgInactiveHabit"` AvgOtherHabit int32 `json:"avgOtherHabit"` ChangeHigh int32 `json:"changeHigh"` ChangeRumina int32 `json:"changeRumina"` ChangeChew int32 `json:"changeChew"` ChangeAdjust int32 `json:"changeAdjust"` ChangeFilter int32 `json:"changeFilter"` RuminaFilter int32 `json:"ruminaFilter"` ChewFilter int32 `json:"chewFilter"` FilterCorrect int32 `json:"filterCorrect"` SumRumina int32 `json:"sumRumina"` SumIntake int32 `json:"sumIntake"` SumInactive int32 `json:"sumInactive"` SumAct int32 `json:"sumAct"` SumMinHigh int32 `json:"sumMinHigh"` SumMaxHigh int32 `json:"sumMaxHigh"` SumMinChew int32 `json:"SumMinChew"` SumRuminaBeforeThreeDay int32 `json:"sumRuminaBeforeThreeDay"` SumIntakeBeforeThreeDay int32 `json:"sumIntakeBeforeThreeDay"` Score int32 `json:"score"` IsMaxTime pasturePb.IsShow_Kind `json:"isMaxTime"` IsShow pasturePb.IsShow_Kind `json:"isShow"` ReceiveNumber int32 `json:"receiveNumber"` RecordCount int32 `json:"recordCount"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } func (n *NeckActiveHabit) TableName() string { return "neck_active_habit" } func NewNeckActiveHabit(frameId int32, heatDate, neckRingNumber string, data *NeckRingOriginalMerge) *NeckActiveHabit { return &NeckActiveHabit{ Frameid: frameId, HeatDate: heatDate, NeckRingNumber: neckRingNumber, Active: data.Active, Gasp: data.Gasp, High: data.High, Inactive: data.Inactive, Intake: data.Intake, Other: data.Other, Rumina: data.Rumina, WeekHigh: DefaultWeeklyActive, IsShow: pasturePb.IsShow_No, IsMaxTime: pasturePb.IsShow_No, ChangeFilter: DefaultChangeFilter, FilterCorrect: DefaultFilterCorrect, RuminaFilter: DefaultRuminaFilter, ChewFilter: DefaultChewFilter, ActiveTime: fmt.Sprintf("%s %02d:00:00", heatDate, frameId), } } func (n *NeckActiveHabit) MergeData(data *NeckActiveHabit) { n.Rumina += data.Rumina n.Inactive += data.Inactive n.Active += data.Active n.Intake += data.Intake n.Other += data.Other n.Gasp += data.Gasp n.High += data.High }