|
@ -204,7 +204,7 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
double totalCorrect = 0;//总准确数
|
|
|
|
|
|
//1. 获取医院档案量;
|
|
|
Envelop envelop = packQcReportService.dailyReport("create_date", start + "T00:00:00Z", end + "T23:59:59Z", null);
|
|
|
Envelop envelop = packQcReportService.dailyReport("event_date", start + "T00:00:00Z", end + "T23:59:59Z", null);
|
|
|
Map<String, Object> hospitalDataMap = (Map<String, Object>) envelop.getDetailModelList().get(0);
|
|
|
//医院总数据量
|
|
|
totalHospitalNum = (int) hospitalDataMap.get("total");
|
|
@ -213,12 +213,12 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
hospitalExamNum = (int) hospitalDataMap.get("physical");
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
//2. 平台就诊完整数
|
|
|
getPatientCount("receive_date",start, end, null, dataMap);
|
|
|
getPatientCount("event_date",start, end, null, dataMap);
|
|
|
totalVisitNum = Double.valueOf(dataMap.get("visitIntegrity").toString());//就诊完整数
|
|
|
//3. 及时数
|
|
|
totalInTime = getInTimeNum("receive_date" ,start, end);
|
|
|
totalInTime = getInTimeNum("event_date" ,start, end);
|
|
|
// 3. 去重准确数【】
|
|
|
totalCorrect = getErrorDataSetData("receive_date",start, end, null);
|
|
|
totalCorrect = getErrorDataSetData("event_date",start, end, null);
|
|
|
//4. 数据集总量
|
|
|
double dataSetsMun = getDataSetsMap(start, end, null);
|
|
|
|
|
@ -267,13 +267,13 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
double totalVisitNum = 0;//总完整数(平台总就诊数)
|
|
|
|
|
|
//1. 获取医院档案量;
|
|
|
Envelop envelop = packQcReportService.dailyReport("create_date", start + "T00:00:00Z", end + "T23:59:59Z", null);
|
|
|
Envelop envelop = packQcReportService.dailyReport("event_date", start + "T00:00:00Z", end + "T23:59:59Z", null);
|
|
|
Map<String, Object> hospitalDataMap = (Map<String, Object>) envelop.getDetailModelList().get(0);
|
|
|
//医院总数据量
|
|
|
totalHospitalNum = (int) hospitalDataMap.get("total");
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
//2. 平台就诊完整数
|
|
|
getPatientCount("receive_date",start, end, null, dataMap);
|
|
|
getPatientCount("event_date",start, end, null, dataMap);
|
|
|
totalVisitNum = Double.valueOf(dataMap.get("visitIntegrity").toString());
|
|
|
totalMap.put("totalComplete", totalVisitNum);//总就诊完整数
|
|
|
totalMap.put("totalHospital", totalHospitalNum);//医院总就诊数
|
|
@ -302,7 +302,7 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
double totalCorrect = 0;//总准确数
|
|
|
long starttime1 = System.currentTimeMillis();
|
|
|
//1. 去重准确数
|
|
|
totalCorrect = getErrorDataSetData("receive_date",start, end, null);
|
|
|
totalCorrect = getErrorDataSetData("event_date",start, end, null);
|
|
|
long endTime1 = System.currentTimeMillis();
|
|
|
logger.info("去重准确数耗时:"+ (endTime1-starttime1));
|
|
|
//2. 数据集总量
|
|
@ -337,13 +337,13 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
int totalHospitalNum = 0;//医院总就诊数
|
|
|
double totalInTime = 0;//总及时数
|
|
|
//1. 获取医院档案量;
|
|
|
Envelop envelop = packQcReportService.dailyReport("create_date", start + "T00:00:00Z", end + "T23:59:59Z", null);
|
|
|
Envelop envelop = packQcReportService.dailyReport("event_date", start + "T00:00:00Z", end + "T23:59:59Z", null);
|
|
|
Map<String, Object> hospitalDataMap = (Map<String, Object>) envelop.getDetailModelList().get(0);
|
|
|
//医院总数据量
|
|
|
totalHospitalNum = (int) hospitalDataMap.get("total");
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
//2. 及时数
|
|
|
totalInTime = getInTimeNum("receive_date" ,start, end);
|
|
|
totalInTime = getInTimeNum("event_date" ,start, end);
|
|
|
totalMap.put("totalInTime", totalInTime);//及时数
|
|
|
totalMap.put("totalHospital", totalHospitalNum);//医院总就诊数
|
|
|
//3 计算及时率
|
|
@ -379,8 +379,8 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
// 原生es
|
|
|
TransportClient transportClient = elasticSearchPool.getClient();
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
stringBuilder.append("receive_date>=" + start + " 00:00:00;");
|
|
|
stringBuilder.append("receive_date<=" + end + " 23:59:59;");
|
|
|
stringBuilder.append("event_date>=" + start + " 00:00:00;");
|
|
|
stringBuilder.append("event_date<=" + end + " 23:59:59;");
|
|
|
stringBuilder.append("qc_step=1||qc_step=2;");
|
|
|
if (StringUtils.isNotEmpty(orgCode)) {
|
|
|
stringBuilder.append("org_code=" + orgCode);
|
|
@ -439,8 +439,8 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
TransportClient transportClient = elasticSearchPool.getClient();
|
|
|
// 条件设置
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
stringBuilder.append("receive_date>=" + start + " 00:00:00;");
|
|
|
stringBuilder.append("receive_date<=" + end + " 23:59:59;");
|
|
|
stringBuilder.append("event_date>=" + start + " 00:00:00;");
|
|
|
stringBuilder.append("event_date<=" + end + " 23:59:59;");
|
|
|
if (StringUtils.isNotEmpty(orgCode)) {
|
|
|
stringBuilder.append("org_code=" + orgCode);
|
|
|
}
|
|
@ -606,8 +606,8 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
fileds.add("count");
|
|
|
fileds.add("version");
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
sql.append("SELECT dataset,COUNT(dataset) count ,version FROM json_archives_qc/qc_metadata_info ");
|
|
|
sql.append(" WHERE receive_date>='" + start + " 00:00:00' and (qc_step=1 or qc_step=2) and receive_date<='" + end + " 23:59:59'");
|
|
|
sql.append("SELECT dataset,COUNT(DISTINCT pack_id) count ,version FROM json_archives_qc/qc_metadata_info ");
|
|
|
sql.append(" WHERE event_date>='" + start + " 00:00:00' and (qc_step=1 or qc_step=2) and event_date<='" + end + " 23:59:59' ");
|
|
|
|
|
|
if(StringUtils.isNotEmpty(orgArea)){
|
|
|
sql.append(" AND org_area = '"+orgArea+"'");
|
|
@ -649,7 +649,7 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
fileds.add("version");
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
sql.append("SELECT dataset, metadata,COUNT(metadata) count ,version FROM json_archives_qc/qc_metadata_info ");
|
|
|
sql.append(" WHERE receive_date>='" + start + " 00:00:00' and (qc_step=1 or qc_step=2) and receive_date<='" + end + " 23:59:59'");
|
|
|
sql.append(" WHERE event_date>='" + start + " 00:00:00' and (qc_step=1 or qc_step=2) and event_date<='" + end + " 23:59:59'");
|
|
|
if(StringUtils.isNotEmpty(orgArea)){
|
|
|
sql.append(" AND org_area = '"+orgArea+"'");
|
|
|
}
|
|
@ -715,7 +715,7 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
start=name.get(i);
|
|
|
end=name.get(i);
|
|
|
}
|
|
|
double totalInTime = getInTimeNum("receive_date" ,start, end);
|
|
|
double totalInTime = getInTimeNum("event_date" ,start, end);
|
|
|
if(hospitalDataMap.get(name.get(i))!=null&&Double.parseDouble(hospitalDataMap.get(name.get(i))+"")!=0){
|
|
|
double rate = totalInTime/(double)hospitalDataMap.get(name.get(i))*100;
|
|
|
data.add((double) Math.round(rate * 100) / 100);
|
|
@ -881,7 +881,7 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
if("10".equals(flag)){//按月
|
|
|
start = DateUtil.formatDate(DateUtil.addMonth(-6, DateUtil.formatCharDateYMD(month+"-01")), "yyyy-MM") + "-01";
|
|
|
end = DateUtil.getLastDate (month + "-01", "yyyy-MM-dd", "yyyy-MM-dd");
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("receive_date")
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("event_date")
|
|
|
.interval(DateHistogramInterval.MONTH).format("yyyy-MM");
|
|
|
|
|
|
}else{//按日
|
|
@ -893,21 +893,21 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
start = month+"-01";
|
|
|
end = DateUtil.getLastDate (month+"-01", "yyyy-MM-dd", "yyyy-MM-dd");
|
|
|
}
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("receive_date")
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("event_date")
|
|
|
.interval(DateHistogramInterval.DAY).format("yyyy-MM-dd");
|
|
|
}
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
stringBuilder.append("pack_type=1;");
|
|
|
stringBuilder.append("receive_date>=" + start + " 00:00:00;");
|
|
|
stringBuilder.append("receive_date<" + end + " 23:59:59;");
|
|
|
stringBuilder.append("event_date>=" + start + " 00:00:00;");
|
|
|
stringBuilder.append("event_date<" + end + " 23:59:59;");
|
|
|
CardinalityBuilder childTerms = AggregationBuilders.cardinality("count").field("event_no").precisionThreshold(40000);
|
|
|
|
|
|
SearchRequestBuilder requestBuilder = transportClient.prepareSearch("json_archives")
|
|
|
.setTypes("info");
|
|
|
requestBuilder.setQuery(elasticSearchUtil.getQueryBuilder(stringBuilder.toString()));
|
|
|
requestBuilder.addAggregation(aggregation.subAggregation(childTerms));
|
|
|
requestBuilder.addSort("receive_date", SortOrder.DESC);
|
|
|
requestBuilder.addSort("event_date", SortOrder.DESC);
|
|
|
SearchResponse response = requestBuilder.execute().actionGet();
|
|
|
Histogram agg = response.getAggregations().get("agg");
|
|
|
|
|
@ -935,7 +935,7 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
if("10".equals(flag)){//按月
|
|
|
start = DateUtil.formatDate(DateUtil.addMonth(-6, DateUtil.formatCharDateYMD(month+"-01")), "yyyy-MM") + "-01";
|
|
|
end = DateUtil.getLastDate (month + "-01", "yyyy-MM-dd", "yyyy-MM-dd");
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("receive_date")
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("event_date")
|
|
|
.interval(DateHistogramInterval.MONTH).format("yyyy-MM");
|
|
|
|
|
|
}else{//按日
|
|
@ -947,20 +947,20 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
start = month+"-01";
|
|
|
end = DateUtil.getLastDate (month+"-01", "yyyy-MM-dd", "yyyy-MM-dd");
|
|
|
}
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("receive_date")
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("event_date")
|
|
|
.interval(DateHistogramInterval.DAY).format("yyyy-MM-dd");
|
|
|
}
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
stringBuilder.append("receive_date>=" + start + " 00:00:00;");
|
|
|
stringBuilder.append("receive_date<=" + end + " 23:59:59;");
|
|
|
stringBuilder.append("event_date>=" + start + " 00:00:00;");
|
|
|
stringBuilder.append("event_date<=" + end + " 23:59:59;");
|
|
|
SumBuilder terms = AggregationBuilders.sum("sumCount").field("count");
|
|
|
|
|
|
SearchRequestBuilder requestBuilder = transportClient.prepareSearch("json_archives_qc")
|
|
|
.setTypes("qc_dataset_detail");
|
|
|
requestBuilder.setQuery(elasticSearchUtil.getQueryBuilder(stringBuilder.toString()));
|
|
|
requestBuilder.addAggregation(aggregation.subAggregation(terms));
|
|
|
requestBuilder.addSort("receive_date", SortOrder.DESC);
|
|
|
requestBuilder.addSort("event_date", SortOrder.DESC);
|
|
|
SearchResponse response = requestBuilder.execute().actionGet();
|
|
|
Histogram agg = response.getAggregations().get("agg");
|
|
|
|
|
@ -986,7 +986,7 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
if("10".equals(flag)){//按月
|
|
|
start = DateUtil.formatDate(DateUtil.addMonth(-6, DateUtil.formatCharDateYMD(month+"-01")), "yyyy-MM") + "-01";
|
|
|
end = DateUtil.getLastDate (month + "-01", "yyyy-MM-dd", "yyyy-MM-dd");
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("receive_date")
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("event_date")
|
|
|
.interval(DateHistogramInterval.MONTH).format("yyyy-MM");
|
|
|
|
|
|
}else{//按日
|
|
@ -998,13 +998,13 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
start = month+"-01";
|
|
|
end = DateUtil.getLastDate (month+"-01", "yyyy-MM-dd", "yyyy-MM-dd");
|
|
|
}
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("receive_date")
|
|
|
aggregation = AggregationBuilders.dateHistogram("agg").field("event_date")
|
|
|
.interval(DateHistogramInterval.DAY).format("yyyy-MM-dd");
|
|
|
}
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
stringBuilder.append("receive_date>=" + start + " 00:00:00;");
|
|
|
stringBuilder.append("receive_date<=" + end + " 23:59:59;");
|
|
|
stringBuilder.append("event_date>=" + start + " 00:00:00;");
|
|
|
stringBuilder.append("event_date<=" + end + " 23:59:59;");
|
|
|
stringBuilder.append("qc_step=1||qc_step=2;");
|
|
|
AggregationBuilder terms = AggregationBuilders.terms("dataset").field("dataset").size(200);
|
|
|
CardinalityBuilder childTerms = AggregationBuilders.cardinality("count").field("pack_id").precisionThreshold(40000);
|
|
@ -1014,7 +1014,7 @@ public class DataQualityHomeService extends BaseJpaService {
|
|
|
.setTypes("qc_metadata_info");
|
|
|
requestBuilder.setQuery(elasticSearchUtil.getQueryBuilder(stringBuilder.toString()));
|
|
|
requestBuilder.addAggregation(aggregation.subAggregation(terms));
|
|
|
requestBuilder.addSort("receive_date", SortOrder.DESC);
|
|
|
requestBuilder.addSort("event_date", SortOrder.DESC);
|
|
|
SearchResponse response = requestBuilder.execute().actionGet();
|
|
|
Histogram agg = response.getAggregations().get("agg");
|
|
|
|