calendar.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. package backend
  2. import (
  3. "context"
  4. "fmt"
  5. "kpt-pasture/model"
  6. "kpt-pasture/util"
  7. "net/http"
  8. "regexp"
  9. "time"
  10. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  11. "gitee.com/xuyiping_admin/pkg/xerr"
  12. )
  13. // CalendarToDoList 获取日历待办列表
  14. func (s *StoreEntry) CalendarToDoList(ctx context.Context, req *pasturePb.CalendarToDoRequest, pagination *pasturePb.PaginationModel) (*pasturePb.CalendarToDoResponse, error) {
  15. userModel, err := s.GetUserModel(ctx)
  16. if err != nil {
  17. return nil, xerr.WithStack(err)
  18. }
  19. calendarToDoList := make([]*pasturePb.CalendarToDoList, 0)
  20. pastureWhereSql := fmt.Sprintf(" AND pasture_id = %d", userModel.AppPasture.Id)
  21. whereSql := ""
  22. if req.CowId > 0 {
  23. whereSql += fmt.Sprintf(" AND cow_id = %d", req.CowId)
  24. }
  25. if req.CalendarType > 0 {
  26. calendarTypeMap := CalendarTypeMap()
  27. calendarTypeName := calendarTypeMap[req.CalendarType]
  28. if len(calendarTypeName) > 0 {
  29. re := regexp.MustCompile(`[a-zA-Z]`) // 使用正则表达式替换匹配的字母为空字符串
  30. calendarTypeName = re.ReplaceAllString(calendarTypeName, "")
  31. whereSql += fmt.Sprintf(" AND calendar_type_name = '%s'", calendarTypeName)
  32. }
  33. }
  34. sql := `SELECT a.cow_id,b.pen_name,a.calendar_type_name,DATE_FORMAT(FROM_UNIXTIME(a.plan_day), '%Y-%m-%d') AS plan_day,b.lact,
  35. b.ear_number FROM (
  36. SELECT cow_id,plan_day,'免疫' as calendar_type_name FROM event_immunization_plan WHERE status = 2 ` + pastureWhereSql + `
  37. UNION ALL
  38. SELECT cow_id,plan_day ,'同期' as calendar_type_name FROM event_cow_same_time WHERE status = 2 ` + pastureWhereSql + `
  39. UNION ALL
  40. SELECT cow_id,plan_day ,'孕检' as calendar_type_name FROM event_pregnant_check WHERE status = 2 ` + pastureWhereSql + `
  41. UNION ALL
  42. SELECT cow_id,plan_day ,'断奶' as calendar_type_name FROM event_weaning WHERE status = 2 ` + pastureWhereSql + `
  43. UNION ALL
  44. SELECT cow_id,plan_day ,'配种' as calendar_type_name FROM event_mating WHERE status = 2 ` + pastureWhereSql + `
  45. UNION ALL
  46. SELECT cow_id,plan_day ,'产犊' as calendar_type_name FROM event_calving WHERE status = 2 ` + pastureWhereSql + `
  47. ) as a JOIN cow b ON a.cow_id = b.id WHERE 1 = 1 `
  48. completeSql := fmt.Sprintf("%s %s ORDER BY a.plan_day ASC LIMIT %d OFFSET %d", sql, whereSql, pagination.PageSize, pagination.PageOffset)
  49. if err = s.DB.Raw(completeSql).Find(&calendarToDoList).Error; err != nil {
  50. return nil, err
  51. }
  52. return &pasturePb.CalendarToDoResponse{
  53. Code: http.StatusOK,
  54. Msg: "ok",
  55. Data: &pasturePb.CalendarToDoData{
  56. List: calendarToDoList,
  57. Total: int32(len(calendarToDoList)),
  58. PageSize: pagination.PageSize,
  59. Page: pagination.Page,
  60. },
  61. }, nil
  62. }
  63. func (s *StoreEntry) CalendarList(ctx context.Context, req *pasturePb.CalendarRequest) (*pasturePb.CalendarResponse, error) {
  64. userModel, err := s.GetUserModel(ctx)
  65. if err != nil {
  66. return nil, xerr.WithStack(err)
  67. }
  68. calendarList := make([]*model.Calendar, 0)
  69. if err = s.DB.Model(&model.Calendar{}).
  70. Where("show_day >= ?", req.ShowStartDay).
  71. Where("show_day <= ?", req.ShowEndDay).
  72. Where("pasture_id = ?", userModel.AppPasture.Id).
  73. Where("is_show = ?", pasturePb.IsShow_Ok).
  74. Find(&calendarList).Error; err != nil {
  75. return nil, xerr.WithStack(err)
  76. }
  77. return &pasturePb.CalendarResponse{
  78. Code: http.StatusOK,
  79. Msg: "ok",
  80. Data: model.CalendarSlice(calendarList).ToPB(),
  81. }, nil
  82. }
  83. func (s *StoreEntry) CalendarTableDetail(
  84. ctx context.Context,
  85. req *pasturePb.CalendarTableRequest,
  86. pagination *pasturePb.PaginationModel,
  87. ) (interface{}, error) {
  88. userModel, err := s.GetUserModel(ctx)
  89. if err != nil {
  90. return nil, xerr.WithStack(err)
  91. }
  92. if req.Start != time.Now().Format(model.LayoutDate2) {
  93. return nil, xerr.Custom("只能获取当天的数据")
  94. }
  95. newCalendar := &model.Calendar{}
  96. if err = s.DB.Model(&model.Calendar{}).
  97. Where("calendar_type = ?", req.CalendarType).
  98. Where("show_day = ?", req.Start).
  99. Where("is_show = ?", pasturePb.IsShow_Ok).
  100. Where("pasture_id = ?", userModel.AppPasture.Id).
  101. First(newCalendar).Error; err != nil {
  102. return nil, xerr.WithStack(err)
  103. }
  104. if newCalendar.Id <= 0 {
  105. return nil, xerr.New("不存在该日历数据")
  106. }
  107. return s.getCalendarCowList(ctx, req.CalendarType, req.Start, pagination, userModel.AppPasture.Id)
  108. }
  109. func (s *StoreEntry) getCalendarCowList(
  110. ctx context.Context,
  111. calendarType pasturePb.CalendarType_Kind,
  112. showDay string,
  113. pagination *pasturePb.PaginationModel,
  114. pastureId int64,
  115. ) (interface{}, error) {
  116. req := &pasturePb.ItemsRequest{EndDay: showDay, CalendarType: calendarType, PastureId: int32(pastureId)}
  117. switch calendarType {
  118. case pasturePb.CalendarType_Immunisation: // 免疫
  119. return s.ImmunisationCowList(ctx, req, pagination)
  120. case pasturePb.CalendarType_PG, pasturePb.CalendarType_RnGH: // 同期
  121. return s.SameTimeCowList(ctx, req, pagination)
  122. case pasturePb.CalendarType_Pregnancy_Check: // 孕检
  123. return s.PregnancyCheckCowList(ctx, req, pagination)
  124. case pasturePb.CalendarType_WorkOrder: // 工作单
  125. return s.WorkOrderCowList(ctx, req, pagination)
  126. case pasturePb.CalendarType_Weaning: // 断奶
  127. return s.WeaningCowList(ctx, req, pagination)
  128. case pasturePb.CalendarType_Treatment: // 治疗
  129. return s.TreatmentCowList(ctx, req, pagination)
  130. case pasturePb.CalendarType_Mating: // 配种
  131. return s.MatingCowList(ctx, req, pagination)
  132. case pasturePb.CalendarType_Calving: // 产犊
  133. return s.CalvingCowList(ctx, req, pagination)
  134. default:
  135. return nil, xerr.New("不支持的日历类型")
  136. }
  137. }
  138. func (s *StoreEntry) ImmunisationCowList(ctx context.Context, req *pasturePb.ItemsRequest, pagination *pasturePb.PaginationModel) (*pasturePb.ImmunizationItemsResponse, error) {
  139. userModel, err := s.GetUserModel(ctx)
  140. if err != nil {
  141. return nil, xerr.WithStack(err)
  142. }
  143. eventImmunizationPlanList := make([]*model.EventImmunizationPlan, 0)
  144. count := int64(0)
  145. pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventImmunizationPlan).TableName())).
  146. Select("a.id,a.cow_id,a.plan_day,a.plan_name as immunization_plan_name,b.pen_name,b.day_age,b.ear_number").
  147. Joins(fmt.Sprintf("JOIN %s AS b on a.cow_id = b.id", new(model.Cow).TableName())).
  148. Where("a.status = ?", pasturePb.IsShow_No).
  149. Where("a.pasture_id = ?", userModel.AppPasture.Id)
  150. if req.StartDay != "" && req.EndDay != "" {
  151. startTime := util.TimeParseLocalUnix(req.StartDay)
  152. endTime := util.TimeParseLocalEndUnix(req.EndDay)
  153. pref.Where("a.plan_day between ? and ?", startTime, endTime)
  154. }
  155. if req.CowId > 0 {
  156. pref.Where("a.cow_id = ?", req.CowId)
  157. }
  158. if req.ImmunizationId > 0 {
  159. pref.Where("a.plan_id = ?", req.ImmunizationId)
  160. }
  161. if req.PenId > 0 {
  162. pref.Where("b.pen_id = ?", req.PenId)
  163. }
  164. if err = pref.Order("id desc").
  165. Count(&count).
  166. Limit(int(pagination.PageSize)).
  167. Offset(int(pagination.PageOffset)).
  168. Order("id desc").
  169. Find(&eventImmunizationPlanList).Error; err != nil {
  170. return nil, xerr.WithStack(err)
  171. }
  172. return &pasturePb.ImmunizationItemsResponse{
  173. Code: http.StatusOK,
  174. Msg: "ok",
  175. Data: &pasturePb.ImmunizationItemsData{
  176. Total: int32(count),
  177. Page: pagination.Page,
  178. PageSize: pagination.PageSize,
  179. Header: map[string]string{
  180. "id": "编号",
  181. "cowId": "牛号",
  182. "earNumber": "耳标号",
  183. "penName": "栏舍",
  184. "dayAge": "日龄",
  185. "planDay": "免疫时间",
  186. "immunizationPlanName": "免疫名称",
  187. },
  188. List: model.EventImmunizationPlanSlice(eventImmunizationPlanList).ToPB(),
  189. },
  190. }, nil
  191. }
  192. func (s *StoreEntry) SameTimeCowList(ctx context.Context, req *pasturePb.ItemsRequest, pagination *pasturePb.PaginationModel) (*pasturePb.SameTimeItemResponse, error) {
  193. userModel, err := s.GetUserModel(ctx)
  194. if err != nil {
  195. return nil, xerr.WithStack(err)
  196. }
  197. sameTimeBodyList := make([]*model.SameTimeItemBody, 0)
  198. count := int64(0)
  199. pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventCowSameTime).TableName())).
  200. Select(`a.id,a.cow_id,a.ear_number,a.pen_name,a.status,a.same_time_type,b.breed_status,a.same_time_name,a.plan_day,
  201. b.cow_type,b.day_age,b.calving_age,b.abortion_age,b.last_calving_at,b.last_abortion_at,b.lact,b.pen_name,b.mating_times`).
  202. Joins("left join cow as b on a.cow_id = b.id").
  203. Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission).
  204. Where("a.pasture_id = ?", userModel.AppPasture.Id).
  205. Where("a.status = ?", pasturePb.IsShow_No)
  206. if req.EndDay != "" {
  207. dateTime := util.TimeParseLocalEndUnix(req.EndDay)
  208. pref.Where("a.plan_day <= ?", dateTime)
  209. }
  210. if req.CowType > 0 {
  211. pref.Where("b.cow_type = ?", req.CowType)
  212. }
  213. if err = pref.Order("a.plan_day ASC").Count(&count).
  214. Limit(int(pagination.PageSize)).
  215. Offset(int(pagination.PageOffset)).
  216. Find(&sameTimeBodyList).Error; err != nil {
  217. return nil, xerr.WithStack(err)
  218. }
  219. breedStatusMap := s.CowBreedStatusMap()
  220. penMap := s.PenMap(ctx, int64(req.PastureId))
  221. sameTimeTypeMap := s.SameTimeTypeMap()
  222. return &pasturePb.SameTimeItemResponse{
  223. Code: http.StatusOK,
  224. Msg: "ok",
  225. Data: &pasturePb.SameTimeItemsData{
  226. Total: int32(count),
  227. Page: pagination.Page,
  228. PageSize: pagination.PageSize,
  229. Header: map[string]string{
  230. "id": "编号",
  231. "cowId": "牛号",
  232. "earNumber": "耳标号",
  233. "breedStatusName": "繁殖状态",
  234. "cowTypeName": "牛只类型",
  235. "planDayAtFormat": "执行日期",
  236. "penName": "栏舍",
  237. "lact": "胎次",
  238. "calvingAge": "产后天数",
  239. "abortionAge": "流产天数",
  240. "dayAge": "日龄",
  241. "status": "状态",
  242. "sameTimeTypeName": "处理方式",
  243. "matingTimes": "本胎次配次",
  244. "calvingAtFormat": "产犊日期",
  245. "abortionAtFormat": "流产日期",
  246. "sameTimeName": "同期名称",
  247. },
  248. List: model.SameTimeBodySlice(sameTimeBodyList).ToPB(breedStatusMap, penMap, sameTimeTypeMap),
  249. },
  250. }, nil
  251. }
  252. func (s *StoreEntry) PregnancyCheckCowList(ctx context.Context, req *pasturePb.ItemsRequest, pagination *pasturePb.PaginationModel) (*pasturePb.PregnancyCheckItemsResponse, error) {
  253. userModel, err := s.GetUserModel(ctx)
  254. if err != nil {
  255. return nil, xerr.WithStack(err)
  256. }
  257. newPregnancyCheckItems := make([]*pasturePb.PregnancyCheckItems, 0)
  258. var count int64
  259. pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventPregnantCheck).TableName())).
  260. Select("a.id,a.cow_id,a.ear_number,a.pen_id,a.status,b.breed_status,b.pen_name,b.cow_type,b.day_age,b.calving_age,b.abortion_age,a.bull_id").
  261. Joins("left join cow as b on a.cow_id = b.id").
  262. Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission).
  263. Where("a.pasture_id = ?", userModel.AppPasture.Id).
  264. Where("a.status = ?", pasturePb.IsShow_No)
  265. if req.EndDay != "" {
  266. dateTime := util.TimeParseLocalEndUnix(req.EndDay)
  267. pref.Where("a.plan_day <= ?", dateTime)
  268. }
  269. if req.CowType > 0 {
  270. pref.Where("a.cow_type = ?", req.CowType)
  271. }
  272. if req.Status > 0 {
  273. pref.Where("a.status = ?", req.Status)
  274. }
  275. if req.PregnantCheckType > 0 {
  276. pref.Where("a.pregnant_check_name = ?", model.PregnantCheckNameValueMap[req.PregnantCheckType])
  277. }
  278. if err = pref.Order("a.plan_day ASC").
  279. Count(&count).
  280. Limit(int(pagination.PageSize)).
  281. Offset(int(pagination.PageOffset)).
  282. Find(&newPregnancyCheckItems).Error; err != nil {
  283. return nil, xerr.WithStack(err)
  284. }
  285. return &pasturePb.PregnancyCheckItemsResponse{
  286. Code: http.StatusOK,
  287. Msg: "ok",
  288. Data: &pasturePb.PregnancyCheckItemsData{
  289. Total: int32(count),
  290. Page: pagination.Page,
  291. PageSize: pagination.PageSize,
  292. Header: map[string]string{
  293. "id": "编号",
  294. "cowId": "牛号",
  295. "earNumber": "耳标号",
  296. "cowTypeName": "牛只类型",
  297. "penName": "栏舍",
  298. "lact": "胎次",
  299. "dayAge": "日龄",
  300. "planDay": "孕检日期",
  301. "checkTypeName": "孕检名称",
  302. "status": "状态",
  303. "matingTimes": "配次",
  304. "calvingAtFormat": "产检日期",
  305. "matingAtFormat": "配种日期",
  306. "matingAge": "配后天数",
  307. "bullId": "配种公牛",
  308. },
  309. List: newPregnancyCheckItems,
  310. },
  311. }, nil
  312. }
  313. func (s *StoreEntry) WeaningCowList(ctx context.Context, req *pasturePb.ItemsRequest, pagination *pasturePb.PaginationModel) (*pasturePb.WeaningItemsResponse, error) {
  314. userModel, err := s.GetUserModel(ctx)
  315. if err != nil {
  316. return nil, xerr.WithStack(err)
  317. }
  318. weaningItems := make([]*pasturePb.WeaningItems, 0)
  319. count := int64(0)
  320. pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventWeaning).TableName())).
  321. Select("a.id,a.cow_id,b.current_weight as weight,a.status,b.birth_at,b.day_age,b.pen_name").
  322. Joins("left join cow as b on a.cow_id = b.id").
  323. Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission).
  324. Where("a.status = ?", pasturePb.IsShow_No).
  325. Where("a.pasture_id = ?", userModel.AppPasture.Id)
  326. if req.EndDay != "" {
  327. dateTime := util.TimeParseLocalEndUnix(req.EndDay)
  328. pref.Where("a.plan_day <= ?", dateTime)
  329. }
  330. if err = pref.Order("a.plan_day ASC").Count(&count).
  331. Limit(int(pagination.PageSize)).
  332. Offset(int(pagination.PageOffset)).
  333. Find(&weaningItems).Error; err != nil {
  334. return nil, xerr.WithStack(err)
  335. }
  336. return &pasturePb.WeaningItemsResponse{
  337. Code: http.StatusOK,
  338. Msg: "ok",
  339. Data: &pasturePb.WeaningItemsData{
  340. Total: int32(count),
  341. Page: pagination.Page,
  342. PageSize: pagination.PageSize,
  343. Header: map[string]string{
  344. "id": "编号",
  345. "cowId": "牛号",
  346. "earNumber": "耳标号",
  347. "penName": "栏舍",
  348. "planDay": "断奶日期",
  349. "dayAge": "日龄",
  350. "status": "状态",
  351. "birthAt": "出生日期",
  352. "weight": "体重",
  353. },
  354. List: weaningItems,
  355. },
  356. }, nil
  357. }
  358. func (s *StoreEntry) MatingCowList(ctx context.Context, req *pasturePb.ItemsRequest, pagination *pasturePb.PaginationModel) (*pasturePb.MatingItemsResponse, error) {
  359. userModel, err := s.GetUserModel(ctx)
  360. if err != nil {
  361. return nil, xerr.WithStack(err)
  362. }
  363. matingItems := make([]*pasturePb.MatingItems, 0)
  364. count := int64(0)
  365. pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventMating).TableName())).
  366. Select(`a.id,a.cow_id,a.status,a.ear_number,
  367. CASE a.expose_estrus_type
  368. WHEN 1 THEN '脖环揭发'
  369. WHEN 2 THEN '脚环/计步器'
  370. WHEN 3 THEN '自然发情'
  371. WHEN 4 THEN '同期'
  372. ELSE '其他'
  373. END AS expose_estrus_type_name,
  374. b.breed_status,b.cow_type,b.pen_id,b.day_age,b.calving_age,b.abortion_age,b.pen_name`).
  375. Joins("left join cow as b on a.cow_id = b.id").
  376. Where("a.pasture_id = ?", userModel.AppPasture.Id).
  377. Where("a.status = ?", pasturePb.IsShow_No)
  378. if req.EndDay != "" {
  379. dateTime := util.TimeParseLocalEndUnix(req.EndDay)
  380. pref.Where("a.plan_day <= ?", dateTime)
  381. }
  382. if req.PenId > 0 {
  383. pref.Where("b.pen_id = ?", req.PenId)
  384. }
  385. if err = pref.Order("a.plan_day ASC").
  386. Count(&count).
  387. Limit(int(pagination.PageSize)).
  388. Offset(int(pagination.PageOffset)).
  389. Find(&matingItems).Error; err != nil {
  390. return nil, xerr.WithStack(err)
  391. }
  392. return &pasturePb.MatingItemsResponse{
  393. Code: http.StatusOK,
  394. Msg: "ok",
  395. Data: &pasturePb.MatingItemsData{
  396. Total: int32(count),
  397. Page: pagination.Page,
  398. PageSize: pagination.PageSize,
  399. Header: map[string]string{
  400. "id": "编号",
  401. "cowId": "牛号",
  402. "earNumber": "耳标号",
  403. "breedStatusName": "繁殖状态",
  404. "cowTypeName": "牛只类型",
  405. "penName": "栏舍",
  406. "lact": "胎次",
  407. "calvingAge": "产后天数",
  408. "abortionAge": "流产天数",
  409. "dayAge": "日龄",
  410. "status": "状态",
  411. "exposeEstrusTypeName": "发情揭发方式",
  412. },
  413. List: matingItems,
  414. },
  415. }, nil
  416. }
  417. func (s *StoreEntry) CalvingCowList(ctx context.Context, req *pasturePb.ItemsRequest, pagination *pasturePb.PaginationModel) (*pasturePb.CalvingItemsResponse, error) {
  418. userModel, err := s.GetUserModel(ctx)
  419. if err != nil {
  420. return nil, xerr.WithStack(err)
  421. }
  422. calvingItems := make([]*pasturePb.CalvingItems, 0)
  423. count := int64(0)
  424. pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventCalving).TableName())).
  425. Select(`a.id,a.cow_id,a.ear_number,a.status,b.breed_status,b.pen_id,DATE_FORMAT(FROM_UNIXTIME(last_mating_at), '%Y-%m-%d') AS mating_at_format,
  426. b.day_age,b.last_bull_number as bull_id,b.pen_name,DATEDIFF(NOW(),FROM_UNIXTIME(last_mating_at)) AS mating_age,DATE_FORMAT(FROM_UNIXTIME(a.plan_day), '%Y-%m-%d') AS plan_day`).
  427. Joins("left join cow as b on a.cow_id = b.id").
  428. Where("a.status = ?", pasturePb.IsShow_No).
  429. Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission).
  430. Where("a.pasture_id = ?", userModel.AppPasture.Id)
  431. if req.EndDay != "" {
  432. dateTime := util.TimeParseLocalEndUnix(req.EndDay)
  433. pref.Where("a.plan_day <= ?", dateTime)
  434. }
  435. if req.Status > 0 {
  436. pref.Where("a.status = ?", req.Status)
  437. }
  438. if err = pref.Order("a.plan_day ASC").
  439. Count(&count).
  440. Limit(int(pagination.PageSize)).
  441. Offset(int(pagination.PageOffset)).
  442. Find(&calvingItems).Error; err != nil {
  443. return nil, xerr.WithStack(err)
  444. }
  445. breedStatusMap := s.CowBreedStatusMap()
  446. for _, v := range calvingItems {
  447. breedStatusName := ""
  448. if breedStatus, ok := breedStatusMap[v.BreedStatus]; ok {
  449. breedStatusName = breedStatus
  450. }
  451. v.BreedStatusName = breedStatusName
  452. }
  453. return &pasturePb.CalvingItemsResponse{
  454. Code: http.StatusOK,
  455. Msg: "ok",
  456. Data: &pasturePb.CalvingItemsData{
  457. Total: int32(count),
  458. Page: pagination.Page,
  459. PageSize: pagination.PageSize,
  460. Header: map[string]string{
  461. "id": "编号",
  462. "cowId": "牛号",
  463. "earNumber": "耳标号",
  464. "breedStatusName": "繁殖状态",
  465. "penName": "栏舍",
  466. "lact": "胎次",
  467. "matingAge": "配后天数",
  468. "dayAge": "日龄",
  469. "status": "是否完成",
  470. "bullId": "配种公牛号",
  471. "planDay": "预产时间",
  472. "matingAtFormat": "配种时间",
  473. },
  474. List: calvingItems,
  475. },
  476. }, nil
  477. }
  478. // WorkOrderCowList 暂时不处理工单业务
  479. func (s *StoreEntry) WorkOrderCowList(ctx context.Context, req *pasturePb.ItemsRequest, pagination *pasturePb.PaginationModel) (interface{}, error) {
  480. return nil, nil
  481. }
  482. // TreatmentCowList 治疗清单
  483. func (s *StoreEntry) TreatmentCowList(ctx context.Context, req *pasturePb.ItemsRequest, pagination *pasturePb.PaginationModel) (interface{}, error) {
  484. return nil, nil
  485. }