package backend import ( "fmt" "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) PregnantCheckMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList { configOptions := make([]*pasturePb.ConfigOptionsList, 0) if isAll == model.IsAllYes { configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.PregnantCheckMethod_Invalid), }) } configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.PregnantCheckMethod_B_Ultrasound), Label: "B超", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.PregnantCheckMethod_Blood_Testing), Label: "血检", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.PregnantCheckMethod_Manual_Inspection), Label: "人工检查", Disabled: true, }) return configOptions } func (s *StoreEntry) DrugCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList { configOptions := make([]*pasturePb.ConfigOptionsList, 0) if isAll == model.IsAllYes { configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Invalid), Label: "全部", Disabled: true, }) } configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Antibiotics), Label: "抗生素类", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Antivirals), Label: "抗病毒类", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Antifungals), Label: "抗真菌类", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Antiparasitics), Label: "驱虫类", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Analgesics), Label: "镇痛类", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Antipyretic), Label: "退烧类", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Vitamin), Label: "维生素类", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Brine), Label: "盐水", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Glucose), Label: "葡萄糖", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Hormone), Label: "激素类", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Anti_Stress), Label: "抗应激类", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Disinfect), Label: "消毒类", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Chinese_Herbal), Label: "中药合剂", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Tocolytic), Label: "保胎类", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugCategory_Immunity), Label: "疫苗类", Disabled: true, }) return configOptions } func (s *StoreEntry) DrugUsageEnumList(isAll string) []*pasturePb.ConfigOptionsList { configOptions := make([]*pasturePb.ConfigOptionsList, 0) if isAll == model.IsAllYes { configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugUsage_Invalid), Label: "全部", Disabled: true, }) } configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugUsage_Oral_Medications), Label: "口服", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugUsage_Injectable_Medications), Label: "肌注", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugUsage_Topical_Medications), Label: "外用", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugUsage_Inhalation_Medications), Label: "吸入", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.DrugUsage_Drink_Medications), Label: "饮水", Disabled: true, }) return configOptions } func (s *StoreEntry) UnitEnumList(isAll string) []*pasturePb.ConfigOptionsList { configOptions := make([]*pasturePb.ConfigOptionsList, 0) configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Unit_Pieces), Label: "个", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Unit_Package), Label: "包/袋", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Unit_Bottle), Label: "瓶", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Unit_Box), Label: "盒", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Unit_Boxful), Label: "箱", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Unit_Branch), Label: "支", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Unit_Barrel), Label: "桶", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Unit_Pot), Label: "罐", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Unit_ML), Label: "毫升", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Unit_L), Label: "升", Disabled: true, }) return configOptions } func (s *StoreEntry) ExposeEstrusTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList { configOptions := make([]*pasturePb.ConfigOptionsList, 0) if isAll == model.IsAllYes { configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.ExposeEstrusType_Invalid), Label: "全部", Disabled: true, }) } configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.ExposeEstrusType_Neck_Ring), Label: "脖环揭发", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.ExposeEstrusType_Foot_Ring), Label: "脚环揭发", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.ExposeEstrusType_Natural_Estrus), Label: "自然发情", Disabled: true, }) return configOptions } func (s *StoreEntry) FrozenSemenTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList { configOptions := make([]*pasturePb.ConfigOptionsList, 0) if isAll == model.IsAllYes { configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.FrozenSemenType_Invalid), Label: "全部", Disabled: true, }) } configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.FrozenSemenType_Ordinary), Label: "常规冻精", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.FrozenSemenType_Gender_Control), Label: "性控冻精", Disabled: true, }) return configOptions } func (s *StoreEntry) BullNumberEnumList(isAll string, pastureId int64) []*pasturePb.BullOptionsList { frozenSemenList := make([]*model.FrozenSemen, 0) bullNumberList := make([]*pasturePb.BullOptionsList, 0) if err := s.DB.Model(new(model.FrozenSemen)). Where("pasture_id = ?", pastureId). Where("quantity > 0"). Group("bull_id"). Find(&frozenSemenList).Error; err != nil { zaplog.Error("BullNumberEnumList", zap.Any("Find", err)) } for _, v := range frozenSemenList { bullNumberList = append(bullNumberList, &pasturePb.BullOptionsList{ Value: v.BullId, Label: v.BullId, Disabled: true, }) } return bullNumberList } func (s *StoreEntry) WeekEnumList(isAll string) []*pasturePb.ConfigOptionsList { configOptions := make([]*pasturePb.ConfigOptionsList, 0) configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Week_Monday), Label: "周一", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Week_Tuesday), Label: "周二", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Week_Wednesday), Label: "周三", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Week_Thursday), Label: "周四", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Week_Friday), Label: "周五", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Week_Saturday), Label: "周六", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.Week_Sunday), Label: "周日", Disabled: true, }) return configOptions } func (s *StoreEntry) MonthEnumList(isAll string) []*pasturePb.ConfigOptionsList { configOptions := make([]*pasturePb.ConfigOptionsList, 0) for v := 1; v <= 31; v++ { configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(v), Label: fmt.Sprintf("%d号", v), Disabled: true, }) } return configOptions } func (s *StoreEntry) WorkOrderFrequencyEnumList(isAll string) []*pasturePb.ConfigOptionsList { configOptions := make([]*pasturePb.ConfigOptionsList, 0) configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.WorkOrderFrequency_None), Label: "一次性", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.WorkOrderFrequency_Daily), Label: "每天", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.WorkOrderFrequency_Weekly), Label: "每周", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.WorkOrderFrequency_Monthly), Label: "每月", Disabled: true, }) return configOptions } func (s *StoreEntry) OutTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList { configOptions := make([]*pasturePb.ConfigOptionsList, 0) if isAll == model.IsAllYes { configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.OutType_Invalid), Label: "全部", Disabled: true, }) } configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.OutType_Drugs), Label: "药品", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.OutType_Medical_Equipment), Label: "医疗器械", Disabled: true, }) return configOptions } func (s *StoreEntry) AuditStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList { configOptions := make([]*pasturePb.ConfigOptionsList, 0) if isAll == model.IsAllYes { configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.AuditStatus_Invalid), Label: "全部", Disabled: true, }) } configOptions = append(configOptions, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.AuditStatus_Pending), Label: "待审核", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.AuditStatus_Pass), Label: "已通过", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.AuditStatus_Reject), Label: "已拒绝", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.AuditStatus_Cancel), Label: "已取消", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.AuditStatus_Delete), Label: "已删除", Disabled: true, }) return configOptions } func (s *StoreEntry) PregnantCheckNameEnumList(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: "初检", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(2), Label: "复检", Disabled: true, }) return configOptions } func (s *StoreEntry) UnMatingReasonsEnumList(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(pasturePb.UnMatingReasons_Irregular_Estrus), Label: "不规则发情", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.UnMatingReasons_No_Mating), Label: "禁配", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.UnMatingReasons_Disease), Label: "疾病", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.UnMatingReasons_Out), Label: "淘汰", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.UnMatingReasons_Other), Label: "其他", Disabled: true, }) return configOptions } func (s *StoreEntry) EventTypeEnumList(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(pasturePb.EventType_Enter), Label: "入场", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Transfer_Ben), Label: "转栏", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Body_Score), Label: "体况评分", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Pregnancy_Check), Label: "孕检", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Estrus), Label: "发情", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Calving), Label: "产犊", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Seme_Time), Label: "同期", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Mating), Label: "配种", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Birth), Label: "出生", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Death), Label: "死亡", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Transfer_Out), Label: "转出", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Transfer_In), Label: "转入", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Out), Label: "淘汰", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Immunication), Label: "免疫", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Weaning), Label: "断奶", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Sale), Label: "出售", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Abort), Label: "流产", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Weight), Label: "称重", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Castrated), Label: "去势", Disabled: true, }, &pasturePb.ConfigOptionsList{ Value: int32(pasturePb.EventType_Insect_Repellent), Label: "驱虫", Disabled: true, }) return configOptions }