|  | @ -958,21 +958,33 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |      * 专科-通过手机号码精确搜索注册居民
 | 
	
		
			
				|  |  |      * @param keywords
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public MixEnvelop searchPatientInSpecialistNew(String keywords,Integer page,Integer pageSize) throws Exception{
 | 
	
		
			
				|  |  |     public MixEnvelop searchPatientInSpecialistNew(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 ,r.sign_status";
 | 
	
		
			
				|  |  |         String sql2 = " select p.name as name,p.idcard,p.code,p.photo";
 | 
	
		
			
				|  |  |         String whereSql ="";
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(keywords)){
 | 
	
		
			
				|  |  |             whereSql+=" and  p.mobile ='"+keywords+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //根据手机号码精确查找居民
 | 
	
		
			
				|  |  |         String centerSql =" from "+basedb+".wlyy_patient p LEFT JOIN wlyy_specialist.wlyy_specialist_patient_relation r ON p.code=r.patient where  p.openid IS NOT NULL "+whereSql;
 | 
	
		
			
				|  |  |         String centerSql =" from "+basedb+".wlyy_patient p /*LEFT JOIN wlyy_specialist.wlyy_specialist_patient_relation r ON p.code=r.patient */where  p.openid IS NOT NULL "+whereSql;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String signSql ="SELECT r.patient,r.sign_status  FROM  wlyy_specialist.wlyy_specialist_patient_relation r WHERE (r.sign_status = '1' or r.sign_status = '0') " +
 | 
	
		
			
				|  |  |                 " AND doctor in (SELECT m.doctor_code FROM  "+basedb+".wlyy_admin_team_member m where m.team_id in " +
 | 
	
		
			
				|  |  |                 " (SELECT dt.id FROM  "+basedb+".wlyy_admin_team dt LEFT JOIN  "+basedb+".wlyy_admin_team_member watm ON dt.id=watm.team_id " +
 | 
	
		
			
				|  |  |                 " WHERE dt.available='1' AND watm.available='1' AND watm.doctor_code='"+doctorCode+"') AND  m.available='1')";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> map1=jdbcTemplate.queryForList(signSql);
 | 
	
		
			
				|  |  |         String sqlCount=sql1+centerSql;
 | 
	
		
			
				|  |  |         String sql=sql2+centerSql+" LIMIT "+(page-1)*pageSize+","+pageSize;
 | 
	
		
			
				|  |  |         List<Map<String,Object>> map = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         List<Map<String,Object>> countMap = jdbcTemplate.queryForList(sqlCount);
 | 
	
		
			
				|  |  |         //根据居民查找专科签约状态
 | 
	
		
			
				|  |  |         //已签约专科,获取签约信息
 | 
	
		
			
				|  |  |         Map<String,String> patientMap = new HashMap<>();
 | 
	
		
			
				|  |  |         if(null!=map1){
 | 
	
		
			
				|  |  |             map1.stream().forEach(temp->{
 | 
	
		
			
				|  |  |                 patientMap.put(temp.get("patient").toString(),temp.get("sign_status").toString()) ;
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //未签约,获取居民信息,及专科医生信息
 | 
	
		
			
				|  |  |         List<Map<String,Object>> resultList = new ArrayList<>();
 | 
	
		
			
				|  |  |         Map m = null;
 | 
	
	
		
			
				|  | @ -983,13 +995,14 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |             m = new HashMap();
 | 
	
		
			
				|  |  |             age = IdCardUtil.getAgeForIdcard(one.get("idcard")+"");
 | 
	
		
			
				|  |  |             sex = IdCardUtil.getSexForIdcard_new(one.get("idcard")+"");
 | 
	
		
			
				|  |  |             String patientCode=null==one.get("code")?"":one.get("code").toString();
 | 
	
		
			
				|  |  |             m.put("name",one.get("name"));
 | 
	
		
			
				|  |  |             m.put("age",age);
 | 
	
		
			
				|  |  |             m.put("sex",sex);
 | 
	
		
			
				|  |  |             //1已签约,0待审核,-1未签约或已取消或已拒绝
 | 
	
		
			
				|  |  |             if(null != one.get("sign_status")&& one.get("sign_status").toString().equals("1")){
 | 
	
		
			
				|  |  |             if(patientMap.containsKey(patientCode)&&"1".equals(patientMap.get(patientCode))){
 | 
	
		
			
				|  |  |                 m.put("sign_status", 1);
 | 
	
		
			
				|  |  |             }else if(null != one.get("sign_status")&& one.get("sign_status").toString().equals("0")){
 | 
	
		
			
				|  |  |             }else if(patientMap.containsKey(patientCode)&&"0".equals(patientMap.get(patientCode))){
 | 
	
		
			
				|  |  |                 m.put("sign_status", 0);
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 m.put("sign_status", -1);
 |