| 
					
				 | 
			
			
				@ -91,7 +91,7 @@ public class ConsultService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map = list.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("sessionId",String.valueOf(map.get("consult"))+"_"+patient+"_23"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("sessionId",patient+"_"+String.valueOf(map.get("doctor"))+"_23"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BaseDoctorDO doctorDO = baseDoctorDao.findById(String.valueOf(map.get("doctor"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("doctorName",doctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -214,7 +214,7 @@ public class ConsultService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pagesize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> map:result){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(type.equals(ImUtil.SESSION_TYPE_ONLINE)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sessionId = String.valueOf(map.get("id"))+"_"+patient+"_23"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sessionId = patient+"_"+String.valueOf(map.get("doctorCode"))+"_23"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //新增未读消息数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer count = imUtil.UserSessionsUnreadMessageCount(sessionId,patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("sessionId",sessionId); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -327,6 +327,31 @@ public class ConsultService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查找历史咨询过的教师 去重 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orgCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findConsultDoctor(String orgCode,String patient,int page,int pagesize){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT  DISTINCT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " a.type AS type, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.name AS doctorName, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.photo AS doctorphoto, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.id AS doctor, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.job_title_name AS jobTitleName,  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.dept_name AS deptName, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.org_name AS orgName " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM wlyy_consult a,wlyy_consult_team b, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " base_doctor d,base_doctor_hospital h  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE a.id=b.consult and d.id = h.doctor_code  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND b.doctor=d.id  AND a.type = 23 and h.org_code = '"+orgCode+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and a.patient = '"+patient +"' "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " ORDER BY a.czrq desc"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,pagesize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return mapList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查询医生所有的咨询记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctor 医生标识 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -417,7 +442,7 @@ public class ConsultService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(type.equals(ImUtil.SESSION_TYPE_ONLINE)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sessionId = String.valueOf(map.get("id"))+"_"+String.valueOf(map.get("patient"))+"_23"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sessionId = String.valueOf(map.get("patient"))+"_"+doctor+"_23"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //新增未读消息数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Integer count = imUtil.UserSessionsUnreadMessageCount(sessionId,doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("sessionId",sessionId); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -518,7 +543,7 @@ public class ConsultService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        users.put(patient, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        users.put(doctor, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String session_type = ImUtil.SESSION_TYPE_ONLINE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sessionId = consult.getId() + "_" + patient + "_" + ct.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sessionId = patient + "_" + doctor + "_" + ct.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject obj = imUtil.createTopics(sessionId, consult.getId(), tempPatient.getName(), users, messages, session_type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (obj == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new RuntimeException("IM消息发送异常!"); 
			 |