|  | @ -23,6 +23,7 @@ import com.yihu.jw.sms.dao.HospitalSysDictDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 | 
	
		
			
				|  |  | import org.apache.commons.collections.map.HashedMap;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
	
		
			
				|  | @ -69,6 +70,32 @@ public class ConsultService {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseDoctorHospitalDao doctorHospitalDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取居民该机构的最近一次在线咨询
 | 
	
		
			
				|  |  |      * @param patient
 | 
	
		
			
				|  |  |      * @param orgCode
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Map<String,Object> findLastOnlineConsult(String patient,String orgCode){
 | 
	
		
			
				|  |  |         Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " b.consult, " +
 | 
	
		
			
				|  |  |                 " b.type,b.status " +
 | 
	
		
			
				|  |  |                 "FROM " +
 | 
	
		
			
				|  |  |                 " wlyy_consult_team b, " +
 | 
	
		
			
				|  |  |                 " base_doctor_hospital h " +
 | 
	
		
			
				|  |  |                 "WHERE " +
 | 
	
		
			
				|  |  |                 " b.doctor = h.doctor_code " +
 | 
	
		
			
				|  |  |                 "AND b.patient = '"+patient+"' " +
 | 
	
		
			
				|  |  |                 "AND b.type = 23 "+
 | 
	
		
			
				|  |  |                 "AND h.org_code = '"+orgCode+"' ORDER BY b.czrq desc LIMIT 1 ";
 | 
	
		
			
				|  |  |         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");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return map;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 居民结束咨询
 | 
	
		
			
				|  |  |      * @param consult 咨询CODE
 |