Преглед изворни кода

Merge branch 'dev' of liuwenbin/patient-co-management into dev

chenweida пре 7 година
родитељ
комит
499011e93e

+ 0 - 60
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -1598,66 +1598,6 @@ public class StatisticsESService {
            return new JSONArray();
        }
    }
    /**
     * 获取三师转签或高危人群签约
     *
     * @param endDate
     * @param area
     * @param level
     * @param index
     * @return
     */
    public JSONObject getSszqAndGwrq(String endDate, String area, int level, String index) {
        JSONObject json = new JSONObject();
        // 查询语句
        String sql = " select " +
                "     ifnull(result,'0') amount" +
                " from  " +
                "     wlyy_quota_result " +
                " where " +
                "     quato_code = ? " +
                "   and level1_type = ? and del = '1'";
        if (level == 4) {
            // 市级别
            sql += " and city = ? ";
        } else if (level == 3) {
            // 区、城镇级别
            sql += " and town = ? ";
        } else if (level == 2) {
            // 机构级别
            sql += " and org_code = ? ";
        } else if (level == 1) {
            sql += " and qkdoctor_code = ?";
        }
        sql += "   order by quota_date DESC " +
                "   limit 0,1";
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, index, level, area);
        if (result != null && result.size() > 0) {
            String total = (result.get(0).get("amount") != null ? result.get(0).get("amount").toString() : "0");
            if (total.equals("0")) {
                json.put("amount", 0L);
                json.put("num", 0L);
                json.put("rate", 0.0000D);
            } else {
                DecimalFormat df = new DecimalFormat("0.0000");
                String[] args = total.split("/");
                json.put("amount", Long.valueOf(args[0]));
                json.put("num", Long.valueOf(args[1]));
                json.put("rate", df.format(Long.valueOf(args[0]) * 1.0000 / Long.valueOf(args[1]) * 100));
            }
        } else {
            json.put("amount", 0L);
            json.put("num", 0L);
            json.put("rate", 0.0000D);
        }
        return json;
    }
    /**
     * 统计回复和未回复

+ 50 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -81,6 +81,8 @@ public class EsStatisticsController extends BaseController {
                                @RequestParam(required = false) String level2_type) {
        String tag = "";
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            if (index != null) {
@ -116,6 +118,8 @@ public class EsStatisticsController extends BaseController {
                                    @RequestParam(required = true) String index,
                                    @RequestParam(required = false) String year) {
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
@ -152,6 +156,8 @@ public class EsStatisticsController extends BaseController {
            @RequestParam(required = true) String index,
            @RequestParam(required = false) String level2_type) {
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
@ -191,6 +197,11 @@ public class EsStatisticsController extends BaseController {
                                        @RequestParam(required = false) String level2_type,
                                        @RequestParam(required = false) String year) {
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            if(StringUtils.isNotEmpty(lowLevel)){
                lowLevel = elasticsearchUtil.changeLevel(Integer.parseInt(lowLevel))+"";
            }
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
@ -226,6 +237,11 @@ public class EsStatisticsController extends BaseController {
                                            @RequestParam(required = false) String lowLevel,
                                            @RequestParam(required = false) String year) {
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            if(StringUtils.isNotEmpty(lowLevel)){
                lowLevel = elasticsearchUtil.changeLevel(Integer.parseInt(lowLevel))+"";
            }
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            JSONArray returnJa = new JSONArray();
@ -325,6 +341,8 @@ public class EsStatisticsController extends BaseController {
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String index) {
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
@ -356,6 +374,8 @@ public class EsStatisticsController extends BaseController {
                                  @RequestParam(required = false) String year
    ) {
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            JSONObject result = new JSONObject();
            //year没传默认是今年
            if (org.springframework.util.StringUtils.isEmpty(year)) {
@ -416,7 +436,8 @@ public class EsStatisticsController extends BaseController {
                                       @RequestParam(required = false) String year) {
        try {
            level=changeLevel(level);
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            JSONArray result = statisticsESService.getSixFiveStatistics(endDate, area, level);
            return write(200, "查询成功", "data", result);
@ -451,6 +472,8 @@ public class EsStatisticsController extends BaseController {
                                     @RequestParam(required = false) String lowCode,
                                     @RequestParam(required = false) String year) {
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
@ -494,9 +517,14 @@ public class EsStatisticsController extends BaseController {
                                            @RequestParam(required = false) String lowLevel,
                                            @RequestParam(required = false) String lowCode) {
        try {
            int levelTemp = level;
            String lowLevelTemp = lowLevel;
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            if(StringUtils.isNotEmpty(lowLevel)){
                lowLevel = elasticsearchUtil.changeLevel(Integer.parseInt(lowLevel))+"";
            }
            String[] indexes = index.split(",");
            level=elasticsearchUtil.changeLevel(level);
            lowLevel=changeLevel(Integer.valueOf(lowLevel))+"";
            JSONObject result = new JSONObject();
            String year = Constant.getNowYearByDate(date);
            if (StringUtils.isNotEmpty(lowCode)) {
@ -511,7 +539,7 @@ public class EsStatisticsController extends BaseController {
//                未指定level下特定查询级别
                for (String idx : indexes) {
                    if (idx.equals("18") || index.equals("19")) {
                        result.put("index_" + idx, statisticsAllService.getLowLevelTotalSpecial(date, area, level, idx, sort, lowLevel));
                        result.put("index_" + idx, statisticsAllService.getLowLevelTotalSpecial(date, area, levelTemp, idx, sort, lowLevelTemp));
                    } else if (index.equals("21")) {
                        result.put("index_" + idx, statisticsESService.getLowLevelTotal2(date, area, level, idx, sort, lowLevel));
                    } else if (idx.equals("28")) {
@ -549,8 +577,8 @@ public class EsStatisticsController extends BaseController {
        try {
            JSONObject result = new JSONObject();
            JSONObject sszq = statisticsESService.getSszqAndGwrq(endDate, area, level, "18");
            JSONObject gwrq = statisticsESService.getSszqAndGwrq(endDate, area, level, "19");
            JSONObject sszq = statisticsAllService.getSszqAndGwrq(endDate, area, level, "18");
            JSONObject gwrq = statisticsAllService.getSszqAndGwrq(endDate, area, level, "19");
            result.put("sszq", sszq);
            result.put("gwrq", gwrq);
@ -579,6 +607,8 @@ public class EsStatisticsController extends BaseController {
                              @RequestParam(required = true) String index,
                              @RequestParam(required = false) String year) {
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
@ -634,7 +664,11 @@ public class EsStatisticsController extends BaseController {
                                              @RequestParam(required = false) String lowlevel,
                                              @RequestParam(required = false) String year) {
        try {
//新         版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            if(StringUtils.isNotEmpty(lowlevel)){
                lowlevel = elasticsearchUtil.changeLevel(Integer.parseInt(lowlevel))+"";
            }
            JSONObject data = null;
            if (Constant.getNowYear().equals(year)) {
                data = statisticsESService.getConsultingStatisticsList(level, area, lowlevel, null);
@ -672,6 +706,8 @@ public class EsStatisticsController extends BaseController {
                                     @RequestParam(required = true) String area,
                                     @RequestParam(required = false) String year) {
        try {
            //版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            JSONObject data = null;
//            if (Constant.getNowYear().equals(year)) {
//                //查今年的查找redis即可
@ -717,6 +753,8 @@ public class EsStatisticsController extends BaseController {
//            } else {
//                return write(200, "查询成功", "data", statisticsService.getCoutListByTimeYear(level, area, year));
//            }
            //版与旧版统计适配
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            return write(200, "查询成功", "data", statisticsESService.getCoutListByTime(level, area, year));
        } catch (Exception e) {
            e.printStackTrace();
@ -1447,6 +1485,8 @@ public class EsStatisticsController extends BaseController {
            @RequestParam(required = true) String level,
            @RequestParam(required = true) String code) {
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            String switchIndex = "";
            String switchIndexReson = "";
            String signIn = "";
@ -1522,7 +1562,7 @@ public class EsStatisticsController extends BaseController {
            }
            result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotalSignAndRenew(area, changeLevel(level), index, sort, String.valueOf(changeLevel(Integer.valueOf(lowLevel))), year, lowCode));
//            result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotalSignAndRenew(area, changeLevel(level), index, sort, String.valueOf(changeLevel(Integer.valueOf(lowLevel))), year, lowCode));
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
@ -1537,6 +1577,8 @@ public class EsStatisticsController extends BaseController {
                                      @ApiParam(name = "area", value = "区域code") @RequestParam(required = true) String area,
                                      @ApiParam(name = "level", value = "级别") @RequestParam(required = true) int level) {
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            return write(200, "查询成功", "data", statisticsESService.getLowLevelTotalSingle2(date, area, level));
        } catch (Exception e) {
            error(e);