config_data.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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) BarnTypeEnumList(excludeTypes []pasturePb.PenType_Kind) []*pasturePb.ConfigOptionsList {
  7. allBarnTypes := s.BarnTypeMap()
  8. barnTypeList := make([]*pasturePb.ConfigOptionsList, 0)
  9. for v1 := range allBarnTypes {
  10. var info bool
  11. for _, v2 := range excludeTypes {
  12. if v1 == v2 {
  13. info = true
  14. break
  15. }
  16. }
  17. if !info {
  18. barnTypeList = append(barnTypeList, &pasturePb.ConfigOptionsList{
  19. Value: int32(v1),
  20. Label: allBarnTypes[v1],
  21. Disabled: true,
  22. })
  23. }
  24. }
  25. return barnTypeList
  26. }
  27. func (s *StoreEntry) BreedStatusEnumList() []*pasturePb.ConfigOptionsList {
  28. breedStatusList := make([]*pasturePb.ConfigOptionsList, 0)
  29. breedStatusList = append(breedStatusList, &pasturePb.ConfigOptionsList{
  30. Value: int32(pasturePb.BreedStatus_UnBreed),
  31. Label: "未配",
  32. Disabled: true,
  33. }, &pasturePb.ConfigOptionsList{
  34. Value: int32(pasturePb.BreedStatus_Breeding),
  35. Label: "已配未检",
  36. Disabled: true,
  37. }, &pasturePb.ConfigOptionsList{
  38. Value: int32(pasturePb.BreedStatus_Pregnant),
  39. Label: "怀孕",
  40. Disabled: true,
  41. }, &pasturePb.ConfigOptionsList{
  42. Value: int32(pasturePb.BreedStatus_Empty),
  43. Label: "空怀",
  44. Disabled: true,
  45. }, &pasturePb.ConfigOptionsList{
  46. Value: int32(pasturePb.BreedStatus_Calving),
  47. Label: "产犊",
  48. Disabled: true,
  49. }, &pasturePb.ConfigOptionsList{
  50. Value: int32(pasturePb.BreedStatus_Abort),
  51. Label: "流产",
  52. Disabled: true,
  53. }, &pasturePb.ConfigOptionsList{
  54. Value: int32(pasturePb.BreedStatus_No_Mating),
  55. Label: "禁配",
  56. Disabled: true,
  57. })
  58. return breedStatusList
  59. }
  60. func (s *StoreEntry) CowKindEnumList() []*pasturePb.ConfigOptionsList {
  61. cowKindList := make([]*pasturePb.ConfigOptionsList, 0)
  62. cowKindList = append(cowKindList,
  63. &pasturePb.ConfigOptionsList{
  64. Value: int32(pasturePb.CowKind_JSN),
  65. Label: "娟姗牛",
  66. Disabled: true,
  67. },
  68. &pasturePb.ConfigOptionsList{
  69. Value: int32(pasturePb.CowKind_XMTEN),
  70. Label: "西门塔尔牛",
  71. Disabled: true,
  72. }, &pasturePb.ConfigOptionsList{
  73. Value: int32(pasturePb.CowKind_AGSN),
  74. Label: "安格斯牛",
  75. Disabled: true,
  76. }, &pasturePb.ConfigOptionsList{
  77. Value: int32(pasturePb.CowKind_XNLN),
  78. Label: "夏洛莱牛",
  79. Disabled: true,
  80. }, &pasturePb.ConfigOptionsList{
  81. Value: int32(pasturePb.CowKind_LMZN),
  82. Label: "利木赞牛",
  83. Disabled: true,
  84. }, &pasturePb.ConfigOptionsList{
  85. Value: int32(pasturePb.CowKind_HFTN),
  86. Label: "海福特牛",
  87. Disabled: true,
  88. }, &pasturePb.ConfigOptionsList{
  89. Value: int32(pasturePb.CowKind_HN),
  90. Label: "和牛",
  91. Disabled: true,
  92. }, &pasturePb.ConfigOptionsList{
  93. Value: int32(pasturePb.CowKind_HX),
  94. Label: "华西牛",
  95. Disabled: true,
  96. })
  97. return cowKindList
  98. }
  99. func (s *StoreEntry) CowSourceEnumList() []*pasturePb.ConfigOptionsList {
  100. cowSourceList := make([]*pasturePb.ConfigOptionsList, 0)
  101. cowSourceList = append(cowSourceList, &pasturePb.ConfigOptionsList{
  102. Value: int32(pasturePb.CowSource_Calving),
  103. Label: "产犊",
  104. Disabled: true,
  105. }, &pasturePb.ConfigOptionsList{
  106. Value: int32(pasturePb.CowSource_Transfer_In),
  107. Label: "调入",
  108. Disabled: true,
  109. }, &pasturePb.ConfigOptionsList{
  110. Value: int32(pasturePb.CowSource_Buy),
  111. Label: "购买",
  112. Disabled: true,
  113. })
  114. return cowSourceList
  115. }
  116. func (s *StoreEntry) CowTypeEnumList(optionName, isAll string) []*pasturePb.ConfigOptionsList {
  117. cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
  118. if isAll == model.IsAllYes {
  119. cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
  120. Value: int32(pasturePb.CowType_Invalid),
  121. Label: "全部",
  122. Disabled: true,
  123. })
  124. }
  125. if optionName == "breed" {
  126. cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
  127. Value: int32(pasturePb.CowType_Reserve_Calf),
  128. Label: "后备牛",
  129. Disabled: true,
  130. }, &pasturePb.ConfigOptionsList{
  131. Value: int32(pasturePb.CowType_Breeding_Calf),
  132. Label: "成母牛",
  133. Disabled: true,
  134. })
  135. return cowTypeList
  136. }
  137. cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
  138. Value: int32(pasturePb.CowType_Lactating_Calf),
  139. Label: "哺乳犊牛",
  140. Disabled: true,
  141. }, &pasturePb.ConfigOptionsList{
  142. Value: int32(pasturePb.CowType_Weaned_Calf),
  143. Label: "育成牛",
  144. Disabled: true,
  145. }, &pasturePb.ConfigOptionsList{
  146. Value: int32(pasturePb.CowType_Youth_Calf),
  147. Label: "青年牛",
  148. Disabled: true,
  149. }, &pasturePb.ConfigOptionsList{
  150. Value: int32(pasturePb.CowType_Fattening_Calf),
  151. Label: "育肥牛",
  152. Disabled: true,
  153. }, &pasturePb.ConfigOptionsList{
  154. Value: int32(pasturePb.CowType_Reserve_Calf),
  155. Label: "后备牛",
  156. Disabled: true,
  157. }, &pasturePb.ConfigOptionsList{
  158. Value: int32(pasturePb.CowType_Breeding_Calf),
  159. Label: "成母牛",
  160. Disabled: true,
  161. }, &pasturePb.ConfigOptionsList{
  162. Value: int32(pasturePb.CowType_Breeding_Bull),
  163. Label: "种公牛",
  164. Disabled: true,
  165. })
  166. return cowTypeList
  167. }
  168. func (s *StoreEntry) SameTimeCowTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  169. cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
  170. if isAll == model.IsAllYes {
  171. cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
  172. Value: int32(pasturePb.SameTimeCowType_Invalid),
  173. Label: "全部",
  174. Disabled: true,
  175. })
  176. }
  177. cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
  178. Value: int32(pasturePb.SameTimeCowType_Empty),
  179. Label: "空怀牛",
  180. Disabled: true,
  181. }, &pasturePb.ConfigOptionsList{
  182. Value: int32(pasturePb.SameTimeCowType_Breeding_Calf),
  183. Label: "成母牛",
  184. Disabled: true,
  185. })
  186. return cowTypeList
  187. }
  188. func (s *StoreEntry) SameTimeTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  189. cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
  190. if isAll == model.IsAllYes {
  191. cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
  192. Value: int32(pasturePb.SameTimeType_Invalid),
  193. Label: "全部",
  194. Disabled: true,
  195. })
  196. }
  197. cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
  198. Value: int32(pasturePb.SameTimeType_PGBJ),
  199. Label: "PG保健",
  200. Disabled: true,
  201. }, &pasturePb.ConfigOptionsList{
  202. Value: int32(pasturePb.SameTimeType_PGTQ),
  203. Label: "PG同期",
  204. Disabled: true,
  205. }, &pasturePb.ConfigOptionsList{
  206. Value: int32(pasturePb.SameTimeType_RnGH),
  207. Label: "RnGH",
  208. Disabled: true,
  209. }, &pasturePb.ConfigOptionsList{
  210. Value: int32(pasturePb.SameTimeType_TAI),
  211. Label: "TAI输精",
  212. Disabled: true,
  213. })
  214. return cowTypeList
  215. }
  216. func (s *StoreEntry) ImmunizationCowTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  217. cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
  218. cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
  219. Value: int32(pasturePb.CowType_Lactating_Calf),
  220. Label: "犊牛",
  221. Disabled: true,
  222. }, &pasturePb.ConfigOptionsList{
  223. Value: int32(pasturePb.CowType_Weaned_Calf),
  224. Label: "育成牛",
  225. Disabled: true,
  226. }, &pasturePb.ConfigOptionsList{
  227. Value: int32(pasturePb.CowType_Youth_Calf),
  228. Label: "青年牛",
  229. Disabled: true,
  230. }, &pasturePb.ConfigOptionsList{
  231. Value: int32(pasturePb.CowType_Fattening_Calf),
  232. Label: "育肥牛",
  233. Disabled: true,
  234. }, &pasturePb.ConfigOptionsList{
  235. Value: int32(pasturePb.CowType_Reserve_Calf),
  236. Label: "后备牛",
  237. Disabled: true,
  238. }, &pasturePb.ConfigOptionsList{
  239. Value: int32(pasturePb.CowType_Breeding_Calf),
  240. Label: "成母牛",
  241. Disabled: true,
  242. }, &pasturePb.ConfigOptionsList{
  243. Value: int32(pasturePb.CowType_Breeding_Bull),
  244. Label: "种公牛",
  245. Disabled: true,
  246. })
  247. return cowTypeList
  248. }
  249. func (s *StoreEntry) ImmunizationConditionsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  250. cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
  251. if isAll == model.IsAllYes {
  252. cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
  253. Value: int32(pasturePb.ImmunizationConditions_Invalid),
  254. Label: "全部",
  255. Disabled: true,
  256. })
  257. }
  258. cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
  259. Value: int32(pasturePb.ImmunizationConditions_Days_Age),
  260. Label: "日龄",
  261. Disabled: true,
  262. }, &pasturePb.ConfigOptionsList{
  263. Value: int32(pasturePb.ImmunizationConditions_Days_After_Delivery),
  264. Label: "产后天数",
  265. Disabled: true,
  266. }, &pasturePb.ConfigOptionsList{
  267. Value: int32(pasturePb.ImmunizationConditions_Days_Of_Pregnancy),
  268. Label: "怀孕天数",
  269. Disabled: true,
  270. }, &pasturePb.ConfigOptionsList{
  271. Value: int32(pasturePb.ImmunizationConditions_Admission_Days),
  272. Label: "入场天数",
  273. Disabled: true,
  274. }, &pasturePb.ConfigOptionsList{
  275. Value: int32(pasturePb.ImmunizationConditions_Other_Vaccine_After),
  276. Label: "基于其他疫苗之后",
  277. Disabled: true,
  278. })
  279. return cowTypeList
  280. }
  281. func (s *StoreEntry) TransferPenEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  282. transferPenList := make([]*pasturePb.ConfigOptionsList, 0)
  283. if isAll == model.IsAllYes {
  284. transferPenList = append(transferPenList, &pasturePb.ConfigOptionsList{
  285. Value: int32(pasturePb.TransferPenReason_Invalid),
  286. Label: "全部",
  287. Disabled: true,
  288. })
  289. }
  290. transferPenList = append(transferPenList, &pasturePb.ConfigOptionsList{
  291. Value: int32(pasturePb.TransferPenReason_Normal),
  292. Label: "正常转群",
  293. Disabled: true,
  294. }, &pasturePb.ConfigOptionsList{
  295. Value: int32(pasturePb.TransferPenReason_Feed),
  296. Label: "饲喂转群",
  297. Disabled: true,
  298. }, &pasturePb.ConfigOptionsList{
  299. Value: int32(pasturePb.TransferPenReason_Dry_Milk),
  300. Label: "干奶转群",
  301. Disabled: true,
  302. }, &pasturePb.ConfigOptionsList{
  303. Value: int32(pasturePb.TransferPenReason_Pregnant),
  304. Label: "怀孕转群",
  305. Disabled: true,
  306. }, &pasturePb.ConfigOptionsList{
  307. Value: int32(pasturePb.TransferPenReason_Overantibody),
  308. Label: "过抗转群",
  309. Disabled: true,
  310. })
  311. return transferPenList
  312. }
  313. func (s *StoreEntry) ChildNumberEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  314. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  315. if isAll == model.IsAllYes {
  316. configOptions = append(configOptions,
  317. &pasturePb.ConfigOptionsList{
  318. Value: int32(pasturePb.ChildNumber_Invalid),
  319. Label: "全部",
  320. Disabled: true,
  321. })
  322. }
  323. configOptions = append(configOptions,
  324. &pasturePb.ConfigOptionsList{
  325. Value: int32(pasturePb.ChildNumber_One),
  326. Label: "单胎",
  327. Disabled: true,
  328. }, &pasturePb.ConfigOptionsList{
  329. Value: int32(pasturePb.ChildNumber_Two),
  330. Label: "双胎",
  331. Disabled: true,
  332. }, &pasturePb.ConfigOptionsList{
  333. Value: int32(pasturePb.ChildNumber_Three),
  334. Label: "三胎",
  335. Disabled: true,
  336. }, &pasturePb.ConfigOptionsList{
  337. Value: int32(pasturePb.ChildNumber_Four),
  338. Label: "四胎",
  339. Disabled: true,
  340. })
  341. return configOptions
  342. }
  343. func (s *StoreEntry) CalvingLevelEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  344. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  345. if isAll == model.IsAllYes {
  346. configOptions = append(configOptions,
  347. &pasturePb.ConfigOptionsList{
  348. Value: int32(pasturePb.CalvingLevel_Invalid),
  349. Label: "全部",
  350. Disabled: true,
  351. })
  352. }
  353. configOptions = append(configOptions,
  354. &pasturePb.ConfigOptionsList{
  355. Value: int32(pasturePb.CalvingLevel_Natural_Childbirth),
  356. Label: "自然分娩",
  357. Disabled: true,
  358. }, &pasturePb.ConfigOptionsList{
  359. Value: int32(pasturePb.CalvingLevel_Artificial_Midwifery1),
  360. Label: "人工助产(1-2人)",
  361. Disabled: true,
  362. }, &pasturePb.ConfigOptionsList{
  363. Value: int32(pasturePb.CalvingLevel_Artificial_Midwifery2),
  364. Label: "人工助产(3人以上)",
  365. Disabled: true,
  366. }, &pasturePb.ConfigOptionsList{
  367. Value: int32(pasturePb.CalvingLevel_Caesarean_Section),
  368. Label: "剖腹产",
  369. Disabled: true,
  370. })
  371. return configOptions
  372. }
  373. func (s *StoreEntry) DystociaReasonEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  374. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  375. if isAll == model.IsAllYes {
  376. configOptions = append(configOptions,
  377. &pasturePb.ConfigOptionsList{
  378. Value: int32(pasturePb.DystociaReason_Invalid),
  379. Label: "全部",
  380. Disabled: true,
  381. })
  382. }
  383. configOptions = append(configOptions,
  384. &pasturePb.ConfigOptionsList{
  385. Value: int32(pasturePb.DystociaReason_Malposition),
  386. Label: "胎位不正",
  387. Disabled: true,
  388. }, &pasturePb.ConfigOptionsList{
  389. Value: int32(pasturePb.DystociaReason_Fetal_Overgrowth),
  390. Label: "胎儿过大",
  391. Disabled: true,
  392. }, &pasturePb.ConfigOptionsList{
  393. Value: int32(pasturePb.DystociaReason_Uterine_Atony),
  394. Label: "子宫收缩无力",
  395. Disabled: true,
  396. }, &pasturePb.ConfigOptionsList{
  397. Value: int32(pasturePb.DystociaReason_Pelvic_Stenosis),
  398. Label: "盆骨狭小",
  399. Disabled: true,
  400. }, &pasturePb.ConfigOptionsList{
  401. Value: int32(pasturePb.DystociaReason_Sub_Health),
  402. Label: "母牛亚健康状态",
  403. Disabled: true,
  404. })
  405. return configOptions
  406. }
  407. func (s *StoreEntry) PregnantCheckResultEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  408. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  409. if isAll == model.IsAllYes {
  410. configOptions = append(configOptions,
  411. &pasturePb.ConfigOptionsList{
  412. Value: int32(pasturePb.PregnantCheckResult_Invalid),
  413. Label: "全部",
  414. Disabled: true,
  415. })
  416. }
  417. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  418. Value: int32(pasturePb.PregnantCheckResult_Pregnant),
  419. Label: "有胎",
  420. Disabled: true,
  421. }, &pasturePb.ConfigOptionsList{
  422. Value: int32(pasturePb.PregnantCheckResult_UnPregnant),
  423. Label: "无胎",
  424. Disabled: true,
  425. })
  426. return configOptions
  427. }