|
@ -26,11 +26,14 @@ 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){
|
|
|
String idcard=patient.getIdcard();
|
|
|
if(!StringUtils.isEmpty(patient.getPassword())||StringUtils.isEmpty(idcard)||(idcard.length()!=15&&idcard.length()!=18)){
|
|
|
patientErrorCount++;
|
|
|
continue;
|
|
|
}
|
|
|
String password=idcard.substring(idcard.length()-6);
|
|
@ -44,6 +47,7 @@ public class DataHandingService {
|
|
|
for (Doctor doctor:doctors){
|
|
|
String phone= doctor.getMobile();
|
|
|
if(!StringUtils.isEmpty(doctor.getPassword())||StringUtils.isEmpty(phone)||phone.length()!=11){
|
|
|
doctorErrorCount++;
|
|
|
continue;
|
|
|
}
|
|
|
String password=phone.substring(5);
|
|
@ -53,7 +57,7 @@ public class DataHandingService {
|
|
|
doctorCount++;
|
|
|
}
|
|
|
doctorDao.save(doctors);
|
|
|
return "更新患者:"+patientCount+",更新医生:"+doctorCount;
|
|
|
return "更新患者(默认身份证后六位):"+patientCount+",有身份证异常的患者:"+patientErrorCount+",更新医生(默认电话后六位):"+doctorCount+",有电话号码异常的医生:"+doctorErrorCount;
|
|
|
}
|
|
|
|
|
|
}
|