|  | @ -780,12 +780,12 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public MixEnvelop searchPatientInSpecialist(String doctorCode,String keywords,Integer page,Integer pageSize) throws Exception{
 | 
	
		
			
				|  |  |         String sql1 = " select count(1) as num ";
 | 
	
		
			
				|  |  |         String sql2 = " select p.name as name,p.idcard,p.code,p.photo,CASE WHEN wsf.status ='-4' THEN '已到期' WHEN wsf.status ='0' THEN '待签约' WHEN wsf.status ='1' THEN '已签约' WHEN wsf.status ='2' THEN '已签约' WHEN wsf.status ='3' THEN '已签约' ELSE '待签约' END  status  ";
 | 
	
		
			
				|  |  |         String sql2 = " select p.name as name,p.idcard,p.code,p.photo ";
 | 
	
		
			
				|  |  |         String whereSql ="";
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(keywords)){
 | 
	
		
			
				|  |  |             whereSql+=" and (p.name like '%"+keywords+"%' or p.idcard like '%"+keywords+"%' or p.mobile like '%"+keywords+"%') ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String centerSql =" from "+basedb+".wlyy_patient p LEFT JOIN  "+basedb+".wlyy_sign_family wsf ON p.code=wsf.patient AND wsf.type = '2' AND wsf.status = '1' " +
 | 
	
		
			
				|  |  |         String centerSql =" from "+basedb+".wlyy_patient p  " +
 | 
	
		
			
				|  |  |                 " WHERE p.code not in (SELECT r.patient FROM  wlyy_specialist.wlyy_specialist_patient_relation r WHERE r.sign_status = '1' and doctor='"+doctorCode+"')"+" AND p.openid IS NOT NULL "+
 | 
	
		
			
				|  |  |                whereSql;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -802,13 +802,16 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         String sex = null;
 | 
	
		
			
				|  |  |         String sexName="";
 | 
	
		
			
				|  |  |         for(Map<String,Object> one:map){
 | 
	
		
			
				|  |  |             StringBuffer statusSql =new StringBuffer( " select CASE WHEN wsf.status ='-4' THEN '已到期' WHEN wsf.status ='0' THEN '待签约' WHEN wsf.status ='1' THEN '已签约' WHEN wsf.status ='2' THEN '已签约' WHEN wsf.status ='3' THEN '已签约' ELSE '待签约' END  status  ");
 | 
	
		
			
				|  |  |             statusSql.append("FROM wlyy.wlyy_sign_family wsf, (SELECT patient,Max(apply_date) applyDate FROM wlyy.wlyy_sign_family WHERE type = '2' AND patient='"+one.get("code")+"' GROUP BY patient) temp WHERE wsf.patient=temp.patient AND wsf.apply_date=temp.applyDate");
 | 
	
		
			
				|  |  |             List<Map<String,Object>> strMap= jdbcTemplate.queryForList(statusSql.toString());
 | 
	
		
			
				|  |  |             m = new HashMap();
 | 
	
		
			
				|  |  |             age = IdCardUtil.getAgeForIdcard(one.get("idcard")+"");
 | 
	
		
			
				|  |  |             sex = IdCardUtil.getSexForIdcard_new(one.get("idcard")+"");
 | 
	
		
			
				|  |  |             m.put("name",one.get("name"));
 | 
	
		
			
				|  |  |             m.put("age",age);
 | 
	
		
			
				|  |  |             m.put("sex",sex);
 | 
	
		
			
				|  |  |             m.put("status",one.get("status"));
 | 
	
		
			
				|  |  |             m.put("status", !(null != strMap && strMap.size() > 0) ? "待签约" : strMap.get(0).get("status"));
 | 
	
		
			
				|  |  |             if("1".equals(sex)){
 | 
	
		
			
				|  |  |                 sexName="男";
 | 
	
		
			
				|  |  |             }else if("2".equals(sex)){
 |