|
@ -29,28 +29,30 @@ public class DataHandingService {
|
|
|
int doctorCount=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)){
|
|
|
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){
|
|
|
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++;
|
|
|
}
|
|
|
doctorDao.save(doctors);
|
|
|
return "更新患者:"+patientCount+",更新医生:"+doctorCount;
|
|
|
}
|
|
|
|