cow_immunization_plan.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package model
  2. import (
  3. "time"
  4. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  5. )
  6. type CowImmunizationPlan struct {
  7. Id int64 `json:"id"`
  8. CowId int64 `json:"cowId"`
  9. ImmunizationPlanId int64 `json:"immunizationPlanId"`
  10. ImmunizationPlanName string `json:"immunizationPlanName"`
  11. PlanDay string `json:"planDay"`
  12. RealityDay string `json:"realityDay"`
  13. Status pasturePb.IsShow_Kind `json:"status"`
  14. OperationId int64 `json:"operationId"`
  15. OperationName string `json:"operationName"`
  16. DrugsId int64 `json:"drugsId"`
  17. Unit pasturePb.Unit_Kind `json:"unit"`
  18. Usage string `json:"usage"`
  19. Remarks string `json:"remarks"`
  20. CreateAt int64 `json:"createAt"`
  21. UpdateAt int64 `json:"updateAt"`
  22. }
  23. func (c *CowImmunizationPlan) TableName() string {
  24. return "cow_immunization_plan"
  25. }
  26. func NewCowImmunizationPlan(cowId int64, immunizationPlan *ImmunizationPlan) *CowImmunizationPlan {
  27. return &CowImmunizationPlan{
  28. CowId: cowId,
  29. ImmunizationPlanId: immunizationPlan.Id,
  30. ImmunizationPlanName: immunizationPlan.Name,
  31. PlanDay: time.Now().Format(LayoutDate2),
  32. Status: pasturePb.IsShow_No,
  33. }
  34. }
  35. func NewCowImmunizationPlanList(cowList []*Cow, immunizationPlan *ImmunizationPlan) []*CowImmunizationPlan {
  36. cowImmunizationPlanList := make([]*CowImmunizationPlan, len(cowList))
  37. for i, v := range cowList {
  38. cowImmunizationPlanList[i] = NewCowImmunizationPlan(v.Id, immunizationPlan)
  39. }
  40. return cowImmunizationPlanList
  41. }
  42. type ImmunizationPlanCowSlice []*CowImmunizationPlan
  43. type ImmunizationCalendarHeader struct {
  44. Id string `json:"id"`
  45. CowId string `json:"cowId"`
  46. PlanStartTime string `json:"planStartTime"`
  47. ImmunizationPlanId string `json:"immunizationPlanId"`
  48. ImmunizationPlanName string `json:"immunizationPlanName"`
  49. Status string `json:"status"`
  50. }
  51. func (I ImmunizationPlanCowSlice) ToPB() []*CowImmunizationPlan {
  52. res := make([]*CowImmunizationPlan, len(I))
  53. for i, v := range I {
  54. res[i] = v
  55. }
  56. return res
  57. }