| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461 | 
							- package backend
 
- import (
 
- 	"kpt-pasture/model"
 
- 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 
- 	"gitee.com/xuyiping_admin/pkg/logger/zaplog"
 
- 	"go.uber.org/zap"
 
- )
 
- func (s *StoreEntry) LactEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	if isAll == model.IsAllYes {
 
- 		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 			Value:    int32(0),
 
- 			Label:    "全部",
 
- 			Disabled: true,
 
- 		})
 
- 	}
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(1),
 
- 		Label:    "1",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(2),
 
- 		Label:    "2",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(3),
 
- 		Label:    "3",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(4),
 
- 		Label:    ">3",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) DiseaseAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	if isAll == model.IsAllYes {
 
- 		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 			Value:    int32(pasturePb.DiseaseAnalysisMethod_Invalid),
 
- 			Label:    "全部",
 
- 			Disabled: true,
 
- 		})
 
- 	}
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.DiseaseAnalysisMethod_Months),
 
- 		Label:    "按月份",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.DiseaseAnalysisMethod_Disease_Category),
 
- 		Label:    "疾病分类",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.DiseaseAnalysisMethod_Disease),
 
- 		Label:    "疾病名称",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.DiseaseAnalysisMethod_Operator),
 
- 		Label:    "兽医",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.DiseaseAnalysisMethod_Prescription),
 
- 		Label:    "处方",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) diseaseTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configDiseaseTypeList := make([]*model.ConfigDiseaseType, 0)
 
- 	configOptionsList := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	if err := s.DB.Where("is_show = ?", pasturePb.IsShow_Ok).Find(&configDiseaseTypeList).Error; err != nil {
 
- 		zaplog.Error("diseaseTypeEnumList", zap.Any("Find", err))
 
- 	}
 
- 	for _, v := range configDiseaseTypeList {
 
- 		configOptionsList = append(configOptionsList, &pasturePb.ConfigOptionsList{
 
- 			Value:    int32(v.Id),
 
- 			Label:    v.Name,
 
- 			Disabled: true,
 
- 		})
 
- 	}
 
- 	return configOptionsList
 
- }
 
- func (s *StoreEntry) SingleFactorAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Cycle),
 
- 		Label:    "按周期分析",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Months),
 
- 		Label:    "按月份分析",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Mating_Times),
 
- 		Label:    "按配种次数分析",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Method),
 
- 		Label:    "按配种方式分析",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Company),
 
- 		Label:    "按育种公司分析",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Operation),
 
- 		Label:    "按兽医人员分析",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Mating_Interval),
 
- 		Label:    "按配种间隔分析",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Bull),
 
- 		Label:    "按公牛号分析",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Cycle),
 
- 		Label:    "按配种周期分析",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Week),
 
- 		Label:    "按星期分析",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SingleFactorAnalysisMethod_Lact),
 
- 		Label:    "按胎次分析",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) LactIntervalSymbolEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CompareSymbol_Less_Than),
 
- 		Label:    "<",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CompareSymbol_Less_Than_Or_Equal_To),
 
- 		Label:    "<=",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CompareSymbol_Greater_Than),
 
- 		Label:    ">",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CompareSymbol_Greater_Than_Or_Equal_To),
 
- 		Label:    ">=",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CompareSymbol_Equal_To),
 
- 		Label:    "=",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CompareSymbol_Not_Equal_To),
 
- 		Label:    "!=",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CompareSymbol_Between),
 
- 		Label:    "区间",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) MultiFactorAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Months),
 
- 		Label:    "月份",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Week),
 
- 		Label:    "周",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Operation),
 
- 		Label:    "配种员",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Bull),
 
- 		Label:    "公牛",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Lact),
 
- 		Label:    "胎次",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Mating_Times),
 
- 		Label:    "配次",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Breeding_Method),
 
- 		Label:    "配种方式",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) SaleCowAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SaleCowAnalysisMethod_Months),
 
- 		Label:    "月份",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.SaleCowAnalysisMethod_Dealer),
 
- 		Label:    "经销商",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) NeckRingStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	if isAll == model.IsAllYes {
 
- 		configOptions = append(configOptions,
 
- 			&pasturePb.ConfigOptionsList{
 
- 				Value:    int32(pasturePb.NeckRingStatus_Invalid),
 
- 				Label:    "全部",
 
- 				Disabled: true,
 
- 			})
 
- 	}
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.NeckRingStatus_Bind),
 
- 		Label:    "绑定",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.NeckRingStatus_Normal),
 
- 		Label:    "正常",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.NeckRingStatus_Offline),
 
- 		Label:    "在线",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.NeckRingStatus_Error),
 
- 		Label:    "异常",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) WorkOrderSubUnitEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.WorkOrderSubscribeUnit_Person),
 
- 		Label:    "个人",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.WorkOrderSubscribeUnit_dept),
 
- 		Label:    "部门",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) WorkOrderPriorityEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.Priority_Low),
 
- 		Label:    "低",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.Priority_Middle),
 
- 		Label:    "一般",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.Priority_High),
 
- 		Label:    "紧急",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) WorkOrderCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.WorkOrderCategory_Health),
 
- 		Label:    "保健",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.WorkOrderCategory_Breed),
 
- 		Label:    "繁殖",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.WorkOrderCategory_Nutrition),
 
- 		Label:    "营养",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.WorkOrderCategory_Ordinary),
 
- 		Label:    "日常",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.WorkOrderCategory_Other),
 
- 		Label:    "其他",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func CalendarTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	if isAll == model.IsAllYes {
 
- 		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 			Value:    int32(pasturePb.SameTimeStatus_Invalid),
 
- 			Label:    "全部",
 
- 			Disabled: true,
 
- 		})
 
- 	}
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CalendarType_Immunisation),
 
- 		Label:    "免疫",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CalendarType_PG),
 
- 		Label:    "同期PG",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CalendarType_RnGH),
 
- 		Label:    "同期RnGH",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CalendarType_Pregnancy_Check),
 
- 		Label:    "孕检",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CalendarType_WorkOrder),
 
- 		Label:    "工单",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CalendarType_Weaning),
 
- 		Label:    "断奶",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CalendarType_Treatment),
 
- 		Label:    "治疗",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CalendarType_Mating),
 
- 		Label:    "配种",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) AbortionReasonsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	if isAll == model.IsAllYes {
 
- 		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 			Value:    int32(pasturePb.AbortionReasons_Invalid),
 
- 			Label:    "全部",
 
- 			Disabled: true,
 
- 		})
 
- 	}
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.AbortionReasons_Mechanical_Abortion),
 
- 		Label:    "机械性流产",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.AbortionReasons_Malnutrition_Abortion),
 
- 		Label:    "营养不良性流产",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.AbortionReasons_Mycotoxin_Abortion),
 
- 		Label:    "霉菌毒素流产",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.AbortionReasons_Habitual_Abortion),
 
- 		Label:    "习惯性流产",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.AbortionReasons_Brucellosis_Abortion),
 
- 		Label:    "布病流产",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.AbortionReasons_Inflammatory_Abortion),
 
- 		Label:    "产道炎症性流产",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.AbortionReasons_Heat_Stress_Abortion),
 
- 		Label:    "热应激流产",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.AbortionReasons_Infectious_Abortion),
 
- 		Label:    "传染病性流产",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.AbortionReasons_Other),
 
- 		Label:    "其他",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) HealthStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	if isAll == model.IsAllYes {
 
- 		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 			Value:    int32(pasturePb.HealthStatus_Invalid),
 
- 			Label:    "全部",
 
- 			Disabled: true,
 
- 		})
 
- 	}
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.HealthStatus_Health),
 
- 		Label:    "健康",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.HealthStatus_Disease),
 
- 		Label:    "发病",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.HealthStatus_Treatment),
 
- 		Label:    "治疗",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.HealthStatus_Curable),
 
- 		Label:    "治愈",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.HealthStatus_Out),
 
- 		Label:    "淘汰",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.HealthStatus_Dead),
 
- 		Label:    "死亡",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
- func (s *StoreEntry) CalvingAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 
- 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 
- 	if isAll == model.IsAllYes {
 
- 		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 			Value:    int32(pasturePb.CalvingAnalysisMethod_Invalid),
 
- 			Label:    "全部",
 
- 			Disabled: true,
 
- 		})
 
- 	}
 
- 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CalvingAnalysisMethod_Months),
 
- 		Label:    "按月份统计",
 
- 		Disabled: true,
 
- 	}, &pasturePb.ConfigOptionsList{
 
- 		Value:    int32(pasturePb.CalvingAnalysisMethod_CowKind),
 
- 		Label:    "按照品种统计",
 
- 		Disabled: true,
 
- 	})
 
- 	return configOptions
 
- }
 
 
  |