config_data_other.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. package backend
  2. import (
  3. "fmt"
  4. "kpt-pasture/model"
  5. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  6. "gitee.com/xuyiping_admin/pkg/logger/zaplog"
  7. "go.uber.org/zap"
  8. )
  9. func (s *StoreEntry) PregnantCheckMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  10. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  11. if isAll == model.IsAllYes {
  12. configOptions = append(configOptions,
  13. &pasturePb.ConfigOptionsList{
  14. Value: int32(pasturePb.PregnantCheckMethod_Invalid),
  15. })
  16. }
  17. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  18. Value: int32(pasturePb.PregnantCheckMethod_B_Ultrasound),
  19. Label: "B超",
  20. Disabled: true,
  21. }, &pasturePb.ConfigOptionsList{
  22. Value: int32(pasturePb.PregnantCheckMethod_Blood_Testing),
  23. Label: "血检",
  24. Disabled: true,
  25. }, &pasturePb.ConfigOptionsList{
  26. Value: int32(pasturePb.PregnantCheckMethod_Manual_Inspection),
  27. Label: "人工检查",
  28. Disabled: true,
  29. })
  30. return configOptions
  31. }
  32. func (s *StoreEntry) DrugCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  33. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  34. if isAll == model.IsAllYes {
  35. configOptions = append(configOptions,
  36. &pasturePb.ConfigOptionsList{
  37. Value: int32(pasturePb.DrugCategory_Invalid),
  38. Label: "全部",
  39. Disabled: true,
  40. })
  41. }
  42. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  43. Value: int32(pasturePb.DrugCategory_Antibiotics),
  44. Label: "抗生素类",
  45. Disabled: true,
  46. }, &pasturePb.ConfigOptionsList{
  47. Value: int32(pasturePb.DrugCategory_Antivirals),
  48. Label: "抗病毒类",
  49. Disabled: true,
  50. }, &pasturePb.ConfigOptionsList{
  51. Value: int32(pasturePb.DrugCategory_Antifungals),
  52. Label: "抗真菌类",
  53. Disabled: true,
  54. }, &pasturePb.ConfigOptionsList{
  55. Value: int32(pasturePb.DrugCategory_Antiparasitics),
  56. Label: "驱虫类",
  57. Disabled: true,
  58. }, &pasturePb.ConfigOptionsList{
  59. Value: int32(pasturePb.DrugCategory_Analgesics),
  60. Label: "镇痛类",
  61. Disabled: true,
  62. }, &pasturePb.ConfigOptionsList{
  63. Value: int32(pasturePb.DrugCategory_Antipyretic),
  64. Label: "退烧类",
  65. Disabled: true,
  66. }, &pasturePb.ConfigOptionsList{
  67. Value: int32(pasturePb.DrugCategory_Vitamin),
  68. Label: "维生素类",
  69. Disabled: true,
  70. }, &pasturePb.ConfigOptionsList{
  71. Value: int32(pasturePb.DrugCategory_Brine),
  72. Label: "盐水",
  73. Disabled: true,
  74. }, &pasturePb.ConfigOptionsList{
  75. Value: int32(pasturePb.DrugCategory_Glucose),
  76. Label: "葡萄糖",
  77. Disabled: true,
  78. }, &pasturePb.ConfigOptionsList{
  79. Value: int32(pasturePb.DrugCategory_Hormone),
  80. Label: "激素类",
  81. Disabled: true,
  82. }, &pasturePb.ConfigOptionsList{
  83. Value: int32(pasturePb.DrugCategory_Anti_Stress),
  84. Label: "抗应激类",
  85. Disabled: true,
  86. }, &pasturePb.ConfigOptionsList{
  87. Value: int32(pasturePb.DrugCategory_Disinfect),
  88. Label: "消毒类",
  89. Disabled: true,
  90. }, &pasturePb.ConfigOptionsList{
  91. Value: int32(pasturePb.DrugCategory_Chinese_Herbal),
  92. Label: "中药合剂",
  93. Disabled: true,
  94. }, &pasturePb.ConfigOptionsList{
  95. Value: int32(pasturePb.DrugCategory_Tocolytic),
  96. Label: "保胎类",
  97. Disabled: true,
  98. }, &pasturePb.ConfigOptionsList{
  99. Value: int32(pasturePb.DrugCategory_Immunity),
  100. Label: "疫苗类",
  101. Disabled: true,
  102. })
  103. return configOptions
  104. }
  105. func (s *StoreEntry) DrugUsageEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  106. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  107. if isAll == model.IsAllYes {
  108. configOptions = append(configOptions,
  109. &pasturePb.ConfigOptionsList{
  110. Value: int32(pasturePb.DrugUsage_Invalid),
  111. Label: "全部",
  112. Disabled: true,
  113. })
  114. }
  115. configOptions = append(configOptions,
  116. &pasturePb.ConfigOptionsList{
  117. Value: int32(pasturePb.DrugUsage_Oral_Medications),
  118. Label: "口服",
  119. Disabled: true,
  120. }, &pasturePb.ConfigOptionsList{
  121. Value: int32(pasturePb.DrugUsage_Injectable_Medications),
  122. Label: "肌注",
  123. Disabled: true,
  124. }, &pasturePb.ConfigOptionsList{
  125. Value: int32(pasturePb.DrugUsage_Topical_Medications),
  126. Label: "外用",
  127. Disabled: true,
  128. }, &pasturePb.ConfigOptionsList{
  129. Value: int32(pasturePb.DrugUsage_Inhalation_Medications),
  130. Label: "吸入",
  131. Disabled: true,
  132. }, &pasturePb.ConfigOptionsList{
  133. Value: int32(pasturePb.DrugUsage_Drink_Medications),
  134. Label: "饮水",
  135. Disabled: true,
  136. })
  137. return configOptions
  138. }
  139. func (s *StoreEntry) UnitEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  140. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  141. configOptions = append(configOptions,
  142. &pasturePb.ConfigOptionsList{
  143. Value: int32(pasturePb.Unit_Pieces),
  144. Label: "个",
  145. Disabled: true,
  146. }, &pasturePb.ConfigOptionsList{
  147. Value: int32(pasturePb.Unit_Package),
  148. Label: "包/袋",
  149. Disabled: true,
  150. }, &pasturePb.ConfigOptionsList{
  151. Value: int32(pasturePb.Unit_Bottle),
  152. Label: "瓶",
  153. Disabled: true,
  154. }, &pasturePb.ConfigOptionsList{
  155. Value: int32(pasturePb.Unit_Box),
  156. Label: "盒",
  157. Disabled: true,
  158. }, &pasturePb.ConfigOptionsList{
  159. Value: int32(pasturePb.Unit_Boxful),
  160. Label: "箱",
  161. Disabled: true,
  162. }, &pasturePb.ConfigOptionsList{
  163. Value: int32(pasturePb.Unit_Branch),
  164. Label: "支",
  165. Disabled: true,
  166. }, &pasturePb.ConfigOptionsList{
  167. Value: int32(pasturePb.Unit_Barrel),
  168. Label: "桶",
  169. Disabled: true,
  170. }, &pasturePb.ConfigOptionsList{
  171. Value: int32(pasturePb.Unit_Pot),
  172. Label: "罐",
  173. Disabled: true,
  174. }, &pasturePb.ConfigOptionsList{
  175. Value: int32(pasturePb.Unit_ML),
  176. Label: "毫升",
  177. Disabled: true,
  178. }, &pasturePb.ConfigOptionsList{
  179. Value: int32(pasturePb.Unit_L),
  180. Label: "升",
  181. Disabled: true,
  182. })
  183. return configOptions
  184. }
  185. func (s *StoreEntry) ExposeEstrusTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  186. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  187. if isAll == model.IsAllYes {
  188. configOptions = append(configOptions,
  189. &pasturePb.ConfigOptionsList{
  190. Value: int32(pasturePb.ExposeEstrusType_Invalid),
  191. Label: "全部",
  192. Disabled: true,
  193. })
  194. }
  195. configOptions = append(configOptions,
  196. &pasturePb.ConfigOptionsList{
  197. Value: int32(pasturePb.ExposeEstrusType_Neck_Ring),
  198. Label: "脖环揭发",
  199. Disabled: true,
  200. }, &pasturePb.ConfigOptionsList{
  201. Value: int32(pasturePb.ExposeEstrusType_Foot_Ring),
  202. Label: "脚环揭发",
  203. Disabled: true,
  204. }, &pasturePb.ConfigOptionsList{
  205. Value: int32(pasturePb.ExposeEstrusType_Natural_Estrus),
  206. Label: "自然发情",
  207. Disabled: true,
  208. })
  209. return configOptions
  210. }
  211. func (s *StoreEntry) FrozenSemenTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  212. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  213. if isAll == model.IsAllYes {
  214. configOptions = append(configOptions,
  215. &pasturePb.ConfigOptionsList{
  216. Value: int32(pasturePb.FrozenSemenType_Invalid),
  217. Label: "全部",
  218. Disabled: true,
  219. })
  220. }
  221. configOptions = append(configOptions,
  222. &pasturePb.ConfigOptionsList{
  223. Value: int32(pasturePb.FrozenSemenType_Ordinary),
  224. Label: "常规冻精",
  225. Disabled: true,
  226. }, &pasturePb.ConfigOptionsList{
  227. Value: int32(pasturePb.FrozenSemenType_Gender_Control),
  228. Label: "性控冻精",
  229. Disabled: true,
  230. })
  231. return configOptions
  232. }
  233. func (s *StoreEntry) BullNumberEnumList(isAll string) []*pasturePb.BullOptionsList {
  234. frozenSemenList := make([]*model.FrozenSemen, 0)
  235. bullNumberList := make([]*pasturePb.BullOptionsList, 0)
  236. if err := s.DB.Where("quantity > 0").Group("bull_id").Find(&frozenSemenList).Error; err != nil {
  237. zaplog.Error("BullNumberEnumList", zap.Any("Find", err))
  238. }
  239. for _, v := range frozenSemenList {
  240. bullNumberList = append(bullNumberList, &pasturePb.BullOptionsList{
  241. Value: v.BullId,
  242. Label: v.BullId,
  243. Disabled: true,
  244. })
  245. }
  246. return bullNumberList
  247. }
  248. func (s *StoreEntry) WeekEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  249. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  250. configOptions = append(configOptions,
  251. &pasturePb.ConfigOptionsList{
  252. Value: int32(pasturePb.Week_Monday),
  253. Label: "周一",
  254. Disabled: true,
  255. }, &pasturePb.ConfigOptionsList{
  256. Value: int32(pasturePb.Week_Tuesday),
  257. Label: "周二",
  258. Disabled: true,
  259. }, &pasturePb.ConfigOptionsList{
  260. Value: int32(pasturePb.Week_Wednesday),
  261. Label: "周三",
  262. Disabled: true,
  263. }, &pasturePb.ConfigOptionsList{
  264. Value: int32(pasturePb.Week_Thursday),
  265. Label: "周四",
  266. Disabled: true,
  267. }, &pasturePb.ConfigOptionsList{
  268. Value: int32(pasturePb.Week_Friday),
  269. Label: "周五",
  270. Disabled: true,
  271. }, &pasturePb.ConfigOptionsList{
  272. Value: int32(pasturePb.Week_Saturday),
  273. Label: "周六",
  274. Disabled: true,
  275. }, &pasturePb.ConfigOptionsList{
  276. Value: int32(pasturePb.Week_Sunday),
  277. Label: "周日",
  278. Disabled: true,
  279. })
  280. return configOptions
  281. }
  282. func (s *StoreEntry) MonthEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  283. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  284. for v := 1; v <= 31; v++ {
  285. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  286. Value: int32(v),
  287. Label: fmt.Sprintf("%d号", v),
  288. Disabled: true,
  289. })
  290. }
  291. return configOptions
  292. }
  293. func (s *StoreEntry) WorkOrderFrequencyEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  294. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  295. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  296. Value: int32(pasturePb.WorkOrderFrequency_None),
  297. Label: "一次性",
  298. Disabled: true,
  299. }, &pasturePb.ConfigOptionsList{
  300. Value: int32(pasturePb.WorkOrderFrequency_Daily),
  301. Label: "每天",
  302. Disabled: true,
  303. }, &pasturePb.ConfigOptionsList{
  304. Value: int32(pasturePb.WorkOrderFrequency_Weekly),
  305. Label: "每周",
  306. Disabled: true,
  307. }, &pasturePb.ConfigOptionsList{
  308. Value: int32(pasturePb.WorkOrderFrequency_Monthly),
  309. Label: "每月",
  310. Disabled: true,
  311. })
  312. return configOptions
  313. }
  314. func (s *StoreEntry) WorkOrderSubUnitEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  315. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  316. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  317. Value: int32(pasturePb.WorkOrderSubscribeUnit_Person),
  318. Label: "个人",
  319. Disabled: true,
  320. }, &pasturePb.ConfigOptionsList{
  321. Value: int32(pasturePb.WorkOrderSubscribeUnit_dept),
  322. Label: "部门",
  323. Disabled: true,
  324. })
  325. return configOptions
  326. }
  327. func (s *StoreEntry) WorkOrderPriorityEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  328. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  329. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  330. Value: int32(pasturePb.Priority_Low),
  331. Label: "低",
  332. Disabled: true,
  333. }, &pasturePb.ConfigOptionsList{
  334. Value: int32(pasturePb.Priority_Middle),
  335. Label: "一般",
  336. Disabled: true,
  337. }, &pasturePb.ConfigOptionsList{
  338. Value: int32(pasturePb.Priority_High),
  339. Label: "紧急",
  340. Disabled: true,
  341. })
  342. return configOptions
  343. }
  344. func (s *StoreEntry) WorkOrderCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  345. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  346. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  347. Value: int32(pasturePb.WorkOrderCategory_Health),
  348. Label: "保健",
  349. Disabled: true,
  350. }, &pasturePb.ConfigOptionsList{
  351. Value: int32(pasturePb.WorkOrderCategory_Breed),
  352. Label: "繁殖",
  353. Disabled: true,
  354. }, &pasturePb.ConfigOptionsList{
  355. Value: int32(pasturePb.WorkOrderCategory_Nutrition),
  356. Label: "营养",
  357. Disabled: true,
  358. }, &pasturePb.ConfigOptionsList{
  359. Value: int32(pasturePb.WorkOrderCategory_Ordinary),
  360. Label: "日常",
  361. Disabled: true,
  362. }, &pasturePb.ConfigOptionsList{
  363. Value: int32(pasturePb.WorkOrderCategory_Other),
  364. Label: "其他",
  365. Disabled: true,
  366. })
  367. return configOptions
  368. }
  369. func CalendarTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  370. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  371. if isAll == model.IsAllYes {
  372. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  373. Value: int32(pasturePb.SameTimeStatus_Invalid),
  374. Label: "全部",
  375. Disabled: true,
  376. })
  377. }
  378. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  379. Value: int32(pasturePb.CalendarType_Immunisation),
  380. Label: "免疫",
  381. Disabled: true,
  382. }, &pasturePb.ConfigOptionsList{
  383. Value: int32(pasturePb.CalendarType_PG),
  384. Label: "同期PG",
  385. Disabled: true,
  386. }, &pasturePb.ConfigOptionsList{
  387. Value: int32(pasturePb.CalendarType_RnGH),
  388. Label: "同期RnGH",
  389. Disabled: true,
  390. }, &pasturePb.ConfigOptionsList{
  391. Value: int32(pasturePb.CalendarType_Pregnancy_Check),
  392. Label: "孕检",
  393. Disabled: true,
  394. }, &pasturePb.ConfigOptionsList{
  395. Value: int32(pasturePb.CalendarType_WorkOrder),
  396. Label: "工单",
  397. Disabled: true,
  398. }, &pasturePb.ConfigOptionsList{
  399. Value: int32(pasturePb.CalendarType_Weaning),
  400. Label: "断奶",
  401. Disabled: true,
  402. }, &pasturePb.ConfigOptionsList{
  403. Value: int32(pasturePb.CalendarType_Treatment),
  404. Label: "治疗",
  405. Disabled: true,
  406. }, &pasturePb.ConfigOptionsList{
  407. Value: int32(pasturePb.CalendarType_Mating),
  408. Label: "配种",
  409. Disabled: true,
  410. })
  411. return configOptions
  412. }
  413. func (s *StoreEntry) AbortionReasonsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  414. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  415. if isAll == model.IsAllYes {
  416. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  417. Value: int32(pasturePb.AbortionReasons_Invalid),
  418. Label: "全部",
  419. Disabled: true,
  420. })
  421. }
  422. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  423. Value: int32(pasturePb.AbortionReasons_Mechanical_Abortion),
  424. Label: "机械性流产",
  425. Disabled: true,
  426. }, &pasturePb.ConfigOptionsList{
  427. Value: int32(pasturePb.AbortionReasons_Malnutrition_Abortion),
  428. Label: "营养不良性流产",
  429. Disabled: true,
  430. }, &pasturePb.ConfigOptionsList{
  431. Value: int32(pasturePb.AbortionReasons_Mycotoxin_Abortion),
  432. Label: "霉菌毒素流产",
  433. Disabled: true,
  434. }, &pasturePb.ConfigOptionsList{
  435. Value: int32(pasturePb.AbortionReasons_Habitual_Abortion),
  436. Label: "习惯性流产",
  437. Disabled: true,
  438. }, &pasturePb.ConfigOptionsList{
  439. Value: int32(pasturePb.AbortionReasons_Brucellosis_Abortion),
  440. Label: "布病流产",
  441. Disabled: true,
  442. }, &pasturePb.ConfigOptionsList{
  443. Value: int32(pasturePb.AbortionReasons_Inflammatory_Abortion),
  444. Label: "产道炎症性流产",
  445. Disabled: true,
  446. }, &pasturePb.ConfigOptionsList{
  447. Value: int32(pasturePb.AbortionReasons_Heat_Stress_Abortion),
  448. Label: "热应激流产",
  449. Disabled: true,
  450. }, &pasturePb.ConfigOptionsList{
  451. Value: int32(pasturePb.AbortionReasons_Infectious_Abortion),
  452. Label: "传染病性流产",
  453. Disabled: true,
  454. }, &pasturePb.ConfigOptionsList{
  455. Value: int32(pasturePb.AbortionReasons_Other),
  456. Label: "其他",
  457. Disabled: true,
  458. })
  459. return configOptions
  460. }
  461. func (s *StoreEntry) HealthStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  462. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  463. if isAll == model.IsAllYes {
  464. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  465. Value: int32(pasturePb.HealthStatus_Invalid),
  466. Label: "全部",
  467. Disabled: true,
  468. })
  469. }
  470. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  471. Value: int32(pasturePb.HealthStatus_Health),
  472. Label: "健康",
  473. Disabled: true,
  474. }, &pasturePb.ConfigOptionsList{
  475. Value: int32(pasturePb.HealthStatus_Disease),
  476. Label: "发病",
  477. Disabled: true,
  478. }, &pasturePb.ConfigOptionsList{
  479. Value: int32(pasturePb.HealthStatus_Treatment),
  480. Label: "治疗",
  481. Disabled: true,
  482. }, &pasturePb.ConfigOptionsList{
  483. Value: int32(pasturePb.HealthStatus_Curable),
  484. Label: "治愈",
  485. Disabled: true,
  486. }, &pasturePb.ConfigOptionsList{
  487. Value: int32(pasturePb.HealthStatus_Out),
  488. Label: "淘汰",
  489. Disabled: true,
  490. }, &pasturePb.ConfigOptionsList{
  491. Value: int32(pasturePb.HealthStatus_Dead),
  492. Label: "死亡",
  493. Disabled: true,
  494. })
  495. return configOptions
  496. }
  497. func (s *StoreEntry) CalvingAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  498. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  499. if isAll == model.IsAllYes {
  500. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  501. Value: int32(pasturePb.CalvingAnalysisMethod_Invalid),
  502. Label: "全部",
  503. Disabled: true,
  504. })
  505. }
  506. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  507. Value: int32(pasturePb.CalvingAnalysisMethod_Months),
  508. Label: "按月份统计",
  509. Disabled: true,
  510. }, &pasturePb.ConfigOptionsList{
  511. Value: int32(pasturePb.CalvingAnalysisMethod_CowKind),
  512. Label: "按照品种统计",
  513. Disabled: true,
  514. })
  515. return configOptions
  516. }
  517. func (s *StoreEntry) LactEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  518. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  519. if isAll == model.IsAllYes {
  520. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  521. Value: int32(0),
  522. Label: "全部",
  523. Disabled: true,
  524. })
  525. }
  526. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  527. Value: int32(1),
  528. Label: "1",
  529. Disabled: true,
  530. }, &pasturePb.ConfigOptionsList{
  531. Value: int32(2),
  532. Label: "2",
  533. Disabled: true,
  534. }, &pasturePb.ConfigOptionsList{
  535. Value: int32(3),
  536. Label: "3",
  537. Disabled: true,
  538. }, &pasturePb.ConfigOptionsList{
  539. Value: int32(4),
  540. Label: ">3",
  541. Disabled: true,
  542. })
  543. return configOptions
  544. }
  545. func (s *StoreEntry) DiseaseAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  546. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  547. if isAll == model.IsAllYes {
  548. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  549. Value: int32(pasturePb.DiseaseAnalysisMethod_Invalid),
  550. Label: "全部",
  551. Disabled: true,
  552. })
  553. }
  554. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  555. Value: int32(pasturePb.DiseaseAnalysisMethod_Months),
  556. Label: "按月份",
  557. Disabled: true,
  558. }, &pasturePb.ConfigOptionsList{
  559. Value: int32(pasturePb.DiseaseAnalysisMethod_Disease_Category),
  560. Label: "疾病分类",
  561. Disabled: true,
  562. }, &pasturePb.ConfigOptionsList{
  563. Value: int32(pasturePb.DiseaseAnalysisMethod_Disease),
  564. Label: "疾病名称",
  565. Disabled: true,
  566. }, &pasturePb.ConfigOptionsList{
  567. Value: int32(pasturePb.DiseaseAnalysisMethod_Operator),
  568. Label: "兽医",
  569. Disabled: true,
  570. }, &pasturePb.ConfigOptionsList{
  571. Value: int32(pasturePb.DiseaseAnalysisMethod_Prescription),
  572. Label: "处方",
  573. Disabled: true,
  574. })
  575. return configOptions
  576. }
  577. func (s *StoreEntry) diseaseTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  578. configDiseaseTypeList := make([]*model.ConfigDiseaseType, 0)
  579. configOptionsList := make([]*pasturePb.ConfigOptionsList, 0)
  580. if err := s.DB.Where("is_show = ?", pasturePb.IsShow_Ok).Find(&configDiseaseTypeList).Error; err != nil {
  581. zaplog.Error("diseaseTypeEnumList", zap.Any("Find", err))
  582. }
  583. for _, v := range configDiseaseTypeList {
  584. configOptionsList = append(configOptionsList, &pasturePb.ConfigOptionsList{
  585. Value: int32(v.Id),
  586. Label: v.Name,
  587. Disabled: true,
  588. })
  589. }
  590. return configOptionsList
  591. }