123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970 |
- package com.yihu.wlyy.web.statistic;
- import com.yihu.wlyy.entity.statistics.PopulationBase;
- 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.data.redis.core.StringRedisTemplate;
- 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, "查询失败");
- }
- }
- /**
- * 指标按间隔统计
- *
- * @param startDate 起始日期
- * @param endDate 结束时间
- * @param interval 时间间隔
- * @param area 区域或机构
- * @param level 级别
- * @param index 指标
- * @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) {
- 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 endDate 结束时间
- * @param area 父code
- * @param level 等级 1 团队,2 机构,3 区,4 市
- * @param index 指标代码
- * @param level2_type 指标代码 例如性别 1 男 2 女 不传就返回男和女的总和
- * @return
- */
- @RequestMapping("/total")
- @ResponseBody
- public String getIndexTotal(@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(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
- 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) {
- 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) {
- 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));
- }
- return write(200, "查询成功", "data", result);
- } catch (Exception e) {
- return error(-1, "查询失败");
- }
- }
- /**
- * 指标截止日期累积量
- * 根据2个ID合并指标
- *
- * @param endDate
- * @param area
- * @param level
- * @param index
- * @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) {
- 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);
- 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) {
- 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 signRate = statisticsAllService.getSignRate(endDate, area, level);
- JSONObject signTaskRate = statisticsAllService.getSignTaskRate(endDate, area, level);
- result.put("sign", sign);
- result.put("expenses", weiJf);
- result.put("signRate", signRate);
- result.put("signTaskRate", signTaskRate);
- } 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) {
- 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 指标
- * @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) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- if (index != null) {
- for (String idx : indexes) {
- result.put("index_" + idx, statisticsAllService.getDateTotal(startDate, endDate, interval, area, level, idx, lowCode));
- }
- }
- 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两率
- * @param sort 1降序排列-1升序排列
- * @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 startDate) {
- 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
- 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) {
- try {
- String[] indexes = index.split(",");
- JSONObject result = new JSONObject();
- for (String idx : indexes) {
- result.put("index_" + idx, statisticsAllService.getIndexTotal(endDate, area, level, idx));
- }
- 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) {
- try {
- JSONObject data = statisticsService.getConsultingStatisticsList(level, area, lowlevel);
- 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) {
- try {
- JSONObject data = statisticsService.getConsultingTitle(level, area);
- 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) {
- try {
- return write(200, "查询成功", "data", statisticsService.getCoutListByTime(level, area));
- } 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){
- try {
- return write(200, "查询成功", "data", statisticsService.getMemberConsultList(teamCode,startDate,endDate,sort));
- } 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, "查询失败");
- }
- }
- }
|