|
@ -2358,7 +2358,7 @@ public class StatisticsService extends BaseService {
|
|
|
* @param doctor 医生code
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject getTeamDocotorConsultCount(String teamCode,String startDate,String endDate,String type,String doctor){
|
|
|
public JSONObject getTeamDoctorConsultCount(String teamCode,String startDate,String endDate,String type,String doctor){
|
|
|
String imDataBaseName = SystemConf.getInstance().getImDataBaseName();
|
|
|
String sql ;
|
|
|
String totalSql ;
|
|
@ -2568,7 +2568,7 @@ public class StatisticsService extends BaseService {
|
|
|
" c.doctorCode, " +
|
|
|
" count(1) AS total " +
|
|
|
" FROM " +
|
|
|
" wlyy__team a, " +
|
|
|
" wlyy_consult_team a, " +
|
|
|
" ( " +
|
|
|
" SELECT DISTINCT " +
|
|
|
" t.id consultId, " +
|
|
@ -2579,7 +2579,7 @@ public class StatisticsService extends BaseService {
|
|
|
" "+imDataBaseName+".doctors d, " +
|
|
|
" "+imDataBaseName+".sessions s " +
|
|
|
" WHERE " +
|
|
|
" tp.participant_id = d.id " +
|
|
|
" p.participant_id = d.id " +
|
|
|
" AND t.session_id = p.session_id " +
|
|
|
" AND t.session_id = s.id " +
|
|
|
" AND s.type = 1 " +
|
|
@ -2848,4 +2848,179 @@ public class StatisticsService extends BaseService {
|
|
|
rs.put("noRelyNumber",noRelyNumber);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public JSONObject getTeamDoctorFollowupLine(String teamCode,String startDate,String endDate,String type,String doctor){
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
String totalSQL ;
|
|
|
String planSQL ;
|
|
|
if("0".equals(type)){
|
|
|
//按周
|
|
|
totalSQL ="SELECT " +
|
|
|
" left(w.create_time,10) AS dateNo,COUNT(1) AS followupCount " +
|
|
|
" FROM " +
|
|
|
" wlyy_followup w " +
|
|
|
" WHERE " +
|
|
|
" 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 " +
|
|
|
" GROUP BY dateNo";
|
|
|
|
|
|
planSQL ="SELECT " +
|
|
|
" ( " +
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
" ) AS weekOfMonth,COUNT(1) AS planCount " +
|
|
|
"FROM " +
|
|
|
" wlyy_followup w " +
|
|
|
"WHERE " +
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
" 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 " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
}else{
|
|
|
//按月
|
|
|
totalSQL ="SELECT " +
|
|
|
" ( " +
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
|
" FROM " +
|
|
|
" wlyy_followup w " +
|
|
|
" WHERE " +
|
|
|
" 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 " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
planSQL = "SELECT " +
|
|
|
" ( " +
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
|
" FROM " +
|
|
|
" wlyy_followup w " +
|
|
|
" WHERE " +
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
" 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 " +
|
|
|
" GROUP BY weekOfMonth";
|
|
|
}
|
|
|
List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSQL);
|
|
|
List<Map<String,Object>> planList = jdbcTemplate.queryForList(planSQL);
|
|
|
JSONObject rs = new JSONObject();
|
|
|
rs.put("totalLine",totalList);
|
|
|
rs.put("planLine",planList);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public JSONObject getTeamFollowupLine(String teamCode,String startDate,String endDate,String type){
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
String totalSQL ;
|
|
|
String planSQL ;
|
|
|
if("0".equals(type)){
|
|
|
//按周
|
|
|
totalSQL ="SELECT " +
|
|
|
" left(w.create_time,10) AS dateNo,COUNT(1) AS followupCount " +
|
|
|
" FROM " +
|
|
|
" wlyy_followup w " +
|
|
|
" WHERE " +
|
|
|
" 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 " +
|
|
|
" ( " +
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
" ) AS weekOfMonth,COUNT(1) AS planCount " +
|
|
|
"FROM " +
|
|
|
" wlyy_followup w " +
|
|
|
"WHERE " +
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
" 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{
|
|
|
//按月
|
|
|
totalSQL ="SELECT " +
|
|
|
" ( " +
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
|
" FROM " +
|
|
|
" wlyy_followup w " +
|
|
|
" WHERE " +
|
|
|
" 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 " +
|
|
|
" ( " +
|
|
|
" DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
|
|
|
" ) AS weekOfMonth,COUNT(1) AS followupCount " +
|
|
|
" FROM " +
|
|
|
" wlyy_followup w " +
|
|
|
" WHERE " +
|
|
|
" w.admin_team_code =" +teamCode+
|
|
|
" 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);
|
|
|
List<Map<String,Object>> planList = jdbcTemplate.queryForList(planSQL);
|
|
|
JSONObject rs = new JSONObject();
|
|
|
rs.put("totalLine",totalList);
|
|
|
rs.put("planLine",planList);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public JSONArray getDoctorTeamFolList(String startDate,String endDate,String teamCode,String sort,String sortType){
|
|
|
startDate = startDate+" 00:00:00";
|
|
|
endDate = endDate+" 23:59:59";
|
|
|
String totalSQL = "SELECT " +
|
|
|
" IFNULL(c.followupCount,0) AS followupCount, " +
|
|
|
" d.`code` AS doctorCode, " +
|
|
|
" d.`name` AS name " +
|
|
|
" FROM " +
|
|
|
" wlyy_admin_team_member m " +
|
|
|
" LEFT JOIN ( " +
|
|
|
" SELECT " +
|
|
|
" w.doctor_code, " +
|
|
|
" w.doctor_name, " +
|
|
|
" COUNT(1) AS followupCount " +
|
|
|
" FROM " +
|
|
|
" wlyy_followup w " +
|
|
|
" WHERE " +
|
|
|
" 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, " +
|
|
|
" wlyy_doctor d " +
|
|
|
" WHERE " +
|
|
|
" d.`code` = m.doctor_code " +
|
|
|
" AND m.available = 1 " +
|
|
|
" AND m.team_id =" +teamCode ;
|
|
|
if("0".equals(sort)){
|
|
|
totalSQL =totalSQL+" ORDER BY followupCount DESC";
|
|
|
}else{
|
|
|
totalSQL =totalSQL+" ORDER BY followupCount ASC";
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
}
|