|
@ -792,6 +792,15 @@ public class StatisticsESService {
|
|
|
String filesize = df.format(size);
|
|
|
return filesize + "%";
|
|
|
}
|
|
|
public int getRangeNum(int first, int second, int i) {
|
|
|
if (second == 0 && first > 0) {
|
|
|
return 100;
|
|
|
} else if (second == 0 && first == 0) {
|
|
|
return 0;
|
|
|
}
|
|
|
float size = (float) (first * 100) / second;
|
|
|
return (int)(size*100);
|
|
|
}
|
|
|
|
|
|
public Double getRange2(int first, int second, int i) {
|
|
|
if (second == 0 && first > 0) {
|
|
@ -5397,12 +5406,13 @@ public class StatisticsESService {
|
|
|
return saveModel.getResult2().longValue();
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> getLevelDeviceAndBinding(String area, int level, int sort, String lowLevel, String year, String deviceType) throws Exception {
|
|
|
public Map<String, Object> getLevelDeviceAndBinding(String area, int level, int sort, String lowLevel, String year, String deviceType,int sortType) throws Exception {
|
|
|
String index_85 = "85";//设备发放量统计指标
|
|
|
String index_86 = "86";//设备绑定量统计指标
|
|
|
String index_87 = "87";//设备使用量统计指标
|
|
|
String index_88 = "88";//设备异常数据24H统计指标
|
|
|
String index_96 = "96";//设备本周使用量
|
|
|
String index_97 = "97";//设备本周使用量
|
|
|
//String lastDate = year + "-06-30";
|
|
|
//String timeKey = elasticsearchUtil.getQuotaTime();
|
|
|
String timeKey = DateUtil.getStringDateShort();//当前时间
|
|
@ -5419,6 +5429,7 @@ public class StatisticsESService {
|
|
|
// List<SaveModel> endUseSaveModel = null;
|
|
|
SaveModel useSaveModel = null;
|
|
|
SaveModel anomalySaveModel = null;
|
|
|
SaveModel anomalyCountSaveModel = null;
|
|
|
String allCountSql = "";
|
|
|
String anomalyCountSql = "";
|
|
|
String useCountSql = "";
|
|
@ -5443,7 +5454,8 @@ public class StatisticsESService {
|
|
|
// startUseSaveModel = elasticsearchUtil.findDateQuotaLevel1(mondayTime, mondayTime, area, level, index_87, SaveModel.timeLevel_DDL, "hemopiezometer", null, null);
|
|
|
// endUseSaveModel = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_87, SaveModel.timeLevel_DDL, "hemopiezometer", null, null);
|
|
|
anomalySaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey, area, level, index_88, SaveModel.timeLevel_DDL, "hemopiezometer");
|
|
|
anomalyCountSql = " SELECT COUNT(i.id) FROM device.wlyy_patient_health_index i left join device.wlyy_devices d on i.device_sn=d.device_code where i.type =1 and i.status=1 and i.del=1 " + areaCondition;
|
|
|
anomalyCountSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey, area, level, index_97, SaveModel.timeLevel_DDL, "hemopiezometer");
|
|
|
// anomalyCountSql = " SELECT COUNT(i.id) FROM device.wlyy_patient_health_index i left join device.wlyy_devices d on i.device_sn=d.device_code where i.type =1 and i.status=1 and i.del=1 " + areaCondition;
|
|
|
allAmountList = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_85, SaveModel.timeLevel_DDL, "hemopiezometer", "", low_level);
|
|
|
bindingAmountList = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_86, SaveModel.timeLevel_DDL, "hemopiezometer", "", low_level);
|
|
|
break;
|
|
@ -5457,7 +5469,8 @@ public class StatisticsESService {
|
|
|
// startUseSaveModel = elasticsearchUtil.findDateQuotaLevel1(mondayTime, mondayTime, area, level, index_87, SaveModel.timeLevel_DDL, "glucometer", null, null);
|
|
|
// endUseSaveModel = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_87, SaveModel.timeLevel_DDL, "glucometer", null, null);
|
|
|
anomalySaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey, area, level, index_88, SaveModel.timeLevel_DDL, "glucometer");
|
|
|
anomalyCountSql = " SELECT COUNT(i.id) FROM device.wlyy_patient_health_index i left join device.wlyy_devices d on i.device_sn=d.device_code where i.type =2 and i.status=1 and i.del=1 " + areaCondition;
|
|
|
anomalyCountSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey, area, level, index_97, SaveModel.timeLevel_DDL, "glucometer");
|
|
|
// anomalyCountSql = " SELECT COUNT(i.id) FROM device.wlyy_patient_health_index i left join device.wlyy_devices d on i.device_sn=d.device_code where i.type =2 and i.status=1 and i.del=1 " + areaCondition;
|
|
|
allAmountList = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_85, SaveModel.timeLevel_DDL, "glucometer", "", low_level);
|
|
|
bindingAmountList = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_86, SaveModel.timeLevel_DDL, "glucometer", "", low_level);
|
|
|
break;
|
|
@ -5469,7 +5482,8 @@ public class StatisticsESService {
|
|
|
allCountSql = "SELECT COUNT(*) FROM device.wlyy_devices d where 1=1 " + areaCondition;
|
|
|
// useCountSql = "SELECT COUNT(DISTINCT p.device_sn) FROM device.wlyy_patient_health_index p LEFT JOIN device.wlyy_devices d on d.device_code=p.device_sn WHERE p.type IN (1, 2) and p.del=1 and p.czrq>= '"+mondayTime+"' AND p.czrq < '"+currentTime+"' "+areaCondition ;
|
|
|
useSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(DateUtil.getSundayOfThisDate(new Date()), area, level, index_96, SaveModel.timeLevel_ZL);
|
|
|
anomalyCountSql = " SELECT COUNT(i.id) FROM device.wlyy_patient_health_index i left join device.wlyy_devices d on i.device_sn=d.device_code where i.status=1 and i.del=1 " + areaCondition;
|
|
|
anomalyCountSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey, area, level, index_97, SaveModel.timeLevel_DDL);
|
|
|
// anomalyCountSql = " SELECT COUNT(i.id) FROM device.wlyy_patient_health_index i left join device.wlyy_devices d on i.device_sn=d.device_code where i.status=1 and i.del=1 " + areaCondition;
|
|
|
// startUseSaveModel = elasticsearchUtil.findDateQuotaLevel0(mondayTime, mondayTime, area, level, index_87, SaveModel.timeLevel_DDL, null, null);
|
|
|
// endUseSaveModel = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index_87, SaveModel.timeLevel_DDL, null, null);
|
|
|
allAmountList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index_85, SaveModel.timeLevel_DDL, "", low_level);
|
|
@ -5503,7 +5517,8 @@ public class StatisticsESService {
|
|
|
} else {
|
|
|
resultMap.put("totalUseRange", 0.0 + "%");//本周使用率
|
|
|
}
|
|
|
Integer totalAnomaly = jdbcTemplate.queryForObject(anomalyCountSql, Integer.class);
|
|
|
// Integer totalAnomaly = jdbcTemplate.queryForObject(anomalyCountSql, Integer.class);
|
|
|
Integer totalAnomaly = anomalyCountSaveModel!=null?anomalyCountSaveModel.getResult1().intValue():0;
|
|
|
resultMap.put("totalAnomaly", totalAnomaly);//异常数据量
|
|
|
resultMap.put("totalIntervene", anomalySaveModel.getResult1());//干预指导数
|
|
|
if (totalAnomaly > 0) {
|
|
@ -5547,10 +5562,21 @@ public class StatisticsESService {
|
|
|
}
|
|
|
//对结果进行排序
|
|
|
Collections.sort(resultList, new Comparator<Map<String, Object>>() {
|
|
|
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
|
|
int map1value = (int) o1.get("allNum");
|
|
|
int map2value = (int) o2.get("allNum");
|
|
|
|
|
|
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
|
|
int map1value = 0;
|
|
|
int map2value = 0;
|
|
|
if(sortType==1){
|
|
|
map1value = (int) o1.get("allNum");
|
|
|
map2value = (int) o2.get("allNum");
|
|
|
|
|
|
}else if(sortType==2){
|
|
|
map1value = (int) o1.get("bindingNum");
|
|
|
map2value = (int) o2.get("bindingNum");
|
|
|
}else {
|
|
|
map1value = (int) o1.get("rateNum");
|
|
|
map2value = (int) o2.get("rateNum");
|
|
|
}
|
|
|
if (map1value - map2value > 0) {
|
|
|
return sort == 1 ? -1 : 1;
|
|
|
} else if (map1value - map2value < 0) {
|
|
@ -5673,6 +5699,7 @@ public class StatisticsESService {
|
|
|
reMap.put("allNum", allAmount);
|
|
|
reMap.put("bindingNum", bindingAmount);
|
|
|
reMap.put("rate", getRange(bindingAmount, allAmount, 2));//续签率是 续签量/去年的签约数
|
|
|
reMap.put("rateNum", getRangeNum(bindingAmount, allAmount, 2));//续签率是 续签量/去年的签约数
|
|
|
return reMap;
|
|
|
}
|
|
|
|