| 
					
				 | 
			
			
				@ -102,20 +102,27 @@ public class PatientService extends TokenService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void updatePatient(Patient patient, String openid) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Sort sort = new Sort(Sort.Direction.ASC, "czrq"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PageRequest pageRequest = new PageRequest(0, 10, sort); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PageRequest pageRequest = new PageRequest(0, 100, sort); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Page<Token> tokens = tokenDao.findByOpenid(openid, pageRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (tokens != null && tokens.getSize() >= 10) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Token token = tokens.getContent().get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Patient p = patientDao.findByCode(token.getUser()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (p == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                throw new Exception("> 10 openid patient info can not find"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (tokens != null && tokens.getContent().size() >= 10) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int i = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int last = tokens.getContent().size() - 10; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(Token token : tokens) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                i++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Patient p = patientDao.findByCode(token.getUser()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (p == null || i <= last) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    tokenDao.delete(token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    SystemData.wxPatientTokens.remove(token.getUser()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                p.setOpenid(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                signFamilyDao.updateOpenidByPatient("", p.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientDao.save(p); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tokenDao.delete(token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                SystemData.wxPatientTokens.remove(p.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            p.setOpenid(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            signFamilyDao.updateOpenidByPatient("", p.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientDao.save(p); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tokenDao.delete(token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SystemData.wxPatientTokens.remove(p.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patient.setOpenid(openid); 
			 |