|
@ -5526,4 +5526,113 @@ public class StatisticsEsService {
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 医生圈-文章统计头部
|
|
|
* @param flag 0自定义 1本月2近半年3本年
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @param area
|
|
|
* @param level 2 市 3区 4医院 5、科室 6医生
|
|
|
* @param index
|
|
|
* @param level2_type
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject getArticleTotalHead(Integer flag,String startDate, String endDate, String area, int level, String index, String level2_type) throws Exception {
|
|
|
//发布量
|
|
|
SaveModel saveModel = null;
|
|
|
//收藏量
|
|
|
SaveModel saveModel1 = null;
|
|
|
//浏览量
|
|
|
SaveModel saveModel2 = null;
|
|
|
//发布量环比;
|
|
|
SaveModel saveModel3 = null;
|
|
|
//发布同比;
|
|
|
SaveModel saveModel4 = null;
|
|
|
//收藏量环比
|
|
|
SaveModel saveModel5 = null;
|
|
|
//收藏量同比
|
|
|
SaveModel saveModel6 = null;
|
|
|
//浏览量环比
|
|
|
SaveModel saveModel7 = null;
|
|
|
//浏览量同比
|
|
|
SaveModel saveModel8 = null;
|
|
|
if (flag==1){
|
|
|
startDate = DateUtil.getFirstMonthDay() +" 00:00:00";
|
|
|
endDate = DateUtil.getLastMonthDay()+" 23:59:59";
|
|
|
} else if (flag==2) {
|
|
|
startDate = DateUtil.getMonthDate(new Date(),-6)+" 00:00:00";
|
|
|
endDate = DateUtil.getStringDateShort()+" 23:59:59";
|
|
|
}else if (flag==3){
|
|
|
startDate = DateUtil.getCurrentYearStartTime()+" 00:00:00";
|
|
|
endDate = DateUtil.getCurrentYearEndTime() +" 23:59:59";
|
|
|
}
|
|
|
//同比时间:
|
|
|
String sameStartDate= DateUtil.getYearDate(DateUtil.strToDate(startDate))+" 00:00:00";
|
|
|
String sameEndDate = DateUtil.getYearDate(DateUtil.strToDate(endDate))+" 23:59:59";
|
|
|
//环比时间:
|
|
|
int months = DateUtil.getMonthDiff(DateUtil.strToDateLong(startDate),DateUtil.strToDateLong(endDate));
|
|
|
String linkStartDate = DateUtil.getMonthDate(DateUtil.strToDateLong(startDate),-months);
|
|
|
String linkEndDate = DateUtil.getMonthDate(DateUtil.strToDateLong(endDate),-months);
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
|
|
// /* saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, indexes[0], SaveModel.timeLevel_DDL);
|
|
|
// saveModel1 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, indexes[1], SaveModel.timeLevel_DDL);
|
|
|
// saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, indexes[2]+",21", SaveModel.timeLevel_DDL);
|
|
|
// JSONObject object = new JSONObject();
|
|
|
// String yesterday = DateUtil.getNextDay(endDate, -1);//昨天
|
|
|
// String lastDay = DateUtil.getNextDay(endDate, -7);//上周的今天
|
|
|
// String weekFirstDay = DateUtil.getMondayOfThisWeek();//周一
|
|
|
// String weekLastDay = DateUtil.getSundayOfThisWeek();//周日
|
|
|
// JSONArray array = dateTotalStatistics2(weekFirstDay,weekLastDay,area,level,indexes[2]+",21",null,SaveModel.timeLevel_ZL,null);//本周量
|
|
|
// Double prices = 0.0;
|
|
|
// for (int i=0;i<array.size();i++){
|
|
|
// JSONObject jsonObject = array.getJSONObject(i);
|
|
|
// prices +=jsonObject.getDouble("num");
|
|
|
// }
|
|
|
// Double num = prices/array.size();
|
|
|
// DecimalFormat df = new DecimalFormat("0.00");
|
|
|
// String str = df.format(num);
|
|
|
// object.put("dayPrice",str);//日均收入
|
|
|
// saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(yesterday, yesterday, area, level, indexes[2]+",21", SaveModel.timeLevel_DDL);
|
|
|
// saveModel4 = elasticsearchUtil.findOneDateQuotaLevel0(lastDay, lastDay, area, level, indexes[2]+",21", SaveModel.timeLevel_DDL);
|
|
|
// object.put("outPatientCount",saveModel.getResult2().longValue());//问诊量
|
|
|
// object.put("prescriptionCount",saveModel1.getResult2().longValue());//开方量
|
|
|
// object.put("priceTotal",saveModel2.getResult1().longValue());//总收入
|
|
|
// object.put("priceDayRate",baseEvaluateScoreService.judgeScore(saveModel2.getResult1().doubleValue(),saveModel3.getResult1().doubleValue()));
|
|
|
// object.put("priceWeekRate",baseEvaluateScoreService.judgeScore(saveModel2.getResult1().doubleValue(),saveModel4.getResult1().doubleValue()));
|
|
|
// String prescriptionRate = getRange(saveModel1.getResult2().intValue(), saveModel.getResult2().intValue(),0);
|
|
|
// object.put("prescriptionRate",prescriptionRate);//开方率
|
|
|
// String startTime = DateUtil.getStringDateShort()+" 00:00:00";
|
|
|
// String endTime = DateUtil.getStringDateShort() +" 23:59:59";
|
|
|
// String sql = "";
|
|
|
// if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
|
|
|
// sql = "select count(*) as \"total\" from wlyy_consult_outpatient_info o where o.create_time >= to_date('"+startTime+"','yyyy-mm-dd hh24:mi:ss') and o.create_time <= to_date('"+endTime+"','yyyy-mm-dd hh24:mi:ss')";
|
|
|
// }else {
|
|
|
// sql = "select count(*) as \"total\" from wlyy_consult_outpatient_info o where o.create_time >='"+startTime+"' and o.create_time <='"+endTime+"'";
|
|
|
// }
|
|
|
// if (level==4){
|
|
|
// sql += " and o.doctor IN (SELECT doctor_code as \"doctor_code\" FROM `base_doctor_hospital` dh where dh.org_code ='"+area+"' and dh.del=1)";
|
|
|
// }if (level==2){
|
|
|
// sql += " AND 1=1 ";
|
|
|
// }else if (level==5){
|
|
|
// sql += " and o.doctor IN (SELECT doctor_code as \"doctor_code\" FROM `base_doctor_hospital` dh where dh.dept_code ='"+area+"' and dh.del=1)";
|
|
|
// }else if (level==6){
|
|
|
// sql +=" and o.doctor='"+area+"'";
|
|
|
// }
|
|
|
// List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
|
|
|
// Long count = 0L;
|
|
|
// if(rstotal!=null&&rstotal.size()>0){
|
|
|
// count =Long.parseLong(rstotal.get(0).get("total").toString()) ;
|
|
|
// }
|
|
|
// object.put("todayOutPatientCount",count);//今日问诊量
|
|
|
// Map<String, Object> scoreAndPercentage = baseEvaluateScoreService.getScoreAndPercentage(area, level);
|
|
|
// object.put("totalAvgScore",scoreAndPercentage.get("totalAvgScore"));//服务总评分
|
|
|
// object.put("weekJudge",scoreAndPercentage.get("weekJudge"));//周同比
|
|
|
// object.put("dayJudge",scoreAndPercentage.get("dayJudge"));//日环比*/
|
|
|
|
|
|
return object;
|
|
|
}
|
|
|
}
|