Browse Source

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

yeshijie 7 năm trước cách đây
mục cha
commit
e061831468

+ 72 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -4158,34 +4158,65 @@ public class StatisticsService extends BaseService {
        return results;
    }
    public JSONObject getRenewPercentAndChangePercent(String renewIndex, String level, String code, String year) {
    public JSONObject getRenewPercentAndChangePercent(String renewIndex, String level, String code, String year, String lowCode) {
        String switchIndex = "";
        if ("2".equals(level)) {
            //团队的转签
            switchIndex = "35";
            if(StringUtils.isNoneBlank(lowCode)){
                //服务类型维度
                switchIndex = "55";
            }else{
                switchIndex = "35";
            }
        } else if ("3".equals(level)) {
            //社区的转签
            switchIndex = "35";
            if(StringUtils.isNoneBlank(lowCode)){
                //服务类型维度
                switchIndex = "56";
            }else{
                switchIndex = "35";
            }
        } else {
            //区和市的转签
            switchIndex = "35";
            if(StringUtils.isNoneBlank(lowCode)){
                //服务类型维度
                switchIndex = "57";
            }else{
                switchIndex = "35";
            }
        }
        JSONObject jo = new JSONObject();
        
        String rediscode = code;
        
        //如果服务类型维度code(老年人3,高血压4,糖尿病5)不为空,则rediscode默认带上lowcode
        if(StringUtils.isNoneBlank(lowCode)){
            rediscode = rediscode + ":"+lowCode;
        }
        
        //获取时间戳
        String timeKey = redisTemplate.opsForValue().get("quota:timeKey");
        int renewNum = getLevel1NumForRedis(renewIndex, level, code, timeKey);
        int renewNum = getLevel1NumForRedis(renewIndex, level, rediscode, timeKey);
        //根据年度获取去年的签约数 签约指标是1
        String date = year + "-06-30";
        String index = "1";
        WlyyQuotaResult wlyyQuotaResult = findOneQuotaResult(date, Integer.valueOf(level), index, code);
        
        int signNum = 0;
        WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
    
        if(StringUtils.isNoneBlank(lowCode)){
            wlyyQuotaResult = findOneQuotaResultWithLevelType2(date, Integer.valueOf(level), index, code,lowCode);
        }else{
            wlyyQuotaResult = findOneQuotaResult(date, Integer.valueOf(level), index, code);
        }
        
        if (wlyyQuotaResult != null) {
            signNum = Integer.valueOf(wlyyQuotaResult.getResult());
        }
        //从redis中获取最新的转签数据  指标是37
        int switchNum = getLevel1NumForRedis(switchIndex, level, code, timeKey);
        int switchNum = getLevel1NumForRedis(switchIndex, level, rediscode, timeKey);
        jo.put("yesterYearSign", signNum);//去年的签约量
        jo.put("thisYearRenew", renewNum);//今年的续签量
        jo.put("thisYearSwithch", switchNum);//今年的转签量
@ -4195,7 +4226,8 @@ public class StatisticsService extends BaseService {
        return jo;
    }
    
    
    public JSONObject getRenewAnalysis(String switchIndex, String switchIndexReson, String signIn, String signOut, String level, String code) {
        JSONObject jo = new JSONObject();
@ -4790,5 +4822,37 @@ public class StatisticsService extends BaseService {
            return null;
        }
    }
    
    /**
     * 获取单个数据(二级维度)
     *
     * @param date
     * @param level
     * @param index
     * @param area
     * @param lowCode
     * @return
     */
    private WlyyQuotaResult findOneQuotaResultWithLevelType2(String date, int level, String index, String area,String lowCode) {
        String sql = " select * from wlyy_quota_result w where w.quota_date ='" + date + "' and w.quato_code='" + index + "' and w.level1_type= '" + level + "' and w.level2_type = "+lowCode;
        if (level == 4) {
            // 市级别
            sql += " and city='" + area + "' ";
        } else if (level == 3) {
            // 区、城镇级别
            sql += " and town='" + area + "' ";
        } else if (level == 2) {
            // 机构级别
            sql += " and org_code='" + area + "' ";
        } else if (level == 1) {
            // 机构级别
            sql += " and qkdoctor_code ='" + area + "'";
        }
        List<WlyyQuotaResult> results = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyQuotaResult.class));
        if (results.size() > 0) {
            return results.get(0);
        }
        return null;
    }
}

+ 10 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -1423,10 +1423,11 @@ public class StatisticsController extends BaseController {
     * 获取转签率和续签率
     * 前端:续签进展
     *
     * @param index 42,43,44
     * @param index 42,43,44 (52,53,54 服务类型维度)
     * @param level 等级  4 市  3区  2社区 1团队
     * @param code  市 默认是厦门市 350200  区 就是区的code  社区就是社区的code 团队就是团队的code
     * @param year  年份 非比传
     * @param lowCode 服务类型维度code(老年人3,高血压4,糖尿病5)
     * @return
     */
    @RequestMapping(value = "/getRenewPercentAndChangePercent", method = RequestMethod.GET)
@ -1435,10 +1436,11 @@ public class StatisticsController extends BaseController {
            @RequestParam(required = true) String index,//续签index
            @RequestParam(required = true) String level,
            @RequestParam(required = true) String code,
            @RequestParam(required = false) String year) {
            @RequestParam(required = false) String year,
            @RequestParam(required = false) String lowCode) {
        try {
            return write(200, "查询成功", "data", statisticsService.getRenewPercentAndChangePercent(index,level, code, year));
            return write(200, "查询成功", "data", statisticsService.getRenewPercentAndChangePercent(index,level, code, year,lowCode));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1516,12 +1518,13 @@ public class StatisticsController extends BaseController {
    /**
     * 去年的签约量,续签量和续签率 列表
     *
     * @param index      42,43,44
     * @param area    每个层级大的code  例如湖里区 350206  xx社区 3502060100
     * @param index    42,43,44 (52,53,54 服务类型维度)
     * @param area     每个层级大的code  例如湖里区 350206  xx社区 3502060100
     * @param level    level1_type等级 1:团队 2社区机构 3区级 4市级
     * @param sort     0:升序 1:降序
     * @param lowLevel  只有可能是 1,2,3,不传默认是level-1
     * @param year      不管根据当前时间找年度
     * @param lowLevel 只有可能是 1,2,3,不传默认是level-1;
     *                 如果是服务类型维度code(老年人3,高血压4,糖尿病5)
     * @param year     不管根据当前时间找年度
     * @return
     */
    @RequestMapping("/lowlevel_all_sign_renew")