visit.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. /**
  4. * 寻访数据信息统计
  5. * */
  6. class VisitController extends Controller {
  7. /**
  8. * 1.老年人健康状况 (计算精准-已测试)
  9. * 现在健康状况选项 ( 健康、一般、较差 )
  10. */
  11. async health() {
  12. const { ctx, service } = this;
  13. const query = ctx.request.body;
  14. delete query.deptId;
  15. const result = await service.visit.health(query);
  16. ctx.body = result;
  17. }
  18. /**
  19. * 2.老年人精神状态 (计算精准-已测试)
  20. * 2020-2-18 出现 '健康' 值,这是以前的错误数据;
  21. * 现在精神状态选项 ( 良好、一般、较差 )
  22. */
  23. async mind() {
  24. const { ctx, service } = this;
  25. const query = ctx.request.body;
  26. delete query.deptId;
  27. const result = await service.visit.mind(query);
  28. ctx.body = result;
  29. }
  30. /**
  31. * 3.老年人安全情况 (计算精准-已测试)
  32. * 现在精神状态选项 ( 安全、一般、较差 )
  33. */
  34. async security() {
  35. const { ctx, service } = this;
  36. const query = ctx.request.body;
  37. delete query.deptId;
  38. const result = await service.visit.security(query);
  39. ctx.body = result;
  40. }
  41. /**
  42. * 4.老年人卫生环境(计算精准-已测试)
  43. * 2020-2-18 出现 '健康' 值,这是以前的错误数据;
  44. * 现在精神状态选项 ( 良好、一般、较差 )
  45. */
  46. async hygiene() {
  47. const { ctx, service } = this;
  48. const query = ctx.request.body;
  49. delete query.deptId;
  50. const result = await service.visit.hygiene(query);
  51. ctx.body = result;
  52. }
  53. /**
  54. * 5.老年人居住情况(计算精准-已测试)
  55. * 2020-2-18 出现 '健康' 值,这是以前的错误数据;
  56. * 现在精神状态选项 ( 良好、一般、较差 )
  57. */
  58. async live() {
  59. const { ctx, service } = this;
  60. const query = ctx.request.body;
  61. delete query.deptId;
  62. const result = await service.visit.live(query);
  63. ctx.body = result;
  64. }
  65. /**
  66. * 6.巡访员性别分布统计(计算精准-已测试)
  67. */
  68. async selectUserBySex() {
  69. const { ctx, service } = this;
  70. const query = ctx.request.body;
  71. delete query.deptId;
  72. const result = await service.visit.selectUserBySex(query);
  73. ctx.body = result;
  74. }
  75. /**
  76. * 7.巡访员认证数据统计(计算精准-已测试)
  77. */
  78. async selectAuthAndLook() {
  79. const { ctx, service } = this;
  80. const query = ctx.request.body;
  81. delete query.deptId;
  82. if (Object.keys(query).length === 0) {
  83. query.dept1 = this.app.config.dept1ObjectId;
  84. }
  85. const result = await service.visit.selectAuthAndLook(query);
  86. ctx.body = result;
  87. }
  88. /**
  89. * 8.巡访员积分排行TOP10(计算精准-已测试)
  90. */
  91. async selectUserValue() {
  92. const { ctx, service } = this;
  93. const query = ctx.request.body;
  94. delete query.deptId;
  95. const result = await service.visit.selectUserValue(query);
  96. ctx.body = result;
  97. }
  98. /**
  99. * 9.巡访员职务分布统计(计算精准-已测试)
  100. */
  101. async selectByJob() {
  102. const { ctx, service } = this;
  103. const query = ctx.request.body;
  104. delete query.deptId;
  105. const result = await service.visit.selectByJob(query);
  106. ctx.body = result;
  107. }
  108. /**
  109. * 10.地区总积分(计算精准-已测试)
  110. */
  111. async selectDeptValue() {
  112. const { ctx, service } = this;
  113. const query = ctx.request.body;
  114. delete query.deptId;
  115. if (Object.keys(query).length === 0) {
  116. query.dept1 = this.app.config.dept1ObjectId;
  117. }
  118. const result = await service.visit.selectDeptValue(query);
  119. ctx.body = result;
  120. }
  121. /**
  122. * 11.巡访员巡访问方式统计(计算精准-已测试)
  123. */
  124. async visitWay() {
  125. const { ctx, service } = this;
  126. const query = ctx.request.body;
  127. delete query.deptId;
  128. const result = await service.visit.visitWay(query);
  129. ctx.body = result;
  130. }
  131. /**
  132. * 12.巡访数量(计算精准-已测试)
  133. */
  134. async visitnum() {
  135. const { ctx, service } = this;
  136. const query = ctx.request.body;
  137. delete query.deptId;
  138. if (Object.keys(query).length === 0) {
  139. query.dept1 = this.app.config.dept1ObjectId;
  140. }
  141. const result = await service.visit.visitnum(query);
  142. ctx.body = result;
  143. }
  144. }
  145. module.exports = VisitController;