Browse Source

event: 孕检

ping 10 months ago
parent
commit
04a2adc987

+ 1 - 1
go.mod

@@ -3,7 +3,7 @@ module kpt-pasture
 go 1.17
 
 require (
-	gitee.com/xuyiping_admin/go_proto v0.0.0-20240523051616-68e1b54a803c
+	gitee.com/xuyiping_admin/go_proto v0.0.0-20240523134220-ba93682bd389
 	gitee.com/xuyiping_admin/pkg v0.0.0-20231218082641-aac597b8a015
 	github.com/dgrijalva/jwt-go v3.2.0+incompatible
 	github.com/getsentry/sentry-go v0.23.0

+ 8 - 0
go.sum

@@ -60,6 +60,14 @@ gitee.com/xuyiping_admin/go_proto v0.0.0-20240523050521-fe80bc2e6c39 h1:mAKmKfbZ
 gitee.com/xuyiping_admin/go_proto v0.0.0-20240523050521-fe80bc2e6c39/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
 gitee.com/xuyiping_admin/go_proto v0.0.0-20240523051616-68e1b54a803c h1:lrHdU6l2vlM+bz5jzYCyNwToNqXtrt8SNWer8StkMvU=
 gitee.com/xuyiping_admin/go_proto v0.0.0-20240523051616-68e1b54a803c/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20240523053413-9f6ac982fbb5 h1:8KHkSHp/1gZ7hJ9Ezl4160O5Sw148LqPhWkPS3e4Rbk=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20240523053413-9f6ac982fbb5/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20240523054710-b247b2564d28 h1:wrt08X71nbLxo8M03qzNlJB3OPVGFijxDGxOjn3fQ+I=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20240523054710-b247b2564d28/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20240523080657-02e978da15c4 h1:aetycKzxhwCRqMUn7QtN1YvIM0H39SqdiJbo0ZX2p10=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20240523080657-02e978da15c4/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20240523134220-ba93682bd389 h1:43IRgppwRjNuTkYiRfDnKsdjBKzVXVngfhKT2F0xHEs=
+gitee.com/xuyiping_admin/go_proto v0.0.0-20240523134220-ba93682bd389/go.mod h1:BKrFW6YLDectlQcQk3FYKBeXvjEiodAKJ5rq7O/QiPE=
 gitee.com/xuyiping_admin/pkg v0.0.0-20231218082641-aac597b8a015 h1:dfb5dRd57L2HKjdwLT93UFmPYFPOmEl56gtZmqcNnaE=
 gitee.com/xuyiping_admin/pkg v0.0.0-20231218082641-aac597b8a015/go.mod h1:Fk4GYI/v0IK3XFrm1Gn+VkgCz5Y7mfswD5hsTJYOG6A=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=

+ 21 - 0
http/handler/event/event.go

@@ -231,3 +231,24 @@ func CalvingEventCreate(c *gin.Context) {
 		Data: &operationPb.Success{Success: true},
 	})
 }
+
+func PregnantCheckEventList(c *gin.Context) {
+	var req pasturePb.SearchEventRequest
+	if err := ginutil.BindProto(c, &req); err != nil {
+		apierr.AbortBadRequest(c, http.StatusBadRequest, err)
+		return
+	}
+
+	pagination := &pasturePb.PaginationModel{
+		Page:       int32(c.GetInt(middleware.Page)),
+		PageSize:   int32(c.GetInt(middleware.PageSize)),
+		PageOffset: int32(c.GetInt(middleware.PageOffset)),
+	}
+
+	res, err := middleware.Dependency(c).StoreEventHub.OpsService.PregnantCheckList(c, &req, pagination)
+	if err != nil {
+		apierr.ClassifiedAbort(c, err)
+		return
+	}
+	ginutil.JSONResp(c, res)
+}

+ 2 - 0
http/route/event_api.go

@@ -24,5 +24,7 @@ func EventAPI(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
 
 		eventRoute.POST("/calving/list", event.CalvingEventList)
 		eventRoute.POST("/calving/create", event.CalvingEventCreate)
+
+		eventRoute.POST("/pregnant/check/list", event.PregnantCheckEventList)
 	}
 }

+ 39 - 38
model/cow.go

@@ -8,35 +8,35 @@ import (
 )
 
 type Cow struct {
-	Id                  int64                  `json:"id"`
-	Sex                 pasturePb.Genders_Kind `json:"sex"`
-	NeckRingNumber      string                 `json:"neck_ring_number"`
-	EarNumber           string                 `json:"ear_number"`
-	EarOldNumber        string                 `json:"ear_old_number"`
-	PenId               int64                  `json:"pen_id"`
-	Lact                int32                  `json:"lact"`
-	TypeId              int32                  `json:"type_id"`
-	BreedStatusId       int32                  `json:"breed_status_id"`
-	KindId              int32                  `json:"kind_id"`
-	BirthWeight         int64                  `json:"birth_weight"`
-	CurrentWeight       int64                  `json:"current_weight"`
-	SourceId            int32                  `json:"source_id"`
-	FatherId            int64                  `json:"father_id"`
-	MotherId            int64                  `json:"mother_id"`
-	IsRemove            pasturePb.IsShow_Kind  `json:"is_remove"`
-	IsPregnant          pasturePb.IsShow_Kind  `json:"is_pregnant"`
-	Status              int32                  `json:"status"`
-	WeaningAt           int64                  `json:"weaning_at"`
-	BirthAt             int64                  `json:"birth_at"`
-	FirstMatingAt       int64                  `json:"first_mating_at"`
-	LastEstrusAt        int64                  `json:"last_estrus_at"`
-	LastCalvingAt       int64                  `json:"last_calving_at"`
-	LastMatingAt        int64                  `json:"last_mating_at"`
-	LastBullId          int64                  `json:"last_bull_id"`
-	LastPregnantCheckAt int64                  `json:"last_pregnant_check_at"`
-	LastDryMilkAt       int64                  `json:"last_dry_milk_at"`
-	CreatedAt           int64                  `json:"created_at"`
-	UpdatedAt           int64                  `json:"updated_at"`
+	Id                  int64                      `json:"id"`
+	Sex                 pasturePb.Genders_Kind     `json:"sex"`
+	NeckRingNumber      string                     `json:"neck_ring_number"`
+	EarNumber           string                     `json:"ear_number"`
+	EarOldNumber        string                     `json:"ear_old_number"`
+	PenId               int64                      `json:"pen_id"`
+	Lact                int32                      `json:"lact"`
+	TypeId              pasturePb.CowType_Kind     `json:"type_id"`
+	BreedStatusId       pasturePb.BreedStatus_Kind `json:"breed_status_id"`
+	KindId              pasturePb.CowKind_Kind     `json:"kind_id"`
+	BirthWeight         int64                      `json:"birth_weight"`
+	CurrentWeight       int64                      `json:"current_weight"`
+	SourceId            pasturePb.CowSource_Kind   `json:"source_id"`
+	FatherId            int64                      `json:"father_id"`
+	MotherId            int64                      `json:"mother_id"`
+	IsRemove            pasturePb.IsShow_Kind      `json:"is_remove"`
+	IsPregnant          pasturePb.IsShow_Kind      `json:"is_pregnant"`
+	Status              pasturePb.CowStatus_Kind   `json:"status"`
+	WeaningAt           int64                      `json:"weaning_at"`
+	BirthAt             int64                      `json:"birth_at"`
+	FirstMatingAt       int64                      `json:"first_mating_at"`
+	LastEstrusAt        int64                      `json:"last_estrus_at"`
+	LastCalvingAt       int64                      `json:"last_calving_at"`
+	LastMatingAt        int64                      `json:"last_mating_at"`
+	LastBullId          int64                      `json:"last_bull_id"`
+	LastPregnantCheckAt int64                      `json:"last_pregnant_check_at"`
+	LastDryMilkAt       int64                      `json:"last_dry_milk_at"`
+	CreatedAt           int64                      `json:"created_at"`
+	UpdatedAt           int64                      `json:"updated_at"`
 }
 
 func (c *Cow) TableName() string {
@@ -45,13 +45,14 @@ func (c *Cow) TableName() string {
 
 func NewCow(req *pasturePb.SearchEnterData) *Cow {
 	var (
-		status     int32                 = 1
-		isPregnant pasturePb.IsShow_Kind = pasturePb.IsShow_No
+		status     = pasturePb.CowStatus_Calving
+		isPregnant = pasturePb.IsShow_No
 	)
 
-	if req.BreedStatusId == 4 || req.BreedStatusId == 5 {
+	if req.BreedStatusId == pasturePb.BreedStatus_InCheck_Pregnant ||
+		req.BreedStatusId == pasturePb.BreedStatus_Recheck_Pregnant {
 		isPregnant = pasturePb.IsShow_Ok
-		status = 4
+		status = pasturePb.CowStatus_Pregnant
 	}
 
 	return &Cow{
@@ -81,16 +82,16 @@ func NewCalfCow(motherId, fatherId int64, calf *EventCalvingCalf) *Cow {
 		Sex:           calf.Sex,
 		EarNumber:     calf.EarNumber,
 		PenId:         int64(calf.PenId),
-		TypeId:        6, // 哺乳犊牛 todo 改成enum
-		BreedStatusId: 1, // 未配  todo 改成enum
-		KindId:        1, // 荷斯坦 todo 改成enum
+		TypeId:        pasturePb.CowType_Lactating_Calf, // 哺乳犊牛
+		BreedStatusId: pasturePb.BreedStatus_Unmarried,  // 未配
+		KindId:        pasturePb.CowKind_HST,            // 荷斯坦
 		BirthWeight:   calf.Weight,
-		SourceId:      2, // 产犊方式 todo 改成enum
+		SourceId:      pasturePb.CowSource_Calving, // 产犊方式
 		FatherId:      fatherId,
 		MotherId:      motherId,
 		IsRemove:      pasturePb.IsShow_Ok,
 		IsPregnant:    pasturePb.IsShow_No,
-		Status:        6, // 哺乳犊牛  todo 改成enum
+		Status:        pasturePb.CowStatus_Calving, // 哺乳犊牛
 	}
 }
 

+ 3 - 1
model/event_calving.go

@@ -67,9 +67,10 @@ func (e EventCalvingListSlice) ToPB(req []*EventCalvingCalf) []*pasturePb.Search
 				IsLive:     v.IsLive,
 				CreatedAt:  int32(v.CreatedAt),
 				UpdatedAt:  int32(v.UpdatedAt),
-				PenId:      int32(v.PenId),
+				PenId:      v.PenId,
 				Remarks:    v.Remarks,
 				MotherId:   int32(v.MotherId),
+				Id:         int32(v.Id),
 			})
 		}
 		list = append(list, &pasturePb.SearchLavingList{
@@ -87,6 +88,7 @@ func (e EventCalvingListSlice) ToPB(req []*EventCalvingCalf) []*pasturePb.Search
 			Remarks:         item.Remarks,
 			CreatedAt:       int32(item.CreatedAt),
 			UpdatedAt:       int32(item.UpdatedAt),
+			DystociaReason:  item.DystociaReason,
 			CalfItemList:    CalfItemList,
 		})
 	}

+ 30 - 30
model/event_enter.go

@@ -8,35 +8,35 @@ import (
 )
 
 type EventEnter struct {
-	Id               int64                  `json:"id"`
-	EarNumber        string                 `json:"ear_number"`
-	CowId            int64                  `json:"cow_id"`
-	Sex              pasturePb.Genders_Kind `json:"sex"`
-	BirthAt          int64                  `json:"birth_at"`
-	CowSourceId      int32                  `json:"cow_source_id"`
-	OldEarNumber     string                 `json:"old_ear_number"`
-	CowTypeId        int32                  `json:"cow_type_id"`
-	BreedStatusId    int32                  `json:"breed_status_id"`
-	Lact             int32                  `json:"lact"`
-	DayAge           int32                  `json:"day_age"`
-	PenId            int32                  `json:"pen_id"`
-	CowKindId        int32                  `json:"cow_kind_id"`
-	Status           int32                  `json:"status"`
-	FatherId         int64                  `json:"father_id"`
-	MotherId         int64                  `json:"mother_id"`
-	MatingAt         int64                  `json:"mating_at"`
-	PregnancyCheckAt int64                  `json:"pregnancy_check_at"`
-	DryMilkAt        int64                  `json:"dry_milk_at"`
-	WeaningAt        int64                  `json:"weaning_at"`
-	EstrusAt         int64                  `json:"estrus_at"`
-	EnterAt          int64                  `json:"enter_at"`
-	Remarks          string                 `json:"remarks"`
-	Weight           int64                  `json:"weight"`
-	Price            int64                  `json:"price"`
-	OperationId      int64                  `json:"operation_id"`
-	StaffMemberId    int64                  `json:"staff_member_id"`
-	CreatedAt        int64                  `json:"created_at"`
-	UpdatedAt        int64                  `json:"updated_at"`
+	Id               int64                      `json:"id"`
+	EarNumber        string                     `json:"ear_number"`
+	CowId            int64                      `json:"cow_id"`
+	Sex              pasturePb.Genders_Kind     `json:"sex"`
+	BirthAt          int64                      `json:"birth_at"`
+	CowSourceId      pasturePb.CowSource_Kind   `json:"cow_source_id"`
+	OldEarNumber     string                     `json:"old_ear_number"`
+	CowTypeId        pasturePb.CowType_Kind     `json:"cow_type_id"`
+	BreedStatusId    pasturePb.BreedStatus_Kind `json:"breed_status_id"`
+	Lact             int32                      `json:"lact"`
+	DayAge           int32                      `json:"day_age"`
+	PenId            int32                      `json:"pen_id"`
+	CowKindId        pasturePb.CowKind_Kind     `json:"cow_kind_id"`
+	Status           pasturePb.CowStatus_Kind   `json:"status"`
+	FatherId         int64                      `json:"father_id"`
+	MotherId         int64                      `json:"mother_id"`
+	MatingAt         int64                      `json:"mating_at"`
+	PregnancyCheckAt int64                      `json:"pregnancy_check_at"`
+	DryMilkAt        int64                      `json:"dry_milk_at"`
+	WeaningAt        int64                      `json:"weaning_at"`
+	EstrusAt         int64                      `json:"estrus_at"`
+	EnterAt          int64                      `json:"enter_at"`
+	Remarks          string                     `json:"remarks"`
+	Weight           int64                      `json:"weight"`
+	Price            int64                      `json:"price"`
+	OperationId      int64                      `json:"operation_id"`
+	StaffMemberId    int64                      `json:"staff_member_id"`
+	CreatedAt        int64                      `json:"created_at"`
+	UpdatedAt        int64                      `json:"updated_at"`
 }
 
 func (e *EventEnter) TableName() string {
@@ -83,7 +83,7 @@ func (e EventEnterSlice) ToPB() []*pasturePb.SearchEnterData {
 			CowId:            int32(d.CowId),
 			Sex:              d.Sex,
 			BirthAt:          int32(d.BirthAt),
-			CowSourceId:      int32(d.CowSourceId),
+			CowSourceId:      d.CowSourceId,
 			CowTypeId:        d.CowTypeId,
 			BreedStatusId:    d.BreedStatusId,
 			Lact:             d.Lact,

+ 73 - 0
model/event_pregnant_check.go

@@ -0,0 +1,73 @@
+package model
+
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
+type EventPregnantCheck struct {
+	Id                  int64                              `json:"id"`
+	CowId               int64                              `json:"cow_id"`
+	DayAge              int32                              `json:"day_age"`
+	Lact                int8                               `json:"lact"`
+	PregnantCheckAt     int64                              `json:"pregnant_check_at"`
+	PregnantCheckResult pasturePb.PregnantCheckResult_Kind `json:"pregnant_check_result"`
+	PregnantCheckMethod pasturePb.PregnantCheckMethod_Kind `json:"pregnant_check_method"`
+	StaffMemberId       int64                              `json:"staff_member_id"`
+	OperationId         int64                              `json:"operation_id"`
+	Remarks             string                             `json:"remarks"`
+	CreatedAt           int64                              `json:"created_at"`
+	UpdatedAt           int64                              `json:"updated_at"`
+}
+
+func (e *EventPregnantCheck) TableName() string {
+	return "event_pregnant_check"
+}
+
+type EventPregnantCheckSlice []*EventPregnantCheck
+
+func (e EventPregnantCheckSlice) ToPB(systemUserList []*SystemUser, pregnantCheckResult, pregnantCheckMethod []*pasturePb.ConfigOptionsList) []*pasturePb.SearchPregnantCheckList {
+	result := make([]*pasturePb.SearchPregnantCheckList, len(e))
+	for i, v := range e {
+		var pregnantCheckResultName, pregnantCheckMethodName, staffMemberName, operationName = "", "", "", ""
+		for _, u := range systemUserList {
+			if v.StaffMemberId != u.Id {
+				staffMemberName = u.Name
+			}
+			if v.OperationId == u.Id {
+				operationName = u.Name
+			}
+		}
+
+		for _, s := range pregnantCheckResult {
+			if int32(v.PregnantCheckResult) != s.Value {
+				continue
+			}
+			pregnantCheckResultName = s.Label
+		}
+
+		for _, m := range pregnantCheckMethod {
+			if int32(v.PregnantCheckMethod) != m.Value {
+				continue
+			}
+			pregnantCheckMethodName = m.Label
+		}
+
+		result[i] = &pasturePb.SearchPregnantCheckList{
+			Id:                      int32(v.Id),
+			CowId:                   int32(v.CowId),
+			DayAge:                  v.DayAge,
+			Lact:                    int32(v.Lact),
+			PregnantCheckAt:         int32(v.PregnantCheckAt),
+			PregnantCheckResult:     v.PregnantCheckResult,
+			PregnantCheckResultName: pregnantCheckResultName,
+			PregnantCheckMethod:     v.PregnantCheckMethod,
+			PregnantCheckMethodName: pregnantCheckMethodName,
+			StaffMemberId:           int32(v.StaffMemberId),
+			StaffMemberName:         staffMemberName,
+			Remarks:                 v.Remarks,
+			OperationId:             int32(v.OperationId),
+			OperationName:           operationName,
+			CreatedAt:               int32(v.CreatedAt),
+			UpdatedAt:               int32(v.UpdatedAt),
+		}
+	}
+	return result
+}

+ 116 - 58
module/backend/config_data.go

@@ -222,6 +222,119 @@ func (s *StoreEntry) TransferPenEnumList() []*pasturePb.ConfigOptionsList {
 	})
 	return transferPenList
 }
+
+func (s *StoreEntry) ChildNumberEnumList() []*pasturePb.ConfigOptionsList {
+	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	configOptions = append(configOptions,
+		&pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.ChildNumber_One),
+			Label:    "单胎",
+			Disabled: true,
+		}, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.ChildNumber_Two),
+			Label:    "双胎",
+			Disabled: true,
+		}, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.ChildNumber_Three),
+			Label:    "三胎",
+			Disabled: true,
+		}, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.ChildNumber_Four),
+			Label:    "四胎",
+			Disabled: true,
+		})
+	return configOptions
+}
+
+func (s *StoreEntry) CalvingLevelEnumList() []*pasturePb.ConfigOptionsList {
+	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	configOptions = append(configOptions,
+		&pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.CalvingLevel_Natural_Childbirth),
+			Label:    "自然分娩",
+			Disabled: true,
+		}, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.CalvingLevel_Artificial_Midwifery1),
+			Label:    "人工助产(1-2人)",
+			Disabled: true,
+		}, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.CalvingLevel_Artificial_Midwifery2),
+			Label:    "人工助产(3人以上)",
+			Disabled: true,
+		}, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.CalvingLevel_Caesarean),
+			Label:    "剖腹产",
+			Disabled: true,
+		})
+	return configOptions
+}
+
+func (s *StoreEntry) DystociaReason() []*pasturePb.ConfigOptionsList {
+	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	configOptions = append(configOptions,
+		&pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.DystociaReason_Malposition),
+			Label:    "胎位不正",
+			Disabled: true,
+		}, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.DystociaReason_Fetal_Overgrowth),
+			Label:    "胎儿过大",
+			Disabled: true,
+		}, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.DystociaReason_Uterine_Atony),
+			Label:    "子宫收缩无力",
+			Disabled: true,
+		}, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.DystociaReason_Pelvic_Stenosis),
+			Label:    "盆骨狭小",
+			Disabled: true,
+		}, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.DystociaReason_Sub_Health),
+			Label:    "母牛亚健康状态",
+			Disabled: true,
+		})
+	return configOptions
+}
+
+func (s *StoreEntry) PregnantCheckResult() []*pasturePb.ConfigOptionsList {
+	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
+		Value:    int32(pasturePb.PregnantCheckResult_InCheck_UnPregnant),
+		Label:    "初检未孕",
+		Disabled: true,
+	}, &pasturePb.ConfigOptionsList{
+		Value:    int32(pasturePb.PregnantCheckResult_InCheck_Pregnant),
+		Label:    "初检已孕",
+		Disabled: true,
+	}, &pasturePb.ConfigOptionsList{
+		Value:    int32(pasturePb.PregnantCheckResult_Recheck_UnPregnant),
+		Label:    "复检未孕",
+		Disabled: true,
+	}, &pasturePb.ConfigOptionsList{
+		Value:    int32(pasturePb.PregnantCheckResult_Recheck_Pregnant),
+		Label:    "初检已孕",
+		Disabled: true,
+	})
+	return configOptions
+}
+
+func (s *StoreEntry) PregnantCheckMethod() []*pasturePb.ConfigOptionsList {
+	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	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) BarnTypeOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error) {
 	return &pasturePb.ConfigOptionsListResponse{
 		Code:    http.StatusOK,
@@ -311,66 +424,11 @@ func (s *StoreEntry) SystemBaseConfigOptions(ctx context.Context, optionsName st
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	switch optionsName {
 	case "childNumber":
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.ChildNumber_One),
-				Label:    "单胎",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.ChildNumber_Two),
-				Label:    "双胎",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.ChildNumber_Three),
-				Label:    "三胎",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.ChildNumber_Four),
-				Label:    "四胎",
-				Disabled: true,
-			})
+		configOptions = s.ChildNumberEnumList()
 	case "calvingLevel":
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.CalvingLevel_Natural_Childbirth),
-				Label:    "自然分娩",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.CalvingLevel_Artificial_Midwifery1),
-				Label:    "人工助产(1-2人)",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.CalvingLevel_Artificial_Midwifery2),
-				Label:    "人工助产(3人以上)",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.CalvingLevel_Caesarean),
-				Label:    "剖腹产",
-				Disabled: true,
-			})
+		configOptions = s.CalvingLevelEnumList()
 	case "dystociaReason":
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DystociaReason_Malposition),
-				Label:    "胎位不正",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DystociaReason_Fetal_Overgrowth),
-				Label:    "胎儿过大",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DystociaReason_Uterine_Atony),
-				Label:    "子宫收缩无力",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DystociaReason_Pelvic_Stenosis),
-				Label:    "盆骨狭小",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DystociaReason_Sub_Health),
-				Label:    "母牛亚健康状态",
-				Disabled: true,
-			})
+		configOptions = s.DystociaReason()
 	}
 	return &pasturePb.ConfigOptionsListResponse{
 		Code:    http.StatusOK,

+ 32 - 0
module/backend/event.go

@@ -314,3 +314,35 @@ func (s *StoreEntry) CalvingCreate(ctx context.Context, req *pasturePb.CalvingEv
 	}
 	return nil
 }
+
+func (s *StoreEntry) PregnantCheckList(ctx context.Context, req *pasturePb.SearchEventRequest, pagination *pasturePb.PaginationModel) (*pasturePb.PregnantCheckEventResponse, error) {
+	pregnantCheckList := make([]*model.EventPregnantCheck, 0)
+	var count int64 = 0
+	pref := s.DB.Table(new(model.EventPregnantCheck).TableName())
+	if len(req.CowId) > 0 {
+		cowIds := strings.Split(req.CowId, ",")
+		pref.Where("cow_id IN ?", cowIds)
+	}
+
+	if err := pref.Order("id desc").
+		Count(&count).Limit(int(pagination.PageSize)).
+		Offset(int(pagination.PageOffset)).
+		Find(&pregnantCheckList).Error; err != nil {
+		return nil, xerr.WithStack(err)
+	}
+
+	systemUserList, _ := s.SystemUserList(ctx)
+	pregnantCheckResult := s.PregnantCheckResult()
+	pregnantCheckMethod := s.PregnantCheckMethod()
+
+	return &pasturePb.PregnantCheckEventResponse{
+		Code:    http.StatusOK,
+		Message: "ok",
+		Data: &pasturePb.SearchPregnantCheckData{
+			List:     model.EventPregnantCheckSlice(pregnantCheckList).ToPB(systemUserList, pregnantCheckResult, pregnantCheckMethod),
+			Total:    int32(count),
+			PageSize: pagination.PageSize,
+			Page:     pagination.Page,
+		},
+	}, nil
+}

+ 1 - 0
module/backend/interface.go

@@ -130,6 +130,7 @@ type EventService interface {
 	CreateBodyScore(ctx context.Context, req *pasturePb.BodyScoreEventRequest) error
 	CalvingList(ctx context.Context, req *pasturePb.SearchEventRequest, pagination *pasturePb.PaginationModel) (*pasturePb.SearchLavingEventResponse, error)
 	CalvingCreate(ctx context.Context, req *pasturePb.CalvingEventRequest) error
+	PregnantCheckList(ctx context.Context, req *pasturePb.SearchEventRequest, pagination *pasturePb.PaginationModel) (*pasturePb.PregnantCheckEventResponse, error)
 }
 
 //go:generate mockgen -destination mock/CowService.go -package kptservicemock kpt-pasture/module/backend CowService

+ 8 - 0
module/backend/system_service.go

@@ -118,6 +118,14 @@ func (s *StoreEntry) SearchSystemUserList(ctx context.Context, req *pasturePb.Se
 	}, nil
 }
 
+func (s *StoreEntry) SystemUserList(ctx context.Context) ([]*model.SystemUser, error) {
+	systemUserList := make([]*model.SystemUser, 0)
+	if err := s.DB.Where("is_delete = ?", pasturePb.IsShow_Ok).Find(&systemUserList).Error; err != nil {
+		return nil, xerr.WithStack(err)
+	}
+	return systemUserList, nil
+}
+
 // DeleteSystemUser 删除系统用户
 func (s *StoreEntry) DeleteSystemUser(ctx context.Context, userId int64) error {
 	systemUser := &model.SystemUser{