Cambiadas todas las listas deplegables fijas, a listas con búsqueda AJAX
integrada (Estilo typeahead). Permite búsquedas en tiempo real. * Se muestra información organizada por columnas de datos. * Identificadores basados en Ids autogenerados. * Nuevos métodos en EJB común para poder realizar búsquedas de datos con filtro y paginadas (para los comboBox). * Varias correcciones de interfaz de usuario. * Nueva clase de utilidades.
This commit is contained in:
@@ -4,18 +4,11 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.ExternalContext;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
import javax.print.attribute.standard.Severity;
|
||||
import javax.resource.NotSupportedException;
|
||||
|
||||
import org.primefaces.PrimeFaces;
|
||||
@@ -26,9 +19,9 @@ import TO.MedicalSpecialtyTO;
|
||||
import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import common.Constants;
|
||||
import common.HashUtils;
|
||||
import common.UserType;
|
||||
import ejb.systemAdmin.SystemAdminFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
import managedbean.common.ValidationUtils;
|
||||
@@ -54,13 +47,18 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
private String oldPassword;
|
||||
private String password;
|
||||
private String email;
|
||||
private String lastUIQueryPH;
|
||||
private String lastUIQueryMS;
|
||||
private String lastUIQueryFD;
|
||||
|
||||
private List<UserType> userTypes;
|
||||
private String userType;
|
||||
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||
private MedicalSpecialtyTO medicalSpecialty;
|
||||
private Collection<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||
private Collection<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||
private List<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
||||
private FamilyDoctorTO familyDoctor;
|
||||
private List<FamilyDoctorTO> familyDoctorList;
|
||||
|
||||
public UpdateProfileMBean() {
|
||||
|
||||
@@ -72,6 +70,8 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
this.userTypes.add(UserType.PATIENT);
|
||||
this.userTypes.add(UserType.FAMILY_DOCTOR);
|
||||
this.userTypes.add(UserType.SPECIALIST_DOCTOR);
|
||||
this.lastUIQueryPH = "";
|
||||
this.lastUIQueryMS = "";
|
||||
|
||||
// Recuperamos el usuario logeado actual
|
||||
LoggedUserTO usr = null;
|
||||
@@ -87,6 +87,7 @@ 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();
|
||||
@@ -96,7 +97,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
this.currentPassword = pat.getPassword();
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listAllMedicalSpecialities();
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
SpecialistDoctorTO sd = this.getRemoteManagerCommon().retrieveSpecialistDoctor(this.id);
|
||||
|
||||
this.name = sd.getName();
|
||||
@@ -107,7 +108,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
this.medicalSpecialty = sd.getMedicalSpecialty();
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listAllCAPs();
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
FamilyDoctorTO fd = this.getRemoteManagerCommon().retrieveFamilyDoctor(this.id);
|
||||
|
||||
this.name = fd.getName();
|
||||
@@ -156,28 +157,59 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||
return medicalSpecialitiesList;
|
||||
}
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> getPhcList() {
|
||||
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
||||
return primaryHealthCareCentersList;
|
||||
}
|
||||
|
||||
public boolean isPatient() {
|
||||
public List<PrimaryHealthCareCenterTO> completePrimaryHealCareCenter(String query) {
|
||||
if (query != null && query.equals(this.lastUIQueryPH) == false) {
|
||||
this.lastUIQueryPH = query;
|
||||
// Recuperamos las 200 primeras coincidencias
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.primaryHealthCareCentersList;
|
||||
}
|
||||
|
||||
public List<MedicalSpecialtyTO> completeMedicalSpecialty(String query) {
|
||||
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
||||
this.lastUIQueryMS = query;
|
||||
// Recuperamos las 200 primeras coincidencias
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.medicalSpecialitiesList;
|
||||
}
|
||||
|
||||
public List<FamilyDoctorTO> getFamilyDoctorList() {
|
||||
return familyDoctorList;
|
||||
}
|
||||
|
||||
public List<FamilyDoctorTO> completeFamilyDoctor(String query) {
|
||||
if (query != null && query.equals(this.lastUIQueryFD) == false) {
|
||||
this.lastUIQueryFD = query;
|
||||
// Recuperamos las 200 primeras coincidencias
|
||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.familyDoctorList;
|
||||
}
|
||||
|
||||
public boolean isUserTypePatient() {
|
||||
return (UserType.valueOf(this.userType) == UserType.PATIENT);
|
||||
}
|
||||
|
||||
public boolean isFamilyDoctor() {
|
||||
public boolean isUserTypeFamilyDoctor() {
|
||||
return (UserType.valueOf(this.userType) == UserType.FAMILY_DOCTOR);
|
||||
}
|
||||
|
||||
public boolean isSpecialistDoctor() {
|
||||
public boolean isUserTypeSpecialistDoctor() {
|
||||
return (UserType.valueOf(this.userType) == UserType.SPECIALIST_DOCTOR);
|
||||
}
|
||||
|
||||
public boolean isDoctor() {
|
||||
return (isFamilyDoctor() || isSpecialistDoctor());
|
||||
public boolean isUserTypeDoctor() {
|
||||
return (isUserTypeFamilyDoctor() || isUserTypeSpecialistDoctor());
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
@@ -228,11 +260,11 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
int error = 0;
|
||||
boolean changePassword = (this.oldPassword != null && this.oldPassword.equals("") == false) || (this.password != null && this.password.equals("") == false);
|
||||
|
||||
if (this.isFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||
if (this.isUserTypeFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria.");
|
||||
error++;
|
||||
}
|
||||
if (this.isSpecialistDoctor() && this.medicalSpecialty == null) {
|
||||
if (this.isUserTypeSpecialistDoctor() && this.medicalSpecialty == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Especialidad médica no seleccionada", "Por favor, especifique una especialidad médica.");
|
||||
error++;
|
||||
}
|
||||
@@ -320,4 +352,12 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
this.oldPassword = oldPassword;
|
||||
}
|
||||
|
||||
public FamilyDoctorTO getFamilyDoctor() {
|
||||
return familyDoctor;
|
||||
}
|
||||
|
||||
public void setFamilyDoctor(FamilyDoctorTO familyDoctor) {
|
||||
this.familyDoctor = familyDoctor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user