'use strict'; const Controller = require('egg').Controller; /** * 寻访数据信息统计 * */ class VisitController extends Controller { /** * 1.老年人健康状况 (计算精准-已测试) * 现在健康状况选项 ( 健康、一般、较差 ) */ async health() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; const result = await service.visit.health(query); ctx.body = result; } /** * 2.老年人精神状态 (计算精准-已测试) * 2020-2-18 出现 '健康' 值,这是以前的错误数据; * 现在精神状态选项 ( 良好、一般、较差 ) */ async mind() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; const result = await service.visit.mind(query); ctx.body = result; } /** * 3.老年人安全情况 (计算精准-已测试) * 现在精神状态选项 ( 安全、一般、较差 ) */ async security() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; const result = await service.visit.security(query); ctx.body = result; } /** * 4.老年人卫生环境(计算精准-已测试) * 2020-2-18 出现 '健康' 值,这是以前的错误数据; * 现在精神状态选项 ( 良好、一般、较差 ) */ async hygiene() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; const result = await service.visit.hygiene(query); ctx.body = result; } /** * 5.老年人居住情况(计算精准-已测试) * 2020-2-18 出现 '健康' 值,这是以前的错误数据; * 现在精神状态选项 ( 良好、一般、较差 ) */ async live() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; const result = await service.visit.live(query); ctx.body = result; } /** * 6.巡访员性别分布统计(计算精准-已测试) */ async selectUserBySex() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; const result = await service.visit.selectUserBySex(query); ctx.body = result; } /** * 7.巡访员认证数据统计(计算精准-已测试) */ async selectAuthAndLook() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; if (Object.keys(query).length === 0) { query.dept1 = this.app.config.dept1ObjectId; } const result = await service.visit.selectAuthAndLook(query); ctx.body = result; } /** * 8.巡访员积分排行TOP10(计算精准-已测试) */ async selectUserValue() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; const result = await service.visit.selectUserValue(query); ctx.body = result; } /** * 9.巡访员职务分布统计(计算精准-已测试) */ async selectByJob() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; const result = await service.visit.selectByJob(query); ctx.body = result; } /** * 10.地区总积分(计算精准-已测试) */ async selectDeptValue() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; if (Object.keys(query).length === 0) { query.dept1 = this.app.config.dept1ObjectId; } const result = await service.visit.selectDeptValue(query); ctx.body = result; } /** * 11.巡访员巡访问方式统计(计算精准-已测试) */ async visitWay() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; const result = await service.visit.visitWay(query); ctx.body = result; } /** * 12.巡访数量(计算精准-已测试) */ async visitnum() { const { ctx, service } = this; const query = ctx.request.body; delete query.deptId; if (Object.keys(query).length === 0) { query.dept1 = this.app.config.dept1ObjectId; } const result = await service.visit.visitnum(query); ctx.body = result; } } module.exports = VisitController;