123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- package backend
- import (
- "context"
- "kpt-pasture/model"
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- )
- func (s *StoreEntry) DepartureTypeEnumList(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.DepartureType_Death),
- Label: "死亡",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.DepartureType_Out),
- Label: "淘汰",
- Disabled: true,
- })
- return configOptions
- }
- func (s *StoreEntry) OutReasonEnumList(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.OutReason_Long_Term_infertility),
- Label: "久配不孕",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Multiple_Miscarriages),
- Label: "多次流产",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Long_Treatment_Without_Recovery),
- Label: "久治不愈",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Postpartum_Paralysis),
- Label: "产后瘫痪",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Mastitis),
- Label: "乳房炎",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Hoof_Disease),
- Label: "蹄病",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Congenital_Malformation),
- Label: "先天畸形",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Dysplasia),
- Label: "发育不良",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Hernia),
- Label: "疝气",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Excessive_Age),
- Label: "月龄过大",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Excessive_Weight),
- Label: "体重过肥",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Other_Disease),
- Label: "其他疾病",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Weak_Child),
- Label: "弱仔",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Obsessive_Bull),
- Label: "恶癖牛",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Splitting),
- Label: "滑倒卧地不起",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.OutReason_Other),
- Label: "其他",
- Disabled: true,
- })
- return configOptions
- }
- func (s *StoreEntry) DeadReasonEnumList(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.DeadReason_Digestive_System_Diseases),
- Label: "消化性疾病",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.DeadReason_Respiratory_System_Diseases),
- Label: "呼吸性疾病",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.DeadReason_Reproductive_System_Diseases),
- Label: "繁殖性疾病",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.DeadReason_Metabolic_System_Diseases),
- Label: "代谢性疾病",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.DeadReason_Infectious_Diseases),
- Label: "传染性疾病",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.DeadReason_Difficult_Birth),
- Label: "难产",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.DeadReason_Accident_Dead),
- Label: "意外死亡",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.DeadReason_Other),
- Label: "其他",
- Disabled: true,
- })
- return configOptions
- }
- func (s *StoreEntry) MatingResultEnumList(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.MatingResult_Unknown),
- Label: "未知",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.MatingResult_ReMatch),
- Label: "复配",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.MatingResult_Pregnant),
- Label: "怀孕",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.MatingResult_Empty),
- Label: "空怀",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.MatingResult_Abort),
- Label: "流产",
- Disabled: true,
- })
- return configOptions
- }
- func (s *StoreEntry) EventCategoryEnumList(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.EventCategory_Base),
- Label: "基础事件",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.EventCategory_Breed),
- Label: "繁殖事件",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.EventCategory_Health),
- Label: "兽医事件",
- Disabled: true,
- }, &pasturePb.ConfigOptionsList{
- Value: int32(pasturePb.EventCategory_Other),
- Label: "其他事件",
- Disabled: true,
- })
- return configOptions
- }
- func (s *StoreEntry) IndicatorsDetailsList(isAll string) []*pasturePb.ConfigOptionsList {
- configOptions := make([]*pasturePb.ConfigOptionsList, 0)
- if isAll == model.IsAllYes {
- configOptions = append(configOptions,
- &pasturePb.ConfigOptionsList{
- Value: int32(0),
- Label: "全部",
- Disabled: true,
- })
- }
- indicatorsDetailsList, _ := s.FindIndicatorsDetailsList(context.Background())
- if len(indicatorsDetailsList) <= 0 {
- return configOptions
- }
- for _, v := range indicatorsDetailsList {
- configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
- Label: v.Name,
- Disabled: true,
- Props: v.Kind,
- })
- }
- return configOptions
- }
|