|
@ -3954,6 +3954,39 @@ public class StatisticsService extends BaseService {
|
|
|
return new JSONArray(list);
|
|
|
}
|
|
|
|
|
|
public JSONArray getTeamDoctorEduLineFromEs(String teamCode, String startDate, String endDate, String type, String doctor) {
|
|
|
String startDateStr = changeDate(DateUtil.getNextDay(startDate,-1));
|
|
|
String endDateStr = changeDate(endDate);
|
|
|
List<Map<String,Object>> list = new ArrayList<>();
|
|
|
String sql;
|
|
|
|
|
|
if ("0".equals(type)) {
|
|
|
//按周统计
|
|
|
sql = "SELECT " +
|
|
|
" COUNT(*) AS articleCount,count(DISTINCT batchNo) batchCount " +
|
|
|
" FROM " + esType+
|
|
|
" WHERE " +
|
|
|
" adminTeamCode =" + teamCode +
|
|
|
" AND doctorCode ='" + doctor + "'" +
|
|
|
" AND createTime >= '?1' " +
|
|
|
" AND createTime <= '?2' ";
|
|
|
|
|
|
list = getGZBGDataWeekLineForEsFrom(startDate,endDate,sql);
|
|
|
} else {
|
|
|
sql = "SELECT COUNT(*) AS articleCount,count(DISTINCT batchNo) batchCount " +
|
|
|
" FROM " +esType+
|
|
|
" WHERE " +
|
|
|
" adminTeamCode =" + teamCode +
|
|
|
" AND doctorCode ='" + doctor + "'" +
|
|
|
" AND createTime >= '?1' " +
|
|
|
" AND createTime <= '?2' ";
|
|
|
|
|
|
list = getGZBGDataMonthLineForEsFrom(startDate,endDate,startDateStr,sql);
|
|
|
}
|
|
|
return new JSONArray(list);
|
|
|
}
|
|
|
|
|
|
|
|
|
public JSONArray getTeamDoctorEduLine(String teamCode, String startDate, String endDate, String type, String doctor) {
|
|
|
String startDateStr = DateUtil.getNextDay(startDate,-1)+" 17:00:00";
|
|
|
endDate = endDate + " 17:00:00";
|
|
@ -4214,29 +4247,29 @@ public class StatisticsService extends BaseService {
|
|
|
startDate = changeDate(DateUtil.getNextDay(startDate,-1));
|
|
|
endDate = changeDate(endDate);
|
|
|
|
|
|
String totalSql = "select count(*) AS articleCount,count(DISTINCT batchNo) AS batchCount " +
|
|
|
String totalSql = "select count(*) as articleCount,count(DISTINCT batchNo) as batchCount " +
|
|
|
" from " +esType+
|
|
|
" where adminTeamCode="+teamCode+" and doctorCode='"+doctor+"' and createTime <='"+endDate+"'";
|
|
|
String addSql = "SELECT " +
|
|
|
" COUNT(*) AS addCount, " +
|
|
|
" COUNT(DISTINCT batchNo) addBatchno " +
|
|
|
" FROM " + esType +
|
|
|
" WHERE " +
|
|
|
" count(*) as addCount, " +
|
|
|
" count(DISTINCT batchNo) as addBatchno " +
|
|
|
" from " + esType +
|
|
|
" where " +
|
|
|
" adminTeamCode =" + teamCode +
|
|
|
" AND doctorCode ='" + doctor + "'" +
|
|
|
" AND createTime <= '" + endDate + "' " +
|
|
|
" AND createTime >= '" + startDate + "'";
|
|
|
List<HealthEduArticleESResult> totalList = elasticsearchUtil.excute(totalSql,HealthEduArticleESResult.class,esType,esIndex);
|
|
|
List<HealthEduArticleESResult> addList = elasticsearchUtil.excute(addSql,HealthEduArticleESResult.class,esType,esIndex);
|
|
|
" and doctorCode ='" + doctor + "'" +
|
|
|
" and createTime <= '" + endDate + "' " +
|
|
|
" and createTime >= '" + startDate + "'";
|
|
|
List<HealthEduArticleESResult> totalHealthEduArticleESResult = elasticsearchUtil.excute(totalSql,HealthEduArticleESResult.class,esType,esIndex);
|
|
|
List<HealthEduArticleESResult> addHealthEduArticleESResult = elasticsearchUtil.excute(addSql,HealthEduArticleESResult.class,esType,esIndex);
|
|
|
JSONObject rs = new JSONObject();
|
|
|
//转换到map
|
|
|
List<Map<String,Object>> totalMapList = new ArrayList<>();
|
|
|
Map<String,Object> totalMap = new HashedMap();
|
|
|
totalMap.put("batchno","0");
|
|
|
totalMap.put("articleCount","0");
|
|
|
if (totalList!=null && totalList.size()>0){
|
|
|
totalMap.put("batchno",totalList.get(0).getBatchCount());
|
|
|
totalMap.put("articleCount",totalList.get(0).getArticleCount());
|
|
|
if (totalHealthEduArticleESResult!=null && totalHealthEduArticleESResult.size()>0){
|
|
|
totalMap.put("batchno",totalHealthEduArticleESResult.get(0).getBatchCount());
|
|
|
totalMap.put("articleCount",totalHealthEduArticleESResult.get(0).getArticleCount());
|
|
|
}
|
|
|
totalMapList.add(totalMap);
|
|
|
//转换到map
|
|
@ -4244,9 +4277,9 @@ public class StatisticsService extends BaseService {
|
|
|
Map<String,Object> addMap = new HashedMap();
|
|
|
addMap.put("addCount","0");
|
|
|
addMap.put("addBatchno","0");
|
|
|
if (addList!=null && addList.size()>0){
|
|
|
totalMap.put("addCount",addList.get(0).getAddCount());
|
|
|
totalMap.put("addBatchno",addList.get(0).getAddBatchno());
|
|
|
if (addHealthEduArticleESResult!=null && addHealthEduArticleESResult.size()>0){
|
|
|
addMap.put("addCount",addHealthEduArticleESResult.get(0).getAddCount());
|
|
|
addMap.put("addBatchno",addHealthEduArticleESResult.get(0).getAddBatchno());
|
|
|
}
|
|
|
addMapList.add(addMap);
|
|
|
rs.put("totalList", totalMapList);
|
|
@ -7043,6 +7076,48 @@ public class StatisticsService extends BaseService {
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<Map<String,Object>> getGZBGDataMonthLineForEsFrom(String startDate,String endDate,String startDateStr,String sql){
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
List<Map<String,Object>> dateList = DateUtil.findDateASWeeks(DateUtil.strToDate(startDate),DateUtil.strToDate(endDate));
|
|
|
String firstWeekMonday = DateUtil.getMondayOfThisDate(DateUtil.strToDate(startDate,"yyyy-MM-dd"));
|
|
|
if (DateUtil.strToDate(firstWeekMonday).before(DateUtil.strToDate(startDate))){
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
map.put("date",firstWeekMonday);
|
|
|
dateList.add(0,map);
|
|
|
}
|
|
|
//以每天的17:00:00为时间的边界设置每周的起始时间和结束时间查询数据库
|
|
|
if (dateList!=null && dateList.size()>0) {
|
|
|
for (Map<String, Object> map : dateList) {
|
|
|
String resultSql = sql;
|
|
|
String mondayDate = String.valueOf(map.get("date"));
|
|
|
String sundayDate = DateUtil.getSundayOfThisDate(DateUtil.strToDate(mondayDate));
|
|
|
if (DateUtil.strToDate(mondayDate).before(DateUtil.strToDate(startDate))) {
|
|
|
mondayDate = startDateStr;
|
|
|
} else {
|
|
|
mondayDate = changeDate(DateUtil.getNextDay(mondayDate, -1));
|
|
|
}
|
|
|
sundayDate = changeDate(sundayDate);
|
|
|
resultSql = resultSql.replace("?1",mondayDate);
|
|
|
resultSql = resultSql.replace("?2",sundayDate);
|
|
|
List<HealthEduArticleESResult> list = elasticsearchUtil.excute(resultSql,HealthEduArticleESResult.class,esType,esIndex);
|
|
|
//放入结果集
|
|
|
if (list!=null && list.size()>0){
|
|
|
for(HealthEduArticleESResult healthEduArticleESResult : list){
|
|
|
if (healthEduArticleESResult!=null){
|
|
|
Map<String,Object> resMap = new HashedMap();
|
|
|
resMap.put("articleCount",healthEduArticleESResult.getArticleCount());
|
|
|
resMap.put("batchCount",healthEduArticleESResult.getBatchCount());
|
|
|
resMap.put("weekOfMonth",DateUtil.getWeekOfMonth(String.valueOf(map.get("date"))));
|
|
|
resultList.add(resMap);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 工作报告医生个人详情折线图--按照周的公用方法(为了解决与es的数据冲突)
|
|
|
* @param startDate
|
|
@ -7078,6 +7153,37 @@ public class StatisticsService extends BaseService {
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> getGZBGDataWeekLineForEsFrom(String startDate,String endDate,String sql){
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
List<Map<String,Object>> dateList = DateUtil.findDates(DateUtil.strToDate(startDate),DateUtil.strToDate(endDate));
|
|
|
|
|
|
//以每天的17:00:00为时间的边界设置每天的起始时间和结束时间查询数据库
|
|
|
if (dateList!=null && dateList.size()>0) {
|
|
|
for (Map<String, Object> map : dateList) {
|
|
|
String resultSql = sql;
|
|
|
String endTime = changeDate(String.valueOf(map.get("date")));
|
|
|
String startTime = changeDate(DateUtil.getNextDay(DateUtil.strToDate(String.valueOf(map.get("date"))),-1));
|
|
|
|
|
|
resultSql = resultSql.replace("?1",startTime);
|
|
|
resultSql = resultSql.replace("?2",endTime);
|
|
|
List<HealthEduArticleESResult> list = elasticsearchUtil.excute(resultSql,HealthEduArticleESResult.class,esType,esIndex);
|
|
|
//放入结果集
|
|
|
if (list!=null && list.size()>0){
|
|
|
for(HealthEduArticleESResult healthEduArticleESResult : list){
|
|
|
if (healthEduArticleESResult!=null){
|
|
|
Map<String,Object> resMap = new HashedMap();
|
|
|
resMap.put("articleCount",healthEduArticleESResult.getArticleCount());
|
|
|
resMap.put("batchCount",healthEduArticleESResult.getBatchCount());
|
|
|
resMap.put("dateNo",String.valueOf(map.get("date")));
|
|
|
resultList.add(resMap);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
private String changeDate(String quotaDate) {
|
|
|
return quotaDate + "T17:00:00+0800";
|
|
|
}
|