|
@@ -388,8 +388,19 @@ func (s *StoreEntry) PregnancyCheckCowList(ctx context.Context, req *pasturePb.I
|
|
newPregnancyCheckItems := make([]*pasturePb.PregnancyCheckItems, 0)
|
|
newPregnancyCheckItems := make([]*pasturePb.PregnancyCheckItems, 0)
|
|
var count int64
|
|
var count int64
|
|
pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventPregnantCheck).TableName())).
|
|
pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventPregnantCheck).TableName())).
|
|
- Select(`a.id,a.cow_id,a.ear_number,a.pen_id,a.status,b.breed_status,b.pen_name,b.cow_type,
|
|
|
|
- DATE_FORMAT(FROM_UNIXTIME(b.last_mating_at),'%Y-%m-%d')as mating_at_format,pregnancy_age,DATEDIFF(CURDATE(), FROM_UNIXTIME(last_mating_at)) AS mating_age,
|
|
|
|
|
|
+ Select(`a.id,a.cow_id,a.ear_number,a.pen_id,a.status,b.pen_name,b.cow_type,
|
|
|
|
+ DATE_FORMAT(FROM_UNIXTIME(b.last_mating_at),'%Y-%m-%d')as mating_at_format,pregnancy_age,DATEDIFF(CURDATE(),
|
|
|
|
+ FROM_UNIXTIME(last_mating_at)) AS mating_age,
|
|
|
|
+ CASE b.breed_status
|
|
|
|
+ WHEN 1 THEN '未配'
|
|
|
|
+ WHEN 2 THEN '已配'
|
|
|
|
+ WHEN 3 THEN '已孕'
|
|
|
|
+ WHEN 4 THEN '空怀'
|
|
|
|
+ WHEN 5 THEN '流产'
|
|
|
|
+ WHEN 6 THEN '产犊'
|
|
|
|
+ WHEN 7 THEN '禁配'
|
|
|
|
+ ELSE '其他'
|
|
|
|
+ END AS breed_status_name,
|
|
CASE a.pregnant_check_name
|
|
CASE a.pregnant_check_name
|
|
WHEN 'pregnant_check_for_first' THEN '初检'
|
|
WHEN 'pregnant_check_for_first' THEN '初检'
|
|
WHEN 'pregnant_check_for_second' THEN '复检'
|
|
WHEN 'pregnant_check_for_second' THEN '复检'
|
|
@@ -432,7 +443,7 @@ func (s *StoreEntry) PregnancyCheckCowList(ctx context.Context, req *pasturePb.I
|
|
Total: int32(count),
|
|
Total: int32(count),
|
|
Page: pagination.Page,
|
|
Page: pagination.Page,
|
|
PageSize: pagination.PageSize,
|
|
PageSize: pagination.PageSize,
|
|
- HeaderSort: []string{"id", "cowId", "earNumber", "cowTypeName", "penName", "lact", "dayAge", "planDay",
|
|
|
|
|
|
+ HeaderSort: []string{"id", "cowId", "earNumber", "cowTypeName", "penName", "lact", "dayAge", "breedStatusName", "planDay",
|
|
"checkTypeName", "status", "matingTimes", "calvingAtFormat", "matingAtFormat", "matingAge", "bullId", "pregnancyAge"},
|
|
"checkTypeName", "status", "matingTimes", "calvingAtFormat", "matingAtFormat", "matingAge", "bullId", "pregnancyAge"},
|
|
Header: map[string]string{
|
|
Header: map[string]string{
|
|
"id": "编号",
|
|
"id": "编号",
|
|
@@ -451,6 +462,7 @@ func (s *StoreEntry) PregnancyCheckCowList(ctx context.Context, req *pasturePb.I
|
|
"matingAge": "配后天数",
|
|
"matingAge": "配后天数",
|
|
"bullId": "配种公牛",
|
|
"bullId": "配种公牛",
|
|
"pregnancyAge": "怀孕天数",
|
|
"pregnancyAge": "怀孕天数",
|
|
|
|
+ "breedStatusName": "繁殖状态",
|
|
},
|
|
},
|
|
List: newPregnancyCheckItems,
|
|
List: newPregnancyCheckItems,
|
|
},
|
|
},
|