123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617 |
- 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) []*pasturePb.BullOptionsList {
- frozenSemenList := make([]*model.FrozenSemen, 0)
- bullNumberList := make([]*pasturePb.BullOptionsList, 0)
- if err := s.DB.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) 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
- }
- 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
- }
|