| 
					
				 | 
			
			
				@ -1,11 +1,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.wlyy.web.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.doctor.profile.Doctor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.patient.Patient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.doctor.DoctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.patient.PatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.util.MD5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.util.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.UUID; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -21,14 +24,34 @@ public class DataHandingService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DoctorDao doctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String producePatientAndDoctorPasswor() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String producePatientAndDoctorPassword() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int patientCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int doctorCount=0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Patient> patients= patientDao.findAllIdCardPatientAndNoPassword(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Patient patient:patients){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String idCard= patient.getIdcard(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!StringUtils.isEmpty(patient.getPassword())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String phone= patient.getPhone(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String password=phone.substring(5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String salt= UUID.randomUUID().toString().replace("-",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patient.setSalt(salt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patient.setPassword(MD5.GetMD5Code(password+salt)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientCount++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Doctor> doctors= doctorDao.findAllDoctors(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Doctor doctor:doctors){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!StringUtils.isEmpty(doctor.getPassword())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                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 null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return "更新患者:"+patientCount+",更新医生:"+doctorCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |