فهرست منبع

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

chenweida 8 سال پیش
والد
کامیت
e0fbc6ed35
1فایلهای تغییر یافته به همراه217 افزوده شده و 12 حذف شده
  1. 217 12
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

+ 217 - 12
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -152,8 +152,10 @@ public class CurrentDayAllQuotaJob implements Job {
        computequota_9();//统计今天的待签约
        computequota_10();//统计今天的改签
        computequota_12();//统计今天的签约下按年龄分组后再
        computequota_15();//统计健康分布统计
        computequota_16();//统计健康分布统计
        computequota_13();//统计今天的签约量
        computequota_14();//统计今天的签约数的扣费钱情况
        computequota_15();//统计今天的健康分布统计
        computequota_16();//统计今天的签约费用统计
        quartzJobLog.setJobContent(allContent.toString());
        quartzJobLog.setJobName("实时统计");
        quartzJobLog.setJobId("11");
@ -162,12 +164,215 @@ public class CurrentDayAllQuotaJob implements Job {
        quartzJobLogDao.save(quartzJobLog);
    }
    private void computequota_14() {
        errorContent=new StringBuffer();
        String quotaId="14";
        //找出今天的签约信息
        String sql=" select id,code,idcard,hospital,admin_team_code from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        Long cityCount = new Long(0L); //统计到市的数目
        Long townCount = new Long(0L); //统计到所有区的数目
        Long orgCount =new Long(0L);//统计到所有机构的数目
        Long adminCount = new Long(0L);//统计到所有团队的数目
        Long errorCount=new Long(0L);//脏数据
        Boolean isAll=true;//是否统计失败
        //统计有已改簽的
        List<ETLModel> etlModels=new ArrayList<ETLModel>();
        //数据过滤清洗出脏数据  -----------start
        for(SignFamily signFamily:signFamilys){
            ETLModel etlModel=new ETLModel();
            String orgCode = signFamily.getHospital();
            if(StringUtils.isEmpty(orgCode)) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的hospital数据为空");
                isAll=false;
                errorCount++;
                continue;
            }
            String orgCodeTemp="";
            if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
                //站
                orgCodeTemp=orgCode.substring(0,orgCode.length()-2)+"00";
            }else{
                //社区
                orgCodeTemp=orgCode;
            }
            //判断社区有没有值
            Hospital hospital=hospitalsMap.get(orgCodeTemp);
            if(hospital == null) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的hospital数据不存在");
                isAll=false;
                errorCount++;
                continue;
            }
            Long adminId=signFamily.getAdminTeamCode();
            if(adminId == null||adminId<=0) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的Admin_Team_Id数据为空");
                isAll=false;
                errorCount++;
                continue;
            }
            AdminTeam adminTeam=adminTeamMap.get(signFamily.getAdminTeamCode()+"");
            if(adminTeam == null) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的Admin_Team_Id数据不存在");
                isAll=false;
                errorCount++;
                continue;
            }
            String idCard=signFamily.getIdcard();
            if(idCard == null||((idCard.length()!=18&&idCard.length()!=15))) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的idCard数据异常");
                isAll=false;
                errorCount++;
                continue;
            }
            String town =hospital.getTown();
            if(StringUtils.isEmpty(town)) {
                errorContent.append("签约code:"+signFamily.getCode()+",机构表的中的town为空");
                isAll=false;
                errorCount++;
                continue;
            }
            Town townObj =townsMap.get(town);
            if(townObj==null) {
                errorContent.append("签约code:"+signFamily.getCode()+",机构表的中的town不存在");
                isAll=false;
                errorCount++;
                continue;
            }
            etlModel.setHospital(orgCodeTemp);
            etlModel.setTown(hospital.getTown());
            etlModel.setCity(Constant.city);
            etlModel.setIdcard(signFamily.getIdcard());
            etlModels.add(etlModel);
            //统计数目+1
            cityCount++;
            townCount++;
            orgCount++;
            adminCount++;
        }
        //数据过滤清洗出脏数据  -----------end
        try{
            //统计数据
            List<Map<String, List<ETLModel>>>  returnData1s= levelRole.elt(etlModels);
            List<Map<String, Map<String, List<ETLModel>>>> role2Data= level2Role.elt(returnData1s);
            //保存数据
            redisStorage.saveByLevel2(role2Data,quotaId,2,4,0);
        }catch (Exception e){
            e.printStackTrace();
            errorContent.append("统计失败:"+e.getMessage());
        }
        allContent.append(saveContent(quotaId,signFamilys.size(),adminCount,orgCount,townCount,cityCount,isAll,errorContent,errorCount));
        allContent.append("-----------14----------");
    }
    private void computequota_13() {
        errorContent=new StringBuffer();
        //找出今天的签约信息 yesterday,now
        String sql=" select id,code,idcard,hospital,admin_team_code from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        Long cityCount = new Long(0L); //统计到市的数目
        Long townCount = new Long(0L); //统计到所有区的数目
        Long orgCount =new Long(0L);//统计到所有机构的数目
        Long adminCount = new Long(0L);//统计到所有团队的数目
        Long errorCount=new Long(0L);//脏数据
        Boolean isAll=true;//是否统计失败
        //统计有已改簽的
        List<ETLModel> etlModels=new ArrayList<ETLModel>();
        //数据过滤清洗出脏数据  -----------start
        for(SignFamily signFamily:signFamilys){
            ETLModel etlModel=new ETLModel();
            String orgCode = signFamily.getHospital();
            if(StringUtils.isEmpty(orgCode)) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的hospital数据为空");
                isAll=false;
                errorCount++;
                continue;
            }
            String orgCodeTemp="";
            if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
                //站
                orgCodeTemp=orgCode.substring(0,orgCode.length()-2)+"00";
            }else{
                //社区
                orgCodeTemp=orgCode;
            }
            //判断社区有没有值
            Hospital hospital=hospitalsMap.get(orgCodeTemp);
            if(hospital == null) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的hospital数据不存在");
                isAll=false;
                errorCount++;
                continue;
            }
            Long adminId=signFamily.getAdminTeamCode();
            if(adminId == null||adminId<=0) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的Admin_Team_Id数据为空");
                isAll=false;
                errorCount++;
                continue;
            }
            AdminTeam adminTeam=adminTeamMap.get(signFamily.getAdminTeamCode()+"");
            if(adminTeam == null) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的Admin_Team_Id数据不存在");
                isAll=false;
                errorCount++;
                continue;
            }
            String idCard=signFamily.getIdcard();
            if(idCard == null||((idCard.length()!=18&&idCard.length()!=15))) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的idCard数据异常");
                isAll=false;
                errorCount++;
                continue;
            }
            String town =hospital.getTown();
            if(StringUtils.isEmpty(town)) {
                errorContent.append("签约code:"+signFamily.getCode()+",机构表的中的town为空");
                isAll=false;
                errorCount++;
                continue;
            }
            Town townObj =townsMap.get(town);
            if(townObj==null) {
                errorContent.append("签约code:"+signFamily.getCode()+",机构表的中的town不存在");
                isAll=false;
                errorCount++;
                continue;
            }
            etlModel.setAdminTeam(adminTeam.getId()+"");
            etlModel.setHospital(orgCodeTemp);
            etlModel.setTown(hospital.getTown());
            etlModel.setCity(Constant.city);
            etlModel.setIdcard(signFamily.getIdcard());
            etlModels.add(etlModel);
            //统计数目+1
            cityCount++;
            townCount++;
            orgCount++;
            adminCount++;
        }
        //数据过滤清洗出脏数据  -----------end
        try{
            //统计数据
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels);
            //保存数据
            redisStorage.saveByLevel1(returnDatas,"13");
        }catch (Exception e){
            e.printStackTrace();
            errorContent.append("统计失败:"+e.getMessage());
        }
        allContent.append(saveContent("13",signFamilys.size(),adminCount,orgCount,townCount,cityCount,isAll,errorContent,errorCount));
        allContent.append("-----------13----------");
    }
    private void computequota_16() {
        errorContent=new StringBuffer();
        String quotaId="16";
        //找出今天的签约信息
        String sql=" select * from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' ";
        String sql=" select id,code,idcard,hospital,admin_team_code from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        Long cityCount = new Long(0L); //统计到市的数目
@ -269,7 +474,7 @@ public class CurrentDayAllQuotaJob implements Job {
        errorContent=new StringBuffer();
        String quotaId="15";
        //找出今天的签约信息
        String sql=" select * from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        String sql=" select id,code,idcard,hospital,admin_team_code from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        Long cityCount = new Long(0L); //统计到市的数目
@ -391,7 +596,7 @@ public class CurrentDayAllQuotaJob implements Job {
            townsMap.put(town.getCode(), town);
        }
        //找出今天的签约信息
        String sql=" select * from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        String sql=" select id,code,idcard,hospital,admin_team_code from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        //数组里面第一个是健康人群 第二个是慢病人群 第三个是65岁以上人群
        Map<String, Map<String, Map>> cityAgeMap = new HashMap<String, Map<String, Map>>();//key是市行政代码 目前只有厦门市
@ -646,7 +851,7 @@ public class CurrentDayAllQuotaJob implements Job {
    private void computequota_1() {
         errorContent=new StringBuffer();
        //找出今天的签约信息 yesterday,now
        String sql=" select * from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        String sql=" select id,code,idcard,hospital,admin_team_code from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        Long cityCount = new Long(0L); //统计到市的数目
        Long townCount = new Long(0L); //统计到所有区的数目
@ -748,7 +953,7 @@ public class CurrentDayAllQuotaJob implements Job {
         errorContent=new StringBuffer();
        String quotaId="2";
        //找出今天的解约信息
        String sql=" select * from wlyy_sign_family a where  a.type =2 and a.status in (-3,-4) and  a.apply_unsign_date>= '"+now+"' and  a.apply_unsign_date< '"+tomorrow+"' and a.expenses_status=1 ";
        String sql=" select id,code,idcard,hospital,admin_team_code,expenses_status from wlyy_sign_family a where  a.type =2 and a.status in (-3,-4) and  a.apply_unsign_date>= '"+now+"' and  a.apply_unsign_date< '"+tomorrow+"' and a.expenses_status=1 ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        Long cityCount = new Long(0L); //统计到市的数目
@ -1140,7 +1345,7 @@ public class CurrentDayAllQuotaJob implements Job {
        errorContent=new StringBuffer();
        String quotaId="6";
        //找出今天的签约信息
        String sql=" select * from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        String sql=" select id,code,idcard,hospital,admin_team_code,expenses_status from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        Long cityCount = new Long(0L); //统计到市的数目
@ -1260,7 +1465,7 @@ public class CurrentDayAllQuotaJob implements Job {
            townsMap.put(town.getCode(), town);
        }
        //找出今天的解约信息
        String sql=" select * from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        String sql=" select id,code,idcard,hospital,admin_team_code,expenses_status from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        Long cityCount = new Long(0L); //统计到市的数目
@ -1399,7 +1604,7 @@ public class CurrentDayAllQuotaJob implements Job {
         errorContent=new StringBuffer();
        String quotaId="8";
        //找出今天的签约信息
        String sql=" select * from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        String sql=" select id,code,idcard,hospital,admin_team_code,expenses_status from wlyy_sign_family a where  a.type =2 and a.status =1 and  a.apply_date>= '"+now+"' and  a.apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        Long cityCount = new Long(0L); //统计到市的数目
        Long townCount = new Long(0L); //统计到所有区的数目
@ -1500,7 +1705,7 @@ public class CurrentDayAllQuotaJob implements Job {
         errorContent=new StringBuffer();
        String quotaId="9";
        //找出今天的待签约信息
        String sql=" select * from wlyy_sign_family a where  a.type =2 and a.status =0  and  a.patient_apply_date>= '"+now+"' and  a.patient_apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        String sql=" select id,code,idcard,hospital,admin_team_code from wlyy_sign_family a where  a.type =2 and a.status =0  and  a.patient_apply_date>= '"+now+"' and  a.patient_apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        Long cityCount = new Long(0L); //统计到市的数目
@ -1620,7 +1825,7 @@ public class CurrentDayAllQuotaJob implements Job {
            townsMap.put(town.getCode(), town);
        }
        //找出今天的已改簽信息
        String sql=" select * from wlyy_sign_family a where  a.type =2 and a.status =100 and  a.patient_apply_date>= '"+now+"' and  a.patient_apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        String sql=" select id,code,idcard,hospital,admin_team_code from wlyy_sign_family a where  a.type =2 and a.status =100 and  a.patient_apply_date>= '"+now+"' and  a.patient_apply_date< '"+tomorrow+"' and a.expenses_status=1 ";
        List<SignFamily> signFamilys = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily .class));
        Long cityCount = new Long(0L); //统计到市的数目