Multiples cambios para soportar la utilización de códigos de usuario
únicos para (Pacientes, medicos de familia, medicos especialista y administradores). Nuevos métodos en EJB común para consultar Entidades por Id y por código (Para el login).
This commit is contained in:
@@ -53,7 +53,7 @@ public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializ
|
||||
if (usr.getUserType() == UserType.PATIENT) {
|
||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
|
||||
PatientTO pat = this.getRemoteManagerCommon().retrievePatient(this.id);
|
||||
PatientTO pat = this.getRemoteManagerCommon().findPatientById(this.id);
|
||||
this.setCurrentFamilyDoctor(pat.getFamilyDoctor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen
|
||||
if (usr.getUserType() == UserType.FAMILY_DOCTOR) {
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
|
||||
FamilyDoctorTO fd = this.getRemoteManagerCommon().retrieveFamilyDoctor(this.id);
|
||||
FamilyDoctorTO fd = this.getRemoteManagerCommon().findFamilyDoctorById(this.id);
|
||||
this.setCurrentCenter(fd.getPrimaryHealthCareCenter());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ import managedbean.common.ValidationUtils;
|
||||
public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int id;
|
||||
private String cipCode;
|
||||
private String nif;
|
||||
private String name;
|
||||
private String surname;
|
||||
@@ -185,14 +185,6 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
this.nif = nif;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void addNewUser() {
|
||||
int error = 0;
|
||||
|
||||
@@ -214,17 +206,17 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
switch (UserType.valueOf(this.userType)) {
|
||||
case PATIENT:
|
||||
PatientTO pat = this.getRemoteManagerProfile().registerPatient(id, nif, name, surname, password, email);
|
||||
this.id = pat.getId();
|
||||
this.cipCode = pat.getPersonalIdentificationCode();
|
||||
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
FamilyDoctorTO fd = this.getRemoteManagerProfile().registerFamilyDoctor(id, nif, name, surname, password, email, this.primaryHealthCareCenter);
|
||||
this.id = fd.getId();
|
||||
this.cipCode = fd.getProfessionalNumber();
|
||||
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
SpecialistDoctorTO sd = this.getRemoteManagerProfile().registerSpecialistDoctor(id, nif, name, surname, password, email, this.medicalSpecialty);
|
||||
this.id = sd.getId();
|
||||
this.cipCode = sd.getProfessionalNumber();
|
||||
|
||||
break;
|
||||
case ADMINISTRATOR:
|
||||
@@ -268,4 +260,12 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
return registered;
|
||||
}
|
||||
|
||||
public String getCipCode() {
|
||||
return cipCode;
|
||||
}
|
||||
|
||||
public void setCipCode(String cipCode) {
|
||||
this.cipCode = cipCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int id;
|
||||
private String cipCode;
|
||||
private String nif;
|
||||
private String name;
|
||||
private String surname;
|
||||
@@ -88,35 +89,15 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
switch (usr.getUserType()) {
|
||||
case PATIENT:
|
||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
PatientTO pat = this.getRemoteManagerCommon().retrievePatient(this.id);
|
||||
|
||||
this.name = pat.getName();
|
||||
this.surname = pat.getName();
|
||||
this.nif = pat.getNif();
|
||||
this.email = pat.getEmail();
|
||||
this.currentPassword = pat.getPassword();
|
||||
this.setPatientData(this.getRemoteManagerCommon().findPatientById(this.id));
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
SpecialistDoctorTO sd = this.getRemoteManagerCommon().retrieveSpecialistDoctor(this.id);
|
||||
|
||||
this.name = sd.getName();
|
||||
this.surname = sd.getName();
|
||||
this.nif = sd.getNif();
|
||||
this.email = sd.getEmail();
|
||||
this.currentPassword = sd.getPassword();
|
||||
this.medicalSpecialty = sd.getMedicalSpecialty();
|
||||
this.setSpecialistDoctorData(this.getRemoteManagerCommon().findSpecialistDoctorById(this.id));
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
FamilyDoctorTO fd = this.getRemoteManagerCommon().retrieveFamilyDoctor(this.id);
|
||||
|
||||
this.name = fd.getName();
|
||||
this.surname = fd.getName();
|
||||
this.nif = fd.getNif();
|
||||
this.email = fd.getEmail();
|
||||
this.currentPassword = fd.getPassword();
|
||||
this.primaryHealthCareCenter = fd.getPrimaryHealthCareCenter();
|
||||
this.setFamilyDoctorData(this.getRemoteManagerCommon().findFamilyDoctorById(this.id));
|
||||
break;
|
||||
case ADMINISTRATOR:
|
||||
// TODO: Recuperar usuario administrador para editar su perfil ¿?
|
||||
@@ -127,7 +108,39 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void setPatientData(PatientTO pat) {
|
||||
this.id = pat.getId();
|
||||
this.cipCode = pat.getPersonalIdentificationCode();
|
||||
this.name = pat.getName();
|
||||
this.surname = pat.getName();
|
||||
this.nif = pat.getNif();
|
||||
this.email = pat.getEmail();
|
||||
this.currentPassword = pat.getPassword();
|
||||
this.familyDoctor = pat.getFamilyDoctor();
|
||||
}
|
||||
|
||||
private void setFamilyDoctorData(FamilyDoctorTO fd) {
|
||||
this.id = fd.getId();
|
||||
this.cipCode = fd.getProfessionalNumber();
|
||||
this.name = fd.getName();
|
||||
this.surname = fd.getName();
|
||||
this.nif = fd.getNif();
|
||||
this.email = fd.getEmail();
|
||||
this.currentPassword = fd.getPassword();
|
||||
this.primaryHealthCareCenter = fd.getPrimaryHealthCareCenter();
|
||||
}
|
||||
|
||||
private void setSpecialistDoctorData(SpecialistDoctorTO sd) {
|
||||
this.id = sd.getId();
|
||||
this.cipCode = sd.getProfessionalNumber();
|
||||
this.name = sd.getName();
|
||||
this.surname = sd.getName();
|
||||
this.nif = sd.getNif();
|
||||
this.email = sd.getEmail();
|
||||
this.currentPassword = sd.getPassword();
|
||||
this.medicalSpecialty = sd.getMedicalSpecialty();
|
||||
}
|
||||
|
||||
public List<UserType> getUserTypes() {
|
||||
@@ -290,17 +303,17 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
switch (UserType.valueOf(this.userType)) {
|
||||
case PATIENT:
|
||||
PatientTO pat = this.getRemoteManagerProfile().updatePatientData(id, nif, name, surname, password, email);
|
||||
this.id = pat.getId();
|
||||
this.setPatientData(pat);
|
||||
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
FamilyDoctorTO fd = this.getRemoteManagerProfile().updateFamilyDoctorData(id, nif, name, surname, password, email, this.primaryHealthCareCenter);
|
||||
this.id = fd.getId();
|
||||
this.setFamilyDoctorData(fd);
|
||||
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
SpecialistDoctorTO sd = this.getRemoteManagerProfile().updateSpecialistDoctorData(id, nif, name, surname, password, email, this.medicalSpecialty);
|
||||
this.id = sd.getId();
|
||||
this.setSpecialistDoctorData(sd);
|
||||
|
||||
break;
|
||||
case ADMINISTRATOR:
|
||||
@@ -360,4 +373,8 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
this.familyDoctor = familyDoctor;
|
||||
}
|
||||
|
||||
public String getCipCode() {
|
||||
return cipCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user