config_data_breed.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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. Props: "months",
  179. Disabled: true,
  180. }, &pasturePb.ConfigOptionsList{
  181. Value: int32(pasturePb.MultiFactorAnalysisMethod_Week),
  182. Label: "周",
  183. Props: "week",
  184. Disabled: true,
  185. }, &pasturePb.ConfigOptionsList{
  186. Value: int32(pasturePb.MultiFactorAnalysisMethod_Operation),
  187. Label: "配种员",
  188. Props: "operationName",
  189. Disabled: true,
  190. }, &pasturePb.ConfigOptionsList{
  191. Value: int32(pasturePb.MultiFactorAnalysisMethod_Bull),
  192. Label: "公牛",
  193. Props: "bull",
  194. Disabled: true,
  195. }, &pasturePb.ConfigOptionsList{
  196. Value: int32(pasturePb.MultiFactorAnalysisMethod_Lact),
  197. Label: "胎次",
  198. Props: "lact",
  199. Disabled: true,
  200. }, &pasturePb.ConfigOptionsList{
  201. Value: int32(pasturePb.MultiFactorAnalysisMethod_Mating_Times),
  202. Label: "配次",
  203. Props: "matingTimes",
  204. Disabled: true,
  205. }, &pasturePb.ConfigOptionsList{
  206. Value: int32(pasturePb.MultiFactorAnalysisMethod_Breeding_Method),
  207. Label: "配种方式",
  208. Props: "exposeEstrusType",
  209. Disabled: true,
  210. })
  211. return configOptions
  212. }
  213. func (s *StoreEntry) SaleCowAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  214. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  215. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  216. Value: int32(pasturePb.SaleCowAnalysisMethod_Months),
  217. Label: "月份",
  218. Disabled: true,
  219. }, &pasturePb.ConfigOptionsList{
  220. Value: int32(pasturePb.SaleCowAnalysisMethod_Dealer),
  221. Label: "经销商",
  222. Disabled: true,
  223. })
  224. return configOptions
  225. }
  226. func (s *StoreEntry) NeckRingIsBindEnumList(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(pasturePb.NeckRingIsBind_Invalid),
  232. Label: "全部",
  233. Disabled: true,
  234. })
  235. }
  236. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  237. Value: int32(pasturePb.NeckRingIsBind_Bind),
  238. Label: "已绑定",
  239. Disabled: true,
  240. }, &pasturePb.ConfigOptionsList{
  241. Value: int32(pasturePb.NeckRingIsBind_Unbind),
  242. Label: "未绑定",
  243. Disabled: true,
  244. })
  245. return configOptions
  246. }
  247. func (s *StoreEntry) NeckRingStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  248. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  249. if isAll == model.IsAllYes {
  250. configOptions = append(configOptions,
  251. &pasturePb.ConfigOptionsList{
  252. Value: int32(pasturePb.NeckRingStatus_Invalid),
  253. Label: "全部",
  254. Disabled: true,
  255. })
  256. }
  257. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  258. Value: int32(pasturePb.NeckRingStatus_Normal),
  259. Label: "正常",
  260. Disabled: true,
  261. }, &pasturePb.ConfigOptionsList{
  262. Value: int32(pasturePb.NeckRingStatus_Abnormal),
  263. Label: "异常",
  264. Disabled: true,
  265. })
  266. return configOptions
  267. }
  268. func CalendarTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  269. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  270. if isAll == model.IsAllYes {
  271. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  272. Value: int32(pasturePb.CalendarType_Invalid),
  273. Label: "全部",
  274. Disabled: true,
  275. })
  276. }
  277. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  278. Value: int32(pasturePb.CalendarType_Immunisation),
  279. Label: "免疫",
  280. Disabled: true,
  281. }, &pasturePb.ConfigOptionsList{
  282. Value: int32(pasturePb.CalendarType_PG),
  283. Label: "同期PG",
  284. Disabled: true,
  285. }, &pasturePb.ConfigOptionsList{
  286. Value: int32(pasturePb.CalendarType_RnGH),
  287. Label: "同期RnGH",
  288. Disabled: true,
  289. }, &pasturePb.ConfigOptionsList{
  290. Value: int32(pasturePb.CalendarType_Pregnancy_Check),
  291. Label: "孕检",
  292. Disabled: true,
  293. }, &pasturePb.ConfigOptionsList{
  294. Value: int32(pasturePb.CalendarType_Weaning),
  295. Label: "断奶",
  296. Disabled: true,
  297. }, &pasturePb.ConfigOptionsList{
  298. Value: int32(pasturePb.CalendarType_Disease),
  299. Label: "疾病",
  300. Disabled: true,
  301. }, &pasturePb.ConfigOptionsList{
  302. Value: int32(pasturePb.CalendarType_Mating),
  303. Label: "配种",
  304. Disabled: true,
  305. }, &pasturePb.ConfigOptionsList{
  306. Value: int32(pasturePb.CalendarType_Calving),
  307. Label: "产犊",
  308. Disabled: true,
  309. }, &pasturePb.ConfigOptionsList{
  310. Value: int32(pasturePb.CalendarType_DryMilk),
  311. Label: "干奶",
  312. Disabled: true,
  313. })
  314. return configOptions
  315. }
  316. func (s *StoreEntry) AbortionReasonsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  317. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  318. if isAll == model.IsAllYes {
  319. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  320. Value: int32(pasturePb.AbortionReasons_Invalid),
  321. Label: "全部",
  322. Disabled: true,
  323. })
  324. }
  325. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  326. Value: int32(pasturePb.AbortionReasons_Mechanical_Abortion),
  327. Label: "机械性流产",
  328. Disabled: true,
  329. }, &pasturePb.ConfigOptionsList{
  330. Value: int32(pasturePb.AbortionReasons_Malnutrition_Abortion),
  331. Label: "营养不良性流产",
  332. Disabled: true,
  333. }, &pasturePb.ConfigOptionsList{
  334. Value: int32(pasturePb.AbortionReasons_Mycotoxin_Abortion),
  335. Label: "霉菌毒素流产",
  336. Disabled: true,
  337. }, &pasturePb.ConfigOptionsList{
  338. Value: int32(pasturePb.AbortionReasons_Habitual_Abortion),
  339. Label: "习惯性流产",
  340. Disabled: true,
  341. }, &pasturePb.ConfigOptionsList{
  342. Value: int32(pasturePb.AbortionReasons_Brucellosis_Abortion),
  343. Label: "布病流产",
  344. Disabled: true,
  345. }, &pasturePb.ConfigOptionsList{
  346. Value: int32(pasturePb.AbortionReasons_Inflammatory_Abortion),
  347. Label: "产道炎症性流产",
  348. Disabled: true,
  349. }, &pasturePb.ConfigOptionsList{
  350. Value: int32(pasturePb.AbortionReasons_Heat_Stress_Abortion),
  351. Label: "热应激流产",
  352. Disabled: true,
  353. }, &pasturePb.ConfigOptionsList{
  354. Value: int32(pasturePb.AbortionReasons_Infectious_Abortion),
  355. Label: "传染病性流产",
  356. Disabled: true,
  357. }, &pasturePb.ConfigOptionsList{
  358. Value: int32(pasturePb.AbortionReasons_Unknown),
  359. Label: "未知原因",
  360. Disabled: true,
  361. }, &pasturePb.ConfigOptionsList{
  362. Value: int32(pasturePb.AbortionReasons_Other),
  363. Label: "其他",
  364. Disabled: true,
  365. })
  366. return configOptions
  367. }
  368. func (s *StoreEntry) CalvingAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  369. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  370. if isAll == model.IsAllYes {
  371. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  372. Value: int32(pasturePb.CalvingAnalysisMethod_Invalid),
  373. Label: "全部",
  374. Disabled: true,
  375. })
  376. }
  377. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  378. Value: int32(pasturePb.CalvingAnalysisMethod_Months),
  379. Label: "按月份统计",
  380. Disabled: true,
  381. }, &pasturePb.ConfigOptionsList{
  382. Value: int32(pasturePb.CalvingAnalysisMethod_CowKind),
  383. Label: "按照品种统计",
  384. Disabled: true,
  385. })
  386. return configOptions
  387. }