Pārlūkot izejas kodu

代码提交:增加获取二级维度的统计结果方法

huangwenjie 7 gadi atpakaļ
vecāks
revīzija
d5035b28d1

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

@ -4202,8 +4202,16 @@ public class StatisticsService extends BaseService {
        //根据年度获取去年的签约数 签约指标是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());
        }
@ -4218,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();
@ -4813,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;
    }
}