浏览代码

bug提交

chenweida 8 年之前
父节点
当前提交
9bad1d89f0

+ 1 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/RenewSignChangeHospitalJob.java

@ -87,7 +87,7 @@ public class RenewSignChangeHospitalJob implements Job {
            quartzJobLog.setJobId(wlyyJobConfig.getId());
            quartzJobLog.setJobName(wlyyJobConfig.getJobName());
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id from wlyy_sign_family_renew_log fr where   fr.apply_date<'"+yesterday+ Constant.quota_date_last+"' and fr.sign_year ='"+Constant.getNowYear()+"' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LEFT(fr.hospital,6)=LEFT(fr.old_hospital,6)";
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id from wlyy_sign_family_renew_log fr where   fr.apply_date<'"+yesterday+ Constant.quota_date_last+"' and fr.sign_year ='"+Constant.getNowYear()+"' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LEFT(fr.hospital,6)=LEFT(fr.old_hospital,6) and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10";
            //抽取數據
            List<SignFamilyRenew> signFamilies= dbExtract.extract(SignFamilyRenew.class,sql);
            //清洗數據

+ 1 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/RenewSignChangeTeamJob.java

@ -86,7 +86,7 @@ public class RenewSignChangeTeamJob implements Job {
            quartzJobLog.setJobStartTime(new Date());
            quartzJobLog.setJobId(wlyyJobConfig.getId());
            quartzJobLog.setJobName(wlyyJobConfig.getJobName());
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id from wlyy_sign_family_renew_log fr where   fr.apply_date<'"+yesterday+ Constant.quota_date_last+"' and fr.sign_year ='"+Constant.getNowYear()+"' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital=fr.old_hospital and LEFT(fr.hospital,6)=LEFT(fr.old_hospital,6)" ;
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id from wlyy_sign_family_renew_log fr where   fr.apply_date<'"+yesterday+ Constant.quota_date_last+"' and fr.sign_year ='"+Constant.getNowYear()+"' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital=fr.old_hospital and LEFT(fr.hospital,6)=LEFT(fr.old_hospital,6) and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10" ;
            //抽取數據
            List<SignFamilyRenew> signFamilies= dbExtract.extract(SignFamilyRenew.class,sql);
            //清洗數據

+ 1 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/RenewSignChangeTownJob.java

@ -87,7 +87,7 @@ public class RenewSignChangeTownJob implements Job {
            quartzJobLog.setJobId(wlyyJobConfig.getId());
            quartzJobLog.setJobName(wlyyJobConfig.getJobName());
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id from wlyy_sign_family_renew_log fr where  fr.apply_date<'"+yesterday+ Constant.quota_date_last+"'  and fr.sign_year ='"+Constant.getNowYear()+"' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LEFT(fr.hospital,6)!=LEFT(fr.old_hospital,6) ";
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id from wlyy_sign_family_renew_log fr where  fr.apply_date<'"+yesterday+ Constant.quota_date_last+"'  and fr.sign_year ='"+Constant.getNowYear()+"' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LEFT(fr.hospital,6)!=LEFT(fr.old_hospital,6) and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10";
            //抽取數據
            List<SignFamilyRenew> signFamilies= dbExtract.extract(SignFamilyRenew.class,sql);
            //清洗數據

+ 1 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/RenewSignJob.java

@ -87,7 +87,7 @@ public class RenewSignJob implements Job {
            quartzJobLog.setJobId(wlyyJobConfig.getId());
            quartzJobLog.setJobName(wlyyJobConfig.getJobName());
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id from wlyy_sign_family_renew_log fr where  fr.apply_date<'"+yesterday+Constant.quota_date_last+"'  and fr.sign_year ='"+Constant.getNowYear()+"'";
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id from wlyy_sign_family_renew_log fr where  fr.apply_date<'"+yesterday+Constant.quota_date_last+"'  and fr.sign_year ='"+Constant.getNowYear()+"' and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10";
            //抽取數據
            List<SignFamilyRenew> signFamilies= dbExtract.extract(SignFamilyRenew.class,sql);
            //清洗數據

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

@ -409,10 +409,10 @@ public class StatisticsService extends BaseService {
                        redisNum = "";
                    }
                    if (StringUtils.isEmpty(redisNum)) {
                        if(org.springframework.util.StringUtils.isEmpty(year)){
                            year= Constant.getNowYear();
                        if (org.springframework.util.StringUtils.isEmpty(year)) {
                            year = Constant.getNowYear();
                        }
                        PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(),Integer.valueOf(year));
                        PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Integer.valueOf(year));
                        if (peopleNum != null) {
                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getNum() * 100));
                            map.put("rateString", map.get("amount") + "/" + peopleNum.getNum());
@ -1899,7 +1899,8 @@ public class StatisticsService extends BaseService {
        JSONArray rsJs = new JSONArray(rs);
        return rsJs;
    }
    public JSONObject getReyStatbyTeamNow(String doctor, String startDate, String endDate, String isNow){
    public JSONObject getReyStatbyTeamNow(String doctor, String startDate, String endDate, String isNow) {
        AdminTeam admin = adminTeamDao.findByLeaderCode(doctor);
        if (admin == null) {
            throw new RuntimeException("未找到团队信息");
@ -1913,47 +1914,47 @@ public class StatisticsService extends BaseService {
                "FROM " +
                " wlyy_consult_team a " +
                "WHERE " +
                " a.czrq <= '"+endDate+"' " +
                " AND a.czrq >= '"+startDate+"' " +
                " AND a.admin_team_code= " +id+
                " a.czrq <= '" + endDate + "' " +
                " AND a.czrq >= '" + startDate + "' " +
                " AND a.admin_team_code= " + id +
                " AND a.consult IN ( " +
                " SELECT DISTINCT " +
                "  t.id consultId " +
                " FROM " +
                "  "+imDataBaseName+".topics t, " +
                "  "+imDataBaseName+".participants p, " +
                "  "+imDataBaseName+".doctors d, " +
                "  "+imDataBaseName+".sessions s " +
                "  " + imDataBaseName + ".topics t, " +
                "  " + imDataBaseName + ".participants p, " +
                "  " + imDataBaseName + ".doctors d, " +
                "  " + imDataBaseName + ".sessions s " +
                " WHERE " +
                "  p.participant_id = d.id " +
                " AND t.session_id = p.session_id " +
                " AND t.session_id = s.id " +
                " AND s.type = 1 " +
                " AND t.create_time <= '"+endDate+"' " +
                " AND t.create_time >= '"+startDate+"' " +
                " AND t.create_time <= '" + endDate + "' " +
                " AND t.create_time >= '" + startDate + "' " +
                ")";
        List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);
        Long totalCount = 0L;
        if(totalList!=null&&totalList.size()>0){
            Map<String,Object> total = totalList.get(0);
            totalCount = (Long)total.get("total");
        if (totalList != null && totalList.size() > 0) {
            Map<String, Object> total = totalList.get(0);
            totalCount = (Long) total.get("total");
        }
        String noReySql = "SELECT " +
                " count(1) AS noRey " +
                "FROM " +
                " wlyy_consult_team a " +
                "WHERE " +
                " a.czrq <= '"+endDate+"' " +
                "AND a.czrq >= '"+startDate+"' " +
                "AND a.admin_team_code= " +id+
                " a.czrq <= '" + endDate + "' " +
                "AND a.czrq >= '" + startDate + "' " +
                "AND a.admin_team_code= " + id +
                " AND a.consult IN ( " +
                " SELECT DISTINCT " +
                "  t.id consultId " +
                " FROM " +
                "  "+imDataBaseName+".topics t, " +
                "  "+imDataBaseName+".participants p, " +
                "  "+imDataBaseName+".doctors d, " +
                "  "+imDataBaseName+".sessions s " +
                "  " + imDataBaseName + ".topics t, " +
                "  " + imDataBaseName + ".participants p, " +
                "  " + imDataBaseName + ".doctors d, " +
                "  " + imDataBaseName + ".sessions s " +
                " WHERE " +
                "  p.participant_id = d.id " +
                " AND t.session_id = p.session_id " +
@ -1961,18 +1962,18 @@ public class StatisticsService extends BaseService {
                " AND s.type = 1 " +
                " AND t. STATUS <> 10  " +
                " AND t.`reply` = 0  " +
                " AND t.create_time <= '"+endDate+"' " +
                " AND t.create_time >= '"+startDate+"' " +
                " AND t.create_time <= '" + endDate + "' " +
                " AND t.create_time >= '" + startDate + "' " +
                ")";
        List<Map<String,Object>> noReyList = jdbcTemplate.queryForList(noReySql);
        List<Map<String, Object>> noReyList = jdbcTemplate.queryForList(noReySql);
        Long noReyCount = 0L;
        if(noReyList!=null&&noReyList.size()>0){
            Map<String,Object> noRey = noReyList.get(0);
            noReyCount = (Long)noRey.get("noRey");
        if (noReyList != null && noReyList.size() > 0) {
            Map<String, Object> noRey = noReyList.get(0);
            noReyCount = (Long) noRey.get("noRey");
        }
        JSONObject rs = new JSONObject();
        rs.put("onReyCount", noReyCount);
        rs.put("totalCount",totalCount);
        rs.put("totalCount", totalCount);
        return rs;
    }
@ -2301,22 +2302,22 @@ public class StatisticsService extends BaseService {
                    " WHERE  " +
                    "  s.consult = t.consult " +
                    " AND  " +
                    " t.czrq <= '"+endDate+"' " +
                    " AND t.czrq >= '"+startDate+"' " +
                    " AND t.admin_team_code = " +id+
                    " t.czrq <= '" + endDate + "' " +
                    " AND t.czrq >= '" + startDate + "' " +
                    " AND t.admin_team_code = " + id +
                    " GROUP BY dateNo";
        } else {
            sql = "SELECT " +
                    " (DATE_FORMAT(t.czrq,'%v')-DATE_FORMAT('"+startDate+"','%v')+1) AS weekNo, " +
                    " (DATE_FORMAT(t.czrq,'%v')-DATE_FORMAT('" + startDate + "','%v')+1) AS weekNo, " +
                    " ifnull(ROUND(AVG(s.score), 1), 0) AS avgCount " +
                    " FROM " +
                    " wlyy_evaluate_score s,wlyy_consult_team t " +
                    " WHERE  " +
                    "  s.consult = t.consult " +
                    " AND  " +
                    " t.czrq <= '"+endDate+"' " +
                    " AND t.czrq >= '"+startDate+"' " +
                    " AND t.admin_team_code = " +id +
                    " t.czrq <= '" + endDate + "' " +
                    " AND t.czrq >= '" + startDate + "' " +
                    " AND t.admin_team_code = " + id +
                    " GROUP BY weekNo";
        }
@ -2647,17 +2648,17 @@ public class StatisticsService extends BaseService {
                " FROM " +
                "  wlyy_consult_team a  " +
                " WHERE " +
                "  a.czrq <= '"+endDate+"' " +
                " AND a.czrq >= '"+startDate+"' " +
                " AND a.admin_team_code = " +teamCode+
                "  a.czrq <= '" + endDate + "' " +
                " AND a.czrq >= '" + startDate + "' " +
                " AND a.admin_team_code = " + teamCode +
                " AND a.consult IN ( " +
                "   SELECT DISTINCT " +
                "    t.id consultId " +
                "   FROM " +
                "    "+ imDataBaseName +".topics t, " +
                "    "+ imDataBaseName +".participants p, " +
                "    "+ imDataBaseName +".doctors d, " +
                "    "+ imDataBaseName +".sessions s " +
                "    " + imDataBaseName + ".topics t, " +
                "    " + imDataBaseName + ".participants p, " +
                "    " + imDataBaseName + ".doctors d, " +
                "    " + imDataBaseName + ".sessions s " +
                "   WHERE " +
                "    p.participant_id = d.id " +
                "   AND t.session_id = p.session_id " +
@ -2665,8 +2666,8 @@ public class StatisticsService extends BaseService {
                "   AND s.type = 1 " +
                "   AND t. STATUS <> 10 " +
                "   AND t.`reply` = 0 " +
                "   AND t.create_time <= '"+endDate+"' " +
                "   AND t.create_time >= '"+startDate+"' " +
                "   AND t.create_time <= '" + endDate + "' " +
                "   AND t.create_time >= '" + startDate + "' " +
                "  ) " +
                "  GROUP BY a.doctor " +
                " ) c ON c.doctor = t.doctor_code, " +
@ -2674,7 +2675,7 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " t.doctor_code = d.`code` " +
                " AND t.available = 1 " +
                " AND t.team_id = "+teamCode;
                " AND t.team_id = " + teamCode;
        if ("0".equals(sort)) {
            onReySQL = onReySQL + " ORDER BY noRely DESC";
        } else {
@ -2693,24 +2694,24 @@ public class StatisticsService extends BaseService {
                " FROM " +
                "  wlyy_consult_team a  " +
                " WHERE " +
                "  a.czrq <= '"+endDate+"' " +
                " AND a.czrq >= '"+startDate+"' " +
                " AND a.admin_team_code = " +teamCode+
                "  a.czrq <= '" + endDate + "' " +
                " AND a.czrq >= '" + startDate + "' " +
                " AND a.admin_team_code = " + teamCode +
                " AND a.consult IN ( " +
                "   SELECT DISTINCT " +
                "    t.id consultId " +
                "   FROM " +
                "    "+ imDataBaseName +".topics t, " +
                "    "+ imDataBaseName +".participants p, " +
                "    "+ imDataBaseName +".doctors d, " +
                "    "+ imDataBaseName +".sessions s " +
                "    " + imDataBaseName + ".topics t, " +
                "    " + imDataBaseName + ".participants p, " +
                "    " + imDataBaseName + ".doctors d, " +
                "    " + imDataBaseName + ".sessions s " +
                "   WHERE " +
                "    p.participant_id = d.id " +
                "   AND t.session_id = p.session_id " +
                "   AND t.session_id = s.id " +
                "   AND s.type = 1 " +
                "   AND t.create_time <= '"+endDate+"' " +
                "   AND t.create_time >= '"+startDate+"' " +
                "   AND t.create_time <= '" + endDate + "' " +
                "   AND t.create_time >= '" + startDate + "' " +
                "  ) " +
                "  GROUP BY a.doctor " +
                " ) c ON c.doctor = t.doctor_code, " +
@ -2718,7 +2719,7 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " t.doctor_code = d.`code` " +
                " AND t.available = 1 " +
                " AND t.team_id = "+teamCode;
                " AND t.team_id = " + teamCode;
        if ("0".equals(sort)) {
            totalSql = totalSql + " ORDER BY total DESC";
        } else {
@ -2737,25 +2738,25 @@ public class StatisticsService extends BaseService {
                " FROM " +
                "  wlyy_consult_team a  " +
                " WHERE " +
                "  a.czrq <= '"+endDate+"' " +
                " AND a.czrq >= '"+startDate+"' " +
                " AND a.admin_team_code = " +teamCode+
                "  a.czrq <= '" + endDate + "' " +
                " AND a.czrq >= '" + startDate + "' " +
                " AND a.admin_team_code = " + teamCode +
                " AND a.consult IN ( " +
                "   SELECT DISTINCT " +
                "    t.id consultId " +
                "   FROM " +
                "    "+ imDataBaseName +".topics t, " +
                "    "+ imDataBaseName +".participants p, " +
                "    "+ imDataBaseName +".doctors d, " +
                "    "+ imDataBaseName +".sessions s " +
                "    " + imDataBaseName + ".topics t, " +
                "    " + imDataBaseName + ".participants p, " +
                "    " + imDataBaseName + ".doctors d, " +
                "    " + imDataBaseName + ".sessions s " +
                "   WHERE " +
                "    p.participant_id = d.id " +
                "   AND t.session_id = p.session_id " +
                "   AND t.session_id = s.id " +
                "   AND s.type = 1 " +
                "   AND t. STATUS = 10 " +
                "   AND t.create_time <= '"+endDate+"' " +
                "   AND t.create_time >= '"+startDate+"' " +
                "   AND t.create_time <= '" + endDate + "' " +
                "   AND t.create_time >= '" + startDate + "' " +
                "  ) " +
                "  GROUP BY a.doctor " +
                " ) c ON c.doctor = t.doctor_code, " +
@ -2763,7 +2764,7 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " t.doctor_code = d.`code` " +
                " AND t.available = 1 " +
                " AND t.team_id = "+teamCode;
                " AND t.team_id = " + teamCode;
        if ("0".equals(sort)) {
            endConsultSql = endConsultSql + " ORDER BY endRey DESC";
        } else {
@ -3658,8 +3659,8 @@ public class StatisticsService extends BaseService {
                    " wlyy_patient_health_guidance w " +
                    " WHERE " +
                    " w.admin_team_code = " + teamCode +
                    " AND w.czrq <= '" +endDate+ "' " +
                    " AND w.czrq >= '" +startDate  + "' " +
                    " AND w.czrq <= '" + endDate + "' " +
                    " AND w.czrq >= '" + startDate + "' " +
                    " GROUP BY dateNo";
        } else {
            //按月统计
@ -3696,7 +3697,7 @@ public class StatisticsService extends BaseService {
                    " w.admin_team_code = " + teamCode +
                    " AND w.doctor ='" + doctor + "'" +
                    " AND w.czrq <= '" + endDate + "' " +
                    " AND w.czrq >= '" +startDate  + "' " +
                    " AND w.czrq >= '" + startDate + "' " +
                    " GROUP BY dateNo";
        } else {
            //按月统计
@ -3847,8 +3848,8 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " w.admin_team_code =  " + teamCode +
                " AND w.doctor ='" + doctor + "'" +
                " AND w.czrq <= '" +endDate  + "' " +
                " AND w.czrq >= '" +startDate+ "'";
                " AND w.czrq <= '" + endDate + "' " +
                " AND w.czrq >= '" + startDate + "'";
        JSONObject rs = new JSONObject();
        Long guidanceCount = 0L;
        Long addCount = 0L;
@ -4187,19 +4188,24 @@ public class StatisticsService extends BaseService {
        int changeTeam = getLevel1NumForRedis("31", level, code, timeKey);//夸团队的数目
        int changeHospital = getLevel1NumForRedis("32", level, code, timeKey);//夸社区的数目
        int changeTown = getLevel1NumForRedis("33", level, code, timeKey);//夸区的数目
        jo.put("inNum", inNum);//今年的签入量
        jo.put("outNum", outNum);//今年的签出量
        jo.put("thisYearSwithch", switchNum);//今年的转签量
        jo.put("switchHealth", switchJO);//今年的服务分布
        String changeTeamNum=getRangeNoLast(changeTeam, switchNum, 2);//跨团队转签率
        String changeHospNum=getRangeNoLast(changeHospital, switchNum, 2);//跨社区转签率
        String changeTownNum=(100-Double.valueOf(changeTeamNum)-Double.valueOf(changeHospNum))+"";//跨区转签率,解决算出来可能不是100%的问题 用扣的
        jo.put("switchTeam", changeTeamNum);//今年的转签量
        jo.put("switchHospital", changeHospNum);//今年的转签量
        jo.put("switchTown", changeTownNum);//今年的转签量
        String changeTeamNum = getRangeNoLast(changeTeam, switchNum, 2);//跨团队转签率
        String changeHospNum = getRangeNoLast(changeHospital, switchNum, 2);//跨团队转签率
        String changeTownNum=null ;
        if (changeTown != 0) {
            changeTownNum = (100 - Double.valueOf(changeTeamNum) - Double.valueOf(changeHospNum)) + "";//解决算出来可能不是100%的问题 用扣的
        }else{
            changeTownNum="0";
        }
        jo.put("switchTeam", changeTeamNum+"%");//今年的转签量
        jo.put("switchHospital", changeHospNum+"%");//今年的转签量
        jo.put("switchTown", changeTownNum+"%");//今年的转签量
        return jo;
    }
@ -4245,9 +4251,9 @@ public class StatisticsService extends BaseService {
     * @return
     */
    public String getRange(int first, int second, int i) {
        if(second==0&&first>0){
        if (second == 0 && first > 0) {
            return "100%";
        }else if(second==0&&first==0){
        } else if (second == 0 && first == 0) {
            return "0%";
        }
        float size = (float) (first * 100) / second;
@ -4257,15 +4263,15 @@ public class StatisticsService extends BaseService {
    }
    public String getRangeNoLast(int first, int second, int i) {
        if(second==0&&first>0){
            return "100%";
        }else if(second==0&&first==0){
            return "0%";
        if (second == 0 && first > 0) {
            return "100";
        } else if (second == 0 && first == 0) {
            return "0";
        }
        float size = (float) (first * 100) / second;
        DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0
        String filesize = df.format(size);
        return filesize ;
        return filesize;
    }
    public JSONObject getConsultingTitleAll(Integer level, String area, String year) {
@ -4513,21 +4519,21 @@ public class StatisticsService extends BaseService {
    public JSONObject getConsultingStatisticsListYear(Integer level, String area, String lowlevel, String year) {
        JSONObject result = new JSONObject();
        Integer coutYear = Integer.parseInt(year)+1;
        Integer coutYear = Integer.parseInt(year) + 1;
        //及时回复数
        JSONArray rely = getQuotaList(level,lowlevel,area,coutYear,23);
        if(rely==null){
        JSONArray rely = getQuotaList(level, lowlevel, area, coutYear, 23);
        if (rely == null) {
            return null;
        }
        //咨询总数
        JSONArray total = getQuotaList(level,lowlevel,area,coutYear,25);
        if(total==null){
        JSONArray total = getQuotaList(level, lowlevel, area, coutYear, 25);
        if (total == null) {
            return null;
        }
        //未回复数
        JSONArray onRely =getQuotaList(level,lowlevel,area,coutYear,22);
        if(total==null){
        JSONArray onRely = getQuotaList(level, lowlevel, area, coutYear, 22);
        if (total == null) {
            return null;
        }
        result.put("resultList", getCoutList(rely, total, onRely));
@ -4659,6 +4665,7 @@ public class StatisticsService extends BaseService {
     * 2.市级-机构
     * 3.区级-机构
     * 4.机构-团队
     *
     * @param level
     * @param lovlevel
     * @param area
@ -4666,35 +4673,35 @@ public class StatisticsService extends BaseService {
     * @param index
     * @return
     */
    public JSONArray getQuotaList(Integer level, String lovlevel, String area, Integer year, Integer index){
        String sql ;
        if(level==4){
            if(StringUtils.isBlank(lovlevel)){
    public JSONArray getQuotaList(Integer level, String lovlevel, String area, Integer year, Integer index) {
        String sql;
        if (level == 4) {
            if (StringUtils.isBlank(lovlevel)) {
                //市 区
                sql =" SELECT t.result As num,t.town_name AS name,t.town AS code,t.create_time AS date" +
                sql = " SELECT t.result As num,t.town_name AS name,t.town AS code,t.create_time AS date" +
                        " FROM wlyy_quota_result t " +
                        " WHERE t.city ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='3'AND LEFT(t.create_time,10)='"+year+"-06-30'";
            }else{
                        " WHERE t.city ='" + area + "' AND t.quato_code ='" + index + "' AND t.level1_type ='3'AND LEFT(t.create_time,10)='" + year + "-06-30'";
            } else {
                //市 机构
                sql = "SELECT t.result As num,t.org_name AS name,t.org_code AS code,t.create_time AS date" +
                        " FROM wlyy_quota_result t " +
                        " WHERE t.city ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='2' AND LEFT(t.create_time,10)='"+year+"-06-30'";
                        " WHERE t.city ='" + area + "' AND t.quato_code ='" + index + "' AND t.level1_type ='2' AND LEFT(t.create_time,10)='" + year + "-06-30'";
            }
        }else if (level ==3){
        } else if (level == 3) {
            //区 机构
            sql = "SELECT t.result As num,t.org_name AS name,t.org_code AS code,t.create_time AS date " +
                    "FROM wlyy_quota_result t " +
                    "WHERE t.town ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='2' AND LEFT(t.create_time,10)='"+year+"-06-30'";
        }else{
                    "WHERE t.town ='" + area + "' AND t.quato_code ='" + index + "' AND t.level1_type ='2' AND LEFT(t.create_time,10)='" + year + "-06-30'";
        } else {
            //机构 团队
            sql ="SELECT t.result As num,t.qkdoctor_name AS name,t.qkdoctor_code AS code,t.create_time AS date " +
            sql = "SELECT t.result As num,t.qkdoctor_name AS name,t.qkdoctor_code AS code,t.create_time AS date " +
                    " FROM wlyy_quota_result t " +
                    " WHERE t.org_code ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='1' AND LEFT(t.create_time,10)='"+year+"-06-30'";
                    " WHERE t.org_code ='" + area + "' AND t.quato_code ='" + index + "' AND t.level1_type ='1' AND LEFT(t.create_time,10)='" + year + "-06-30'";
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        if (list != null && list.size() > 0) {
            return new JSONArray(list);
        }else{
        } else {
            return null;
        }