config_data_base.go 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. package backend
  2. import (
  3. "context"
  4. "kpt-pasture/model"
  5. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  6. )
  7. func (s *StoreEntry) DepartureTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  8. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  9. if isAll == model.IsAllYes {
  10. configOptions = append(configOptions,
  11. &pasturePb.ConfigOptionsList{
  12. Value: int32(0),
  13. Label: "全部",
  14. Disabled: true,
  15. })
  16. }
  17. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  18. Value: int32(pasturePb.DepartureType_Death),
  19. Label: "死亡",
  20. Disabled: true,
  21. }, &pasturePb.ConfigOptionsList{
  22. Value: int32(pasturePb.DepartureType_Out),
  23. Label: "淘汰",
  24. Disabled: true,
  25. })
  26. return configOptions
  27. }
  28. func (s *StoreEntry) OutReasonEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  29. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  30. if isAll == model.IsAllYes {
  31. configOptions = append(configOptions,
  32. &pasturePb.ConfigOptionsList{
  33. Value: int32(0),
  34. Label: "全部",
  35. Disabled: true,
  36. })
  37. }
  38. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  39. Value: int32(pasturePb.OutReason_Long_Term_infertility),
  40. Label: "久配不孕",
  41. Disabled: true,
  42. }, &pasturePb.ConfigOptionsList{
  43. Value: int32(pasturePb.OutReason_Multiple_Miscarriages),
  44. Label: "多次流产",
  45. Disabled: true,
  46. }, &pasturePb.ConfigOptionsList{
  47. Value: int32(pasturePb.OutReason_Long_Treatment_Without_Recovery),
  48. Label: "久治不愈",
  49. Disabled: true,
  50. }, &pasturePb.ConfigOptionsList{
  51. Value: int32(pasturePb.OutReason_Postpartum_Paralysis),
  52. Label: "产后瘫痪",
  53. Disabled: true,
  54. }, &pasturePb.ConfigOptionsList{
  55. Value: int32(pasturePb.OutReason_Mastitis),
  56. Label: "乳房炎",
  57. Disabled: true,
  58. }, &pasturePb.ConfigOptionsList{
  59. Value: int32(pasturePb.OutReason_Hoof_Disease),
  60. Label: "蹄病",
  61. Disabled: true,
  62. }, &pasturePb.ConfigOptionsList{
  63. Value: int32(pasturePb.OutReason_Congenital_Malformation),
  64. Label: "先天畸形",
  65. Disabled: true,
  66. }, &pasturePb.ConfigOptionsList{
  67. Value: int32(pasturePb.OutReason_Dysplasia),
  68. Label: "发育不良",
  69. Disabled: true,
  70. }, &pasturePb.ConfigOptionsList{
  71. Value: int32(pasturePb.OutReason_Hernia),
  72. Label: "疝气",
  73. Disabled: true,
  74. }, &pasturePb.ConfigOptionsList{
  75. Value: int32(pasturePb.OutReason_Excessive_Age),
  76. Label: "月龄过大",
  77. Disabled: true,
  78. }, &pasturePb.ConfigOptionsList{
  79. Value: int32(pasturePb.OutReason_Excessive_Weight),
  80. Label: "体重过肥",
  81. Disabled: true,
  82. }, &pasturePb.ConfigOptionsList{
  83. Value: int32(pasturePb.OutReason_Other_Disease),
  84. Label: "其他疾病",
  85. Disabled: true,
  86. }, &pasturePb.ConfigOptionsList{
  87. Value: int32(pasturePb.OutReason_Weak_Child),
  88. Label: "弱仔",
  89. Disabled: true,
  90. }, &pasturePb.ConfigOptionsList{
  91. Value: int32(pasturePb.OutReason_Obsessive_Bull),
  92. Label: "恶癖牛",
  93. Disabled: true,
  94. }, &pasturePb.ConfigOptionsList{
  95. Value: int32(pasturePb.OutReason_Splitting),
  96. Label: "滑倒卧地不起",
  97. Disabled: true,
  98. }, &pasturePb.ConfigOptionsList{
  99. Value: int32(pasturePb.OutReason_Other),
  100. Label: "其他",
  101. Disabled: true,
  102. })
  103. return configOptions
  104. }
  105. func (s *StoreEntry) DeadReasonEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  106. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  107. if isAll == model.IsAllYes {
  108. configOptions = append(configOptions,
  109. &pasturePb.ConfigOptionsList{
  110. Value: int32(0),
  111. Label: "全部",
  112. Disabled: true,
  113. })
  114. }
  115. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  116. Value: int32(pasturePb.DeadReason_Digestive_System_Diseases),
  117. Label: "消化性疾病",
  118. Disabled: true,
  119. }, &pasturePb.ConfigOptionsList{
  120. Value: int32(pasturePb.DeadReason_Respiratory_System_Diseases),
  121. Label: "呼吸性疾病",
  122. Disabled: true,
  123. }, &pasturePb.ConfigOptionsList{
  124. Value: int32(pasturePb.DeadReason_Reproductive_System_Diseases),
  125. Label: "繁殖性疾病",
  126. Disabled: true,
  127. }, &pasturePb.ConfigOptionsList{
  128. Value: int32(pasturePb.DeadReason_Metabolic_System_Diseases),
  129. Label: "代谢性疾病",
  130. Disabled: true,
  131. }, &pasturePb.ConfigOptionsList{
  132. Value: int32(pasturePb.DeadReason_Infectious_Diseases),
  133. Label: "传染性疾病",
  134. Disabled: true,
  135. }, &pasturePb.ConfigOptionsList{
  136. Value: int32(pasturePb.DeadReason_Difficult_Birth),
  137. Label: "难产",
  138. Disabled: true,
  139. }, &pasturePb.ConfigOptionsList{
  140. Value: int32(pasturePb.DeadReason_Accident_Dead),
  141. Label: "意外死亡",
  142. Disabled: true,
  143. }, &pasturePb.ConfigOptionsList{
  144. Value: int32(pasturePb.DeadReason_Other),
  145. Label: "其他",
  146. Disabled: true,
  147. })
  148. return configOptions
  149. }
  150. func (s *StoreEntry) MatingResultEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  151. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  152. if isAll == model.IsAllYes {
  153. configOptions = append(configOptions,
  154. &pasturePb.ConfigOptionsList{
  155. Value: int32(0),
  156. Label: "全部",
  157. Disabled: true,
  158. })
  159. }
  160. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  161. Value: int32(pasturePb.MatingResult_Unknown),
  162. Label: "未知",
  163. Disabled: true,
  164. }, &pasturePb.ConfigOptionsList{
  165. Value: int32(pasturePb.MatingResult_ReMatch),
  166. Label: "复配",
  167. Disabled: true,
  168. }, &pasturePb.ConfigOptionsList{
  169. Value: int32(pasturePb.MatingResult_Pregnant),
  170. Label: "怀孕",
  171. Disabled: true,
  172. }, &pasturePb.ConfigOptionsList{
  173. Value: int32(pasturePb.MatingResult_Empty),
  174. Label: "空怀",
  175. Disabled: true,
  176. }, &pasturePb.ConfigOptionsList{
  177. Value: int32(pasturePb.MatingResult_Abort),
  178. Label: "流产",
  179. Disabled: true,
  180. })
  181. return configOptions
  182. }
  183. func (s *StoreEntry) EventCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  184. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  185. if isAll == model.IsAllYes {
  186. configOptions = append(configOptions,
  187. &pasturePb.ConfigOptionsList{
  188. Value: int32(0),
  189. Label: "全部",
  190. Disabled: true,
  191. })
  192. }
  193. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  194. Value: int32(pasturePb.EventCategory_Base),
  195. Label: "基础事件",
  196. Disabled: true,
  197. }, &pasturePb.ConfigOptionsList{
  198. Value: int32(pasturePb.EventCategory_Breed),
  199. Label: "繁殖事件",
  200. Disabled: true,
  201. }, &pasturePb.ConfigOptionsList{
  202. Value: int32(pasturePb.EventCategory_Health),
  203. Label: "兽医事件",
  204. Disabled: true,
  205. }, &pasturePb.ConfigOptionsList{
  206. Value: int32(pasturePb.EventCategory_Other),
  207. Label: "其他事件",
  208. Disabled: true,
  209. })
  210. return configOptions
  211. }
  212. func (s *StoreEntry) IndicatorsDetailsList(isAll string) []*pasturePb.ConfigOptionsList {
  213. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  214. if isAll == model.IsAllYes {
  215. configOptions = append(configOptions,
  216. &pasturePb.ConfigOptionsList{
  217. Value: int32(0),
  218. Label: "全部",
  219. Disabled: true,
  220. })
  221. }
  222. indicatorsDetailsList, _ := s.FindIndicatorsDetailsList(context.Background())
  223. if len(indicatorsDetailsList) <= 0 {
  224. return configOptions
  225. }
  226. for _, v := range indicatorsDetailsList {
  227. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  228. Label: v.Name,
  229. Disabled: true,
  230. Props: v.Kind,
  231. })
  232. }
  233. return configOptions
  234. }