|
@ -977,6 +977,18 @@ public class StatisticsEsService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Double getDoubleRange(Double first, Double second, int i) {
|
|
|
|
if (second == 0 && first > 0) {
|
|
|
|
return 100.0;
|
|
|
|
} else if (second == 0 && first == 0) {
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
Double size =first / second;
|
|
|
|
DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0
|
|
|
|
Double filesize = Double.parseDouble(df.format(size));
|
|
|
|
return filesize ;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 总体分析 折线图 按日--0级维度1级维度
|
|
* 总体分析 折线图 按日--0级维度1级维度
|
|
*
|
|
*
|
|
@ -1593,5 +1605,119 @@ public class StatisticsEsService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 服务评分平均分
|
|
|
|
* @param startDate
|
|
|
|
* @param endDate
|
|
|
|
* @param area
|
|
|
|
* @param level
|
|
|
|
* @param index
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public JSONObject getScoreHead(String startDate, String endDate, String area, int level, String index) throws Exception {
|
|
|
|
//总评分
|
|
|
|
SaveModel saveModel = null;
|
|
|
|
|
|
|
|
saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL);
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
Double scoreTotal = saveModel.getResult1();//总评分
|
|
|
|
Double people = saveModel.getResult2();//评价总人数
|
|
|
|
object.put("scoreTotal",scoreTotal);//总评分
|
|
|
|
object.put("people",people);//总人数
|
|
|
|
object.put("scoreRate",getDoubleRange(scoreTotal,people,0));//平均评分
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 服务评分曲线
|
|
|
|
* @param startDate
|
|
|
|
* @param endDate
|
|
|
|
* @param area
|
|
|
|
* @param level
|
|
|
|
* @param index
|
|
|
|
* @param interval
|
|
|
|
* @param level2_type
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public JSONObject getScoreLine(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception {
|
|
|
|
//服务评分
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
if (interval==1){
|
|
|
|
array = dateTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null);
|
|
|
|
}else if (interval==2){
|
|
|
|
array = weekTotalStatistics(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL);
|
|
|
|
}else if (interval==3){
|
|
|
|
array = monthTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL);
|
|
|
|
}
|
|
|
|
for (int i=0;i<array.size();i++){
|
|
|
|
JSONObject jsonObject = array.getJSONObject(i);
|
|
|
|
Long amount = jsonObject.getLong("amount");
|
|
|
|
Double num = jsonObject.getDouble("num");
|
|
|
|
jsonObject.put("scoreRate",getDoubleRange(num,amount.doubleValue(),0));
|
|
|
|
}
|
|
|
|
object.put("data",array);
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public JSONObject getScoreList(String startTime,String endTime,int level, String area, String lowLevel) throws Exception {
|
|
|
|
JSONObject result1 = new JSONObject();
|
|
|
|
|
|
|
|
//咨询总数
|
|
|
|
List<SaveModel> total = elasticsearchUtil.findListDateQuotaLevel0(endTime, endTime, area, level, "9", SaveModel.timeLevel_DDL, lowLevel);
|
|
|
|
Map<String, Object> totalMap = new HashMap<>();
|
|
|
|
org.json.JSONObject result = new org.json.JSONObject();
|
|
|
|
String low_level = StringUtils.isEmpty(lowLevel) ? String.valueOf(level + 1) : lowLevel;
|
|
|
|
|
|
|
|
|
|
|
|
//转换总咨询数
|
|
|
|
for (SaveModel saveModel : total) {
|
|
|
|
if (SaveModel.doctorLevel.equals(low_level)) {
|
|
|
|
totalMap.put(saveModel.getDoctor(), saveModel);
|
|
|
|
} else if (SaveModel.deptLevel.equals(low_level)) {
|
|
|
|
totalMap.put(saveModel.getDept(), saveModel);
|
|
|
|
}else if (SaveModel.OrgLevel.equals(low_level)) {
|
|
|
|
totalMap.put(saveModel.getHospital(), saveModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
;
|
|
|
|
List<Map<String, Object>> resultMaps = new ArrayList<>();
|
|
|
|
for (String key : totalMap.keySet()) {
|
|
|
|
Map<String, Object> rs = new HashMap<>();
|
|
|
|
SaveModel totalRs = (SaveModel) totalMap.get(key);
|
|
|
|
if (totalRs == null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
//合并结果集
|
|
|
|
Double totalNm = totalRs.getResult2();//总人数
|
|
|
|
Double scoreNm = totalRs.getResult1();//总分数
|
|
|
|
if (SaveModel.doctorLevel.equals(low_level)) {
|
|
|
|
rs.put("name", totalRs.getDoctorName());
|
|
|
|
} else if (SaveModel.deptLevel.equals(low_level)) {
|
|
|
|
rs.put("name", totalRs.getDeptName());
|
|
|
|
} else if (SaveModel.OrgLevel.equals(low_level)) {
|
|
|
|
rs.put("name", totalRs.getHospitalName());
|
|
|
|
}
|
|
|
|
rs.put("total", totalNm);
|
|
|
|
rs.put("scoreRate",getDoubleRange(scoreNm,totalNm,0));
|
|
|
|
rs.put("code", key);
|
|
|
|
resultMaps.add(rs);
|
|
|
|
}
|
|
|
|
//根据为回复数排序
|
|
|
|
Collections.sort(resultMaps, new Comparator<Map<String, Object>>() {
|
|
|
|
|
|
|
|
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
|
|
|
return (Double) o1.get("scoreRate") < (Double) o2.get("scoreRate") ? 1 : ((Double) o1.get("scoreRate") == (Double) o2.get("scoreRate") ? 0 : -1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
result1.put("resultList", resultMaps);
|
|
|
|
return result1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|