1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498 |
- package com.yihu.wlyy.web.statistic;
- import com.yihu.wlyy.entity.statistics.PopulationBase;
- import com.yihu.wlyy.entity.statistics.WlyyQuotaResult;
- import com.yihu.wlyy.job.Constant;
- import com.yihu.wlyy.service.app.statistics.StatisticsAllService;
- import com.yihu.wlyy.service.app.statistics.StatisticsService;
- import com.yihu.wlyy.util.ValueComparator;
- import com.yihu.wlyy.web.BaseController;
- import io.swagger.annotations.Api;
- import org.apache.commons.lang3.StringUtils;
- import org.json.JSONArray;
- import org.json.JSONObject;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.http.MediaType;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- import java.util.*;
- /**
- * Created by lyr on 2016/08/16.
- */
- @Controller
- @RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- @Api(description = "统计")
- public class StatisticsController extends BaseController {
- @Autowired
- StatisticsService statisticsService;
- @Autowired
- StatisticsAllService statisticsAllService;
- /**
- * 获取统计时间
- *
- * @return
- */
- @RequestMapping(value = "/time")
- @ResponseBody
- public String getStatisticsTime() {
- try {
- return write(200, "查询成功", "data", statisticsService.getStatisticsTime());
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 指标按间隔统计 增量
- * 按年度统计是根据前端传的 startDate
- *
- * @param startDate 起始日期
- * @param endDate 结束时间
- * @param interval 时间间隔
- * @param area 区域或机构
- * @param level 级别
- * @param index 指标 3 4 5 27
- * @return
- */
- @RequestMapping(value = "/interval")
- @ResponseBody
- public String indexInterval(@RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) int interval,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = true) String index,
- @RequestParam(required = false) String level2_type) {
- String tag = "";
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- if (index != null) {
- for (String idx : indexes) {
- result.put("index_" + idx, statisticsService.getDateIncrementDetail(startDate, endDate, interval, area, level, idx, level2_type));
- }
- }
- return write(200, "查询成功!", "data", result);
- } catch (Exception e) {
- return error(-1, tag + "查询失败!");
- }
- }
- /**
- * 指标期间 增长量
- *
- * @param startDate
- * @param endDate
- * @param area
- * @param level
- * @param index
- * @return
- */
- @RequestMapping("/increment")
- @ResponseBody
- public String getIndexIncrement(@RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = true) String index,
- @RequestParam(required = false) String year) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- for (String idx : indexes) {
- result.put("index_" + idx, statisticsService.getIntervalIncrement(startDate, endDate, area, level, idx));
- }
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- e.printStackTrace();
- return error(-1, "查询失败");
- }
- }
- /**
- * 指标截止日期累积量 增量的累加接口
- *
- * @param startDate 开始时间
- * @param endDate 结束时间
- * @param area 父code
- * @param level 等级 1 团队,2 机构,3 区,4 市
- * @param index 指标代码 3 4 5 27
- * @param level2_type 指标代码 例如性别 1 男 2 女 不传就返回男和女的总和
- * @return
- */
- @RequestMapping("/total")
- @ResponseBody
- public String getIndexTotal(
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = true) String index,
- @RequestParam(required = false) String level2_type) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- for (String idx : indexes) {
- result.put("index_" + idx, statisticsService.getTotalAmount(startDate, endDate, area, level, idx, level2_type));
- }
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 指标期间增长量 此接口前端没用
- *
- * @param startDate
- * @param endDate
- * @param area
- * @param level
- * @param index
- * @return
- */
- @RequestMapping("/lowlevel_increment")
- @ResponseBody
- @Deprecated
- public String getIndexLowLevelIncrement(@RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = true) String index,
- @RequestParam(required = true) int sort,
- @RequestParam(required = false) String lowLevel,
- @RequestParam(required = false) String year) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- for (String idx : indexes) {
- result.put("index_" + idx, statisticsService.getLowLevelIncrementDetail(startDate, endDate, area, level, idx, sort, lowLevel));
- }
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- e.printStackTrace();
- return error(-1, "查询失败");
- }
- }
- /**
- * 指标截止日期 增量
- * (如:待预约量)
- *
- * @param endDate 结束时间
- * @param area 父code
- * @param level 等级 1 团队,2 机构,3 区,4 市
- * @param index 指标代码
- * @param sort 排序 1倒叙 2是 正序
- * @param lowLevel
- * @param level2_type 指标代码 例如性别 1 男 2 女 不传就返回男和女的总和
- * @return
- */
- @RequestMapping("/lowlevel_total")
- @ResponseBody
- public String getIndexLowLevelTotal(@RequestParam(required = true) String endDate,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = true) String index,
- @RequestParam(required = true) int sort,
- @RequestParam(required = false) String lowLevel,
- @RequestParam(required = false) String level2_type,
- @RequestParam(required = false) String year) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- for (String idx : indexes) {
- result.put("index_" + idx, statisticsService.getLowLevelTotalDetail(endDate, area, level, idx, sort, lowLevel, level2_type, year));
- }
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 指标截止日期累积量 增量
- * 根据2个ID合并指标
- *
- * @param endDate
- * @param area
- * @param level
- * @param index 3,22
- * @return
- */
- @RequestMapping("/lowlevel_total_mesh")
- @ResponseBody
- public String getIndexLowLevelTotalMesh(@RequestParam(required = true) String endDate, // 2007-10-02
- @RequestParam(required = true) String area,//区域 350205
- @RequestParam(required = true) int level,//等级
- @RequestParam(required = true) String index,//指标code
- @RequestParam(required = true) int sort,//1是倒叙 0是正序
- @RequestParam(required = false) String lowLevel,
- @RequestParam(required = false) String year) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- JSONArray returnJa = new JSONArray();
- List<JSONArray> jsonArrays = new ArrayList<>();
- JSONArray jsonArray1 = statisticsService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel, null, year);
- jsonArrays.add(jsonArray1);
- JSONArray jsonArray2 = statisticsService.getLowLevelIncrementDetail(endDate, endDate, area, level, indexes[1], sort, lowLevel);
- jsonArrays.add(jsonArray2);
- //遍历合并2个指标中key值一样的
- if (jsonArrays.get(1).length() == 0) {
- //如果只有一个指标的时候 另外一个指标默认是0
- for (int i = 0; i < jsonArrays.get(0).length(); i++) {
- //未回复咨询不存在的时候默认是0
- JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
- String amount = map1.get("amount").toString() + ",0";
- map1.put("amount", amount);
- returnJa.put(map1);
- }
- } else {
- //如果是2个指标的时候,分别放入map中,以减少查询次数
- Map<String, JSONObject> in = new TreeMap<>();
- ValueComparator vc = new ValueComparator(in);
- Map<String, JSONObject> index2 = new TreeMap<>();
- for (int i = 0; i < jsonArrays.get(0).length(); i++) {
- JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
- in.put(map1.get("code").toString(), map1);
- }
- Map<String, JSONObject> index1 = new TreeMap<>(vc);
- index1.putAll(in);
- for (int i = 0; i < jsonArrays.get(1).length(); i++) {
- JSONObject map1 = jsonArrays.get(1).getJSONObject(i);
- index2.put(map1.get("code").toString(), map1);
- }
- for (Map.Entry<String, JSONObject> one : index1.entrySet()) {
- JSONObject map1 = one.getValue();
- JSONObject map2 = index2.get(one.getKey());
- String amount = map1.get("amount").toString() + "," + map2.get("amount").toString();
- map1.put("amount", amount);
- returnJa.put(map1);
- }
- }
- if (level == 2) {
- statisticsAllService.translateTeamLeaderNameByCode(returnJa);
- }
- result.put("index_" + indexes[0], returnJa);
- return write(200, "查询成功", "data", result);
- } catch (
- Exception e
- )
- {
- e.printStackTrace();
- return error(-1, "查询失败");
- }
- }
- /**
- * 指标期间 增长量
- *
- * @param startDate
- * @param endDate
- * @param area
- * @param level
- * @param index
- * @return
- */
- @RequestMapping("/leveltwo_increment")
- @ResponseBody
- public String getIndexLevelTwoIncrement(@RequestParam(required = false) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = true) String index,
- @RequestParam(required = false) String year) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- for (String idx : indexes) {
- result.put("index_" + idx, statisticsAllService.getIndexLevelTwototal(endDate, area, level, idx));
- }
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- e.printStackTrace();
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取签约率、签约完成率
- *
- * @param endDate 截止日期
- * @param area 区域
- * @param level 区域级别 4:城市 3:区 2:社区 1:团队
- * @return
- */
- @RequestMapping(value = "/sign_info")
- @ResponseBody
- public String getAreaSignInfo(@RequestParam(required = true) String endDate,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = false) String lowCode
- ) {
- try {
- JSONObject result = new JSONObject();
- if (StringUtils.isEmpty(lowCode)) {
- long sign = statisticsAllService.getIndexTotal(endDate, area, level, "13");
- long weiJf = statisticsAllService.getWeiJiaoFei(endDate, area, level);
- JSONObject jo = statisticsService.getRenewPercentAndChangePercent(level + "", area, Constant.getStartYear());
- JSONObject signRate = statisticsAllService.getSignRate(endDate, area, level);
- JSONObject signTaskRate = statisticsAllService.getSignTaskRate(endDate, area, level);
- result.put("sign", sign);
- result.put("expenses", weiJf);
- result.put("renew", jo.get("thisYearRenew") + "/" + jo.get("yesterYearSign"));//去年的签约量
- result.put("signRate", signRate);
- result.put("signTaskRate", signTaskRate);
- result.put("renewRange", jo.get("renewRange"));//续签率 50.00%
- } else {
- result = statisticsAllService.getGroupInfo(endDate, lowCode, area, level);
- }
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取三级指标增量 到达量
- *
- * @param startDate
- * @param endDate
- * @param area
- * @param level
- * @return
- */
- @RequestMapping(value = "/sixfive_statistics")
- @ResponseBody
- public String getSixFiveStatistics(@RequestParam(required = false) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String area,
- int level,
- @RequestParam(required = false) String year) {
- try {
- JSONArray result = statisticsAllService.getSixFiveStatistics(endDate, area, level);
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- e.printStackTrace();
- return error(-1, "查询失败");
- }
- }
- /**
- * 指标按间隔统计 到达量
- *
- * @param startDate 起始日期
- * @param endDate 结束时间
- * @param interval 时间间隔
- * @param area 区域或机构
- * @param level 级别
- * @param index 指标 除了增量的指标都会调用
- * @param lowCode 子维度
- * @param year 查询年份
- * @return
- */
- @RequestMapping(value = "/interval_total")
- @ResponseBody
- public String indexIntervalTotal(@RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) int interval,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = true) String index,
- @RequestParam(required = false) String lowCode,
- @RequestParam(required = false) String year) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- if (index != null) {
- for (String idx : indexes) {
- JSONObject json = statisticsAllService.getDateTotal(startDate, endDate, interval, area, level, idx, lowCode);
- //如果year不为空 那么因为是到达量 所以要累加上一年的数据
- if (!org.springframework.util.StringUtils.isEmpty(year) && !"2016".equals(year)) {
- //得到上一个年份的的最后一天的统计数据
- String date = year + "-06-30";//固定是 6月三十号 为一个年份的最后一天,如果是2017年份 那么就是2017-7-1 到 2018-6-30
- WlyyQuotaResult wlyyQuotaResult = statisticsService.findOneQuotaResult(date, level, idx, area);
- if (wlyyQuotaResult != null) {
- JSONArray ja = json.getJSONArray("data");
- for (int i = 0; i < ja.length(); i++) {
- Integer value = Integer.valueOf(ja.getJSONObject(i).getString("amount"));
- super.infoMessage("原来的总数:" + value);
- ja.getJSONObject(i).put("amount", value + Integer.valueOf(wlyyQuotaResult.getResult()));
- super.infoMessage("需要想加的总数:" + wlyyQuotaResult.getResult());
- }
- }
- }
- result.put("index_" + idx, json);
- }
- }
- return write(200, "查询成功!", "data", result);
- } catch (Exception e) {
- return error(-1, "查询失败!");
- }
- }
- /**
- * 指标截止日期累积量 到达量
- *
- * @param date
- * @param area
- * @param level level1_type等级 1:团队 2社区机构 3区级 4市级
- * @param index quotoCode 18/19两率 28 13 17
- * @param sort 0:升序 1:降序
- * @param lowCode
- * @return
- */
- @RequestMapping("/lowlevel_all")
- @ResponseBody
- public String getIndexLowLevelTotalSign(@RequestParam(required = true) String date,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = true) String index,
- @RequestParam(required = true) int sort,
- @RequestParam(required = false) String lowLevel,
- @RequestParam(required = false) String lowCode,
- @RequestParam(required = false) String year) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- if (StringUtils.isNotEmpty(lowCode)) {
- // 指定level下特定查询级别
- if (index.equals("17")) {
- result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotalTeamLeader(date, area, level, index, sort, lowLevel, lowCode));
- } else {
- result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotal(date, area, level, index, sort, lowLevel, lowCode));
- }
- } else {
- // 未指定level下特定查询级别
- for (String idx : indexes) {
- if (idx.equals("18") || index.equals("19")) {
- result.put("index_" + idx, statisticsAllService.getLowLevelTotalSpecial(date, area, level, idx, sort, lowLevel));
- } else if (idx.equals("1") || index.equals("21")) {
- result.put("index_" + idx, statisticsAllService.getLowLevelTotal2(date, area, level, idx, sort, lowLevel));
- } else if (idx.equals("28")) {
- result.put("index_" + idx, statisticsService.getAvgAllInfo(level, area, lowLevel));
- } else if (idx.equals("13")) {
- result.put("index_" + idx, statisticsAllService.getLowLevelTotalTeamLeader(date, area, level, idx, sort, lowLevel));
- } else {
- result.put("index_" + idx, statisticsAllService.getLowLevelTotal(date, area, level, idx, sort, lowLevel));
- }
- }
- }
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- e.printStackTrace();
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取三师转签或高危人群
- *
- * @param endDate
- * @param area
- * @param level
- * @return
- */
- @RequestMapping(value = "/sszq_qwrq_info")
- @ResponseBody
- public String getSszqAndGwrq(@RequestParam(required = true) String endDate,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level) {
- try {
- JSONObject result = new JSONObject();
- JSONObject sszq = statisticsAllService.getSszqAndGwrq(endDate, area, level, "18");
- JSONObject gwrq = statisticsAllService.getSszqAndGwrq(endDate, area, level, "19");
- result.put("sszq", sszq);
- result.put("gwrq", gwrq);
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 二级指标 到达量 废弃接口 前端没有调用
- *
- * @param date
- * @param area
- * @param level
- * @param index
- * @return
- */
- @RequestMapping(value = "/leveltwo_all")
- @ResponseBody
- @Deprecated
- public String getIndexLevelTwoTotal(@RequestParam(required = true) String date,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = true) String index) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- for (String idx : indexes) {
- result.put("index_" + idx, statisticsAllService.getIndexLevelTwototal(date, area, level, idx));
- }
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- e.printStackTrace();
- return error(-1, "查询失败");
- }
- }
- /**
- * 指标截止日期 到达量
- *
- * @param endDate
- * @param area
- * @param level
- * @param index
- * @return
- */
- @RequestMapping("/index_all")
- @ResponseBody
- public String getIndexAll(@RequestParam(required = true) String endDate,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = true) String index,
- @RequestParam(required = false) String year) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- for (String idx : indexes) {
- Long total = statisticsAllService.getIndexTotal(endDate, area, level, idx);
- super.infoMessage("原来的总数:" + total);
- //如果year不为空 那么因为是到达量 所以要加上一年的数据
- if (!org.springframework.util.StringUtils.isEmpty(year) && !"2016".equals(year)) {
- //得到上一个年份的的最后一天的统计数据
- String date = year + "-06-30";//固定是 6月三十号 为一个年份的最后一天,如果是2017年份 那么就是2017-7-1 到 2018-6-30
- WlyyQuotaResult wlyyQuotaResult = statisticsService.findOneQuotaResult(date, level, idx, area);
- if (wlyyQuotaResult != null) {
- super.infoMessage("需要添加的数目:" + wlyyQuotaResult.getResult());
- total = total + Long.valueOf(wlyyQuotaResult.getResult());
- }
- }
- result.put("index_" + idx, total);
- }
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 咨询统计
- * 咨询分析页面具体交互与业务分析内一致,即按市、区、社区、机构有不同展示,可一级级进入查看
- * ①回复及时率------医生首次回复24小时内比例
- * ②未回复数(数、率)----------当前未回复咨询数、以及相应比例
- * ③处理咨询回复时间分布---------全部咨询的首次回复咨询时间分布
- *
- * @param level 查询的等级,按市、区、机构
- * @param area 查询的等级对应Code
- * @return
- */
- @RequestMapping("/Consulting_Stat")
- @ResponseBody
- public String getConsultingStatistics(@RequestParam(required = true) Integer level,
- @RequestParam(required = true) String area) {
- try {
- return write(200, "查询成功", "data", statisticsService.getConsultingStatistics(level, area));
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 咨询统计
- * 咨询分析页面具体交互与业务分析内一致,即按市、区、社区、机构有不同展示,可一级级进入查看
- * ①回复及时率------医生首次回复24小时内比例
- * ②未回复数(数、率)----------当前未回复咨询数、以及相应比例
- * ③处理咨询回复时间分布---------全部咨询的首次回复咨询时间分布
- *
- * @param level 查询的等级,按市、区、机构
- * @return
- */
- @RequestMapping("/Consulting_StatList")
- @ResponseBody
- public String getConsultingStatisticsList(@RequestParam(required = true) Integer level,
- @RequestParam(required = true) String area,
- @RequestParam(required = false) String lowlevel,
- @RequestParam(required = false) String year) {
- try {
- JSONObject data = null;
- if (Constant.getNowYear().equals(year)) {
- data = statisticsService.getConsultingStatisticsList(level, area, lowlevel);
- } else if (org.springframework.util.StringUtils.isEmpty(year)) {
- data = statisticsService.getConsultingStatisticsListAll(level, area, lowlevel, year);
- } else {
- data = statisticsService.getConsultingStatisticsListYear(level, area, lowlevel, year);
- }
- if (data != null) {
- return write(200, "查询成功", "data", data);
- } else {
- return error(-1, "查询失败");
- }
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 咨询统计
- * 咨询分析页面具体交互与业务分析内一致,即按市、区、社区、机构有不同展示,可一级级进入查看
- * ①回复及时率------医生首次回复24小时内比例
- * ②未回复数(数、率)----------当前未回复咨询数、以及相应比例
- * ③处理咨询回复时间分布---------全部咨询的首次回复咨询时间分布
- *
- * @param level 查询的等级,按市、区、机构
- * @return
- */
- @RequestMapping("/Consulting_Title")
- @ResponseBody
- public String getConsultingTitle(@RequestParam(required = true) Integer level,
- @RequestParam(required = true) String area,
- @RequestParam(required = false) String year) {
- try {
- JSONObject data = null;
- if (Constant.getStartYear().equals(year)) {
- //查今年的查找redis即可
- data = statisticsService.getConsultingTitle(level, area);
- } else if (org.springframework.util.StringUtils.isEmpty(year)) {
- //为空默认查询全部
- //查找redis的然后再添加去年年度的
- data = statisticsService.getConsultingTitleAll(level, area, year);
- } else {
- //去数据库查找年份
- data = statisticsService.getConsultingTitleWithYear(level, area, year);
- }
- if (data != null) {
- return write(200, "查询成功", "data", data);
- } else {
- return error(-1, "查询失败");
- }
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取回复数时间分布数
- *
- * @param level
- * @param area
- * @return
- */
- @RequestMapping("/getCoutListByTime")
- @ResponseBody
- public String getCoutListByTime(
- @RequestParam(required = true) String level,
- @RequestParam(required = true) String area,
- @RequestParam(required = false) String year) {
- try {
- if (Constant.getStartYear().equals(year)) {
- return write(200, "查询成功", "data", statisticsService.getCoutListByTime(level, area));
- } else if (org.springframework.util.StringUtils.isEmpty(year)) {
- return write(200, "查询成功", "data", statisticsService.getCoutListByTimeAll(level, area));
- } else {
- return write(200, "查询成功", "data", statisticsService.getCoutListByTimeYear(level, area, year));
- }
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取绑定率
- * 1、选定绑定微信指标,下面排行内,在绑定微信数后新增:"绑定率:xx.22%"
- * 2、绑定率=绑定数/已签约数
- *
- * @return
- */
- @RequestMapping("/bindingRate_stat")
- @ResponseBody
- public String getBindingRate() {
- try {
- return write(200, "查询成功", "data", statisticsService.getBindingRate());
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取得分平均数
- *
- * @param level
- * @param area
- * @return
- */
- @RequestMapping("/getAVGSocre")
- @ResponseBody
- public String getAVGSocre(@RequestParam(required = true) String level, @RequestParam(required = true) String area) {
- try {
- return write(200, "查询成功", "data", statisticsService.getAVGSocre(level, area));
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取得分平均数按月份
- *
- * @return
- */
- @RequestMapping("/getAVGSocreByMonth")
- @ResponseBody
- public String getAVGSocreByMonth(@RequestParam(required = true) String level,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) String statDate,
- @RequestParam(required = true) String endDate) {
- try {
- return write(200, "查询成功", "data", statisticsService.getAVGSocreByMonth(level, area, statDate, endDate));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 统计当前团队,签约人数,服务次数,平均满意度
- *
- * @return
- */
- @RequestMapping("/getStatTitleInfo")
- @ResponseBody
- public String getStatTitleInfo(@RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate) {
- try {
- return write(200, "查询成功", "data", statisticsService.getStatTitleInfo(getUID(), startDate, endDate));
- //return write(200, "查询成功", "data", statisticsService.getStatTitleInfo("xh1D201703150222",startDate,endDate));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取签约折线图
- *
- * @param startDate
- * @param endDate
- * @param signType 0 签约,1 续签
- * @param type 0 按周,1 按月
- * @return
- */
- @RequestMapping("/getSignCountLineByType")
- @ResponseBody
- public String getSignCountLineByType(@RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String signType,
- @RequestParam(required = true) String type) {
- try {
- //判断是签约还是续签
- if ("0".equals(signType)) {
- return write(200, "查询成功", "data", statisticsService.getSignCountLineByType(getUID(), type, startDate, endDate));
- //return write(200, "查询成功", "data", statisticsService.getSignCountLineByType("xh1D201703150222",type,startDate,endDate));
- } else {
- return write(200, "查询成功", "data", statisticsService.getRenewCountLineByType(getUID(), type, startDate, endDate));
- //return write(200, "查询成功", "data", statisticsService.getRenewCountLineByType("xh1D201703150222",type,startDate,endDate));
- }
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取咨询数和未回复数
- *
- * @param startDate
- * @param endDate
- * @param isNow 1 为当前;2为非当前
- * @return
- */
- @RequestMapping("/getReyStatbyTeam")
- @ResponseBody
- public String getReyStatbyTeam(@RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String isNow) {
- try {
- return write(200, "查询成功", "data", statisticsService.getReyStatbyTeam(getUID(), startDate, endDate, isNow));
- //return write(200, "查询成功", "data", statisticsService.getReyStatbyTeam("xh1D201703150222",startDate,endDate,isNow));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取机构内服务排行
- *
- * @param startDate
- * @param endDate
- * @return
- */
- @RequestMapping("/getServiceRankingList")
- @ResponseBody
- public String getServiceRankingList(@RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate) {
- try {
- return write(200, "查询成功", "data", statisticsService.getServiceRankingList(getUID(), startDate, endDate));
- //return write(200, "查询成功", "data", statisticsService.getServiceRankingList("xh1D201703150222",startDate,endDate));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取平均值统计折线图
- *
- * @param startDate
- * @param endDate
- * @param type 0周,1月
- * @return
- */
- @RequestMapping("/getAvgLine")
- @ResponseBody
- public String getAvgLine(@RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String type) {
- try {
- return write(200, "查询成功", "data", statisticsService.getAvgLine(getUID(), startDate, endDate, type));
- // return write(200, "查询成功", "data", statisticsService.getAvgLine("xh1D201703150222",startDate,endDate,type));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 判断团队是否是团队长
- *
- * @return
- */
- @RequestMapping("/checkDoctorIsTeamLeder")
- @ResponseBody
- public String checkDoctorIsTeamLeder() {
- try {
- return write(200, "查询成功", "data", statisticsService.checkDoctorIsTeamleader(getUID()));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队月或周咨询未回复和总数折线图
- *
- * @param teamCode 团队id
- * @param startDate
- * @param endDate
- * @param type 0周,1月
- * @return
- */
- @RequestMapping("/getTeamConsultCount")
- @ResponseBody
- public String getTeamConsultCount(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String type) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamConsultCount(teamCode, startDate, endDate, type));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 计算团队医生月或周咨询未回复和总数折线图
- *
- * @param teamCode
- * @param startDate
- * @param endDate
- * @param type 0周,1月
- * @param doctor
- * @return
- */
- @RequestMapping("/getTeamDoctorConsultCount")
- @ResponseBody
- public String getTeamDoctorConsultCount(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String type,
- @RequestParam(required = true) String doctor) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamDoctorConsultCount(teamCode, startDate, endDate, type, doctor));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队内这成员,未回复数,总数,结束咨询数
- *
- * @param teamCode
- * @param startDate
- * @param endDate
- * @param sort 0降序,1升序
- * @return
- */
- @RequestMapping("/getMemberConsultList")
- @ResponseBody
- public String getMemberConsultList(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String sort,
- @RequestParam(required = true) String sortType) {
- try {
- return write(200, "查询成功", "data", statisticsService.getMemberConsultList(teamCode, startDate, endDate, sort, sortType));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取Doctor咨询结果
- *
- * @param doctor
- * @param teamCode
- * @param startDate
- * @param endDate
- * @return
- */
- @RequestMapping("/getDoctorConsultTitle")
- @ResponseBody
- public String getDoctorConsultTitle(@RequestParam(required = true) String doctor,
- @RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate) {
- try {
- return write(200, "查询成功", "data", statisticsService.getDoctorConsultTitle(doctor, teamCode, startDate, endDate));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队随访量折线统计图
- *
- * @param type
- * @param teamCode
- * @param startDate
- * @param endDate
- * @return
- */
- @RequestMapping("/getTeamFollowupLine")
- @ResponseBody
- public String getTeamFollowupLine(@RequestParam(required = true) String type,
- @RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamFollowupLine(teamCode, startDate, endDate, type));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- @RequestMapping("/getTeamDoctorFollowupLine")
- @ResponseBody
- public String getTeamDoctorFollowupLine(@RequestParam(required = true) String type,
- @RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String doctor) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamDoctorFollowupLine(teamCode, startDate, endDate, type, doctor));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 根据团队获取团队底下用户列表
- *
- * @param sort 0为降序,1为升序
- * @param teamCode
- * @param startDate
- * @param endDate
- * @param sortType 0为总数排序,1为增量排序,2为计划中排序
- * @return
- */
- @RequestMapping("/getDoctorTeamFolList")
- @ResponseBody
- public String getDoctorTeamFolList(@RequestParam(required = true) String sort,
- @RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String sortType) {
- try {
- return write(200, "查询成功", "data", statisticsService.getDoctorTeamFolList(startDate, endDate, teamCode, sort, sortType));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取医生随访头信息
- *
- * @param teamCode
- * @param doctor
- * @param startDate
- * @param endDate
- * @return
- */
- @RequestMapping("/getTeamDoctorFolTitle")
- @ResponseBody
- public String getTeamDoctorFolTitle(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String doctor,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamDoctorFolTitle(teamCode, doctor, startDate, endDate));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取待预约量团队统计则线图
- *
- * @param teamCode
- * @param type
- * @param startDate
- * @param endDate
- * @return
- */
- @RequestMapping("/getTeamResLine")
- @ResponseBody
- public String getTeamResLine(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String type,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamResLine(teamCode, startDate, endDate, type));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队医生预约量团队统计则线图
- *
- * @param teamCode
- * @param type
- * @param startDate
- * @param endDate
- * @param doctor
- * @return
- */
- @RequestMapping("/getTeamDoctorResLine")
- @ResponseBody
- public String getTeamDoctorResLine(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String type,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String doctor) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamDoctorResLine(teamCode, startDate, endDate, type, doctor));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队待预约量医生列表信息
- *
- * @param teamCode
- * @param startDate
- * @param endDate
- * @param sort 0为降序,1为升序
- * @param sortType 0为按总数,1为按增数
- * @return
- */
- @RequestMapping("/getTeamDoctorResList")
- @ResponseBody
- public String getTeamDoctorResList(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String sort,
- @RequestParam(required = true) String sortType) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamDoctorResList(teamCode, startDate, endDate, sort, sortType));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队医生待预信息
- *
- * @param teamCode
- * @param doctor
- * @param startDate
- * @param endDate
- * @return
- */
- @RequestMapping("/getTeamDoctorResTitle")
- @ResponseBody
- public String getTeamDoctorResTitle(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String doctor,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamDoctorResTitle(teamCode, doctor, startDate, endDate));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队健康指导折线图
- *
- * @param teamCode
- * @param startDate
- * @param endDate
- * @param type 0周,1月
- * @return
- */
- @RequestMapping("/getTeamGuidLine")
- @ResponseBody
- public String getTeamGuidLine(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String type) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamGuidLine(teamCode, startDate, endDate, type));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队医生则线图
- *
- * @param teamCode
- * @param startDate
- * @param endDate
- * @param type
- * @param doctor
- * @return
- */
- @RequestMapping("/getTeamDoctorGuidLine")
- @ResponseBody
- public String getTeamDoctorGuidLine(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String type,
- @RequestParam(required = true) String doctor) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamDoctorGuidLine(teamCode, startDate, endDate, type, doctor));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队指导总数List
- *
- * @param teamCode
- * @param startDate
- * @param endDate
- * @param sort
- * @param sortType
- * @return
- */
- @RequestMapping("/getTeamGuidList")
- @ResponseBody
- public String getTeamGuidList(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String sort,
- @RequestParam(required = true) String sortType) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamGuidList(teamCode, startDate, endDate, sort, sortType));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取医生健康指导头部信息
- *
- * @param teamCode
- * @param doctor
- * @param startDate
- * @param endDate
- * @return
- */
- @RequestMapping("/getTeamDoctorGuiTitle")
- @ResponseBody
- public String getTeamDoctorGuiTitle(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String doctor,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamDoctorGuiTitle(teamCode, doctor, startDate, endDate));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队健康教育折线统计
- *
- * @param teamCode
- * @param startDate
- * @param endDate
- * @param type 0按周 1按月
- * @return
- */
- @RequestMapping("/getTeamEduLine")
- @ResponseBody
- public String getTeamEduLine(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String type) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamEduLine(teamCode, startDate, endDate, type));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队健康
- *
- * @param teamCode
- * @param startDate
- * @param endDate
- * @param type
- * @return
- */
- @RequestMapping("/getTeamDoctorEduLine")
- @ResponseBody
- public String getTeamDoctorEduLine(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String type,
- @RequestParam(required = true) String doctor) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamDoctorEduLine(teamCode, startDate, endDate, type, doctor));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取团队成员健康教育列表
- *
- * @param teamCode
- * @param startDate
- * @param endDate
- * @param sort
- * @param sortType
- * @return
- */
- @RequestMapping("/getTeamEduList")
- @ResponseBody
- public String getTeamEduList(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String sort,
- @RequestParam(required = true) String sortType) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamEduList(teamCode, startDate, endDate, sort, sortType));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- @RequestMapping("/getTeamDoctorEduTitle")
- @ResponseBody
- public String getTeamDoctorEduTitle(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String doctor) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamDoctorEduTitle(teamCode, startDate, endDate, doctor));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- @RequestMapping("/getDotorInfo")
- @ResponseBody
- public String getDotorInfo(String code) {
- try {
- return write(200, "查询成功", "data", statisticsService.getDoctorInfo(code));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取转签率和续签率
- * 前端:续签进展
- *
- * @param level 等级 4 市 3区 2社区 1团队
- * @param code 市 默认是厦门市 350200 区 就是区的code 社区就是社区的code 团队就是团队的code
- * @param year 年份 非比传
- * @return
- */
- @RequestMapping(value = "/getRenewPercentAndChangePercent", method = RequestMethod.GET)
- @ResponseBody
- public String getRenewPercentAndChangePercent(
- @RequestParam(required = true) String level,
- @RequestParam(required = true) String code,
- @RequestParam(required = false) String year) {
- try {
- return write(200, "查询成功", "data", statisticsService.getRenewPercentAndChangePercent(level, code, year));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 获取转签人数,转签原因分析,转签分布
- * 前端:签约数据分析,团队转签详情
- *
- * @param level 等级 4 市 3区 2社区 1团队
- * @param code 市 默认是厦门市 350200 区 就是区的code 社区就是社区的code 团队就是团队的code
- * @param year 年份 非比传
- * @return
- */
- @RequestMapping(value = "/getRenewAnalysis", method = RequestMethod.GET)
- @ResponseBody
- public String getRenewAnalysis(
- @RequestParam(required = true) String level,
- @RequestParam(required = true) String code,
- @RequestParam(required = false) String year) {
- try {
- return write(200, "查询成功", "data", statisticsService.getRenewAnalysis(level, code, year));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- @RequestMapping("/getTeamRenewChangeLine")
- @ResponseBody
- public String getTeamRenewChangeLine(@RequestParam(required = true) String teamCode,
- @RequestParam(required = true) String startDate,
- @RequestParam(required = true) String endDate,
- @RequestParam(required = true) String type) {
- try {
- return write(200, "查询成功", "data", statisticsService.getTeamRenewChangeLine(teamCode, startDate, endDate, type));
- } catch (Exception e) {
- error(e);
- return error(-1, "查询失败");
- }
- }
- /**
- * 去年的签约量,续签量和续签率
- *
- * @param date
- * @param area
- * @param level level1_type等级 1:团队 2社区机构 3区级 4市级
- * @param sort 0:升序 1:降序
- * @param lowCode
- * @return
- */
- @RequestMapping("/lowlevel_all_sign_renew")
- @ResponseBody
- public String getIndexLowLevelTotalSignAndRenew(@RequestParam(required = true) String date,
- @RequestParam(required = true) String area,
- @RequestParam(required = true) int level,
- @RequestParam(required = true) int sort,
- @RequestParam(required = false) String lowLevel,
- @RequestParam(required = false) String lowCode,
- @RequestParam(required = false) String year) {
- try {
- JSONObject result = new JSONObject();
- //如果年度是空,按当前时间计算是年度是属于那个年度
- if(org.springframework.util.StringUtils.isEmpty(year)){
- year=Constant.getNowYear();
- }
- result.put("index_29" , statisticsAllService.getLevelTwoLowLevelTotalSignAndRenew(date, area, level, "29", sort, lowLevel, lowCode,year));
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- e.printStackTrace();
- return error(-1, "查询失败");
- }
- }
- }
|