|
@@ -10,6 +10,39 @@ import (
|
|
|
pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
|
|
|
)
|
|
|
|
|
|
+var DrugCategoryMap = map[pasturePb.DrugCategory_Kind]string{
|
|
|
+ pasturePb.DrugCategory_Antibiotics: "抗生素类",
|
|
|
+ pasturePb.DrugCategory_Antivirals: "抗病毒类",
|
|
|
+ pasturePb.DrugCategory_Antifungals: "抗真菌类",
|
|
|
+ pasturePb.DrugCategory_Antiparasitics: "抗寄生虫类",
|
|
|
+ pasturePb.DrugCategory_Analgesics: "镇痛类",
|
|
|
+ pasturePb.DrugCategory_Antipyretic: "退烧类",
|
|
|
+ pasturePb.DrugCategory_Vitamin: "维生素类",
|
|
|
+ pasturePb.DrugCategory_Brine: "盐水",
|
|
|
+ pasturePb.DrugCategory_Glucose: "葡萄糖",
|
|
|
+ pasturePb.DrugCategory_Hormone: "激素类",
|
|
|
+ pasturePb.DrugCategory_Anti_Stress: "抗应激类",
|
|
|
+ pasturePb.DrugCategory_Disinfect: "消毒类",
|
|
|
+ pasturePb.DrugCategory_Chinese_Herbal: "中药合剂",
|
|
|
+ pasturePb.DrugCategory_Tocolytic: "保胎类",
|
|
|
+}
|
|
|
+var UnitMap = map[pasturePb.Unit_Kind]string{
|
|
|
+ pasturePb.Unit_Pieces: "个",
|
|
|
+ pasturePb.Unit_Package: "包/袋",
|
|
|
+ pasturePb.Unit_Bottle: "瓶",
|
|
|
+ pasturePb.Unit_Box: "盒",
|
|
|
+ pasturePb.Unit_Boxful: "箱",
|
|
|
+ pasturePb.Unit_Branch: "支",
|
|
|
+ pasturePb.Unit_Barrel: "桶",
|
|
|
+ pasturePb.Unit_Pot: "罐",
|
|
|
+}
|
|
|
+var DrugUsageMap = map[pasturePb.DrugUsage_Kind]string{
|
|
|
+ pasturePb.DrugUsage_Oral_Medications: "口服",
|
|
|
+ pasturePb.DrugUsage_Injectable_Medications: "肌注",
|
|
|
+ pasturePb.DrugUsage_Topical_Medications: "外用",
|
|
|
+ pasturePb.DrugUsage_Drink_Medications: "饮水",
|
|
|
+}
|
|
|
+
|
|
|
func (s *StoreEntry) BarnTypeEnumList() []*pasturePb.ConfigOptionsList {
|
|
|
barnTypeList := make([]*pasturePb.ConfigOptionsList, 0)
|
|
|
barnTypeList = append(barnTypeList, &pasturePb.ConfigOptionsList{
|
|
@@ -84,7 +117,6 @@ func (s *StoreEntry) BreedStatusEnumList() []*pasturePb.ConfigOptionsList {
|
|
|
})
|
|
|
return breedStatusList
|
|
|
}
|
|
|
-
|
|
|
func (s *StoreEntry) CowKindEnumList() []*pasturePb.ConfigOptionsList {
|
|
|
cowKindList := make([]*pasturePb.ConfigOptionsList, 0)
|
|
|
cowKindList = append(cowKindList, &pasturePb.ConfigOptionsList{
|
|
@@ -269,7 +301,7 @@ func (s *StoreEntry) CalvingLevelEnumList() []*pasturePb.ConfigOptionsList {
|
|
|
return configOptions
|
|
|
}
|
|
|
|
|
|
-func (s *StoreEntry) DystociaReason() []*pasturePb.ConfigOptionsList {
|
|
|
+func (s *StoreEntry) DystociaReasonEnumList() []*pasturePb.ConfigOptionsList {
|
|
|
configOptions := make([]*pasturePb.ConfigOptionsList, 0)
|
|
|
configOptions = append(configOptions,
|
|
|
&pasturePb.ConfigOptionsList{
|
|
@@ -296,7 +328,7 @@ func (s *StoreEntry) DystociaReason() []*pasturePb.ConfigOptionsList {
|
|
|
return configOptions
|
|
|
}
|
|
|
|
|
|
-func (s *StoreEntry) PregnantCheckResult() []*pasturePb.ConfigOptionsList {
|
|
|
+func (s *StoreEntry) PregnantCheckResultEnumList() []*pasturePb.ConfigOptionsList {
|
|
|
configOptions := make([]*pasturePb.ConfigOptionsList, 0)
|
|
|
configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
|
|
|
Value: int32(pasturePb.PregnantCheckResult_InCheck_UnPregnant),
|
|
@@ -318,7 +350,7 @@ func (s *StoreEntry) PregnantCheckResult() []*pasturePb.ConfigOptionsList {
|
|
|
return configOptions
|
|
|
}
|
|
|
|
|
|
-func (s *StoreEntry) PregnantCheckMethod() []*pasturePb.ConfigOptionsList {
|
|
|
+func (s *StoreEntry) PregnantCheckMethodEnumList() []*pasturePb.ConfigOptionsList {
|
|
|
configOptions := make([]*pasturePb.ConfigOptionsList, 0)
|
|
|
configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
|
|
|
Value: int32(pasturePb.PregnantCheckMethod_B_Ultrasound),
|
|
@@ -335,6 +367,142 @@ func (s *StoreEntry) PregnantCheckMethod() []*pasturePb.ConfigOptionsList {
|
|
|
})
|
|
|
return configOptions
|
|
|
}
|
|
|
+
|
|
|
+func (s *StoreEntry) DrugCategoryEnumList() []*pasturePb.ConfigOptionsList {
|
|
|
+ configOptions := make([]*pasturePb.ConfigOptionsList, 0)
|
|
|
+ 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,
|
|
|
+ })
|
|
|
+ return configOptions
|
|
|
+}
|
|
|
+
|
|
|
+func (s *StoreEntry) DrugUsageEnumList() []*pasturePb.ConfigOptionsList {
|
|
|
+ configOptions := make([]*pasturePb.ConfigOptionsList, 0)
|
|
|
+ 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_Drink_Medications),
|
|
|
+ Label: "饮水",
|
|
|
+ Disabled: true,
|
|
|
+ })
|
|
|
+ return configOptions
|
|
|
+}
|
|
|
+
|
|
|
+func (s *StoreEntry) UnitEnumList() []*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,
|
|
|
+ })
|
|
|
+ return configOptions
|
|
|
+}
|
|
|
+
|
|
|
+func (s *StoreEntry) DrugUsageMaps(key pasturePb.DrugUsage_Kind) string {
|
|
|
+ res := ""
|
|
|
+ for _, v := range s.DrugUsageEnumList() {
|
|
|
+ if v.Value != int32(key) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ res = v.Label
|
|
|
+ }
|
|
|
+ return res
|
|
|
+}
|
|
|
+
|
|
|
func (s *StoreEntry) BarnTypeOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
|
|
|
return &pasturePb.ConfigOptionsListResponse{
|
|
|
Code: http.StatusOK,
|
|
@@ -412,7 +580,7 @@ func (s *StoreEntry) SystemUserOptions(ctx context.Context, depId int) (*pasture
|
|
|
Where("is_delete = ?", pasturePb.IsShow_Ok).
|
|
|
Where("is_show =? ", pasturePb.IsShow_Ok)
|
|
|
if depId != -1 && depId > 0 {
|
|
|
- pref = pref.Where("dep_id = ?", depId)
|
|
|
+ pref = pref.Where("dept_id = ?", depId)
|
|
|
}
|
|
|
if err := pref.Find(&systemUserList).Error; err != nil {
|
|
|
return nil, xxerr.WithStack(err)
|
|
@@ -432,7 +600,17 @@ func (s *StoreEntry) SystemBaseConfigOptions(ctx context.Context, optionsName st
|
|
|
case "calvingLevel":
|
|
|
configOptions = s.CalvingLevelEnumList()
|
|
|
case "dystociaReason":
|
|
|
- configOptions = s.DystociaReason()
|
|
|
+ configOptions = s.DystociaReasonEnumList()
|
|
|
+ case "drugCategory":
|
|
|
+ configOptions = s.DrugCategoryEnumList()
|
|
|
+ case "drugUsage":
|
|
|
+ configOptions = s.DrugUsageEnumList()
|
|
|
+ case "unit":
|
|
|
+ configOptions = s.UnitEnumList()
|
|
|
+ case "pregnantCheckResult":
|
|
|
+ configOptions = s.PregnantCheckResultEnumList()
|
|
|
+ case "pregnantCheckMethod":
|
|
|
+ configOptions = s.PregnantCheckMethodEnumList()
|
|
|
}
|
|
|
return &pasturePb.ConfigOptionsListResponse{
|
|
|
Code: http.StatusOK,
|