Procházet zdrojové kódy

完整性、及时性、准确性趋势性能优化

zhengwei před 6 roky
rodič
revize
ea5535e11d

+ 2 - 2
src/main/java/com/yihu/ehr/analyze/service/dataQuality/DataCompleteService.java

@ -41,13 +41,13 @@ public class DataCompleteService extends DataQualityBaseService {
     */
    @Override
    public List<Map<String, Object>> getAreaDataQuality(Integer dataLevel, String startDate, String endDate) throws Exception {
        String end = DateUtil.addDate(1, endDate, DateUtil.DEFAULT_DATE_YMD_FORMAT);
        //String end = DateUtil.addDate(1, endDate, DateUtil.DEFAULT_DATE_YMD_FORMAT);
        Map<String, Object> resMap = null;
        List<Map<String, Object>> list = new ArrayList<>();
        double totalNum = 0;//平台总数
        double totalHospitalNum = 0;//医院总数
        //机构数据
        List<Map<String, Object>> groupList = dataCorrectService.getOrgDataMap(dataLevel, "event_date", startDate, end, null);
        List<Map<String, Object>> groupList = dataCorrectService.getOrgDataMap(dataLevel, "event_date", startDate, endDate, null);
        //平台接收数据量
        Map<String, Object> platformDataGroup = getPlatformDataGroup(dataLevel, "event_date", startDate, endDate, null);
        // 计算

+ 3 - 3
src/main/java/com/yihu/ehr/analyze/service/dataQuality/DataCorrectService.java

@ -176,7 +176,7 @@ public class DataCorrectService extends DataQualityBaseService {
                end = dateStr;
            }
            if ("create_date".equals(dateField)) {
            if ("event_date".equals(dateField)) {
                start = start + "T00:00:00Z";
                end = end + "T23:59:59Z";
            }else {
@ -245,7 +245,7 @@ public class DataCorrectService extends DataQualityBaseService {
    @Override
    public List<Map<String, Object>> getAreaDataQuality(Integer dataLevel,String startDate, String endDate) throws Exception {
        String end = DateUtil.addDate(1, endDate,DateUtil.DEFAULT_DATE_YMD_FORMAT);
       //String end = DateUtil.addDate(1, endDate,DateUtil.DEFAULT_DATE_YMD_FORMAT);
        Map<String,Object> resMap = null;
        List<Map<String,Object>> list = new ArrayList<>();
        double totalNum = 0;//平台总数
@ -253,7 +253,7 @@ public class DataCorrectService extends DataQualityBaseService {
        //机构数据
        //List<Map<String,Object>> groupList = getOrgDataMap(dataLevel,"create_date",startDate,end,null);
        //准确性算法,由于之前算法依赖到  医院总数据量,   医院数据量经常未做上报,导致数据问题,先改成 根据接收总数计算
        List<Map<String,Object>> groupList = getReceiveMap(dataLevel,startDate,end,null);
        List<Map<String,Object>> groupList = getReceiveMap(dataLevel,startDate,endDate,null);
        //平台接收错误数据量
        Map<String, Object> platformErrorGroup = getErrorPlatformData(dataLevel,"event_date",startDate, endDate,null);
        // 计算

+ 2 - 2
src/main/java/com/yihu/ehr/analyze/service/dataQuality/DataInTimeService.java

@ -141,13 +141,13 @@ public class DataInTimeService extends DataQualityBaseService {
    /* ******************************** 区域层级模块相关 ***********************************/
    @Override
    public List<Map<String, Object>> getAreaDataQuality(Integer dataLevel, String startDate, String endDate) throws Exception {
        String end = DateUtil.addDate(1, endDate, DateUtil.DEFAULT_DATE_YMD_FORMAT);
        //String end = DateUtil.addDate(1, endDate, DateUtil.DEFAULT_DATE_YMD_FORMAT);
        Map<String, Object> resMap = null;
        List<Map<String, Object>> list = new ArrayList<>();
        double totalNum = 0;//平台总数
        double totalHospitalNum = 0;//医院总数
        //机构数据
        List<Map<String, Object>> groupList = dataCorrectService.getOrgDataMap(dataLevel, "event_date", startDate, end, null);
        List<Map<String, Object>> groupList = dataCorrectService.getOrgDataMap(dataLevel, "event_date", startDate, endDate, null);
        //平台接收数据量
        Map<String, Object> platformDataGroup = getInTimeDataMap(dataLevel, "event_date", startDate, endDate, null);
        // 计算

+ 7 - 7
src/main/java/com/yihu/ehr/analyze/service/dataQuality/DataQualityHomeService.java

@ -226,13 +226,13 @@ public class DataQualityHomeService extends BaseJpaService {
        totalMap.put("orgName", cloudName);//机构名称
        totalMap.put("totalInTime", totalInTime);//及时数
        totalMap.put("totalComplete", totalVisitNum);//总就诊完整数
        totalMap.put("totalCorrect", totalCorrect);//准确数
        totalMap.put("totalCorrect", dataSetsMun-totalCorrect);//准确数
        totalMap.put("totalHospital", totalHospitalNum);//医院总就诊数
        totalMap.put("totalDataSet", dataSetsMun);//数据集总行数
        //计算及时率及完整率,准确性
        totalMap.put("inTimeRate", calRate(totalInTime, totalHospitalNum));//及时率
        totalMap.put("completeRate", calRate(totalVisitNum, totalHospitalNum));//完整率
        totalMap.put("correctRate", calRate(totalCorrect, dataSetsMun));//数据集准确率
        totalMap.put("correctRate", calRate(dataSetsMun-totalCorrect, dataSetsMun));//数据集准确率
        Map<String, Object> outPatientMap = genVisitMap("outPatient", hospitalOutpatientNum, totalHospitalNum);
        Map<String, Object> inPatientMap = genVisitMap("inPatient", hospitalInpatientNum, totalHospitalNum);
@ -309,10 +309,10 @@ public class DataQualityHomeService extends BaseJpaService {
        double dataSetsMun = getDataSetsMap(start, end, null);
        long endTime2= System.currentTimeMillis();
        logger.info("总准确数据集数耗时:"+ (endTime2-endTime1));
        totalMap.put("totalCorrect", totalCorrect);//准确数
        totalMap.put("totalCorrect", dataSetsMun-totalCorrect);//准确数
        totalMap.put("totalDataSet", dataSetsMun);//数据集总行数
        //3  计算准确性
        totalMap.put("correctRate", calRate(totalCorrect, dataSetsMun));//数据集准确率
        totalMap.put("correctRate", calRate(dataSetsMun-totalCorrect, dataSetsMun));//数据集准确率
        long endlong = System.currentTimeMillis();
        logger.info("总耗时:"+ (endlong-startlong));
        return totalMap;
@ -439,8 +439,8 @@ public class DataQualityHomeService extends BaseJpaService {
        TransportClient transportClient = elasticSearchPool.getClient();
        //  条件设置
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("event_date>=" + start + " 00:00:00;");
        stringBuilder.append("event_date<=" + end + " 23:59:59;");
        stringBuilder.append("receive_date>=" + start + " 00:00:00;");
        stringBuilder.append("receive_date<=" + end + " 23:59:59;");
        if (StringUtils.isNotEmpty(orgCode)) {
            stringBuilder.append("org_code=" + orgCode);
        }
@ -729,7 +729,7 @@ public class DataQualityHomeService extends BaseJpaService {
            for(int i=0;i<name.size();i++){
                if(map1.get(name.get(i))!=null&&map2.get(name.get(i))!=null){
                    if(Double.parseDouble(map2.get(name.get(i))+"")!=0){
                        double rate = (double)map1.get(name.get(i))/(double)map2.get(name.get(i))*100;
                        double rate = ((double)map2.get(name.get(i))-(double)map1.get(name.get(i)))/(double)map2.get(name.get(i))*100;
                        data.add((double) Math.round(rate * 100) / 100);
                    }else{
                        data.add(0.0);