config_data.go 13 KB

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