|
@ -144,7 +144,7 @@ public class StatisticsService extends BaseService {
|
|
|
sql += " and level2_type = '" + level2_type + "'";
|
|
|
}
|
|
|
|
|
|
Map<String, Object> result = jdbcTemplate.queryForMap(sql, new Object[]{level, endDate, area});
|
|
|
Map<String, Object> result = jdbcTemplate.queryForMap(sql, level, endDate, area);
|
|
|
|
|
|
// 截止日期包含当天,则从redis查询当天统计数据
|
|
|
if (endDate.compareTo(new SimpleDateFormat("yyyy-MM-dd").format(new Date())) >= 0) {
|
|
@ -206,7 +206,7 @@ public class StatisticsService extends BaseService {
|
|
|
sql += " and qkdoctor_code = ?";
|
|
|
}
|
|
|
|
|
|
Map<String, Object> result = jdbcTemplate.queryForMap(sql, new Object[]{level, startDate, endDate, area});
|
|
|
Map<String, Object> result = jdbcTemplate.queryForMap(sql, level, startDate, endDate, area);
|
|
|
|
|
|
// 截止日期包含当天,则从redis查询当天统计数据
|
|
|
if (endDate.compareTo(new SimpleDateFormat("yyyy-MM-dd").format(new Date())) >= 0) {
|
|
@ -310,7 +310,7 @@ public class StatisticsService extends BaseService {
|
|
|
sql += " order by amount asc ";
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql, new Object[]{low_level, endDate, area});
|
|
|
List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql, low_level, endDate, area);
|
|
|
|
|
|
// 结果为空时,自建结果集
|
|
|
if (resultList == null || resultList.size() < 1) {
|
|
@ -525,7 +525,7 @@ public class StatisticsService extends BaseService {
|
|
|
sql += " order by amount asc ";
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql, new Object[]{low_level, startDate, endDate, area});
|
|
|
List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql, low_level, startDate, endDate, area);
|
|
|
|
|
|
// 结果为空时,自建结果集
|
|
|
if (resultList == null || resultList.size() < 1) {
|
|
@ -771,7 +771,7 @@ public class StatisticsService extends BaseService {
|
|
|
if (resultList != null) {
|
|
|
for (Map<String, Object> map : resultList) {
|
|
|
if (countResult.containsKey(map.get("range").toString())) {
|
|
|
JSONObject range = (JSONObject) countResult.get(map.get("range").toString());
|
|
|
JSONObject range = countResult.get(map.get("range").toString());
|
|
|
long amount = range.getLong("amount");
|
|
|
long resultAmount = map.get("amount") != null ? Math.round(Double.valueOf(map.get("amount").toString())) : 0;
|
|
|
range.put("amount", amount + resultAmount);
|
|
@ -1647,7 +1647,7 @@ public class StatisticsService extends BaseService {
|
|
|
sql += " AND d.hospital = ? ";
|
|
|
}
|
|
|
|
|
|
Map<String, Object> rs = jdbcTemplate.queryForMap(sql, new Object[]{area});
|
|
|
Map<String, Object> rs = jdbcTemplate.queryForMap(sql, area);
|
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
@ -1681,7 +1681,7 @@ public class StatisticsService extends BaseService {
|
|
|
|
|
|
sql += " GROUP BY mt order by mt DESC ";
|
|
|
|
|
|
List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql, new Object[]{statDate, endDate, area});
|
|
|
List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql, statDate, endDate, area);
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if (rs != null && rs.size() > 0) {
|
|
|
//降低循环层级
|
|
@ -2275,7 +2275,7 @@ public class StatisticsService extends BaseService {
|
|
|
// startDate = startDate + " 00:00:00";
|
|
|
// endDate = endDate + " 23:59:59";
|
|
|
//随访数目
|
|
|
String followup_sql = "SELECT COUNT(1) AS followupCount from wlyy_followup w WHERE w.admin_team_code=" + id + " AND w.create_time >='" + startDate + "' AND w.create_time<='" + endDate + "' AND w.followup_class IS NOT NULL ";
|
|
|
String followup_sql = "SELECT COUNT(1) AS followupCount from wlyy_followup w WHERE w.admin_team_code=" + id + " AND w.create_time >='" + startDate + "' AND w.create_time<='" + endDate + "' ";
|
|
|
//随访数目
|
|
|
Map<String, Object> followupCout = jdbcTemplate.queryForMap(followup_sql);
|
|
|
if (followupCout.get("followupCount") == null) {
|
|
@ -2866,14 +2866,14 @@ public class StatisticsService extends BaseService {
|
|
|
List<Map<String, Object>> couTotal = jdbcTemplate.queryForList(couTotalSQL);
|
|
|
if (couTotal != null && couTotal.size() > 0) {
|
|
|
Map<String, Object> couTotalMap = couTotal.get(0);
|
|
|
total = (Long) couTotalMap.get("total") == null ? 0L : (Long) couTotalMap.get("total");
|
|
|
total = couTotalMap.get("total") == null ? 0L : (Long) couTotalMap.get("total");
|
|
|
}
|
|
|
rs.put("total", total);
|
|
|
|
|
|
List<Map<String, Object>> reyTotal = jdbcTemplate.queryForList(reyTotalSql);
|
|
|
if (reyTotal != null && reyTotal.size() > 0) {
|
|
|
Map<String, Object> reyTotalMap = reyTotal.get(0);
|
|
|
relyOnTime = (Long) reyTotalMap.get("total") == null ? 0L : (Long) reyTotalMap.get("total");
|
|
|
relyOnTime = reyTotalMap.get("total") == null ? 0L : (Long) reyTotalMap.get("total");
|
|
|
}
|
|
|
if (total != 0L && relyOnTime != 0L) {
|
|
|
double rr = (double) relyOnTime / total * 100;
|
|
@ -2887,7 +2887,7 @@ public class StatisticsService extends BaseService {
|
|
|
List<Map<String, Object>> addTotal = jdbcTemplate.queryForList(addTotalSql);
|
|
|
if (addTotal != null && addTotal.size() > 0) {
|
|
|
Map<String, Object> addTotalMap = addTotal.get(0);
|
|
|
addNumber = (Long) addTotalMap.get("total") == null ? 0L : (Long) addTotalMap.get("total");
|
|
|
addNumber = addTotalMap.get("total") == null ? 0L : (Long) addTotalMap.get("total");
|
|
|
}
|
|
|
//本周或月增量
|
|
|
rs.put("addNumber", addNumber);
|
|
@ -2895,7 +2895,7 @@ public class StatisticsService extends BaseService {
|
|
|
List<Map<String, Object>> noRelyTotal = jdbcTemplate.queryForList(noRelySql);
|
|
|
if (noRelyTotal != null && noRelyTotal.size() > 0) {
|
|
|
Map<String, Object> noRelyTotalMap = noRelyTotal.get(0);
|
|
|
noRelyNumber = (Long) noRelyTotalMap.get("total") == null ? 0L : (Long) noRelyTotalMap.get("total");
|
|
|
noRelyNumber = noRelyTotalMap.get("total") == null ? 0L : (Long) noRelyTotalMap.get("total");
|
|
|
}
|
|
|
rs.put("noRelyNumber", noRelyNumber);
|
|
|
return rs;
|
|
@ -2917,7 +2917,6 @@ public class StatisticsService extends BaseService {
|
|
|
" AND w.doctor_code ='" + doctor + "'" +
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
" GROUP BY dateNo";
|
|
|
|
|
|
planSQL = "SELECT " +
|
|
@ -2930,7 +2929,6 @@ public class StatisticsService extends BaseService {
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.status ='2'" +
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
" GROUP BY dateNo";
|
|
|
} else {
|
|
|
//按月
|
|
@ -2945,7 +2943,6 @@ public class StatisticsService extends BaseService {
|
|
|
" AND w.doctor_code ='" + doctor + "'" +
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
planSQL = "SELECT " +
|
|
|
" ( " +
|
|
@ -2959,7 +2956,6 @@ public class StatisticsService extends BaseService {
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.status ='2'" +
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
}
|
|
|
List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSQL);
|
|
@ -2985,7 +2981,6 @@ public class StatisticsService extends BaseService {
|
|
|
" w.admin_team_code =" + teamCode +
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
" GROUP BY dateNo";
|
|
|
|
|
|
planSQL = "SELECT " +
|
|
@ -2999,7 +2994,6 @@ public class StatisticsService extends BaseService {
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.status ='2'" +
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
} else {
|
|
|
//按月
|
|
@ -3013,7 +3007,6 @@ public class StatisticsService extends BaseService {
|
|
|
" w.admin_team_code =" + teamCode +
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
planSQL = "SELECT " +
|
|
|
" ( " +
|
|
@ -3026,7 +3019,6 @@ public class StatisticsService extends BaseService {
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.status ='2'" +
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
}
|
|
|
List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSQL);
|
|
@ -3056,7 +3048,6 @@ public class StatisticsService extends BaseService {
|
|
|
" WHERE " +
|
|
|
" w.admin_team_code =" + teamCode +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
" GROUP BY " +
|
|
|
" w.doctor_code " +
|
|
|
" ) c ON c.doctor_code =m.doctor_code, " +
|
|
@ -3088,7 +3079,6 @@ public class StatisticsService extends BaseService {
|
|
|
" w.admin_team_code =" + teamCode +
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
" GROUP BY " +
|
|
|
" w.doctor_code " +
|
|
|
" ) c ON c.doctor_code =m.doctor_code, " +
|
|
@ -3121,7 +3111,6 @@ public class StatisticsService extends BaseService {
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.status ='2'" +
|
|
|
" AND w.followup_class IS NOT NULL " +
|
|
|
" GROUP BY " +
|
|
|
" w.doctor_code " +
|
|
|
" ) c ON c.doctor_code =m.doctor_code, " +
|
|
@ -3257,8 +3246,7 @@ public class StatisticsService extends BaseService {
|
|
|
" WHERE " +
|
|
|
" w.admin_team_code =" + teamCode +
|
|
|
" AND w.doctor_code ='" + doctor + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.followup_class IS NOT NULL";
|
|
|
" AND w.create_time <= '" + endDate + "' ";
|
|
|
String addSql = "SELECT " +
|
|
|
" COUNT(1) AS addCount " +
|
|
|
" FROM " +
|
|
@ -3267,8 +3255,7 @@ public class StatisticsService extends BaseService {
|
|
|
" w.admin_team_code =" + teamCode +
|
|
|
" AND w.doctor_code ='" + doctor + "' " +
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.followup_class IS NOT NULL";
|
|
|
" AND w.create_time <= '" + endDate + "' ";
|
|
|
String planSql = "SELECT " +
|
|
|
" COUNT(1) AS planCount " +
|
|
|
" FROM " +
|
|
@ -3278,8 +3265,7 @@ public class StatisticsService extends BaseService {
|
|
|
" AND w.doctor_code ='" + doctor + "' " +
|
|
|
" AND w.create_time >= '" + startDate + "' " +
|
|
|
" AND w.create_time <= '" + endDate + "' " +
|
|
|
" AND w.status ='2'" +
|
|
|
" AND w.followup_class IS NOT NULL";
|
|
|
" AND w.status ='2'";
|
|
|
|
|
|
JSONObject rs = new JSONObject();
|
|
|
List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);
|
|
@ -4027,12 +4013,30 @@ public class StatisticsService extends BaseService {
|
|
|
}
|
|
|
|
|
|
public JSONObject getRenewPercentAndChangePercent(String level, String code, String year) {
|
|
|
String renewIndex="";
|
|
|
String switchIndex="";
|
|
|
if("2".equals(level)){
|
|
|
//团队的续签量
|
|
|
renewIndex="42";
|
|
|
//团队的转签
|
|
|
switchIndex="37";
|
|
|
}else if("2".equals(level)){
|
|
|
//社区的续签量
|
|
|
renewIndex="43";
|
|
|
//社区的转签
|
|
|
switchIndex="45";
|
|
|
}else{
|
|
|
//区和市的续签量
|
|
|
renewIndex="44";
|
|
|
//区和市的转签
|
|
|
switchIndex="46";
|
|
|
}
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
//获取时间戳
|
|
|
String timeKey = redisTemplate.opsForValue().get("quota:timeKey");
|
|
|
//从redis中获取最新的续签数据 续签指标是29
|
|
|
int renewNum = getLevel1NumForRedis("29", level, code, timeKey);
|
|
|
;
|
|
|
|
|
|
int renewNum = getLevel1NumForRedis(renewIndex, level, code, timeKey);
|
|
|
//根据年度获取去年的签约数 签约指标是1
|
|
|
String date = year + "-06-30";
|
|
|
String index = "1";
|
|
@ -4042,7 +4046,7 @@ public class StatisticsService extends BaseService {
|
|
|
signNum = Integer.valueOf(wlyyQuotaResult.getResult());
|
|
|
}
|
|
|
//从redis中获取最新的转签数据 指标是37
|
|
|
int switchNum = getLevel1NumForRedis("37", level, code, timeKey);
|
|
|
int switchNum = getLevel1NumForRedis(switchIndex, level, code, timeKey);
|
|
|
jo.put("yesterYearSign", signNum);//去年的签约量
|
|
|
jo.put("thisYearRenew", renewNum);//今年的续签量
|
|
|
jo.put("thisYearSwithch", switchNum);//今年的转签量
|
|
@ -4053,18 +4057,19 @@ public class StatisticsService extends BaseService {
|
|
|
}
|
|
|
|
|
|
|
|
|
public JSONObject getRenewAnalysis(String level, String code) {
|
|
|
public JSONObject getRenewAnalysis(String switchIndex,String switchIndexReson,String signIn,String signOut,String level, String code) {
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
String timeKey = redisTemplate.opsForValue().get("quota:timeKey");
|
|
|
//获取签入人数
|
|
|
int switchNum = getLevel1NumForRedis("37", level, code, timeKey);
|
|
|
//获取转签人数
|
|
|
int switchNum = getLevel1NumForRedis(switchIndex, level, code, timeKey);
|
|
|
|
|
|
//获取转签分布
|
|
|
JSONArray switchJO = getLevel2JsonObjectForRedis("30", level, code, timeKey);
|
|
|
JSONArray switchJO = getLevel2JsonObjectForRedis(switchIndexReson, level, code, timeKey);
|
|
|
//获取签入人数
|
|
|
int inNum = getLevel1NumForRedis("34", level, code, timeKey);
|
|
|
int inNum = getLevel1NumForRedis(signIn, level, code, timeKey);
|
|
|
//获取签出人数
|
|
|
int outNum = getLevel1NumForRedis("35", level, code, timeKey);
|
|
|
int outNum = getLevel1NumForRedis(signOut, level, code, timeKey);
|
|
|
|
|
|
int changeTeam = getLevel1NumForRedis("31", level, code, timeKey);//夸团队的数目
|
|
|
int changeHospital = getLevel1NumForRedis("32", level, code, timeKey);//夸社区的数目
|
|
@ -4554,23 +4559,23 @@ public class StatisticsService extends BaseService {
|
|
|
//市 区
|
|
|
sql =" SELECT t.result As num,t.town_name AS name,t.town AS code,t.create_time AS date" +
|
|
|
" FROM wlyy_quota_result t " +
|
|
|
" WHERE t.city ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='3'AND LEFT(t.create_time,10)='"+year+"-06-30'";
|
|
|
" WHERE t.city ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='3'AND t.quota_date='"+year+"-06-30'";
|
|
|
}else{
|
|
|
//市 机构
|
|
|
sql = "SELECT t.result As num,t.org_name AS name,t.org_code AS code,t.create_time AS date" +
|
|
|
" FROM wlyy_quota_result t " +
|
|
|
" WHERE t.city ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='2' AND LEFT(t.create_time,10)='"+year+"-06-30'";
|
|
|
" WHERE t.city ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='2' AND t.quota_date='"+year+"-06-30'";
|
|
|
}
|
|
|
}else if (level ==3){
|
|
|
//区 机构
|
|
|
sql = "SELECT t.result As num,t.org_name AS name,t.org_code AS code,t.create_time AS date " +
|
|
|
"FROM wlyy_quota_result t " +
|
|
|
"WHERE t.town ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='2' AND LEFT(t.create_time,10)='"+year+"-06-30'";
|
|
|
"WHERE t.town ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='2' AND t.quota_date='"+year+"-06-30'";
|
|
|
}else{
|
|
|
//机构 团队
|
|
|
sql ="SELECT t.result As num,t.qkdoctor_name AS name,t.qkdoctor_code AS code,t.create_time AS date " +
|
|
|
" FROM wlyy_quota_result t " +
|
|
|
" WHERE t.org_code ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='1' AND LEFT(t.create_time,10)='"+year+"-06-30'";
|
|
|
" WHERE t.org_code ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='1' AND t.quota_date='"+year+"-06-30'";
|
|
|
}
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if(list!=null&&list.size()>0){
|