|
@ -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,24 +1883,30 @@ 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);
|
|
@ -1909,29 +1923,21 @@ 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+"' " +
|
|
|
" 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){
|
|
@ -1939,31 +1945,23 @@ public class StatisticsService extends BaseService {
|
|
|
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+"' " +
|
|
|
" 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){
|
|
@ -2210,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) {
|
|
@ -2351,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);
|
|
@ -2494,124 +2469,86 @@ public class StatisticsService extends BaseService {
|
|
|
if ("0".equals(type)) {
|
|
|
//按周统计
|
|
|
sql = "SELECT " +
|
|
|
" left(a.czrq,10) AS dateNo,count(1) AS noRely " +
|
|
|
" left(t.create_time,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 " +
|
|
|
" 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 " +
|
|
|
" left(t.create_time,10) AS dateNo, COUNT(1) 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 " +
|
|
|
" "+ 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);
|
|
@ -2637,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 {
|
|
@ -2683,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 {
|
|
@ -2727,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 {
|
|
@ -2860,122 +2785,78 @@ public class StatisticsService extends BaseService {
|
|
|
endDate = endDate + " 23:59:59";
|
|
|
//获取咨询总数
|
|
|
String couTotalSQL = "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.type = 1 " +
|
|
|
" 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 ";
|
|
|
" 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;
|