|
@ -37,6 +37,7 @@ import org.springframework.context.annotation.Scope;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.jdbc.support.nativejdbc.OracleJdbc4NativeJdbcExtractor;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
|
|
@ -158,30 +159,31 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
|
|
|
//抽取數據
|
|
|
List<SignFamily> signFamilies= SpringUtil.getBean(DBExtract.class).extractByPage(SignFamily.class,sql,sqlCount,true);
|
|
|
computequota_1(sql,signFamilies,null); //统计今天的签约
|
|
|
computequota_2(); //统计今天的解约
|
|
|
computequota_3(); //统计今天的健康咨询量
|
|
|
computequota_4(); //统计今天的随访量
|
|
|
computequota_5(); //统计今天的健康指导
|
|
|
computequota_6(sql,signFamilies,null); //统计今天的签约患者性别
|
|
|
computequota_7(sql,signFamilies,null);//统计今天的签约患者分组
|
|
|
computequota_8(sql,signFamilies,null);//统计今天的签约患者年龄
|
|
|
computequota_9();//统计今天的待签约
|
|
|
computequota_10();//统计今天的改签
|
|
|
computequota_12(sql,signFamilies,null);//统计今天的签约下按年龄分组后再
|
|
|
computequota_13(sql,signFamilies,null);//统计今天的签约量
|
|
|
computequota_16_1(sql,signFamilies,null);//统计今天的签约数的扣费钱 1
|
|
|
computequota_15(sql,signFamilies,null);//统计今天的健康分布统计
|
|
|
computequota_16_0(sql,signFamilies,null);//统计今天的签约数的未扣费 0
|
|
|
computequota_17(sql,signFamilies,null);//统计今天的年龄疾病
|
|
|
computequota_20();//统计今天的已经签约患者绑定设备
|
|
|
computequota_21();//统计今天的已经签约微信关注人数
|
|
|
computequota_22();//未回复的咨询量
|
|
|
computequota_23();//及时回复的咨询量
|
|
|
computequota_24();//及时回复的咨询量时间分布
|
|
|
computequota_25();//统计质询量总数
|
|
|
computequota_26();//统计未缴费签约总数
|
|
|
computequota_27();//统计代预约量
|
|
|
// computequota_1(sql,signFamilies,null); //统计今天的签约
|
|
|
// computequota_2(); //统计今天的解约
|
|
|
// computequota_3(); //统计今天的健康咨询量
|
|
|
// computequota_4(); //统计今天的随访量
|
|
|
// computequota_5(); //统计今天的健康指导
|
|
|
// computequota_6(sql,signFamilies,null); //统计今天的签约患者性别
|
|
|
// computequota_7(sql,signFamilies,null);//统计今天的签约患者分组
|
|
|
// computequota_8(sql,signFamilies,null);//统计今天的签约患者年龄
|
|
|
// computequota_9();//统计今天的待签约
|
|
|
// computequota_10();//统计今天的改签
|
|
|
// computequota_12(sql,signFamilies,null);//统计今天的签约下按年龄分组后再
|
|
|
// computequota_13(sql,signFamilies,null);//统计今天的签约量
|
|
|
// computequota_16_1(sql,signFamilies,null);//统计今天的签约数的扣费钱 1
|
|
|
// computequota_15(sql,signFamilies,null);//统计今天的健康分布统计
|
|
|
// computequota_16_0(sql,signFamilies,null);//统计今天的签约数的未扣费 0
|
|
|
// computequota_17(sql,signFamilies,null);//统计今天的年龄疾病
|
|
|
// computequota_20();//统计今天的已经签约患者绑定设备
|
|
|
// computequota_21();//统计今天的已经签约微信关注人数
|
|
|
// computequota_22();//未回复的咨询量
|
|
|
// computequota_23();//及时回复的咨询量
|
|
|
// computequota_24();//及时回复的咨询量时间分布
|
|
|
// computequota_25();//统计质询量总数
|
|
|
// computequota_26();//统计未缴费签约总数
|
|
|
// computequota_27();//统计代预约量
|
|
|
computequota_28();//统计平均值
|
|
|
|
|
|
quartzJobLog.setJobContent(allContent.toString());
|
|
|
quartzJobLog.setJobName("实时统计");
|
|
@ -965,6 +967,120 @@ public class CurrentDayAllQuotaJob implements Job {
|
|
|
allContent.append("-----------27----------");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* SQL统计平均值存储redis
|
|
|
* 统计市,区,机构,团队医生满意度
|
|
|
*/
|
|
|
private void computequota_28(){
|
|
|
//获取市,区统计结果
|
|
|
List<Map<String,Object>> m1 = getCityTowms();
|
|
|
JSONObject json1 = new JSONObject();
|
|
|
json1.put("data",m1);
|
|
|
redisTemplate.opsForValue().set("quota:28:4:"+Constant.city+":3:"+RedisStorage.timeKey,json1.toString());
|
|
|
//获取市,机构统计结果
|
|
|
List<Map<String,Object>> m2 = getCityHoss();
|
|
|
JSONObject json2 = new JSONObject();
|
|
|
json2.put("data",m2);
|
|
|
redisTemplate.opsForValue().set("quota:28:4:"+Constant.city+":2:"+RedisStorage.timeKey,json2.toString());
|
|
|
//统计区级低下所有机构
|
|
|
if(m1!=null&&m1.size()>0){
|
|
|
for(Map<String,Object> m:m1){
|
|
|
String town =(String)m.get("code");
|
|
|
List<Map<String,Object>> m3 = getTownHoss(town);
|
|
|
JSONObject json3 = new JSONObject();
|
|
|
json3.put("data",m3);
|
|
|
redisTemplate.opsForValue().set("quota:28:3:"+town+":2:"+RedisStorage.timeKey,json3.toString());
|
|
|
}
|
|
|
}
|
|
|
//得到所有机构
|
|
|
List<Map<String,Object>> allHs = getAllHoss();
|
|
|
//得到所有团队统计结果
|
|
|
List<Map<String,Object>> allTs =getAllHosTeams();
|
|
|
|
|
|
//将团队按机构分组,分别存储
|
|
|
if(allHs!=null&&allHs.size()>0){
|
|
|
for(Map<String,Object> h : allHs){
|
|
|
String code = (String)h.get("code");
|
|
|
List<Map<String,Object>> hosTeams = new ArrayList<>();
|
|
|
Iterator<Map<String,Object>> it = allTs.iterator();
|
|
|
while(it.hasNext()){
|
|
|
Map<String,Object> x = it.next();
|
|
|
String hospital = (String)x.get("hospital");
|
|
|
if(code.equals(hospital)){
|
|
|
hosTeams.add(x);
|
|
|
it.remove();
|
|
|
}
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("data",hosTeams);
|
|
|
redisTemplate.opsForValue().set("quota:28:2:"+code+":1:"+RedisStorage.timeKey,json.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> getCityTowms(){
|
|
|
List<Map<String,Object>> map = jdbcTemplate.queryForList(getAvgSqlByCode("city_town_SQL"));
|
|
|
return map;
|
|
|
}
|
|
|
public List<Map<String,Object>> getCityHoss(){
|
|
|
List<Map<String,Object>> map = jdbcTemplate.queryForList(getAvgSqlByCode("city_hos_SQL"));
|
|
|
return map;
|
|
|
}
|
|
|
public List<Map<String,Object>> getTownHoss(String townCode){
|
|
|
List<Map<String,Object>> map = jdbcTemplate.queryForList(getAvgSqlByCode("town_hos_SQL"),new Object[]{townCode});
|
|
|
return map;
|
|
|
}
|
|
|
public List<Map<String,Object>> getAllHosTeams(){
|
|
|
List<Map<String,Object>> map = jdbcTemplate.queryForList(getAvgSqlByCode("team_SQL"));
|
|
|
return map;
|
|
|
}
|
|
|
public List<Map<String,Object>> getAllHoss(){
|
|
|
List<Map<String,Object>> map = jdbcTemplate.queryForList(getAvgSqlByCode("All_hos_SQL"));
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
public String getAvgSqlByCode(String code){
|
|
|
|
|
|
if("city_town_SQL".equals(code)){
|
|
|
//统计市级各区
|
|
|
String city_town_SQL ="SELECT t.code,t.`name` ,ifnull(ROUND(AVG(s.score),1),0) as avgCount " +
|
|
|
" FROM wlyy_doctor d " +
|
|
|
" RIGHT JOIN dm_town t on t.code=d.town " +
|
|
|
" LEFT JOIN wlyy_evaluate_score s ON d.code = s.doctor " +
|
|
|
" WHERE t.city='"+Constant.city+"' GROUP BY d.town order by avgCount DESC ";
|
|
|
return city_town_SQL;
|
|
|
}else if("city_hos_SQL".equals(code)){
|
|
|
//统计市级各社区
|
|
|
String city_hos_SQL ="SELECT t.code,t.`name`,ifnull(ROUND(AVG(s.score),1),0) as avgCount " +
|
|
|
" FROM wlyy_doctor d " +
|
|
|
" RIGHT JOIN dm_hospital t on t.code = d.hospital " +
|
|
|
" LEFT JOIN wlyy_evaluate_score s ON d.code = s.doctor " +
|
|
|
" WHERE t.city='"+Constant.city+"' GROUP BY d.hospital order by avgCount DESC ";
|
|
|
return city_hos_SQL;
|
|
|
}else if("town_hos_SQL".equals(code)){
|
|
|
//统计区级各社区
|
|
|
String town_hos_SQL ="SELECT t.code,t.`name`,ifnull(ROUND(AVG(s.score),1),0) as avgCount " +
|
|
|
" FROM wlyy_doctor d " +
|
|
|
" RIGHT JOIN dm_hospital t on t.code = d.hospital " +
|
|
|
" LEFT JOIN wlyy_evaluate_score s ON d.code = s.doctor " +
|
|
|
" WHERE t.town= ? GROUP BY d.hospital order by avgCount DESC ";
|
|
|
return town_hos_SQL;
|
|
|
}else if("team_SQL".equals(code)){
|
|
|
//查找所有团队
|
|
|
String team_SQL ="SELECT t.id,t.`name` ,d.hospital,ifnull(ROUND(AVG(s.score),1),0) as avgCount " +
|
|
|
" FROM wlyy_doctor d " +
|
|
|
" RIGHT JOIN wlyy_admin_team t on t.leader_code = d.code " +
|
|
|
" LEFT JOIN wlyy_evaluate_score s ON d.code = s.doctor " +
|
|
|
" GROUP BY t.id order by avgCount DESC ";
|
|
|
return team_SQL;
|
|
|
}else if("All_hos_SQL".equals(code)){
|
|
|
//查找所有机构
|
|
|
String All_hos_SQL = "SELECT t.code FROM dm_hospital t where t.city ='"+Constant.city+"'";
|
|
|
return All_hos_SQL;
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
public static String getDayString(Integer size) {
|
|
|
Date date = new Date();//取时间
|