|
@ -409,10 +409,10 @@ public class StatisticsService extends BaseService {
|
|
|
redisNum = "";
|
|
|
}
|
|
|
if (StringUtils.isEmpty(redisNum)) {
|
|
|
if (org.springframework.util.StringUtils.isEmpty(year)) {
|
|
|
year = Constant.getNowYear();
|
|
|
if(org.springframework.util.StringUtils.isEmpty(year)){
|
|
|
year= Constant.getNowYear();
|
|
|
}
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Integer.valueOf(year));
|
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(),Integer.valueOf(year));
|
|
|
if (peopleNum != null) {
|
|
|
map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getNum() * 100));
|
|
|
map.put("rateString", map.get("amount") + "/" + peopleNum.getNum());
|
|
@ -1772,7 +1772,15 @@ public class StatisticsService extends BaseService {
|
|
|
|
|
|
|
|
|
//3.平均满意度
|
|
|
String avg_sql = "SELECT ROUND(AVG(s.score),1) avgScore FROM wlyy_consult c LEFT JOIN wlyy_evaluate_score s ON c.`code` = s.consult WHERE c.czrq>='" + startDate + "' AND c.czrq<='" + endDate + "' AND s.doctor in(select m.doctor_code from wlyy_admin_team_member m where m.team_id=" + id + ")";
|
|
|
String avg_sql = "SELECT " +
|
|
|
" ROUND(AVG(s.score), 1) avgScore " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team c,wlyy_evaluate_score s " +
|
|
|
" WHERE " +
|
|
|
" c.consult = s.consult " +
|
|
|
" AND c.czrq >= '"+startDate+"' " +
|
|
|
" AND c.czrq <= '"+endDate+"' " +
|
|
|
" AND c.admin_team_code ="+id;
|
|
|
|
|
|
//计算签约表记录
|
|
|
Map<String, Object> signCount = jdbcTemplate.queryForMap(sign_sql);
|
|
@ -1834,7 +1842,7 @@ public class StatisticsService extends BaseService {
|
|
|
sql = "SELECT left(f.apply_date,10) as applyDate,count(1) as signCount " +
|
|
|
" FROM wlyy_sign_family f " +
|
|
|
" where f.apply_date >='" + startDate + " 00:00:00' " +
|
|
|
" AND f.apply_date<='" + endDate + " 00:00:00' " +
|
|
|
" AND f.apply_date<='" + endDate + " 23:59:59' " +
|
|
|
" AND f.status >0 " +
|
|
|
" AND f.expenses_status='1' " +
|
|
|
" AND f.admin_team_code=" + id +
|
|
@ -1844,7 +1852,7 @@ public class StatisticsService extends BaseService {
|
|
|
sql = "SELECT (DATE_FORMAT(f.apply_date,'%v')-DATE_FORMAT('" + DateUtil.getFristDayOfMonth() + "','%v')+1) as weekOfMonth,count(1) as signCount " +
|
|
|
" FROM wlyy_sign_family f " +
|
|
|
" where f.apply_date >='" + startDate + " 00:00:00' " +
|
|
|
" AND f.apply_date<='" + endDate + " 00:00:00' " +
|
|
|
" AND f.apply_date<='" + endDate + " 23:59:59' " +
|
|
|
" AND f.status >0 " +
|
|
|
" AND f.expenses_status='1' " +
|
|
|
" AND f.admin_team_code=" + id +
|
|
@ -1875,32 +1883,37 @@ public class StatisticsService extends BaseService {
|
|
|
String sql;
|
|
|
//按周
|
|
|
if ("0".equals(type)) {
|
|
|
sql = "SELECT left(f.apply_date,10) as applyDate,count(1) as signCount " +
|
|
|
" FROM wlyy_sign_family_renew f " +
|
|
|
" where f.apply_date >='" + startDate + " 00:00:00' " +
|
|
|
" AND f.apply_date<='" + endDate + " 23:59:59' " +
|
|
|
" AND f.status >0 " +
|
|
|
" AND f.expenses_status='1' " +
|
|
|
" AND f.admin_team_code=" + id +
|
|
|
" GROUP BY left(f.apply_date,10)";
|
|
|
sql = "SELECT " +
|
|
|
" LEFT (f.apply_date, 10) AS applyDate, " +
|
|
|
" count(1) AS signCount " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family_renew_log f " +
|
|
|
" WHERE " +
|
|
|
" f.apply_date >= '"+startDate+"' " +
|
|
|
" AND f.apply_date <= '"+endDate+"' " +
|
|
|
" AND f.admin_team_id = " +id+
|
|
|
" GROUP BY " +
|
|
|
" LEFT (f.apply_date, 10)";
|
|
|
//按月
|
|
|
} else {
|
|
|
sql = "SELECT (DATE_FORMAT(f.apply_date,'%v')-DATE_FORMAT('" + startDate + "','%v')+1) as weekOfMonth,count(1) as signCount " +
|
|
|
" FROM wlyy_sign_family_renew f " +
|
|
|
" where f.apply_date >='" + startDate + " 00:00:00' " +
|
|
|
" AND f.apply_date<='" + endDate + " 23:59:59' " +
|
|
|
" AND f.status >0 " +
|
|
|
" AND f.expenses_status='1' " +
|
|
|
" AND f.admin_team_code=" + id +
|
|
|
" GROUP BY DATE_FORMAT(f.apply_date,'%m %v')";
|
|
|
sql = "SELECT " +
|
|
|
" (DATE_FORMAT(f.apply_date,'%v')-DATE_FORMAT('"+startDate+"','%v')+1) AS weekOfMonth, " +
|
|
|
" count(1) AS signCount " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family_renew_log f " +
|
|
|
" WHERE " +
|
|
|
" f.apply_date >= '"+startDate+"' " +
|
|
|
" AND f.apply_date <= '"+endDate+"' " +
|
|
|
" AND f.admin_team_id = " +id+
|
|
|
" GROUP BY " +
|
|
|
" DATE_FORMAT(f.apply_date, '%m %v')";
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql);
|
|
|
JSONArray rsJs = new JSONArray(rs);
|
|
|
return rsJs;
|
|
|
}
|
|
|
|
|
|
public JSONObject getReyStatbyTeamNow(String doctor, String startDate, String endDate, String isNow) {
|
|
|
public JSONObject getReyStatbyTeamNow(String doctor, String startDate, String endDate, String isNow){
|
|
|
AdminTeam admin = adminTeamDao.findByLeaderCode(doctor);
|
|
|
if (admin == null) {
|
|
|
throw new RuntimeException("未找到团队信息");
|
|
@ -1910,70 +1923,54 @@ public class StatisticsService extends BaseService {
|
|
|
endDate = endDate + " 23:59:59";
|
|
|
Long id = admin.getId();
|
|
|
String totalSql = "SELECT " +
|
|
|
" count(1) AS total " +
|
|
|
"FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
"WHERE " +
|
|
|
" a.czrq <= '" + endDate + "' " +
|
|
|
" AND a.czrq >= '" + startDate + "' " +
|
|
|
" AND a.admin_team_code= " + id +
|
|
|
" AND a.consult IN ( " +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t.create_time <= '" + endDate + "' " +
|
|
|
" AND t.create_time >= '" + startDate + "' " +
|
|
|
")";
|
|
|
List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);
|
|
|
" COUNT(1) total " +
|
|
|
" FROM " +
|
|
|
" "+imDataBaseName+".Topics t, " +
|
|
|
" "+imDataBaseName+".Participants p, " +
|
|
|
" "+imDataBaseName+".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+imDataBaseName+".Patients s " +
|
|
|
" WHERE " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code =" +id +
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"'";
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
|
|
|
Long totalCount = 0L;
|
|
|
if (totalList != null && totalList.size() > 0) {
|
|
|
Map<String, Object> total = totalList.get(0);
|
|
|
totalCount = (Long) total.get("total");
|
|
|
if(totalList!=null&&totalList.size()>0){
|
|
|
Map<String,Object> total = totalList.get(0);
|
|
|
totalCount = (Long)total.get("total");
|
|
|
}
|
|
|
String noReySql = "SELECT " +
|
|
|
" count(1) AS noRey " +
|
|
|
"FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
"WHERE " +
|
|
|
" a.czrq <= '" + endDate + "' " +
|
|
|
"AND a.czrq >= '" + startDate + "' " +
|
|
|
"AND a.admin_team_code= " + id +
|
|
|
" AND a.consult IN ( " +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 " +
|
|
|
" AND t.create_time <= '" + endDate + "' " +
|
|
|
" AND t.create_time >= '" + startDate + "' " +
|
|
|
")";
|
|
|
List<Map<String, Object>> noReyList = jdbcTemplate.queryForList(noReySql);
|
|
|
" COUNT(1) noRey " +
|
|
|
" FROM " +
|
|
|
" "+imDataBaseName+".Topics t, " +
|
|
|
" "+imDataBaseName+".Participants p, " +
|
|
|
" "+imDataBaseName+".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+imDataBaseName+".Patients s " +
|
|
|
" WHERE " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 "+
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code =" +id +
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"'";
|
|
|
List<Map<String,Object>> noReyList = jdbcTemplate.queryForList(noReySql);
|
|
|
Long noReyCount = 0L;
|
|
|
if (noReyList != null && noReyList.size() > 0) {
|
|
|
Map<String, Object> noRey = noReyList.get(0);
|
|
|
noReyCount = (Long) noRey.get("noRey");
|
|
|
if(noReyList!=null&&noReyList.size()>0){
|
|
|
Map<String,Object> noRey = noReyList.get(0);
|
|
|
noReyCount = (Long)noRey.get("noRey");
|
|
|
}
|
|
|
JSONObject rs = new JSONObject();
|
|
|
rs.put("onReyCount", noReyCount);
|
|
|
rs.put("totalCount", totalCount);
|
|
|
rs.put("totalCount",totalCount);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
@ -2211,7 +2208,22 @@ public class StatisticsService extends BaseService {
|
|
|
// startDate = startDate + " 00:00:00";
|
|
|
// endDate = endDate + " 23:59:59";
|
|
|
//咨询量
|
|
|
String consult_sql = "SELECT COUNT(1) AS consultCount FROM wlyy_consult_team t WHERE t.admin_team_code = " + id + " AND t.czrq <='" + endDate + "' AND t.czrq >='" + startDate + "'";
|
|
|
String consult_sql = "SELECT " +
|
|
|
" COUNT(1) consultCount " +
|
|
|
" FROM " +
|
|
|
" im_new.Topics t, " +
|
|
|
" im_new.Participants p, " +
|
|
|
" im_new.Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" im_new.Patients s " +
|
|
|
" WHERE " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code =" +id+
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"'";
|
|
|
//获取咨詢數
|
|
|
Map<String, Object> consultCout = jdbcTemplate.queryForMap(consult_sql);
|
|
|
if (consultCout.get("consultCount") == null) {
|
|
@ -2302,22 +2314,22 @@ public class StatisticsService extends BaseService {
|
|
|
" WHERE " +
|
|
|
" s.consult = t.consult " +
|
|
|
" AND " +
|
|
|
" t.czrq <= '" + endDate + "' " +
|
|
|
" AND t.czrq >= '" + startDate + "' " +
|
|
|
" AND t.admin_team_code = " + id +
|
|
|
" t.czrq <= '"+endDate+"' " +
|
|
|
" AND t.czrq >= '"+startDate+"' " +
|
|
|
" AND t.admin_team_code = " +id+
|
|
|
" GROUP BY dateNo";
|
|
|
} else {
|
|
|
sql = "SELECT " +
|
|
|
" (DATE_FORMAT(t.czrq,'%v')-DATE_FORMAT('" + startDate + "','%v')+1) AS weekNo, " +
|
|
|
" (DATE_FORMAT(t.czrq,'%v')-DATE_FORMAT('"+startDate+"','%v')+1) AS weekNo, " +
|
|
|
" ifnull(ROUND(AVG(s.score), 1), 0) AS avgCount " +
|
|
|
" FROM " +
|
|
|
" wlyy_evaluate_score s,wlyy_consult_team t " +
|
|
|
" WHERE " +
|
|
|
" s.consult = t.consult " +
|
|
|
" AND " +
|
|
|
" t.czrq <= '" + endDate + "' " +
|
|
|
" AND t.czrq >= '" + startDate + "' " +
|
|
|
" AND t.admin_team_code = " + id +
|
|
|
" t.czrq <= '"+endDate+"' " +
|
|
|
" AND t.czrq >= '"+startDate+"' " +
|
|
|
" AND t.admin_team_code = " +id +
|
|
|
" GROUP BY weekNo";
|
|
|
}
|
|
|
|
|
@ -2352,120 +2364,82 @@ public class StatisticsService extends BaseService {
|
|
|
if ("0".equals(type)) {
|
|
|
//按周统计
|
|
|
sql = "SELECT " +
|
|
|
" left(a.czrq,10) AS dateNo,count(1) AS noRely " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
" WHERE" +
|
|
|
" a.czrq <= '" + endDate + "'" +
|
|
|
" AND a.czrq >= '" + startDate + "'" +
|
|
|
" AND a.admin_team_code =" + teamCode +
|
|
|
" AND a.consult IN (" +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" left(t.create_time,10) AS dateNo, COUNT(1) AS noRely " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" "+ imDataBaseName +".Topics t, " +
|
|
|
" "+ imDataBaseName +".Participants p, " +
|
|
|
" "+ imDataBaseName +".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+ imDataBaseName +".Patients s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 " +
|
|
|
" AND t.create_time <= '" + endDate + "'" +
|
|
|
" AND t.create_time >= '" + startDate + "'" +
|
|
|
" )" +
|
|
|
" GROUP BY left(a.czrq,10)";
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code = " +teamCode+
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"' " +
|
|
|
" GROUP BY dateNo";
|
|
|
|
|
|
totalSql = "SELECT " +
|
|
|
" left(a.czrq,10) AS dateNo,count(1) AS total " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
" WHERE" +
|
|
|
" a.czrq <= '" + endDate + "'" +
|
|
|
" AND a.czrq >= '" + startDate + "'" +
|
|
|
" AND a.admin_team_code =" + teamCode +
|
|
|
" AND a.consult IN (" +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" left(t.create_time,10) AS dateNo, COUNT(1) total " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" "+ imDataBaseName +".Topics t, " +
|
|
|
" "+ imDataBaseName +".Participants p, " +
|
|
|
" "+ imDataBaseName +".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+ imDataBaseName +".Patients s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t.create_time <= '" + endDate + "'" +
|
|
|
" AND t.create_time >= '" + startDate + "'" +
|
|
|
" )" +
|
|
|
" GROUP BY left(a.czrq,10)";
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code = " +teamCode+
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"' " +
|
|
|
" GROUP BY dateNo";
|
|
|
} else {
|
|
|
//按月统计
|
|
|
sql = "SELECT " +
|
|
|
" ( " +
|
|
|
" DATE_FORMAT(a.czrq, '%v') - DATE_FORMAT('" + DateUtil.getFristDayOfMonth() + "', '%v') + 1" +
|
|
|
" ) AS weekOfMonth, " +
|
|
|
" COUNT(1) AS noRely" +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
" WHERE " +
|
|
|
" a.czrq <= '" + endDate + "' " +
|
|
|
" AND a.czrq >= '" + startDate + "' " +
|
|
|
" AND a.admin_team_code =" + teamCode +
|
|
|
" AND a.consult IN (" +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t," +
|
|
|
" " + imDataBaseName + ".participants p," +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 " +
|
|
|
" AND t.create_time <= '" + endDate + "'" +
|
|
|
" AND t.create_time >= '" + startDate + "'" +
|
|
|
" )" +
|
|
|
" GROUP BY " +
|
|
|
" DATE_FORMAT(a.czrq, '%m %v')";
|
|
|
totalSql = "SELECT " +
|
|
|
" ( " +
|
|
|
" DATE_FORMAT(a.czrq, '%v') - DATE_FORMAT('" + DateUtil.getFristDayOfMonth() + "', '%v') + 1" +
|
|
|
" ) AS weekOfMonth, " +
|
|
|
" COUNT(1) AS total" +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
" WHERE " +
|
|
|
" a.czrq <= '" + endDate + "' " +
|
|
|
" AND a.czrq >= '" + startDate + "' " +
|
|
|
" AND a.admin_team_code =" + teamCode +
|
|
|
" AND a.consult IN (" +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t," +
|
|
|
" " + imDataBaseName + ".participants p," +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t.create_time <= '" + endDate + "'" +
|
|
|
" AND t.create_time >= '" + startDate + "'" +
|
|
|
" )" +
|
|
|
" GROUP BY " +
|
|
|
" DATE_FORMAT(a.czrq, '%m %v')";
|
|
|
sql ="SELECT " +
|
|
|
" (DATE_FORMAT(t.create_time, '%v') - DATE_FORMAT('"+startDate+"', '%v') + 1) AS weekOfMonth, " +
|
|
|
" COUNT(1) AS noRely " +
|
|
|
" FROM " +
|
|
|
" im_new.Topics t, " +
|
|
|
" im_new.Participants p, " +
|
|
|
" im_new.Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" im_new.Patients s " +
|
|
|
" WHERE " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code = " +teamCode+
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 " +
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"' " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
totalSql ="SELECT " +
|
|
|
" (DATE_FORMAT(t.create_time, '%v') - DATE_FORMAT('"+startDate+"', '%v') + 1) AS weekOfMonth, " +
|
|
|
" COUNT(1) AS total " +
|
|
|
" FROM " +
|
|
|
" im_new.Topics t, " +
|
|
|
" im_new.Participants p, " +
|
|
|
" im_new.Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" im_new.Patients s " +
|
|
|
" WHERE " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code = " +teamCode+
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"' " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> noReyList = jdbcTemplate.queryForList(sql);
|
|
@ -2495,124 +2469,86 @@ public class StatisticsService extends BaseService {
|
|
|
if ("0".equals(type)) {
|
|
|
//按周统计
|
|
|
sql = "SELECT " +
|
|
|
" left(a.czrq,10) AS dateNo,count(1) AS noRely " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
" WHERE" +
|
|
|
" a.czrq <= '" + endDate + "'" +
|
|
|
" AND a.czrq >= '" + startDate + "'" +
|
|
|
" AND a.admin_team_code =" + teamCode +
|
|
|
" AND a.consult IN (" +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" left(t.create_time,10) AS dateNo, COUNT(1) AS noRely " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" "+ imDataBaseName +".Topics t, " +
|
|
|
" "+ imDataBaseName +".Participants p, " +
|
|
|
" "+ imDataBaseName +".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+ imDataBaseName +".Patients s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 " +
|
|
|
" AND t.create_time <= '" + endDate + "'" +
|
|
|
" AND t.create_time >= '" + startDate + "'" +
|
|
|
" AND d.id = '" + doctor + "'" +
|
|
|
" )" +
|
|
|
" GROUP BY left(a.czrq,10)";
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND d.id ='"+doctor +"'"+
|
|
|
" AND c.admin_team_code = " +teamCode+
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"' " +
|
|
|
" GROUP BY dateNo";
|
|
|
|
|
|
totalSql = "SELECT " +
|
|
|
" left(a.czrq,10) AS dateNo,count(1) AS total " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
" WHERE" +
|
|
|
" a.czrq <= '" + endDate + "'" +
|
|
|
" AND a.czrq >= '" + startDate + "'" +
|
|
|
" AND a.admin_team_code =" + teamCode +
|
|
|
" AND a.consult IN (" +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" left(t.create_time,10) AS dateNo, COUNT(1) total " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" "+ imDataBaseName +".Topics t, " +
|
|
|
" "+ imDataBaseName +".Participants p, " +
|
|
|
" "+ imDataBaseName +".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+ imDataBaseName +".Patients s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t.create_time <= '" + endDate + "'" +
|
|
|
" AND t.create_time >= '" + startDate + "'" +
|
|
|
" AND d.id = '" + doctor + "'" +
|
|
|
" )" +
|
|
|
" GROUP BY left(a.czrq,10)";
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND d.id ='"+doctor +"'"+
|
|
|
" AND c.admin_team_code = " +teamCode+
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"' " +
|
|
|
" GROUP BY dateNo";
|
|
|
} else {
|
|
|
//按月统计
|
|
|
sql = "SELECT " +
|
|
|
" ( " +
|
|
|
" DATE_FORMAT(a.czrq, '%v') - DATE_FORMAT('" + DateUtil.getFristDayOfMonth() + "', '%v') + 1" +
|
|
|
" ) AS weekOfMonth, " +
|
|
|
" COUNT(1) AS noRely" +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
" WHERE " +
|
|
|
" a.czrq <= '" + endDate + "' " +
|
|
|
" AND a.czrq >= '" + startDate + "' " +
|
|
|
" AND a.admin_team_code =" + teamCode +
|
|
|
" AND a.consult IN (" +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t," +
|
|
|
" " + imDataBaseName + ".participants p," +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 " +
|
|
|
" AND t.create_time <= '" + endDate + "'" +
|
|
|
" AND t.create_time >= '" + startDate + "'" +
|
|
|
" AND d.id = '" + doctor + "'" +
|
|
|
" )" +
|
|
|
" GROUP BY " +
|
|
|
" DATE_FORMAT(a.czrq, '%m %v')";
|
|
|
totalSql = "SELECT " +
|
|
|
" ( " +
|
|
|
" DATE_FORMAT(a.czrq, '%v') - DATE_FORMAT('" + DateUtil.getFristDayOfMonth() + "', '%v') + 1" +
|
|
|
" ) AS weekOfMonth, " +
|
|
|
" COUNT(1) AS total" +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
" WHERE " +
|
|
|
" a.czrq <= '" + endDate + "' " +
|
|
|
" AND a.czrq >= '" + startDate + "' " +
|
|
|
" AND a.admin_team_code =" + teamCode +
|
|
|
" AND a.consult IN (" +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t," +
|
|
|
" " + imDataBaseName + ".participants p," +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t.create_time <= '" + endDate + "'" +
|
|
|
" AND t.create_time >= '" + startDate + "'" +
|
|
|
" AND d.id = '" + doctor + "'" +
|
|
|
" )" +
|
|
|
" GROUP BY " +
|
|
|
" DATE_FORMAT(a.czrq, '%m %v')";
|
|
|
sql ="SELECT " +
|
|
|
" (DATE_FORMAT(t.create_time, '%v') - DATE_FORMAT('"+startDate+"', '%v') + 1) AS weekOfMonth, " +
|
|
|
" COUNT(1) AS noRely " +
|
|
|
" FROM " +
|
|
|
" im_new.Topics t, " +
|
|
|
" im_new.Participants p, " +
|
|
|
" im_new.Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" im_new.Patients s " +
|
|
|
" WHERE " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code = " +teamCode+
|
|
|
" AND d.id ='"+doctor +"'"+
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 " +
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"' " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
totalSql ="SELECT " +
|
|
|
" (DATE_FORMAT(t.create_time, '%v') - DATE_FORMAT('"+startDate+"', '%v') + 1) AS weekOfMonth, " +
|
|
|
" COUNT(1) AS total " +
|
|
|
" FROM " +
|
|
|
" im_new.Topics t, " +
|
|
|
" im_new.Participants p, " +
|
|
|
" im_new.Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" im_new.Patients s " +
|
|
|
" WHERE " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND d.id ='"+doctor +"'"+
|
|
|
" AND c.admin_team_code = " +teamCode+
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"' " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> noReyList = jdbcTemplate.queryForList(sql);
|
|
@ -2638,44 +2574,40 @@ public class StatisticsService extends BaseService {
|
|
|
endDate = endDate + " 23:59:59";
|
|
|
// 未回复咨询总量
|
|
|
String onReySQL = "SELECT " +
|
|
|
" t.doctor_code AS doctorCode, " +
|
|
|
" d.`name`, " +
|
|
|
" IFNULL(c.total, 0) AS noRely " +
|
|
|
" IFNULL(c.total,0) AS noRely, " +
|
|
|
" d.code AS doctorCode, " +
|
|
|
" d.name " +
|
|
|
" FROM " +
|
|
|
" wlyy_admin_team_member t " +
|
|
|
" wlyy_doctor d, " +
|
|
|
" wlyy_admin_team_member m " +
|
|
|
" " +
|
|
|
" LEFT JOIN ( " +
|
|
|
" SELECT count(1) AS total ,a.doctor " +
|
|
|
" SELECT " +
|
|
|
" COUNT(1) total, " +
|
|
|
" d.`name`, " +
|
|
|
" d.id " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
" "+imDataBaseName+".Topics t, " +
|
|
|
" "+imDataBaseName+".Participants p, " +
|
|
|
" "+imDataBaseName+".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+imDataBaseName+".Patients s " +
|
|
|
" WHERE " +
|
|
|
" a.czrq <= '" + endDate + "' " +
|
|
|
" AND a.czrq >= '" + startDate + "' " +
|
|
|
" AND a.admin_team_code = " + teamCode +
|
|
|
" AND a.consult IN ( " +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 " +
|
|
|
" AND t.create_time <= '" + endDate + "' " +
|
|
|
" AND t.create_time >= '" + startDate + "' " +
|
|
|
" ) " +
|
|
|
" GROUP BY a.doctor " +
|
|
|
" ) c ON c.doctor = t.doctor_code, " +
|
|
|
" wlyy_doctor d " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code = " +teamCode+
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 " +
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"' " +
|
|
|
" GROUP BY " +
|
|
|
" id " +
|
|
|
" ) c ON c.id = m.doctor_code " +
|
|
|
" WHERE " +
|
|
|
" t.doctor_code = d.`code` " +
|
|
|
" AND t.available = 1 " +
|
|
|
" AND t.team_id = " + teamCode;
|
|
|
" m.doctor_code = d.`code` " +
|
|
|
" AND m.team_id = "+teamCode;
|
|
|
if ("0".equals(sort)) {
|
|
|
onReySQL = onReySQL + " ORDER BY noRely DESC";
|
|
|
} else {
|
|
@ -2684,42 +2616,38 @@ public class StatisticsService extends BaseService {
|
|
|
|
|
|
//总咨询量
|
|
|
String totalSql = "SELECT " +
|
|
|
" t.doctor_code AS doctorCode, " +
|
|
|
" d.`name`, " +
|
|
|
" IFNULL(c.total, 0) AS total " +
|
|
|
" IFNULL(c.total,0) AS total, " +
|
|
|
" d.code AS doctorCode, " +
|
|
|
" d.name " +
|
|
|
" FROM " +
|
|
|
" wlyy_admin_team_member t " +
|
|
|
" wlyy_doctor d, " +
|
|
|
" wlyy_admin_team_member m " +
|
|
|
" " +
|
|
|
" LEFT JOIN ( " +
|
|
|
" SELECT count(1) AS total ,a.doctor " +
|
|
|
" SELECT " +
|
|
|
" COUNT(1) total, " +
|
|
|
" d.`name`, " +
|
|
|
" d.id " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
" "+ imDataBaseName +".Topics t, " +
|
|
|
" "+ imDataBaseName +".Participants p, " +
|
|
|
" "+ imDataBaseName +".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+ imDataBaseName +".Patients s " +
|
|
|
" WHERE " +
|
|
|
" a.czrq <= '" + endDate + "' " +
|
|
|
" AND a.czrq >= '" + startDate + "' " +
|
|
|
" AND a.admin_team_code = " + teamCode +
|
|
|
" AND a.consult IN ( " +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t.create_time <= '" + endDate + "' " +
|
|
|
" AND t.create_time >= '" + startDate + "' " +
|
|
|
" ) " +
|
|
|
" GROUP BY a.doctor " +
|
|
|
" ) c ON c.doctor = t.doctor_code, " +
|
|
|
" wlyy_doctor d " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code = " +teamCode+
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"' " +
|
|
|
" GROUP BY " +
|
|
|
" id " +
|
|
|
" ) c ON c.id = m.doctor_code " +
|
|
|
" WHERE " +
|
|
|
" t.doctor_code = d.`code` " +
|
|
|
" AND t.available = 1 " +
|
|
|
" AND t.team_id = " + teamCode;
|
|
|
" m.doctor_code = d.`code` " +
|
|
|
" AND m.team_id = "+teamCode;
|
|
|
if ("0".equals(sort)) {
|
|
|
totalSql = totalSql + " ORDER BY total DESC";
|
|
|
} else {
|
|
@ -2728,43 +2656,39 @@ public class StatisticsService extends BaseService {
|
|
|
|
|
|
//结束咨询
|
|
|
String endConsultSql = "SELECT " +
|
|
|
" t.doctor_code AS doctorCode, " +
|
|
|
" d.`name`, " +
|
|
|
" IFNULL(c.total, 0) AS endRey " +
|
|
|
" IFNULL(c.total,0) AS endRey, " +
|
|
|
" d.code AS doctorCode, " +
|
|
|
" d.name " +
|
|
|
" FROM " +
|
|
|
" wlyy_admin_team_member t " +
|
|
|
" wlyy_doctor d, " +
|
|
|
" wlyy_admin_team_member m " +
|
|
|
" " +
|
|
|
" LEFT JOIN ( " +
|
|
|
" SELECT count(1) AS total ,a.doctor " +
|
|
|
" SELECT " +
|
|
|
" COUNT(1) total, " +
|
|
|
" d.`name`, " +
|
|
|
" d.id " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a " +
|
|
|
" "+ imDataBaseName +".Topics t, " +
|
|
|
" "+ imDataBaseName +".Participants p, " +
|
|
|
" "+ imDataBaseName +".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+ imDataBaseName +".Patients s " +
|
|
|
" WHERE " +
|
|
|
" a.czrq <= '" + endDate + "' " +
|
|
|
" AND a.czrq >= '" + startDate + "' " +
|
|
|
" AND a.admin_team_code = " + teamCode +
|
|
|
" AND a.consult IN ( " +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t. STATUS = 10 " +
|
|
|
" AND t.create_time <= '" + endDate + "' " +
|
|
|
" AND t.create_time >= '" + startDate + "' " +
|
|
|
" ) " +
|
|
|
" GROUP BY a.doctor " +
|
|
|
" ) c ON c.doctor = t.doctor_code, " +
|
|
|
" wlyy_doctor d " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code = " +teamCode+
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"' " +
|
|
|
" AND t. STATUS = 10 " +
|
|
|
" GROUP BY " +
|
|
|
" id " +
|
|
|
" ) c ON c.id = m.doctor_code " +
|
|
|
" WHERE " +
|
|
|
" t.doctor_code = d.`code` " +
|
|
|
" AND t.available = 1 " +
|
|
|
" AND t.team_id = " + teamCode;
|
|
|
" m.doctor_code = d.`code` " +
|
|
|
" AND m.team_id = "+teamCode;
|
|
|
if ("0".equals(sort)) {
|
|
|
endConsultSql = endConsultSql + " ORDER BY endRey DESC";
|
|
|
} else {
|
|
@ -2861,122 +2785,78 @@ public class StatisticsService extends BaseService {
|
|
|
endDate = endDate + " 23:59:59";
|
|
|
//获取咨询总数
|
|
|
String couTotalSQL = "SELECT " +
|
|
|
" c.doctorCode, " +
|
|
|
" count(1) AS total " +
|
|
|
" COUNT(1) total " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a, " +
|
|
|
" ( " +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId, " +
|
|
|
" d.id doctorCode " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t.create_time <= '" + endDate + "' " +
|
|
|
" AND d.id='" + doctor + "' " +
|
|
|
" ) c " +
|
|
|
" "+imDataBaseName+".Topics t, " +
|
|
|
" "+imDataBaseName+".Participants p, " +
|
|
|
" "+imDataBaseName+".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+imDataBaseName+".Patients s " +
|
|
|
" WHERE " +
|
|
|
" c.consultId = a.consult " +
|
|
|
" AND a.admin_team_code = " + teamCode +
|
|
|
" GROUP BY " +
|
|
|
" c.doctorCode ";
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code ="+teamCode+
|
|
|
" AND d.id='"+doctor+"'" +
|
|
|
" AND t.create_time <= '"+endDate+"'";
|
|
|
//及时回复数
|
|
|
String reyTotalSql = "SELECT " +
|
|
|
" c.doctorCode, " +
|
|
|
" count(1) AS total " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a, " +
|
|
|
" ( " +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId, " +
|
|
|
" d.id doctorCode " +
|
|
|
" COUNT(1) total " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" "+imDataBaseName+".Topics t, " +
|
|
|
" "+imDataBaseName+".Participants p, " +
|
|
|
" "+imDataBaseName+".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+imDataBaseName+".Patients s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.business_type=2 " +
|
|
|
" AND t.`reply`=1 " +
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND t.`reply`=1 " +
|
|
|
" AND c.admin_team_code ="+teamCode+
|
|
|
" AND d.id='"+doctor+"'" +
|
|
|
" AND TIMESTAMPDIFF(SECOND ,t.create_time ,t.reply_time) <86400 AND TIMESTAMPDIFF(SECOND ,t.create_time,t.reply_time) >0 " +
|
|
|
" AND t.create_time <= '" + endDate + "' " +
|
|
|
" AND d.id='" + doctor + "' " +
|
|
|
" ) c " +
|
|
|
" WHERE " +
|
|
|
" c.consultId = a.consult " +
|
|
|
" AND a.admin_team_code =" + teamCode +
|
|
|
" GROUP BY " +
|
|
|
" c.doctorCode";
|
|
|
" AND t.create_time <= '"+endDate+"'";
|
|
|
//本周或月增量
|
|
|
String addTotalSql = "SELECT " +
|
|
|
" c.doctorCode, " +
|
|
|
" count(1) AS total " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a, " +
|
|
|
" ( " +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId," +
|
|
|
" d.id doctorCode " +
|
|
|
" COUNT(1) total " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t.create_time <= '" + endDate + "' " +
|
|
|
" AND t.create_time >= '" + startDate + "' " +
|
|
|
" AND d.id='" + doctor + "' " +
|
|
|
" ) c " +
|
|
|
" "+imDataBaseName+".Topics t, " +
|
|
|
" "+imDataBaseName+".Participants p, " +
|
|
|
" "+imDataBaseName+".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+imDataBaseName+".Patients s " +
|
|
|
" WHERE " +
|
|
|
" c.consultId = a.consult " +
|
|
|
" AND a.admin_team_code =" + teamCode +
|
|
|
" GROUP BY " +
|
|
|
" c.doctorCode";
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND c.admin_team_code ="+teamCode+
|
|
|
" AND d.id='"+doctor+"'" +
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"'";
|
|
|
//当前未回复咨询数
|
|
|
String noRelySql = "SELECT " +
|
|
|
" c.doctorCode, " +
|
|
|
" count(1) AS total " +
|
|
|
" COUNT(1) total " +
|
|
|
" FROM " +
|
|
|
" wlyy_consult_team a, " +
|
|
|
" ( " +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId, " +
|
|
|
" d.id doctorCode " +
|
|
|
" FROM " +
|
|
|
" " + imDataBaseName + ".topics t, " +
|
|
|
" " + imDataBaseName + ".participants p, " +
|
|
|
" " + imDataBaseName + ".doctors d, " +
|
|
|
" " + imDataBaseName + ".sessions s " +
|
|
|
" WHERE " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 " +
|
|
|
" AND t.create_time <= '" + endDate + "' " +
|
|
|
" AND t.create_time >= '" + startDate + "' " +
|
|
|
" AND d.id='" + doctor + "' " +
|
|
|
" ) c " +
|
|
|
" "+imDataBaseName+".Topics t, " +
|
|
|
" "+imDataBaseName+".Participants p, " +
|
|
|
" "+imDataBaseName+".Doctors d, " +
|
|
|
" Wlyy_Consult_Team c, " +
|
|
|
" "+imDataBaseName+".Patients s " +
|
|
|
" WHERE " +
|
|
|
" c.consultId = a.consult " +
|
|
|
" AND a.admin_team_code =" + teamCode +
|
|
|
" GROUP BY " +
|
|
|
" c.doctorCode";
|
|
|
" d.id = p.participant_id " +
|
|
|
" AND c.consult = t.id " +
|
|
|
" AND c.patient = s.id " +
|
|
|
" AND p.session_id = t.session_id " +
|
|
|
" AND t. STATUS <> 10 " +
|
|
|
" AND t.`reply` = 0 " +
|
|
|
" AND c.admin_team_code ="+teamCode+
|
|
|
" AND d.id='"+doctor+"'" +
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"'";
|
|
|
|
|
|
JSONObject rs = new JSONObject();
|
|
|
Long total = 0L;
|
|
@ -3659,8 +3539,8 @@ public class StatisticsService extends BaseService {
|
|
|
" wlyy_patient_health_guidance w " +
|
|
|
" WHERE " +
|
|
|
" w.admin_team_code = " + teamCode +
|
|
|
" AND w.czrq <= '" + endDate + "' " +
|
|
|
" AND w.czrq >= '" + startDate + "' " +
|
|
|
" AND w.czrq <= '" +endDate+ "' " +
|
|
|
" AND w.czrq >= '" +startDate + "' " +
|
|
|
" GROUP BY dateNo";
|
|
|
} else {
|
|
|
//按月统计
|
|
@ -3697,7 +3577,7 @@ public class StatisticsService extends BaseService {
|
|
|
" w.admin_team_code = " + teamCode +
|
|
|
" AND w.doctor ='" + doctor + "'" +
|
|
|
" AND w.czrq <= '" + endDate + "' " +
|
|
|
" AND w.czrq >= '" + startDate + "' " +
|
|
|
" AND w.czrq >= '" +startDate + "' " +
|
|
|
" GROUP BY dateNo";
|
|
|
} else {
|
|
|
//按月统计
|
|
@ -3848,8 +3728,8 @@ public class StatisticsService extends BaseService {
|
|
|
" WHERE " +
|
|
|
" w.admin_team_code = " + teamCode +
|
|
|
" AND w.doctor ='" + doctor + "'" +
|
|
|
" AND w.czrq <= '" + endDate + "' " +
|
|
|
" AND w.czrq >= '" + startDate + "'";
|
|
|
" AND w.czrq <= '" +endDate + "' " +
|
|
|
" AND w.czrq >= '" +startDate+ "'";
|
|
|
JSONObject rs = new JSONObject();
|
|
|
Long guidanceCount = 0L;
|
|
|
Long addCount = 0L;
|
|
@ -4188,24 +4068,19 @@ public class StatisticsService extends BaseService {
|
|
|
|
|
|
int changeTeam = getLevel1NumForRedis("31", level, code, timeKey);//夸团队的数目
|
|
|
int changeHospital = getLevel1NumForRedis("32", level, code, timeKey);//夸社区的数目
|
|
|
int changeTown = getLevel1NumForRedis("33", level, code, timeKey);//夸区的数目
|
|
|
|
|
|
|
|
|
jo.put("inNum", inNum);//今年的签入量
|
|
|
jo.put("outNum", outNum);//今年的签出量
|
|
|
jo.put("thisYearSwithch", switchNum);//今年的转签量
|
|
|
jo.put("switchHealth", switchJO);//今年的服务分布
|
|
|
String changeTeamNum = getRangeNoLast(changeTeam, switchNum, 2);//跨团队转签率
|
|
|
String changeHospNum = getRangeNoLast(changeHospital, switchNum, 2);//跨团队转签率
|
|
|
String changeTownNum=null ;
|
|
|
if (changeTown != 0) {
|
|
|
changeTownNum = (100 - Double.valueOf(changeTeamNum) - Double.valueOf(changeHospNum)) + "";//解决算出来可能不是100%的问题 用扣的
|
|
|
}else{
|
|
|
changeTownNum="0";
|
|
|
}
|
|
|
jo.put("switchTeam", changeTeamNum+"%");//今年的转签量
|
|
|
jo.put("switchHospital", changeHospNum+"%");//今年的转签量
|
|
|
jo.put("switchTown", changeTownNum+"%");//今年的转签量
|
|
|
String changeTeamNum=getRangeNoLast(changeTeam, switchNum, 2);//跨团队转签率
|
|
|
String changeHospNum=getRangeNoLast(changeHospital, switchNum, 2);//跨社区转签率
|
|
|
String changeTownNum=(100-Double.valueOf(changeTeamNum)-Double.valueOf(changeHospNum))+"";//跨区转签率,解决算出来可能不是100%的问题 用扣的
|
|
|
|
|
|
jo.put("switchTeam", changeTeamNum);//今年的转签量
|
|
|
jo.put("switchHospital", changeHospNum);//今年的转签量
|
|
|
jo.put("switchTown", changeTownNum);//今年的转签量
|
|
|
return jo;
|
|
|
}
|
|
|
|
|
@ -4251,9 +4126,9 @@ public class StatisticsService extends BaseService {
|
|
|
* @return
|
|
|
*/
|
|
|
public String getRange(int first, int second, int i) {
|
|
|
if (second == 0 && first > 0) {
|
|
|
if(second==0&&first>0){
|
|
|
return "100%";
|
|
|
} else if (second == 0 && first == 0) {
|
|
|
}else if(second==0&&first==0){
|
|
|
return "0%";
|
|
|
}
|
|
|
float size = (float) (first * 100) / second;
|
|
@ -4263,15 +4138,15 @@ public class StatisticsService extends BaseService {
|
|
|
}
|
|
|
|
|
|
public String getRangeNoLast(int first, int second, int i) {
|
|
|
if (second == 0 && first > 0) {
|
|
|
return "100";
|
|
|
} else if (second == 0 && first == 0) {
|
|
|
return "0";
|
|
|
if(second==0&&first>0){
|
|
|
return "100%";
|
|
|
}else if(second==0&&first==0){
|
|
|
return "0%";
|
|
|
}
|
|
|
float size = (float) (first * 100) / second;
|
|
|
DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0
|
|
|
String filesize = df.format(size);
|
|
|
return filesize;
|
|
|
return filesize ;
|
|
|
}
|
|
|
|
|
|
public JSONObject getConsultingTitleAll(Integer level, String area, String year) {
|
|
@ -4519,21 +4394,21 @@ public class StatisticsService extends BaseService {
|
|
|
|
|
|
public JSONObject getConsultingStatisticsListYear(Integer level, String area, String lowlevel, String year) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
Integer coutYear = Integer.parseInt(year) + 1;
|
|
|
Integer coutYear = Integer.parseInt(year)+1;
|
|
|
|
|
|
//及时回复数
|
|
|
JSONArray rely = getQuotaList(level, lowlevel, area, coutYear, 23);
|
|
|
if (rely == null) {
|
|
|
JSONArray rely = getQuotaList(level,lowlevel,area,coutYear,23);
|
|
|
if(rely==null){
|
|
|
return null;
|
|
|
}
|
|
|
//咨询总数
|
|
|
JSONArray total = getQuotaList(level, lowlevel, area, coutYear, 25);
|
|
|
if (total == null) {
|
|
|
JSONArray total = getQuotaList(level,lowlevel,area,coutYear,25);
|
|
|
if(total==null){
|
|
|
return null;
|
|
|
}
|
|
|
//未回复数
|
|
|
JSONArray onRely = getQuotaList(level, lowlevel, area, coutYear, 22);
|
|
|
if (total == null) {
|
|
|
JSONArray onRely =getQuotaList(level,lowlevel,area,coutYear,22);
|
|
|
if(total==null){
|
|
|
return null;
|
|
|
}
|
|
|
result.put("resultList", getCoutList(rely, total, onRely));
|
|
@ -4665,7 +4540,6 @@ public class StatisticsService extends BaseService {
|
|
|
* 2.市级-机构
|
|
|
* 3.区级-机构
|
|
|
* 4.机构-团队
|
|
|
*
|
|
|
* @param level
|
|
|
* @param lovlevel
|
|
|
* @param area
|
|
@ -4673,35 +4547,35 @@ public class StatisticsService extends BaseService {
|
|
|
* @param index
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getQuotaList(Integer level, String lovlevel, String area, Integer year, Integer index) {
|
|
|
String sql;
|
|
|
if (level == 4) {
|
|
|
if (StringUtils.isBlank(lovlevel)) {
|
|
|
public JSONArray getQuotaList(Integer level, String lovlevel, String area, Integer year, Integer index){
|
|
|
String sql ;
|
|
|
if(level==4){
|
|
|
if(StringUtils.isBlank(lovlevel)){
|
|
|
//市 区
|
|
|
sql = " SELECT t.result As num,t.town_name AS name,t.town AS code,t.create_time AS date" +
|
|
|
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'";
|
|
|
} else {
|
|
|
" WHERE t.city ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='3'AND LEFT(t.create_time,10)='"+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 LEFT(t.create_time,10)='"+year+"-06-30'";
|
|
|
}
|
|
|
} else if (level == 3) {
|
|
|
}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'";
|
|
|
} else {
|
|
|
"WHERE t.town ='"+area+"' AND t.quato_code ='"+index+"' AND t.level1_type ='2' AND LEFT(t.create_time,10)='"+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 " +
|
|
|
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 LEFT(t.create_time,10)='"+year+"-06-30'";
|
|
|
}
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
return new JSONArray(list);
|
|
|
} else {
|
|
|
}else{
|
|
|
return null;
|
|
|
}
|
|
|
|