package model import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow" type NeckRingHealthWarning struct { Id int64 `json:"id"` PastureId int64 `json:"pastureId"` NeckRingNumber string `json:"neckRingNumber"` CowId int64 `json:"cowId"` Lact int32 `json:"lact"` CalvingAge int32 `json:"calvingAge"` HeatDate string `json:"heatDate"` Frameid int32 `json:"frameid"` ActiveTime string `json:"activeTime"` ChangeFilter int32 `json:"changeFilter"` ChewFilter int32 `json:"chewFilter"` SumChew int32 `json:"sumChew"` SumInactive int32 `json:"sumInactive"` BeforeThreeSumChew int32 `json:"beforeThreeSumChew"` MinHigh int32 `json:"minHigh"` MaxHigh int32 `json:"maxHigh"` MinChew int32 `json:"minChew"` MinInactive int32 `json:"minInactive"` Score int32 `json:"score"` IsWorse pasturePb.IsShow_Kind `json:"isWorse"` CheckResult pasturePb.CheckResult_Kind `json:"checkResult"` IsShow pasturePb.IsShow_Kind `json:"isShow"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } func (h *NeckRingHealthWarning) TableName() string { return "neck_ring_health_warning" } func NewNeckRingHealthWarning(habit *NeckActiveHabit, sumChew, chew3dago int32) *NeckRingHealthWarning { return &NeckRingHealthWarning{ PastureId: habit.PastureId, NeckRingNumber: habit.NeckRingNumber, CowId: habit.CowId, Lact: habit.Lact, CalvingAge: habit.CalvingAge, HeatDate: habit.HeatDate, Frameid: habit.Frameid, ActiveTime: habit.ActiveTime, ChangeFilter: getAbleInt(habit.ChangeFilter), ChewFilter: getAbleInt(habit.ChewFilter), SumChew: sumChew, SumInactive: habit.SumInactive, BeforeThreeSumChew: chew3dago, MinHigh: getAbleInt(habit.SumMinHigh), MaxHigh: getAbleInt(habit.SumMaxHigh), MinChew: getAbleInt(habit.SumMinChew), //MinInactive: getAbleInt(habit.SumInactive), Score: habit.Score, IsWorse: 0, CheckResult: pasturePb.CheckResult_Pending, IsShow: pasturePb.IsShow_No, } } func getAbleInt(value int32) int32 { if value > -99 { return value } return 0 }