| 
					
				 | 
			
			
				@ -2639,45 +2639,42 @@ public class StatisticsService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String onReySQL = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " t.doctor_code AS doctorCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.`name`, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " IFNULL(r.noRely,0) AS noRely " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_admin_team_member t " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " LEFT JOIN (" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  c.doctorCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  count(1) AS noRely " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " IFNULL(c.total, 0) AS noRely " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_consult_team a," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " SELECT DISTINCT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " t.id consultId, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.id doctorCode " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_admin_team_member t  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " LEFT JOIN ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " SELECT count(1) AS total ,a.doctor  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " " + imDataBaseName + ".topics t, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " " + imDataBaseName + ".participants p, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " " + imDataBaseName + ".doctors d, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " " + imDataBaseName + ".sessions s " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  wlyy_consult_team a  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " 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 + "' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ) c" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " c.consultId = a.consult " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND a.admin_team_code = " + teamCode + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " GROUP BY " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " c.doctorCode " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ) r ON r.doctorCode = t.doctor_code, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  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 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " t.doctor_code = d.`code` " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND t.available = 1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND t.team_id = " + teamCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND t.team_id = "+teamCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("0".equals(sort)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            onReySQL = onReySQL + " ORDER BY noRely DESC"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2688,43 +2685,40 @@ public class StatisticsService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " t.doctor_code AS doctorCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.`name`, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " IFNULL(r.total,0) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_admin_team_member t " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " c.doctorCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " count(1) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " IFNULL(c.total, 0) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_consult_team a, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " SELECT DISTINCT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " t.id consultId, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.id doctorCode " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_admin_team_member t  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " LEFT JOIN ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " SELECT count(1) AS total ,a.doctor  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " 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 + "' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ) c " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  wlyy_consult_team a  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " c.consultId = a.consult " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND a.admin_team_code = " + teamCode + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " GROUP BY " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " c.doctorCode " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ") r ON r.doctorCode = t.doctor_code, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  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 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " t.doctor_code = d.`code` " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND t.available = 1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND t.team_id =  " + teamCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND t.available = 1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND t.team_id = "+teamCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("0".equals(sort)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql = totalSql + " ORDER BY total DESC"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2733,46 +2727,43 @@ public class StatisticsService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //结束咨询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String endConsultSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " t.doctor_code doctorCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " t.doctor_code AS doctorCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.`name`, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " IFNULL(r.endRey,0) AS endRey " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_admin_team_member t " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  c.doctorCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  count(1) AS endRey " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " IFNULL(c.total, 0) AS endRey " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  wlyy_consult_team a, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " SELECT DISTINCT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " t.id consultId, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.id doctorCode " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_admin_team_member t  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " LEFT JOIN ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " SELECT count(1) AS total ,a.doctor  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " 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 + "' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ) c " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  wlyy_consult_team a  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " c.consultId = a.consult " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND a.admin_team_code =" + teamCode + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " GROUP BY " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " c.doctorCode " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ") r ON r.doctorCode = t.doctor_code, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  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 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " t.doctor_code = d.`code` " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND t.available = 1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND t.team_id = " + teamCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND t.team_id = "+teamCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("0".equals(sort)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            endConsultSql = endConsultSql + " ORDER BY endRey DESC"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 |