config_data_base.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  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) OutReasonEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  7. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  8. if isAll == model.IsAllYes {
  9. configOptions = append(configOptions,
  10. &pasturePb.ConfigOptionsList{
  11. Value: int32(0),
  12. Label: "全部",
  13. Disabled: true,
  14. })
  15. }
  16. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  17. Value: int32(pasturePb.OutReasons_Respiratory_System_Disease),
  18. Label: "呼吸系统疾病",
  19. Disabled: true,
  20. }, &pasturePb.ConfigOptionsList{
  21. Value: int32(pasturePb.OutReasons_Nutritional_Metabolic_Disease),
  22. Label: "营养代谢疾病",
  23. Disabled: true,
  24. }, &pasturePb.ConfigOptionsList{
  25. Value: int32(pasturePb.OutReasons_Breeding_Disease),
  26. Label: "繁殖疾病",
  27. Disabled: true,
  28. }, &pasturePb.ConfigOptionsList{
  29. Value: int32(pasturePb.OutReasons_Breast_Disease),
  30. Label: "乳房疾病",
  31. Disabled: true,
  32. }, &pasturePb.ConfigOptionsList{
  33. Value: int32(pasturePb.OutReasons_Long_Term_infertility),
  34. Label: "久配不孕",
  35. Disabled: true,
  36. }, &pasturePb.ConfigOptionsList{
  37. Value: int32(pasturePb.OutReasons_Multiple_Miscarriages),
  38. Label: "多次流产",
  39. Disabled: true,
  40. }, &pasturePb.ConfigOptionsList{
  41. Value: int32(pasturePb.OutReasons_Long_Treatment_Without_Recovery),
  42. Label: "久治不愈",
  43. Disabled: true,
  44. }, &pasturePb.ConfigOptionsList{
  45. Value: int32(pasturePb.OutReasons_Postpartum_Paralysis),
  46. Label: "产后瘫痪",
  47. Disabled: true,
  48. }, &pasturePb.ConfigOptionsList{
  49. Value: int32(pasturePb.OutReasons_Mastitis),
  50. Label: "乳房炎",
  51. Disabled: true,
  52. }, &pasturePb.ConfigOptionsList{
  53. Value: int32(pasturePb.OutReasons_Hoof_Disease),
  54. Label: "蹄病",
  55. Disabled: true,
  56. }, &pasturePb.ConfigOptionsList{
  57. Value: int32(pasturePb.OutReasons_Congenital_Malformation),
  58. Label: "先天畸形",
  59. Disabled: true,
  60. }, &pasturePb.ConfigOptionsList{
  61. Value: int32(pasturePb.OutReasons_Congenital_Malformation),
  62. Label: "先天畸形",
  63. Disabled: true,
  64. }, &pasturePb.ConfigOptionsList{
  65. Value: int32(pasturePb.OutReasons_Dysplasia),
  66. Label: "发育不良",
  67. Disabled: true,
  68. }, &pasturePb.ConfigOptionsList{
  69. Value: int32(pasturePb.OutReasons_Hernia),
  70. Label: "疝气",
  71. Disabled: true,
  72. }, &pasturePb.ConfigOptionsList{
  73. Value: int32(pasturePb.OutReasons_Excessive_Age),
  74. Label: "月龄过大",
  75. Disabled: true,
  76. }, &pasturePb.ConfigOptionsList{
  77. Value: int32(pasturePb.OutReasons_Excessive_Age),
  78. Label: "月龄过大",
  79. Disabled: true,
  80. }, &pasturePb.ConfigOptionsList{
  81. Value: int32(pasturePb.OutReasons_Excessive_Weight),
  82. Label: "体重过肥",
  83. Disabled: true,
  84. }, &pasturePb.ConfigOptionsList{
  85. Value: int32(pasturePb.OutReasons_Other_Disease),
  86. Label: "其他疾病",
  87. Disabled: true,
  88. }, &pasturePb.ConfigOptionsList{
  89. Value: int32(pasturePb.OutReasons_Weak_Child),
  90. Label: "弱仔",
  91. Disabled: true,
  92. }, &pasturePb.ConfigOptionsList{
  93. Value: int32(pasturePb.OutReasons_Obsessive_Bull),
  94. Label: "恶癖牛",
  95. Disabled: true,
  96. }, &pasturePb.ConfigOptionsList{
  97. Value: int32(pasturePb.OutReasons_Low_Milk),
  98. Label: "低产",
  99. Disabled: true,
  100. }, &pasturePb.ConfigOptionsList{
  101. Value: int32(pasturePb.OutReasons_Slow_Growing),
  102. Label: "生长缓慢",
  103. Disabled: true,
  104. }, &pasturePb.ConfigOptionsList{
  105. Value: int32(pasturePb.OutReasons_Other),
  106. Label: "其他",
  107. Disabled: true,
  108. }, &pasturePb.ConfigOptionsList{
  109. Value: int32(pasturePb.OutReasons_Unknown),
  110. Label: "未知原因",
  111. Disabled: true,
  112. })
  113. return configOptions
  114. }
  115. func (s *StoreEntry) DeathReasonEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  116. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  117. if isAll == model.IsAllYes {
  118. configOptions = append(configOptions,
  119. &pasturePb.ConfigOptionsList{
  120. Value: int32(0),
  121. Label: "全部",
  122. Disabled: true,
  123. })
  124. }
  125. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  126. Value: int32(pasturePb.DeathReason_Digestive_System_Diseases),
  127. Label: "消化性疾病",
  128. Disabled: true,
  129. }, &pasturePb.ConfigOptionsList{
  130. Value: int32(pasturePb.DeathReason_Respiratory_System_Diseases),
  131. Label: "呼吸性疾病",
  132. Disabled: true,
  133. }, &pasturePb.ConfigOptionsList{
  134. Value: int32(pasturePb.DeathReason_Reproductive_System_Diseases),
  135. Label: "繁殖性疾病",
  136. Disabled: true,
  137. }, &pasturePb.ConfigOptionsList{
  138. Value: int32(pasturePb.DeathReason_Metabolic_System_Diseases),
  139. Label: "代谢性疾病",
  140. Disabled: true,
  141. }, &pasturePb.ConfigOptionsList{
  142. Value: int32(pasturePb.DeathReason_Infectious_Diseases),
  143. Label: "传染性疾病",
  144. Disabled: true,
  145. }, &pasturePb.ConfigOptionsList{
  146. Value: int32(pasturePb.DeathReason_Difficult_Birth),
  147. Label: "难产",
  148. Disabled: true,
  149. }, &pasturePb.ConfigOptionsList{
  150. Value: int32(pasturePb.DeathReason_Accident_Dead),
  151. Label: "意外死亡",
  152. Disabled: true,
  153. }, &pasturePb.ConfigOptionsList{
  154. Value: int32(pasturePb.DeathReason_Stress),
  155. Label: "应激",
  156. Disabled: true,
  157. }, &pasturePb.ConfigOptionsList{
  158. Value: int32(pasturePb.DeathReason_Trauma),
  159. Label: "外伤",
  160. Disabled: true,
  161. }, &pasturePb.ConfigOptionsList{
  162. Value: int32(pasturePb.DeathReason_Pneumonia),
  163. Label: "肺炎",
  164. Disabled: true,
  165. }, &pasturePb.ConfigOptionsList{
  166. Value: int32(pasturePb.DeathReason_Diarrhea),
  167. Label: "腹泻",
  168. Disabled: true,
  169. }, &pasturePb.ConfigOptionsList{
  170. Value: int32(pasturePb.DeathReason_Ketosis),
  171. Label: "酮症",
  172. Disabled: true,
  173. }, &pasturePb.ConfigOptionsList{
  174. Value: int32(pasturePb.DeathReason_Acidosis),
  175. Label: "酸中毒",
  176. Disabled: true,
  177. }, &pasturePb.ConfigOptionsList{
  178. Value: int32(pasturePb.DeathReason_Rumina_Impaction),
  179. Label: "瘤胃积食",
  180. Disabled: true,
  181. }, &pasturePb.ConfigOptionsList{
  182. Value: int32(pasturePb.DeathReason_Intestinal_Torsion),
  183. Label: "肠扭转",
  184. Disabled: true,
  185. }, &pasturePb.ConfigOptionsList{
  186. Value: int32(pasturePb.DeathReason_Other),
  187. Label: "其他",
  188. Disabled: true,
  189. })
  190. return configOptions
  191. }
  192. func (s *StoreEntry) MatingResultEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  193. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  194. if isAll == model.IsAllYes {
  195. configOptions = append(configOptions,
  196. &pasturePb.ConfigOptionsList{
  197. Value: int32(0),
  198. Label: "全部",
  199. Disabled: true,
  200. })
  201. }
  202. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  203. Value: int32(pasturePb.MatingResult_Unknown),
  204. Label: "未知",
  205. Disabled: true,
  206. }, &pasturePb.ConfigOptionsList{
  207. Value: int32(pasturePb.MatingResult_ReMatch),
  208. Label: "复配",
  209. Disabled: true,
  210. }, &pasturePb.ConfigOptionsList{
  211. Value: int32(pasturePb.MatingResult_Pregnant),
  212. Label: "怀孕",
  213. Disabled: true,
  214. }, &pasturePb.ConfigOptionsList{
  215. Value: int32(pasturePb.MatingResult_Empty),
  216. Label: "空怀",
  217. Disabled: true,
  218. }, &pasturePb.ConfigOptionsList{
  219. Value: int32(pasturePb.MatingResult_Abort),
  220. Label: "流产",
  221. Disabled: true,
  222. })
  223. return configOptions
  224. }
  225. func (s *StoreEntry) EventCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  226. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  227. if isAll == model.IsAllYes {
  228. configOptions = append(configOptions,
  229. &pasturePb.ConfigOptionsList{
  230. Value: int32(0),
  231. Label: "全部",
  232. Disabled: true,
  233. })
  234. }
  235. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  236. Value: int32(pasturePb.EventCategory_Base),
  237. Label: "基础事件",
  238. Disabled: true,
  239. }, &pasturePb.ConfigOptionsList{
  240. Value: int32(pasturePb.EventCategory_Breed),
  241. Label: "繁殖事件",
  242. Disabled: true,
  243. }, &pasturePb.ConfigOptionsList{
  244. Value: int32(pasturePb.EventCategory_Health),
  245. Label: "兽医事件",
  246. Disabled: true,
  247. }, &pasturePb.ConfigOptionsList{
  248. Value: int32(pasturePb.EventCategory_Other),
  249. Label: "其他事件",
  250. Disabled: true,
  251. })
  252. return configOptions
  253. }
  254. func (s *StoreEntry) IndicatorsCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  255. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  256. if isAll == model.IsAllYes {
  257. configOptions = append(configOptions,
  258. &pasturePb.ConfigOptionsList{
  259. Value: int32(0),
  260. Label: "全部",
  261. Disabled: true,
  262. })
  263. }
  264. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  265. Value: int32(pasturePb.IndicatorType_Basic),
  266. Label: "基本指标",
  267. Disabled: true,
  268. }, &pasturePb.ConfigOptionsList{
  269. Value: int32(pasturePb.IndicatorType_Breed),
  270. Label: "繁殖指标",
  271. Disabled: true,
  272. }, &pasturePb.ConfigOptionsList{
  273. Value: int32(pasturePb.IndicatorType_Health),
  274. Label: "健康指标",
  275. Disabled: true,
  276. }, &pasturePb.ConfigOptionsList{
  277. Value: int32(pasturePb.IndicatorType_Feed),
  278. Label: "饲喂指标",
  279. Disabled: true,
  280. }, &pasturePb.ConfigOptionsList{
  281. Value: int32(pasturePb.IndicatorType_Calf),
  282. Label: "犊牛指标",
  283. Disabled: true,
  284. }, &pasturePb.ConfigOptionsList{
  285. Value: int32(pasturePb.IndicatorType_Fatten),
  286. Label: "育肥指标",
  287. Disabled: true,
  288. })
  289. return configOptions
  290. }
  291. func (s *StoreEntry) IndicatorsDetailsList(isAll string) []*pasturePb.ConfigOptionsList {
  292. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  293. if isAll == model.IsAllYes {
  294. configOptions = append(configOptions,
  295. &pasturePb.ConfigOptionsList{
  296. Value: int32(0),
  297. Label: "全部",
  298. Disabled: true,
  299. })
  300. }
  301. indicatorsDetailsList, _ := s.FindIndicatorsDetailsList()
  302. if len(indicatorsDetailsList) <= 0 {
  303. return configOptions
  304. }
  305. for _, v := range indicatorsDetailsList {
  306. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  307. Label: v.Name,
  308. Disabled: true,
  309. Props: v.Kind,
  310. })
  311. }
  312. return configOptions
  313. }
  314. func (s *StoreEntry) CowPurposeList(isAll string) []*pasturePb.ConfigOptionsList {
  315. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  316. if isAll == model.IsAllYes {
  317. configOptions = append(configOptions,
  318. &pasturePb.ConfigOptionsList{
  319. Value: int32(0),
  320. Label: "全部",
  321. Disabled: true,
  322. })
  323. }
  324. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  325. Value: int32(pasturePb.Purpose_Breeding),
  326. Label: "繁殖",
  327. Disabled: true,
  328. }, &pasturePb.ConfigOptionsList{
  329. Value: int32(pasturePb.Purpose_Fatten),
  330. Label: "育肥",
  331. Disabled: true,
  332. })
  333. return configOptions
  334. }
  335. func (s *StoreEntry) CowOutReasonList(isAll string) []*pasturePb.ConfigOptionsList {
  336. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  337. if isAll == model.IsAllYes {
  338. configOptions = append(configOptions,
  339. &pasturePb.ConfigOptionsList{
  340. Value: int32(0),
  341. Label: "全部",
  342. Disabled: true,
  343. })
  344. }
  345. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  346. Value: int32(pasturePb.OutReasons_Respiratory_System_Disease),
  347. Label: "呼吸系统疾病",
  348. Disabled: true,
  349. }, &pasturePb.ConfigOptionsList{
  350. Value: int32(pasturePb.OutReasons_Nutritional_Metabolic_Disease),
  351. Label: "营养代谢疾病",
  352. Disabled: true,
  353. }, &pasturePb.ConfigOptionsList{
  354. Value: int32(pasturePb.OutReasons_Breeding_Disease),
  355. Label: "繁殖疾病",
  356. Disabled: true,
  357. }, &pasturePb.ConfigOptionsList{
  358. Value: int32(pasturePb.OutReasons_Breast_Disease),
  359. Label: "乳房疾病",
  360. Disabled: true,
  361. }, &pasturePb.ConfigOptionsList{
  362. Value: int32(pasturePb.OutReasons_Hoof_Disease),
  363. Label: "蹄病",
  364. Disabled: true,
  365. }, &pasturePb.ConfigOptionsList{
  366. Value: int32(pasturePb.OutReasons_Low_Milk),
  367. Label: "低产",
  368. Disabled: true,
  369. }, &pasturePb.ConfigOptionsList{
  370. Value: int32(pasturePb.OutReasons_Slow_Growing),
  371. Label: "生长缓慢",
  372. Disabled: true,
  373. }, &pasturePb.ConfigOptionsList{
  374. Value: int32(pasturePb.OutReasons_Slow_Growing),
  375. Label: "生长缓慢",
  376. Disabled: true,
  377. }, &pasturePb.ConfigOptionsList{
  378. Value: int32(pasturePb.OutReasons_Other),
  379. Label: "其他原因",
  380. Disabled: true,
  381. })
  382. return configOptions
  383. }
  384. func (s *StoreEntry) CowDeathDestinationList(isAll string) []*pasturePb.ConfigOptionsList {
  385. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  386. if isAll == model.IsAllYes {
  387. configOptions = append(configOptions,
  388. &pasturePb.ConfigOptionsList{
  389. Value: int32(0),
  390. Label: "全部",
  391. Disabled: true,
  392. })
  393. }
  394. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  395. Value: int32(pasturePb.DeathDestination_NuisanceLess),
  396. Label: "无公害处理",
  397. Disabled: true,
  398. }, &pasturePb.ConfigOptionsList{
  399. Value: int32(pasturePb.DeathDestination_Slaughterhouse),
  400. Label: "屠宰场",
  401. Disabled: true,
  402. }, &pasturePb.ConfigOptionsList{
  403. Value: int32(pasturePb.DeathDestination_Other),
  404. Label: "其他",
  405. Disabled: true,
  406. })
  407. return configOptions
  408. }