config_data_breed.go 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. package backend
  2. import (
  3. "kpt-pasture/model"
  4. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  5. "gitee.com/xuyiping_admin/pkg/logger/zaplog"
  6. "go.uber.org/zap"
  7. )
  8. func (s *StoreEntry) LactEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  9. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  10. if isAll == model.IsAllYes {
  11. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  12. Value: int32(0),
  13. Label: "全部",
  14. Disabled: true,
  15. })
  16. }
  17. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  18. Value: int32(1),
  19. Label: "1",
  20. Disabled: true,
  21. }, &pasturePb.ConfigOptionsList{
  22. Value: int32(2),
  23. Label: "2",
  24. Disabled: true,
  25. }, &pasturePb.ConfigOptionsList{
  26. Value: int32(3),
  27. Label: "3",
  28. Disabled: true,
  29. }, &pasturePb.ConfigOptionsList{
  30. Value: int32(4),
  31. Label: ">3",
  32. Disabled: true,
  33. })
  34. return configOptions
  35. }
  36. func (s *StoreEntry) DiseaseAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  37. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  38. if isAll == model.IsAllYes {
  39. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  40. Value: int32(pasturePb.DiseaseAnalysisMethod_Invalid),
  41. Label: "全部",
  42. Disabled: true,
  43. })
  44. }
  45. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  46. Value: int32(pasturePb.DiseaseAnalysisMethod_Months),
  47. Label: "按月份",
  48. Disabled: true,
  49. }, &pasturePb.ConfigOptionsList{
  50. Value: int32(pasturePb.DiseaseAnalysisMethod_Disease_Category),
  51. Label: "疾病分类",
  52. Disabled: true,
  53. }, &pasturePb.ConfigOptionsList{
  54. Value: int32(pasturePb.DiseaseAnalysisMethod_Disease),
  55. Label: "疾病名称",
  56. Disabled: true,
  57. }, &pasturePb.ConfigOptionsList{
  58. Value: int32(pasturePb.DiseaseAnalysisMethod_Operator),
  59. Label: "兽医",
  60. Disabled: true,
  61. }, &pasturePb.ConfigOptionsList{
  62. Value: int32(pasturePb.DiseaseAnalysisMethod_Prescription),
  63. Label: "处方",
  64. Disabled: true,
  65. })
  66. return configOptions
  67. }
  68. func (s *StoreEntry) diseaseTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  69. configDiseaseTypeList := make([]*model.ConfigDiseaseType, 0)
  70. configOptionsList := make([]*pasturePb.ConfigOptionsList, 0)
  71. if err := s.DB.Where("is_show = ?", pasturePb.IsShow_Ok).Find(&configDiseaseTypeList).Error; err != nil {
  72. zaplog.Error("diseaseTypeEnumList", zap.Any("Find", err))
  73. }
  74. for _, v := range configDiseaseTypeList {
  75. configOptionsList = append(configOptionsList, &pasturePb.ConfigOptionsList{
  76. Value: int32(v.Id),
  77. Label: v.Name,
  78. Disabled: true,
  79. })
  80. }
  81. return configOptionsList
  82. }
  83. func (s *StoreEntry) SingleFactorAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  84. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  85. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  86. Value: int32(pasturePb.SingleFactorAnalysisMethod_Cycle),
  87. Label: "按周期分析",
  88. Disabled: true,
  89. }, &pasturePb.ConfigOptionsList{
  90. Value: int32(pasturePb.SingleFactorAnalysisMethod_Months),
  91. Label: "按月份分析",
  92. Disabled: true,
  93. }, &pasturePb.ConfigOptionsList{
  94. Value: int32(pasturePb.SingleFactorAnalysisMethod_Mating_Times),
  95. Label: "按配种次数分析",
  96. Disabled: true,
  97. }, &pasturePb.ConfigOptionsList{
  98. Value: int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Method),
  99. Label: "按配种方式分析",
  100. Disabled: true,
  101. }, &pasturePb.ConfigOptionsList{
  102. Value: int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Company),
  103. Label: "按育种公司分析",
  104. Disabled: true,
  105. }, &pasturePb.ConfigOptionsList{
  106. Value: int32(pasturePb.SingleFactorAnalysisMethod_Operation),
  107. Label: "按兽医人员分析",
  108. Disabled: true,
  109. }, &pasturePb.ConfigOptionsList{
  110. Value: int32(pasturePb.SingleFactorAnalysisMethod_Mating_Interval),
  111. Label: "按配种间隔分析",
  112. Disabled: true,
  113. }, &pasturePb.ConfigOptionsList{
  114. Value: int32(pasturePb.SingleFactorAnalysisMethod_Bull),
  115. Label: "按公牛号分析",
  116. Disabled: true,
  117. }, &pasturePb.ConfigOptionsList{
  118. Value: int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Cycle),
  119. Label: "按配种周期分析",
  120. Disabled: true,
  121. }, &pasturePb.ConfigOptionsList{
  122. Value: int32(pasturePb.SingleFactorAnalysisMethod_Week),
  123. Label: "按星期分析",
  124. Disabled: true,
  125. }, &pasturePb.ConfigOptionsList{
  126. Value: int32(pasturePb.SingleFactorAnalysisMethod_Lact),
  127. Label: "按胎次分析",
  128. Disabled: true,
  129. })
  130. return configOptions
  131. }
  132. func (s *StoreEntry) LactIntervalSymbolEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  133. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  134. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  135. Value: int32(pasturePb.CompareSymbol_Less_Than),
  136. Label: "<",
  137. Disabled: true,
  138. }, &pasturePb.ConfigOptionsList{
  139. Value: int32(pasturePb.CompareSymbol_Less_Than_Or_Equal_To),
  140. Label: "<=",
  141. Disabled: true,
  142. }, &pasturePb.ConfigOptionsList{
  143. Value: int32(pasturePb.CompareSymbol_Greater_Than),
  144. Label: ">",
  145. Disabled: true,
  146. }, &pasturePb.ConfigOptionsList{
  147. Value: int32(pasturePb.CompareSymbol_Greater_Than_Or_Equal_To),
  148. Label: ">=",
  149. Disabled: true,
  150. }, &pasturePb.ConfigOptionsList{
  151. Value: int32(pasturePb.CompareSymbol_Equal_To),
  152. Label: "=",
  153. Disabled: true,
  154. }, &pasturePb.ConfigOptionsList{
  155. Value: int32(pasturePb.CompareSymbol_Not_Equal_To),
  156. Label: "!=",
  157. Disabled: true,
  158. }, &pasturePb.ConfigOptionsList{
  159. Value: int32(pasturePb.CompareSymbol_Between),
  160. Label: "区间",
  161. Disabled: true,
  162. }, &pasturePb.ConfigOptionsList{
  163. Value: int32(pasturePb.CompareSymbol_Include),
  164. Label: "包含",
  165. Disabled: true,
  166. }, &pasturePb.ConfigOptionsList{
  167. Value: int32(pasturePb.CompareSymbol_Not_Include),
  168. Label: "不包含",
  169. Disabled: true,
  170. })
  171. return configOptions
  172. }
  173. func (s *StoreEntry) MultiFactorAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  174. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  175. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  176. Value: int32(pasturePb.MultiFactorAnalysisMethod_Months),
  177. Label: "月份",
  178. Disabled: true,
  179. }, &pasturePb.ConfigOptionsList{
  180. Value: int32(pasturePb.MultiFactorAnalysisMethod_Week),
  181. Label: "周",
  182. Disabled: true,
  183. }, &pasturePb.ConfigOptionsList{
  184. Value: int32(pasturePb.MultiFactorAnalysisMethod_Operation),
  185. Label: "配种员",
  186. Disabled: true,
  187. }, &pasturePb.ConfigOptionsList{
  188. Value: int32(pasturePb.MultiFactorAnalysisMethod_Bull),
  189. Label: "公牛",
  190. Disabled: true,
  191. }, &pasturePb.ConfigOptionsList{
  192. Value: int32(pasturePb.MultiFactorAnalysisMethod_Lact),
  193. Label: "胎次",
  194. Disabled: true,
  195. }, &pasturePb.ConfigOptionsList{
  196. Value: int32(pasturePb.MultiFactorAnalysisMethod_Mating_Times),
  197. Label: "配次",
  198. Disabled: true,
  199. }, &pasturePb.ConfigOptionsList{
  200. Value: int32(pasturePb.MultiFactorAnalysisMethod_Breeding_Method),
  201. Label: "配种方式",
  202. Disabled: true,
  203. })
  204. return configOptions
  205. }
  206. func (s *StoreEntry) SaleCowAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  207. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  208. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  209. Value: int32(pasturePb.SaleCowAnalysisMethod_Months),
  210. Label: "月份",
  211. Disabled: true,
  212. }, &pasturePb.ConfigOptionsList{
  213. Value: int32(pasturePb.SaleCowAnalysisMethod_Dealer),
  214. Label: "经销商",
  215. Disabled: true,
  216. })
  217. return configOptions
  218. }
  219. func (s *StoreEntry) NeckRingStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  220. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  221. if isAll == model.IsAllYes {
  222. configOptions = append(configOptions,
  223. &pasturePb.ConfigOptionsList{
  224. Value: int32(pasturePb.NeckRingStatus_Invalid),
  225. Label: "全部",
  226. Disabled: true,
  227. })
  228. }
  229. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  230. Value: int32(pasturePb.NeckRingStatus_Unbind),
  231. Label: "未绑定",
  232. Disabled: true,
  233. }, &pasturePb.ConfigOptionsList{
  234. Value: int32(pasturePb.NeckRingStatus_Bind),
  235. Label: "绑定",
  236. Disabled: true,
  237. }, &pasturePb.ConfigOptionsList{
  238. Value: int32(pasturePb.NeckRingStatus_Normal),
  239. Label: "正常",
  240. Disabled: true,
  241. }, &pasturePb.ConfigOptionsList{
  242. Value: int32(pasturePb.NeckRingStatus_Offline),
  243. Label: "在线",
  244. Disabled: true,
  245. }, &pasturePb.ConfigOptionsList{
  246. Value: int32(pasturePb.NeckRingStatus_Error),
  247. Label: "异常",
  248. Disabled: true,
  249. })
  250. return configOptions
  251. }
  252. func (s *StoreEntry) WorkOrderSubUnitEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  253. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  254. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  255. Value: int32(pasturePb.WorkOrderSubscribeUnit_Person),
  256. Label: "个人",
  257. Disabled: true,
  258. }, &pasturePb.ConfigOptionsList{
  259. Value: int32(pasturePb.WorkOrderSubscribeUnit_dept),
  260. Label: "部门",
  261. Disabled: true,
  262. })
  263. return configOptions
  264. }
  265. func (s *StoreEntry) WorkOrderPriorityEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  266. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  267. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  268. Value: int32(pasturePb.Priority_Low),
  269. Label: "低",
  270. Disabled: true,
  271. }, &pasturePb.ConfigOptionsList{
  272. Value: int32(pasturePb.Priority_Middle),
  273. Label: "一般",
  274. Disabled: true,
  275. }, &pasturePb.ConfigOptionsList{
  276. Value: int32(pasturePb.Priority_High),
  277. Label: "紧急",
  278. Disabled: true,
  279. })
  280. return configOptions
  281. }
  282. func (s *StoreEntry) WorkOrderCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  283. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  284. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  285. Value: int32(pasturePb.WorkOrderCategory_Health),
  286. Label: "保健",
  287. Disabled: true,
  288. }, &pasturePb.ConfigOptionsList{
  289. Value: int32(pasturePb.WorkOrderCategory_Breed),
  290. Label: "繁殖",
  291. Disabled: true,
  292. }, &pasturePb.ConfigOptionsList{
  293. Value: int32(pasturePb.WorkOrderCategory_Nutrition),
  294. Label: "营养",
  295. Disabled: true,
  296. }, &pasturePb.ConfigOptionsList{
  297. Value: int32(pasturePb.WorkOrderCategory_Ordinary),
  298. Label: "日常",
  299. Disabled: true,
  300. }, &pasturePb.ConfigOptionsList{
  301. Value: int32(pasturePb.WorkOrderCategory_Other),
  302. Label: "其他",
  303. Disabled: true,
  304. })
  305. return configOptions
  306. }
  307. func CalendarTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  308. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  309. if isAll == model.IsAllYes {
  310. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  311. Value: int32(pasturePb.CalendarType_Invalid),
  312. Label: "全部",
  313. Disabled: true,
  314. })
  315. }
  316. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  317. Value: int32(pasturePb.CalendarType_Immunisation),
  318. Label: "免疫",
  319. Disabled: true,
  320. }, &pasturePb.ConfigOptionsList{
  321. Value: int32(pasturePb.CalendarType_PG),
  322. Label: "同期PG",
  323. Disabled: true,
  324. }, &pasturePb.ConfigOptionsList{
  325. Value: int32(pasturePb.CalendarType_RnGH),
  326. Label: "同期RnGH",
  327. Disabled: true,
  328. }, &pasturePb.ConfigOptionsList{
  329. Value: int32(pasturePb.CalendarType_Pregnancy_Check),
  330. Label: "孕检",
  331. Disabled: true,
  332. }, &pasturePb.ConfigOptionsList{
  333. Value: int32(pasturePb.CalendarType_WorkOrder),
  334. Label: "工单",
  335. Disabled: true,
  336. }, &pasturePb.ConfigOptionsList{
  337. Value: int32(pasturePb.CalendarType_Weaning),
  338. Label: "断奶",
  339. Disabled: true,
  340. }, &pasturePb.ConfigOptionsList{
  341. Value: int32(pasturePb.CalendarType_Treatment),
  342. Label: "治疗",
  343. Disabled: true,
  344. }, &pasturePb.ConfigOptionsList{
  345. Value: int32(pasturePb.CalendarType_Mating),
  346. Label: "配种",
  347. Disabled: true,
  348. })
  349. return configOptions
  350. }
  351. func (s *StoreEntry) AbortionReasonsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  352. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  353. if isAll == model.IsAllYes {
  354. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  355. Value: int32(pasturePb.AbortionReasons_Invalid),
  356. Label: "全部",
  357. Disabled: true,
  358. })
  359. }
  360. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  361. Value: int32(pasturePb.AbortionReasons_Mechanical_Abortion),
  362. Label: "机械性流产",
  363. Disabled: true,
  364. }, &pasturePb.ConfigOptionsList{
  365. Value: int32(pasturePb.AbortionReasons_Malnutrition_Abortion),
  366. Label: "营养不良性流产",
  367. Disabled: true,
  368. }, &pasturePb.ConfigOptionsList{
  369. Value: int32(pasturePb.AbortionReasons_Mycotoxin_Abortion),
  370. Label: "霉菌毒素流产",
  371. Disabled: true,
  372. }, &pasturePb.ConfigOptionsList{
  373. Value: int32(pasturePb.AbortionReasons_Habitual_Abortion),
  374. Label: "习惯性流产",
  375. Disabled: true,
  376. }, &pasturePb.ConfigOptionsList{
  377. Value: int32(pasturePb.AbortionReasons_Brucellosis_Abortion),
  378. Label: "布病流产",
  379. Disabled: true,
  380. }, &pasturePb.ConfigOptionsList{
  381. Value: int32(pasturePb.AbortionReasons_Inflammatory_Abortion),
  382. Label: "产道炎症性流产",
  383. Disabled: true,
  384. }, &pasturePb.ConfigOptionsList{
  385. Value: int32(pasturePb.AbortionReasons_Heat_Stress_Abortion),
  386. Label: "热应激流产",
  387. Disabled: true,
  388. }, &pasturePb.ConfigOptionsList{
  389. Value: int32(pasturePb.AbortionReasons_Infectious_Abortion),
  390. Label: "传染病性流产",
  391. Disabled: true,
  392. }, &pasturePb.ConfigOptionsList{
  393. Value: int32(pasturePb.AbortionReasons_Unknown),
  394. Label: "未知原因",
  395. Disabled: true,
  396. }, &pasturePb.ConfigOptionsList{
  397. Value: int32(pasturePb.AbortionReasons_Other),
  398. Label: "其他",
  399. Disabled: true,
  400. })
  401. return configOptions
  402. }
  403. func (s *StoreEntry) HealthStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  404. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  405. if isAll == model.IsAllYes {
  406. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  407. Value: int32(pasturePb.HealthStatus_Invalid),
  408. Label: "全部",
  409. Disabled: true,
  410. })
  411. }
  412. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  413. Value: int32(pasturePb.HealthStatus_Health),
  414. Label: "健康",
  415. Disabled: true,
  416. }, &pasturePb.ConfigOptionsList{
  417. Value: int32(pasturePb.HealthStatus_Disease),
  418. Label: "发病",
  419. Disabled: true,
  420. }, &pasturePb.ConfigOptionsList{
  421. Value: int32(pasturePb.HealthStatus_Treatment),
  422. Label: "治疗中",
  423. Disabled: true,
  424. }, &pasturePb.ConfigOptionsList{
  425. Value: int32(pasturePb.HealthStatus_Curable),
  426. Label: "治愈",
  427. Disabled: true,
  428. }, &pasturePb.ConfigOptionsList{
  429. Value: int32(pasturePb.HealthStatus_Out),
  430. Label: "淘汰",
  431. Disabled: true,
  432. }, &pasturePb.ConfigOptionsList{
  433. Value: int32(pasturePb.HealthStatus_Dead),
  434. Label: "死亡",
  435. Disabled: true,
  436. })
  437. return configOptions
  438. }
  439. func (s *StoreEntry) CalvingAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  440. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  441. if isAll == model.IsAllYes {
  442. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  443. Value: int32(pasturePb.CalvingAnalysisMethod_Invalid),
  444. Label: "全部",
  445. Disabled: true,
  446. })
  447. }
  448. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  449. Value: int32(pasturePb.CalvingAnalysisMethod_Months),
  450. Label: "按月份统计",
  451. Disabled: true,
  452. }, &pasturePb.ConfigOptionsList{
  453. Value: int32(pasturePb.CalvingAnalysisMethod_CowKind),
  454. Label: "按照品种统计",
  455. Disabled: true,
  456. })
  457. return configOptions
  458. }