Преглед на файлове

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

chenweida преди 8 години
родител
ревизия
76ab35a9f6

+ 26 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/Constant.java

@ -351,6 +351,12 @@ public class Constant {
        }
    }
    /**
     * 获取现在时间属于那个年度
     * @param date
     * @return
     * @throws ParseException
     */
    public static String getNowYearByDate(String date) throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date today = new Date();
@ -365,6 +371,26 @@ public class Constant {
            return (1900 + today.getYear() - 1) + "";
        }
    }
    /**
     * 由于统计是每天晚上12点之后,所以获取现在时间要减一天才能获取属于那个年度
     * @param date
     * @return
     * @throws ParseException
     */
    public static String getNowYearByDateYeaterday(String date) throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date today = simpleDateFormat.parse(date);
        String todayString = date;
        String startDateString = (1900 + today.getYear()) + "-07-01";
        Date startDate = simpleDateFormat.parse(startDateString);
        if (simpleDateFormat.parse(todayString).after(startDate)) {
            return (1900 + today.getYear()) + "";
        } else {
            return (1900 + today.getYear() - 1) + "";
        }
    }
    public static String getStartYear() throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");

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

@ -574,7 +574,8 @@ public class CurrentDayAllQuotaJob implements Job {
                    " AND sf.type = 2 " +
                    " AND sf. STATUS IN (1, 2) " +
                    " AND p.openid is not null  " +
                    " AND p.openid_time <'" + tomorrow + "' " ;
                    " AND p.openid_time <'" + tomorrow + "' " +
                    " and sf.sign_year ='"+Constant.getNowYearByDate(tomorrow)+"'  ";
            //抽取數據
            List<SignFamily> signFamilies = SpringUtil.getBean(DBExtract.class).extract(SignFamily.class, sql);
            //清洗數據
@ -606,7 +607,8 @@ public class CurrentDayAllQuotaJob implements Job {
                    " AND sf.type = 2 " +
                    " AND pd.del=0 " +
                    " AND sf. STATUS IN (1, 2) " +
                    " AND pd.czrq <' " + tomorrow + "'" ;
                    " AND pd.czrq <' " + tomorrow + "'"+
                    " and sf.sign_year ='"+Constant.getNowYearByDate(tomorrow)+"'  " ;
            //抽取數據
            List<SignFamily> signFamilies = SpringUtil.getBean(DBExtract.class).extract(SignFamily.class, sql);
            //清洗數據

+ 4 - 16
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/FollowUpJob.java

@ -90,7 +90,10 @@ public class FollowUpJob implements Job {
            quartzJobLog.setJobId(wlyyJobConfig.getId());
            quartzJobLog.setJobName(wlyyJobConfig.getJobName());
            String sql = " select * from wlyy_followup a where  a.status=1 and  a.followup_plan_date>='" + daybefore + Constant.quota_date_last + "' and a.followup_plan_date< '" + yesterday + Constant.quota_date_last + "'  ";
            String sql = " select * from wlyy_followup a where  " +
                    " a.status=1 and  " +
                    " a.followup_plan_date>='" + daybefore + Constant.quota_date_last + "' and " +
                    " a.followup_plan_date< '" + yesterday + Constant.quota_date_last + "'  ";
            //找出今天的随访信息
            List<Map<String, Object>> plans = jdbcTemplate.queryForList(sql);
            FilterModel etlModels = followUpDataFilter.filter(plans, sql, yesterday);
@ -109,21 +112,6 @@ public class FollowUpJob implements Job {
    }
    private String saveContent(List<Map<String, Object>> plans, Long qkCount, Long orgCount, Long townCount, Long cityCount, boolean isAll, StringBuffer errorContent, Long errorCount, String sql) {
        StringBuffer string = new StringBuffer("统计" + yesterday + " 的随访完成 ,数据库查询到随访数目:" + plans.size());
        string.append(",sql语句:" + sql);
        string.append(",过滤的脏数据数目:" + errorCount);
        string.append(",统计到市的数据总数:" + cityCount);
        string.append(",统计到区的数据总数:" + townCount);
        string.append(",统计到机构的数据总数:" + orgCount);
        string.append(",统计到团队的数据总数:" + qkCount);
        string.append(",是否统计成功:" + isAll);
        if (!isAll) {
            string.append(",失败原因:" + errorContent);
        }
        return string.toString();
    }
    public Date getYesterday() {
        return DateUtil.strToDateShort(yesterday);

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

@ -98,7 +98,8 @@ public class PatientDeviceJob implements Job {
                    " AND sf.type = 2 " +
                    " AND pd.del=0 " +
                    " AND sf. STATUS IN (1, 2) " +
                    " AND pd.czrq <' "+yesterday+ Constant.quota_date_last+"'" ;
                    " AND pd.czrq <' "+yesterday+ Constant.quota_date_last+"' " +
                    " and sf.sign_year ='"+Constant.getNowYearByDateYeaterday(yesterday)+"'  " ;
            //抽取數據
             List<SignFamily> signFamilies= dbExtract.extract(SignFamily.class,sql);
            //清洗數據

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

@ -97,7 +97,8 @@ public class WechatCountJob implements Job {
                    " AND sf.type = 2 " +
                    " AND sf. STATUS IN (1, 2) " +
                    " AND p.openid is not null  " +
                    " AND p.openid_time <'" +yesterday+ Constant.quota_date_last+"'" ;
                    " AND p.openid_time <'" +yesterday+ Constant.quota_date_last+"' " +
                    " and sf.sign_year ='"+Constant.getNowYearByDateYeaterday(yesterday)+"'  " ;
            //抽取數據
            List<SignFamily> signFamilies= dbExtract.extract(SignFamily.class,sql);