|
@ -4945,4 +4945,181 @@ public class StatisticsESService {
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
public JSONArray getArticleLowlevelTotal(String endDate, String area, int level, int sort, String lowLevel, String level2_type, String year) throws Exception {
|
|
|
|
|
|
|
|
|
//83:健康文章,84:健康指导
|
|
|
List<SaveModel> list_83_84 = elasticsearchUtil.findListDateQuotaLevel0(null, endDate, area, level, "83,84", SaveModel.timeLevel_DDL, lowLevel);
|
|
|
List<SaveModel> list_read_83_84 = elasticsearchUtil.findListDateQuotaLevel1(endDate,area,level,"83,84", SaveModel.timeLevel_DDL, lowLevel, "1");
|
|
|
|
|
|
// List<SaveModel> list_84 = elasticsearchUtil.findListDateQuotaLevel0(null, endDate, area, level, "84", SaveModel.timeLevel_ZL, lowLevel);
|
|
|
// List<SaveModel> list_read_84 = elasticsearchUtil.findListDateQuotaLevel1(endDate,area,level,"84", SaveModel.timeLevel_DDL, lowLevel, "1");
|
|
|
|
|
|
// Double readNum = 0.0;
|
|
|
String readRate = "";
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
for(SaveModel saveModel:list_83_84){
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if (SaveModel.OrgLevel.equals(lowLevel)) {
|
|
|
map.put("code", saveModel.getHospital());
|
|
|
map.put("name", saveModel.getHospitalName());
|
|
|
map.put("amount", saveModel.getResult1());
|
|
|
Double readNum = 0.0;
|
|
|
for(SaveModel saveModel2:list_read_83_84){
|
|
|
if(saveModel.getHospital().equals(saveModel2.getHospital())){
|
|
|
//获取阅读量
|
|
|
readNum = saveModel2.getResult1();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
readRate = df.format( readNum > 0.0? ((readNum)/(saveModel.getResult1() * 1.0000)*100):0.0);
|
|
|
map.put("readNum", readNum.longValue());
|
|
|
map.put("readRate", readRate+"%");
|
|
|
} else if (SaveModel.townLevel.equals(lowLevel)) {
|
|
|
map.put("code", saveModel.getTown());
|
|
|
map.put("name", saveModel.getTownName());
|
|
|
map.put("amount", saveModel.getResult1());
|
|
|
Double readNum = 0.0;
|
|
|
for(SaveModel saveModel2:list_read_83_84){
|
|
|
if(saveModel.getTown().equals(saveModel2.getTown())){
|
|
|
//获取阅读量
|
|
|
readNum = saveModel2.getResult1();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
readRate = df.format( readNum > 0.0? ((readNum)/(saveModel.getResult1() * 1.0000)*100):0.0);
|
|
|
map.put("readNum", readNum.longValue());
|
|
|
map.put("readRate", readRate+"%");
|
|
|
} else if (SaveModel.cityLevel.equals(lowLevel)) {
|
|
|
map.put("code", saveModel.getCity());
|
|
|
map.put("name", saveModel.getCityName());
|
|
|
map.put("amount", saveModel.getResult1());
|
|
|
Double readNum = 0.0;
|
|
|
for(SaveModel saveModel2:list_read_83_84){
|
|
|
if(saveModel.getCity().equals(saveModel2.getCity())){
|
|
|
//获取阅读量
|
|
|
readNum = saveModel2.getResult1();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
readRate = df.format( readNum > 0.0? ((readNum)/(saveModel.getResult1() * 1.0000)*100):0.0);
|
|
|
map.put("readNum", readNum.longValue());
|
|
|
map.put("readRate", readRate+"%");
|
|
|
} else if (SaveModel.teamLevel.equals(lowLevel)) {
|
|
|
map.put("code", saveModel.getTeam());
|
|
|
map.put("name", saveModel.getTeamName());
|
|
|
map.put("amount", saveModel.getResult1());
|
|
|
Double readNum = 0.0;
|
|
|
for(SaveModel saveModel2:list_read_83_84){
|
|
|
if(saveModel.getTeam().equals(saveModel2.getTeam())){
|
|
|
//获取阅读量
|
|
|
readNum = saveModel2.getResult1();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
readRate = df.format( readNum > 0.0? ((readNum)/(saveModel.getResult1() * 1.0000)*100):0.0);
|
|
|
map.put("readNum", readNum.longValue());
|
|
|
map.put("readRate", readRate+"%");
|
|
|
}
|
|
|
resultList.add(map);
|
|
|
}
|
|
|
|
|
|
// 结果为空时,自建结果集
|
|
|
if (resultList == null || resultList.size() < 1) {
|
|
|
resultList = new ArrayList<>();
|
|
|
if (SaveModel.townLevel.equals(lowLevel)) {
|
|
|
List<Town> towns = townDao.findByCityCode(area);
|
|
|
if (towns != null) {
|
|
|
for (Town town : towns) {
|
|
|
Map<String, Object> obj = new HashMap<>();
|
|
|
obj.put("code", town.getCode());
|
|
|
obj.put("name", town.getName());
|
|
|
obj.put("amount", "0");
|
|
|
obj.put("readNum", 0);
|
|
|
obj.put("readRate", Double.valueOf("0.00")+"%");
|
|
|
resultList.add(obj);
|
|
|
}
|
|
|
}
|
|
|
} else if (SaveModel.OrgLevel.equals(lowLevel)) {
|
|
|
List<Town> towns = new ArrayList<>();
|
|
|
if (SaveModel.cityLevel.equals(level + "")) {
|
|
|
towns = townDao.findByCityCode(area);
|
|
|
} else if (SaveModel.townLevel.equals(level + "")) {
|
|
|
Town town = townDao.findByCode(area);
|
|
|
towns.add(town);
|
|
|
}
|
|
|
|
|
|
if (towns != null && towns.size() > 0) {
|
|
|
for (Town town : towns) {
|
|
|
List<Hospital> hospitals = hospitalDao.findByTownCode(town.getCode());
|
|
|
|
|
|
for (Hospital hos : hospitals) {
|
|
|
Map<String, Object> obj = new HashMap<>();
|
|
|
obj.put("code", hos.getCode());
|
|
|
obj.put("name", hos.getName());
|
|
|
obj.put("amount", "0");
|
|
|
obj.put("readNum", 0);
|
|
|
obj.put("readRate", Double.valueOf("0.00")+"%");
|
|
|
resultList.add(obj);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else if (SaveModel.teamLevel.equals(lowLevel)) {
|
|
|
List<Hospital> hospitals = new ArrayList<>();
|
|
|
if (SaveModel.cityLevel.equals(level + "")) {
|
|
|
hospitals = hospitalDao.findByCity(area);
|
|
|
} else if (SaveModel.townLevel.equals(level + "")) {
|
|
|
hospitals = hospitalDao.findByTownCode(area);
|
|
|
} else {
|
|
|
Hospital hos = hospitalDao.findByCode(area);
|
|
|
if (hos != null) {
|
|
|
hospitals.add(hos);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (hospitals != null && hospitals.size() > 0) {
|
|
|
for (Hospital hos : hospitals) {
|
|
|
List<AdminTeam> teams = adminTeamDao.findByOrgCode(hos.getCode());
|
|
|
|
|
|
for (AdminTeam team : teams) {
|
|
|
Map<String, Object> obj = new HashMap<>();
|
|
|
obj.put("code", String.valueOf(team.getId()));
|
|
|
obj.put("name", team.getName());
|
|
|
obj.put("amount", "0");
|
|
|
obj.put("readNum", 0);
|
|
|
obj.put("readRate", Double.valueOf("0.00")+"%");
|
|
|
resultList.add(obj);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (SaveModel.OrgLevel.equals(level + "")) {
|
|
|
statisticsAllService.translateTeamLeaderName(resultList);
|
|
|
}
|
|
|
Collections.sort(resultList, new Comparator<Map<String, Object>>() {
|
|
|
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
|
|
long map1value = 0L;
|
|
|
long map2value = 0L;
|
|
|
if(o1.get("amount")!=null && o1.get("amount")+""!=""){
|
|
|
map1value = ((Double)o1.get("amount")).longValue();
|
|
|
}
|
|
|
if(o2.get("amount")!=null && o2.get("amount")+""!=""){
|
|
|
map2value = ((Double)o2.get("amount")).longValue();
|
|
|
}
|
|
|
|
|
|
if (map1value - map2value > 0) {
|
|
|
return sort == 1 ? -1 : 1;
|
|
|
} else if (map1value - map2value < 0) {
|
|
|
return sort == 1 ? 1 : -1;
|
|
|
} else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return new JSONArray(resultList);
|
|
|
}
|
|
|
|
|
|
}
|