info.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. class InfoController extends Controller {
  4. /**
  5. * 1.年龄分布(计算精准-已测试)
  6. */
  7. async fournums() {
  8. const { ctx, service } = this;
  9. const query = ctx.request.body;
  10. delete query.deptId;
  11. const result = await service.info.fournums(query);
  12. ctx.body = result;
  13. }
  14. /**
  15. * 2.性别分布(计算精准-已测试)
  16. */
  17. async sex() {
  18. const { ctx, service } = this;
  19. const query = ctx.request.body;
  20. delete query.deptId;
  21. const result = await service.info.sex(query);
  22. ctx.body = result;
  23. }
  24. /**
  25. * 3.能力评估(计算精准-已测试)
  26. */
  27. async ability() {
  28. const { ctx, service } = this;
  29. const query = ctx.request.body;
  30. delete query.deptId;
  31. const result = await service.info.ability(query);
  32. ctx.body = result;
  33. }
  34. /**
  35. * 4.健康状况(计算精准-已测试)
  36. */
  37. async oldHealth() {
  38. const { ctx, service } = this;
  39. const query = ctx.request.body;
  40. delete query.deptId;
  41. const result = await service.info.oldHealth(query);
  42. ctx.body = result;
  43. }
  44. /**
  45. * 5.类别分布(计算精准-已测试)
  46. */
  47. async oldType() {
  48. const { ctx, service } = this;
  49. const query = ctx.request.body;
  50. delete query.deptId;
  51. if (Object.keys(query).length === 0) {
  52. query.dept1 = this.app.config.dept1ObjectId;
  53. }
  54. const result = await service.info.oldType(query);
  55. ctx.body = result;
  56. }
  57. /**
  58. * 6.探访频次(计算精准-已测试)
  59. */
  60. async visitFrequency() {
  61. const { ctx, service } = this;
  62. const query = ctx.request.body;
  63. delete query.deptId;
  64. const result = await service.info.visitFrequency(query);
  65. ctx.body = result;
  66. }
  67. /**
  68. * 7.收入来源(计算精准-已测试)
  69. */
  70. async oldIncome() {
  71. const { ctx, service } = this;
  72. const query = ctx.request.body;
  73. delete query.deptId;
  74. const result = await service.info.oldIncome(query);
  75. ctx.body = result;
  76. }
  77. /**
  78. * 8.可支配收入(计算精准-已测试)
  79. */
  80. async income() {
  81. const { ctx, service } = this;
  82. const query = ctx.request.body;
  83. delete query.deptId;
  84. const result = await service.info.income(query);
  85. ctx.body = result;
  86. }
  87. /**
  88. * 9.生活经济状况(计算精准-已测试)
  89. */
  90. async livingCondition() {
  91. const { ctx, service } = this;
  92. const query = ctx.request.body;
  93. delete query.deptId;
  94. const result = await service.info.livingCondition(query);
  95. ctx.body = result;
  96. }
  97. /**
  98. * 10.关爱服务(计算精准-已测试)
  99. */
  100. async oldDemand() {
  101. const { ctx, service } = this;
  102. const query = ctx.request.body;
  103. delete query.deptId;
  104. const result = await service.info.oldDemand(query);
  105. ctx.body = result;
  106. }
  107. /**
  108. * 11.老人数量(计算精准-已测试)
  109. */
  110. async oldnum() {
  111. const { ctx, service } = this;
  112. const query = ctx.request.body;
  113. delete query.deptId;
  114. if (Object.keys(query).length === 0) {
  115. query.dept1 = this.app.config.dept1ObjectId;
  116. }
  117. const result = await service.info.oldnum(query);
  118. ctx.body = result;
  119. }
  120. }
  121. module.exports = InfoController;