| 
					
				 | 
			
			
				@ -26,32 +26,38 @@ public class DataHandingService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String producePatientAndDoctorPassword() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int patientCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int patientErrorCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int doctorCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int doctorErrorCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Patient> patients= patientDao.findAllIdCardPatientAndNoPassword(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Patient patient:patients){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!StringUtils.isEmpty(patient.getPassword())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String idcard=patient.getIdcard(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!StringUtils.isEmpty(patient.getPassword())||StringUtils.isEmpty(idcard)||(idcard.length()!=15&&idcard.length()!=18)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientErrorCount++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String phone= patient.getPhone(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String password=phone.substring(5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String password=idcard.substring(idcard.length()-6); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String salt= UUID.randomUUID().toString().replace("-",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patient.setSalt(salt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patient.setPassword(MD5.GetMD5Code(password+salt)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientCount++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patientDao.save(patients); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Doctor> doctors= doctorDao.findAllDoctors(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Doctor doctor:doctors){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!StringUtils.isEmpty(doctor.getPassword())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String phone= doctor.getMobile(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!StringUtils.isEmpty(doctor.getPassword())||StringUtils.isEmpty(phone)||phone.length()!=11){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctorErrorCount++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String phone= doctor.getMobile(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String password=phone.substring(5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String salt= UUID.randomUUID().toString().replace("-",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctor.setSalt(salt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctor.setPassword(MD5.GetMD5Code(password+salt)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorCount++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return "更新患者:"+patientCount+",更新医生:"+doctorCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        doctorDao.save(doctors); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return "更新患者(默认身份证后六位):"+patientCount+",有身份证异常的患者:"+patientErrorCount+",更新医生(默认电话后六位):"+doctorCount+",有电话号码异常的医生:"+doctorErrorCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |