config_data_other.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  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) OutTypeEnumList(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(pasturePb.OutType_Invalid),
  320. Label: "全部",
  321. Disabled: true,
  322. })
  323. }
  324. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  325. Value: int32(pasturePb.OutType_Drugs),
  326. Label: "药品",
  327. Disabled: true,
  328. }, &pasturePb.ConfigOptionsList{
  329. Value: int32(pasturePb.OutType_Medical_Equipment),
  330. Label: "医疗器械",
  331. Disabled: true,
  332. })
  333. return configOptions
  334. }
  335. func (s *StoreEntry) AuditStatusEnumList(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(pasturePb.AuditStatus_Invalid),
  341. Label: "全部",
  342. Disabled: true,
  343. })
  344. }
  345. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  346. Value: int32(pasturePb.AuditStatus_Pending),
  347. Label: "待审核",
  348. Disabled: true,
  349. }, &pasturePb.ConfigOptionsList{
  350. Value: int32(pasturePb.AuditStatus_Pass),
  351. Label: "已通过",
  352. Disabled: true,
  353. }, &pasturePb.ConfigOptionsList{
  354. Value: int32(pasturePb.AuditStatus_Reject),
  355. Label: "已拒绝",
  356. Disabled: true,
  357. }, &pasturePb.ConfigOptionsList{
  358. Value: int32(pasturePb.AuditStatus_Cancel),
  359. Label: "已取消",
  360. Disabled: true,
  361. })
  362. return configOptions
  363. }
  364. func (s *StoreEntry) PregnantCheckNameEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  365. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  366. if isAll == model.IsAllYes {
  367. configOptions = append(configOptions,
  368. &pasturePb.ConfigOptionsList{
  369. Value: int32(0),
  370. Label: "全部",
  371. Disabled: true,
  372. })
  373. }
  374. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  375. Value: int32(1),
  376. Label: "初检",
  377. Disabled: true,
  378. }, &pasturePb.ConfigOptionsList{
  379. Value: int32(2),
  380. Label: "复检",
  381. Disabled: true,
  382. })
  383. return configOptions
  384. }
  385. func (s *StoreEntry) UnMatingReasonsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
  386. configOptions := make([]*pasturePb.ConfigOptionsList, 0)
  387. if isAll == model.IsAllYes {
  388. configOptions = append(configOptions,
  389. &pasturePb.ConfigOptionsList{
  390. Value: int32(0),
  391. Label: "全部",
  392. Disabled: true,
  393. })
  394. }
  395. configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
  396. Value: int32(pasturePb.UnMatingReasons_Irregular_Estrus),
  397. Label: "不规则发情",
  398. Disabled: true,
  399. }, &pasturePb.ConfigOptionsList{
  400. Value: int32(pasturePb.UnMatingReasons_No_Mating),
  401. Label: "禁配",
  402. Disabled: true,
  403. }, &pasturePb.ConfigOptionsList{
  404. Value: int32(pasturePb.UnMatingReasons_Disease),
  405. Label: "疾病",
  406. Disabled: true,
  407. }, &pasturePb.ConfigOptionsList{
  408. Value: int32(pasturePb.UnMatingReasons_Out),
  409. Label: "淘汰",
  410. Disabled: true,
  411. }, &pasturePb.ConfigOptionsList{
  412. Value: int32(pasturePb.UnMatingReasons_Other),
  413. Label: "其他",
  414. Disabled: true,
  415. })
  416. return configOptions
  417. }