enum_map.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. package backend
  2. import (
  3. "kpt-pasture/model"
  4. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  5. )
  6. func (s *StoreEntry) DrugCategoryMaps(userModel *model.UserModel) map[pasturePb.DrugCategory_Kind]string {
  7. res := make(map[pasturePb.DrugCategory_Kind]string)
  8. for _, v := range s.DrugCategoryEnumList(userModel, "") {
  9. res[pasturePb.DrugCategory_Kind(v.Value)] = v.Label
  10. }
  11. return res
  12. }
  13. func (s *StoreEntry) DrugUsageMaps(userModel *model.UserModel) map[pasturePb.DrugUsage_Kind]string {
  14. res := make(map[pasturePb.DrugUsage_Kind]string)
  15. for _, v := range s.DrugUsageEnumList(userModel, "") {
  16. res[pasturePb.DrugUsage_Kind(v.Value)] = v.Label
  17. }
  18. return res
  19. }
  20. func (s *StoreEntry) ExposeEstrusTypeMap(userModel *model.UserModel) map[pasturePb.ExposeEstrusType_Kind]string {
  21. res := make(map[pasturePb.ExposeEstrusType_Kind]string)
  22. for _, v := range s.ExposeEstrusTypeEnumList(userModel, "") {
  23. res[pasturePb.ExposeEstrusType_Kind(v.Value)] = v.Label
  24. }
  25. return res
  26. }
  27. func (s *StoreEntry) FrozenSemenTypeMap(userModel *model.UserModel) map[pasturePb.FrozenSemenType_Kind]string {
  28. res := make(map[pasturePb.FrozenSemenType_Kind]string)
  29. for _, v := range s.FrozenSemenTypeEnumList(userModel, "") {
  30. res[pasturePb.FrozenSemenType_Kind(v.Value)] = v.Label
  31. }
  32. return res
  33. }
  34. func (s *StoreEntry) UnitMap(userModel *model.UserModel) map[pasturePb.Unit_Kind]string {
  35. res := make(map[pasturePb.Unit_Kind]string)
  36. for _, v := range s.UnitEnumList(userModel, "") {
  37. res[pasturePb.Unit_Kind(v.Value)] = v.Label
  38. }
  39. return res
  40. }
  41. func (s *StoreEntry) WeekMap(userModel *model.UserModel) map[pasturePb.Week_Kind]string {
  42. res := make(map[pasturePb.Week_Kind]string)
  43. for _, v := range s.WeekEnumList(userModel, "") {
  44. res[pasturePb.Week_Kind(v.Value)] = v.Label
  45. }
  46. return res
  47. }
  48. func (s *StoreEntry) MonthMap(userModel *model.UserModel) map[int32]string {
  49. res := make(map[int32]string)
  50. for _, v := range s.MonthEnumList(userModel, "") {
  51. res[v.Value] = v.Label
  52. }
  53. return res
  54. }
  55. func (s *StoreEntry) CowTypeMap(userModel *model.UserModel) map[pasturePb.CowType_Kind]string {
  56. res := make(map[pasturePb.CowType_Kind]string)
  57. optionName, isAll := "", ""
  58. for _, v := range s.CowTypeEnumList(userModel, optionName, isAll) {
  59. res[pasturePb.CowType_Kind(v.Value)] = v.Label
  60. }
  61. return res
  62. }
  63. func (s *StoreEntry) CowTypeMap2(userModel *model.UserModel) map[string]pasturePb.CowType_Kind {
  64. res := make(map[string]pasturePb.CowType_Kind)
  65. optionName, isAll := "", ""
  66. for _, v := range s.CowTypeEnumList(userModel, optionName, isAll) {
  67. res[v.Label] = pasturePb.CowType_Kind(v.Value)
  68. }
  69. return res
  70. }
  71. func (s *StoreEntry) CowBreedStatusMap(userModel *model.UserModel) map[pasturePb.BreedStatus_Kind]string {
  72. res := make(map[pasturePb.BreedStatus_Kind]string)
  73. for _, v := range s.BreedStatusEnumList(userModel, "") {
  74. res[pasturePb.BreedStatus_Kind(v.Value)] = v.Label
  75. }
  76. return res
  77. }
  78. func (s *StoreEntry) CowKindMap(userModel *model.UserModel) map[pasturePb.CowKind_Kind]string {
  79. res := make(map[pasturePb.CowKind_Kind]string)
  80. for _, v := range s.CowKindEnumList(userModel, "") {
  81. res[pasturePb.CowKind_Kind(v.Value)] = v.Label
  82. }
  83. return res
  84. }
  85. func (s *StoreEntry) CowKindMap2(userModel *model.UserModel) map[string]pasturePb.CowKind_Kind {
  86. res := make(map[string]pasturePb.CowKind_Kind)
  87. for _, v := range s.CowKindEnumList(userModel, "") {
  88. res[v.Label] = pasturePb.CowKind_Kind(v.Value)
  89. }
  90. return res
  91. }
  92. func (s *StoreEntry) CowSourceMap(userModel *model.UserModel) map[pasturePb.CowSource_Kind]string {
  93. res := make(map[pasturePb.CowSource_Kind]string)
  94. for _, v := range s.CowSourceEnumList(userModel, "") {
  95. res[pasturePb.CowSource_Kind(v.Value)] = v.Label
  96. }
  97. return res
  98. }
  99. func (s *StoreEntry) CowSourceMap2(userModel *model.UserModel) map[string]pasturePb.CowSource_Kind {
  100. res := make(map[string]pasturePb.CowSource_Kind)
  101. for _, v := range s.CowSourceEnumList(userModel, "") {
  102. res[v.Label] = pasturePb.CowSource_Kind(v.Value)
  103. }
  104. return res
  105. }
  106. func (s *StoreEntry) WorkOrderCategoryMap(userModel *model.UserModel) map[pasturePb.WorkOrderCategory_Kind]string {
  107. res := make(map[pasturePb.WorkOrderCategory_Kind]string)
  108. for _, v := range s.WorkOrderCategoryEnumList(userModel, "") {
  109. res[pasturePb.WorkOrderCategory_Kind(v.Value)] = v.Label
  110. }
  111. return res
  112. }
  113. func (s *StoreEntry) WorkOrderFrequencyMap(userModel *model.UserModel) map[pasturePb.WorkOrderFrequency_Kind]string {
  114. res := make(map[pasturePb.WorkOrderFrequency_Kind]string)
  115. for _, v := range s.WorkOrderFrequencyEnumList(userModel, "") {
  116. res[pasturePb.WorkOrderFrequency_Kind(v.Value)] = v.Label
  117. }
  118. return res
  119. }
  120. func (s *StoreEntry) WorkOrderSubUnitMap(userModel *model.UserModel) map[pasturePb.WorkOrderSubscribeUnit_Kind]string {
  121. res := make(map[pasturePb.WorkOrderSubscribeUnit_Kind]string)
  122. for _, v := range s.WorkOrderSubUnitEnumList(userModel, "") {
  123. res[pasturePb.WorkOrderSubscribeUnit_Kind(v.Value)] = v.Label
  124. }
  125. return res
  126. }
  127. func (s *StoreEntry) WorkOrderPriorityMap(userModel *model.UserModel) map[pasturePb.Priority_Kind]string {
  128. res := make(map[pasturePb.Priority_Kind]string)
  129. for _, v := range s.WorkOrderPriorityEnumList(userModel, "") {
  130. res[pasturePb.Priority_Kind(v.Value)] = v.Label
  131. }
  132. return res
  133. }
  134. func (s *StoreEntry) SameTimeCowTypeMap(userModel *model.UserModel) map[pasturePb.SameTimeCowType_Kind]string {
  135. res := make(map[pasturePb.SameTimeCowType_Kind]string)
  136. for _, v := range s.SameTimeCowTypeEnumList(userModel, "") {
  137. res[pasturePb.SameTimeCowType_Kind(v.Value)] = v.Label
  138. }
  139. return res
  140. }
  141. func (s *StoreEntry) CalendarTypeMap(userModel *model.UserModel) map[pasturePb.CalendarType_Kind]string {
  142. res := make(map[pasturePb.CalendarType_Kind]string)
  143. for _, v := range s.CalendarTypeEnumList(userModel, "") {
  144. res[pasturePb.CalendarType_Kind(v.Value)] = v.Label
  145. }
  146. return res
  147. }
  148. func CalendarTypeMap() map[pasturePb.CalendarType_Kind]string {
  149. res := make(map[pasturePb.CalendarType_Kind]string)
  150. for _, v := range CalendarTypeEnumList("") {
  151. res[pasturePb.CalendarType_Kind(v.Value)] = v.Label
  152. }
  153. return res
  154. }
  155. func (s *StoreEntry) AbortionReasonsMap(userModel *model.UserModel) map[pasturePb.AbortionReasons_Kind]string {
  156. res := make(map[pasturePb.AbortionReasons_Kind]string)
  157. for _, v := range s.AbortionReasonsEnumList(userModel, "") {
  158. res[pasturePb.AbortionReasons_Kind(v.Value)] = v.Label
  159. }
  160. return res
  161. }
  162. func (s *StoreEntry) PregnantCheckMethodMap(userModel *model.UserModel) map[pasturePb.PregnantCheckMethod_Kind]string {
  163. res := make(map[pasturePb.PregnantCheckMethod_Kind]string)
  164. for _, v := range s.PregnantCheckMethodEnumList(userModel, "") {
  165. res[pasturePb.PregnantCheckMethod_Kind(v.Value)] = v.Label
  166. }
  167. return res
  168. }
  169. func (s *StoreEntry) PregnantCheckResultMap(userModel *model.UserModel) map[pasturePb.PregnantCheckResult_Kind]string {
  170. res := make(map[pasturePb.PregnantCheckResult_Kind]string)
  171. for _, v := range s.PregnantCheckResultEnumList(userModel, "") {
  172. res[pasturePb.PregnantCheckResult_Kind(v.Value)] = v.Label
  173. }
  174. return res
  175. }
  176. func (s *StoreEntry) HealthStatusMap(userModel *model.UserModel) map[pasturePb.HealthStatus_Kind]string {
  177. res := make(map[pasturePb.HealthStatus_Kind]string)
  178. for _, v := range s.HealthStatusEnumList(userModel, "") {
  179. res[pasturePb.HealthStatus_Kind(v.Value)] = v.Label
  180. }
  181. return res
  182. }
  183. func (s *StoreEntry) PurposeMap(userModel *model.UserModel) map[pasturePb.Purpose_Kind]string {
  184. res := make(map[pasturePb.Purpose_Kind]string)
  185. for _, v := range s.CowPurposeList(userModel, "") {
  186. res[pasturePb.Purpose_Kind(v.Value)] = v.Label
  187. }
  188. return res
  189. }
  190. func (s *StoreEntry) PurposeMap2(userModel *model.UserModel) map[string]pasturePb.Purpose_Kind {
  191. res := make(map[string]pasturePb.Purpose_Kind)
  192. for _, v := range s.CowPurposeList(userModel, "") {
  193. res[v.Label] = pasturePb.Purpose_Kind(v.Value)
  194. }
  195. return res
  196. }
  197. func (s *StoreEntry) DiseaseTypeMap(userModel *model.UserModel) map[int32]string {
  198. res := make(map[int32]string)
  199. for _, v := range s.diseaseTypeEnumList(userModel, "") {
  200. res[v.Value] = v.Label
  201. }
  202. return res
  203. }
  204. func (s *StoreEntry) MultiFactorAnalysisMethodMap() map[pasturePb.MultiFactorAnalysisMethod_Kind]string {
  205. return map[pasturePb.MultiFactorAnalysisMethod_Kind]string{
  206. pasturePb.MultiFactorAnalysisMethod_Months: "months",
  207. pasturePb.MultiFactorAnalysisMethod_Week: "week",
  208. pasturePb.MultiFactorAnalysisMethod_Operation: "operation_name",
  209. pasturePb.MultiFactorAnalysisMethod_Bull: "frozen_semen_number",
  210. pasturePb.MultiFactorAnalysisMethod_Lact: "lact",
  211. pasturePb.MultiFactorAnalysisMethod_Mating_Times: "mating_times",
  212. pasturePb.MultiFactorAnalysisMethod_Breeding_Method: "expose_estrus_type",
  213. }
  214. }
  215. func (s *StoreEntry) NeckRingIsBindMap(userModel *model.UserModel) map[pasturePb.NeckRingIsBind_Kind]string {
  216. res := make(map[pasturePb.NeckRingIsBind_Kind]string)
  217. for _, v := range s.NeckRingIsBindEnumList(userModel, "") {
  218. res[pasturePb.NeckRingIsBind_Kind(v.Value)] = v.Label
  219. }
  220. return res
  221. }
  222. func (s *StoreEntry) NeckRingStatusMap(userModel *model.UserModel) map[pasturePb.NeckRingStatus_Kind]string {
  223. res := make(map[pasturePb.NeckRingStatus_Kind]string)
  224. for _, v := range s.NeckRingStatusEnumList(userModel, "") {
  225. res[pasturePb.NeckRingStatus_Kind(v.Value)] = v.Label
  226. }
  227. return res
  228. }
  229. func (s *StoreEntry) SaleCowAnalysisMap(userModel *model.UserModel) map[pasturePb.SaleCowAnalysisMethod_Kind]string {
  230. res := make(map[pasturePb.SaleCowAnalysisMethod_Kind]string)
  231. for _, v := range s.SaleCowAnalysisMethodEnumList(userModel, "") {
  232. res[pasturePb.SaleCowAnalysisMethod_Kind(v.Value)] = v.Label
  233. }
  234. return res
  235. }
  236. func (s *StoreEntry) OutTypeMap(userModel *model.UserModel) map[pasturePb.OutType_Kind]string {
  237. res := make(map[pasturePb.OutType_Kind]string)
  238. for _, v := range s.OutTypeEnumList(userModel, "") {
  239. res[pasturePb.OutType_Kind(v.Value)] = v.Label
  240. }
  241. return res
  242. }
  243. func (s *StoreEntry) AuditStatusMap(userModel *model.UserModel) map[pasturePb.AuditStatus_Kind]string {
  244. res := make(map[pasturePb.AuditStatus_Kind]string)
  245. for _, v := range s.AuditStatusEnumList(userModel, "") {
  246. res[pasturePb.AuditStatus_Kind(v.Value)] = v.Label
  247. }
  248. return res
  249. }
  250. func (s *StoreEntry) AdmissionStatusMap(userModel *model.UserModel) map[pasturePb.AdmissionStatus_Kind]string {
  251. res := make(map[pasturePb.AdmissionStatus_Kind]string)
  252. for _, v := range s.AdmissionStatusEnumList(userModel, "") {
  253. res[pasturePb.AdmissionStatus_Kind(v.Value)] = v.Label
  254. }
  255. return res
  256. }
  257. func (s *StoreEntry) SameTimeTypeMap(userModel *model.UserModel) map[pasturePb.SameTimeType_Kind]string {
  258. res := make(map[pasturePb.SameTimeType_Kind]string)
  259. for _, v := range s.SameTimeTypeEnumList(userModel, "") {
  260. res[pasturePb.SameTimeType_Kind(v.Value)] = v.Label
  261. }
  262. return res
  263. }
  264. func (s *StoreEntry) EventTypeMap(userModel *model.UserModel) map[pasturePb.EventType_Kind]string {
  265. res := make(map[pasturePb.EventType_Kind]string)
  266. for _, v := range s.EventTypeEnumList(userModel, "") {
  267. res[pasturePb.EventType_Kind(v.Value)] = v.Label
  268. }
  269. return res
  270. }
  271. func (s *StoreEntry) CalvingLevelMap(userModel *model.UserModel) map[pasturePb.CalvingLevel_Kind]string {
  272. res := make(map[pasturePb.CalvingLevel_Kind]string)
  273. for _, v := range s.CalvingLevelEnumList(userModel, "") {
  274. res[pasturePb.CalvingLevel_Kind(v.Value)] = v.Label
  275. }
  276. return res
  277. }
  278. func (s *StoreEntry) DystociaReasonMap(userModel *model.UserModel) map[pasturePb.DystociaReason_Kind]string {
  279. res := make(map[pasturePb.DystociaReason_Kind]string)
  280. for _, v := range s.DystociaReasonEnumList(userModel, "") {
  281. res[pasturePb.DystociaReason_Kind(v.Value)] = v.Label
  282. }
  283. return res
  284. }
  285. func (s *StoreEntry) DeadReasonMap(userModel *model.UserModel) map[pasturePb.DeathReason_Kind]string {
  286. res := make(map[pasturePb.DeathReason_Kind]string)
  287. for _, v := range s.DeathReasonEnumList(userModel, "") {
  288. res[pasturePb.DeathReason_Kind(v.Value)] = v.Label
  289. }
  290. return res
  291. }
  292. func (s *StoreEntry) MatingResultMap(userModel *model.UserModel) map[pasturePb.MatingResult_Kind]string {
  293. res := make(map[pasturePb.MatingResult_Kind]string)
  294. for _, v := range s.MatingResultEnumList(userModel, "") {
  295. res[pasturePb.MatingResult_Kind(v.Value)] = v.Label
  296. }
  297. return res
  298. }
  299. func (s *StoreEntry) EventCategoryMap(userModel *model.UserModel) map[pasturePb.EventCategory_Kind]string {
  300. res := make(map[pasturePb.EventCategory_Kind]string)
  301. for _, v := range s.EventCategoryEnumList(userModel, "") {
  302. res[pasturePb.EventCategory_Kind(v.Value)] = v.Label
  303. }
  304. return res
  305. }
  306. func (s *StoreEntry) GroupTransferReasonMap(userModel *model.UserModel) map[int32]string {
  307. res := make(map[int32]string)
  308. for _, v := range s.TransferPenEnumList(userModel, "") {
  309. res[v.Value] = v.Label
  310. }
  311. return res
  312. }
  313. func (s *StoreEntry) BarnTypeMap(userModel *model.UserModel) map[pasturePb.PenType_Kind]string {
  314. res := make(map[pasturePb.PenType_Kind]string)
  315. for _, v := range s.BarnTypeEnumList(userModel, nil, "") {
  316. res[pasturePb.PenType_Kind(v.Value)] = v.Label
  317. }
  318. return res
  319. }
  320. func (s *StoreEntry) UnMatingReasonsMap(userModel *model.UserModel) map[pasturePb.UnMatingReasons_Kind]string {
  321. res := make(map[pasturePb.UnMatingReasons_Kind]string)
  322. for _, v := range s.UnMatingReasonsEnumList(userModel, "") {
  323. res[pasturePb.UnMatingReasons_Kind(v.Value)] = v.Label
  324. }
  325. return res
  326. }
  327. func (s *StoreEntry) ForbiddenMatingReasonsMap(userModel *model.UserModel) map[pasturePb.ForbiddenMatingReasons_Kind]string {
  328. res := make(map[pasturePb.ForbiddenMatingReasons_Kind]string)
  329. for _, v := range s.ForbiddenMatingReasonsEnumList(userModel, "") {
  330. res[pasturePb.ForbiddenMatingReasons_Kind(v.Value)] = v.Label
  331. }
  332. return res
  333. }
  334. func (s *StoreEntry) CowOutReasonsMap(userModel *model.UserModel) map[pasturePb.OutReasons_Kind]string {
  335. res := make(map[pasturePb.OutReasons_Kind]string)
  336. for _, v := range s.CowOutReasonEnumList(userModel, "") {
  337. res[pasturePb.OutReasons_Kind(v.Value)] = v.Label
  338. }
  339. return res
  340. }
  341. func (s *StoreEntry) CowDeathDestinationMap(userModel *model.UserModel) map[pasturePb.DeathDestination_Kind]string {
  342. res := make(map[pasturePb.DeathDestination_Kind]string)
  343. for _, v := range s.CowDeathDestinationList(userModel, "") {
  344. res[pasturePb.DeathDestination_Kind(v.Value)] = v.Label
  345. }
  346. return res
  347. }
  348. func (s *StoreEntry) WarningHealthLevelMap(userModel *model.UserModel) map[pasturePb.WarningHealthLevel_Kind]string {
  349. res := make(map[pasturePb.WarningHealthLevel_Kind]string)
  350. for _, v := range s.WarningHealthLevel(userModel, "") {
  351. res[pasturePb.WarningHealthLevel_Kind(v.Value)] = v.Label
  352. }
  353. return res
  354. }
  355. func (s *StoreEntry) eventCategoryMap() map[pasturePb.EventType_Kind]pasturePb.EventCategory_Kind {
  356. return map[pasturePb.EventType_Kind]pasturePb.EventCategory_Kind{
  357. pasturePb.EventType_Enter: pasturePb.EventCategory_Base,
  358. pasturePb.EventType_Transfer_Ben: pasturePb.EventCategory_Base,
  359. pasturePb.EventType_Body_Score: pasturePb.EventCategory_Base,
  360. pasturePb.EventType_Pregnancy_Check: pasturePb.EventCategory_Base,
  361. pasturePb.EventType_Weight: pasturePb.EventCategory_Base,
  362. pasturePb.EventType_Death: pasturePb.EventCategory_Base,
  363. pasturePb.EventType_Out: pasturePb.EventCategory_Base,
  364. pasturePb.EventType_Dry_Milk: pasturePb.EventCategory_Breed,
  365. pasturePb.EventType_Estrus: pasturePb.EventCategory_Breed,
  366. pasturePb.EventType_Calving: pasturePb.EventCategory_Breed,
  367. pasturePb.EventType_Seme_Time: pasturePb.EventCategory_Breed,
  368. pasturePb.EventType_Mating: pasturePb.EventCategory_Breed,
  369. pasturePb.EventType_Birth: pasturePb.EventCategory_Breed,
  370. pasturePb.EventType_ForbiddenMating: pasturePb.EventCategory_Breed,
  371. pasturePb.EventType_UnForbiddenMating: pasturePb.EventCategory_Breed,
  372. pasturePb.EventType_Immunication: pasturePb.EventCategory_Health,
  373. pasturePb.EventType_Castrated: pasturePb.EventCategory_Health,
  374. pasturePb.EventType_Insect_Repellent: pasturePb.EventCategory_Health,
  375. pasturePb.EventType_Disease: pasturePb.EventCategory_Health,
  376. pasturePb.EventType_Weaning: pasturePb.EventCategory_Breed,
  377. pasturePb.EventType_Sale: pasturePb.EventCategory_Other,
  378. pasturePb.EventType_Abort: pasturePb.EventCategory_Other,
  379. }
  380. }