config_data_base.go 12 KB

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