12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- package model
- import (
- "time"
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- )
- const (
- MinScore = 1
- MaxScore = 84
- )
- type NeckRingHealth struct {
- Id int64 `json:"id"`
- PastureId int64 `json:"pastureId"`
- NeckRingNumber string `json:"neckRingNumber"`
- EarNumber string `json:"earNumber"`
- 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"`
- FilterMilk int32 `json:"filterMilk"`
- IsTransferGroup pasturePb.IsShow_Kind `json:"isTransferGroup"`
- IsDryMilk pasturePb.IsShow_Kind `json:"isDryMilk"`
- IsImmunization pasturePb.IsShow_Kind `json:"isImmunization"`
- IsWorse pasturePb.IsShow_Kind `json:"isWorse"`
- CheckResult pasturePb.CheckResult_Kind `json:"checkResult"`
- CheckUserId int64 `json:"checkUserId"`
- CheckUserName string `json:"checkUserName"`
- CheckAt int64 `json:"checkAt"`
- IsShow pasturePb.IsShow_Kind `json:"isShow"`
- CreatedAt int64 `json:"createdAt"`
- UpdatedAt int64 `json:"updatedAt"`
- }
- func (n *NeckRingHealth) TableName() string {
- return "neck_ring_health"
- }
- func (n *NeckRingHealth) EventDiseaseUpdate(operationUser *SystemUser) {
- n.IsShow = pasturePb.IsShow_No
- n.CheckResult = pasturePb.CheckResult_Correct
- n.CheckUserId = operationUser.Id
- n.CheckUserName = operationUser.Name
- n.CreatedAt = time.Now().Local().Unix()
- }
- func NewNeckRingHealth(habit *NeckActiveHabit, sumChew, chew3dago int32) *NeckRingHealth {
- return &NeckRingHealth{
- PastureId: habit.PastureId,
- NeckRingNumber: habit.NeckRingNumber,
- EarNumber: habit.EarNumber,
- 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,
- FilterMilk: 0,
- IsWorse: 0,
- IsTransferGroup: pasturePb.IsShow_No,
- IsDryMilk: pasturePb.IsShow_No,
- IsImmunization: pasturePb.IsShow_No,
- CheckResult: pasturePb.CheckResult_Pending,
- IsShow: pasturePb.IsShow_Ok,
- }
- }
- func getAbleInt(value int32) int32 {
- if value > -99 {
- return value
- }
- return 0
- }
|