Merge branch 'master' of http://pdp-pds.eimt.uoc.edu/pds19-grupo2/myhealth.git
This commit is contained in:
@@ -6,31 +6,67 @@
|
|||||||
|
|
||||||
<ui:composition template="../header.xhtml">
|
<ui:composition template="../header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="frmRegisterUser">
|
<h:form id="frmChangePHCC">
|
||||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
<p:panel id="badProfile" rendered="#{not home.familyDoctor}">
|
||||||
|
<div class="ui-g-3 ui-md-3" />
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:panel id="badProfileInfo" header="Perfil de usuario incorrecto para realizar acción">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-12">
|
||||||
|
Su perfil de usuario no permite que pueda cambiar su Centro de Atención Primaria asignado.<br /> Si cree que no debería estar viendo esta página y que se trata de un
|
||||||
|
error, por favor, contacte con el soporte de la aplicación para obtener asistencia tecnica.
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-3"></div>
|
||||||
|
<div class="ui-g-6">
|
||||||
|
<p:button value="Ir a la página principal" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-3"></div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-3 ui-md-3" />
|
||||||
|
</p:panel>
|
||||||
|
|
||||||
<p:panel id="DatosPersonales" header="Cambiar el Centro de Atención Primaria">
|
<p:panel id="PanelPHC" header="Cambiar centro de antención primaria asignado" rendered="#{home.familyDoctor}">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-2 ui-md-2">
|
|
||||||
<p:outputLabel value="Campo1:" for="campo1" />
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:outputLabel value="Centro de antención primaria actualmente asignado:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:inputText id="campo1" value="123 asdf 123" required="true" requiredMessage="Por favor, indque el campo 1" />
|
<p:outputLabel id="lblCurrentCenter" value="#{ChangeCAP.currentCenter.displayDescription}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6 ui-md-6">
|
<div class="ui-g-4 ui-md-4" />
|
||||||
<p:message for="campo1" display="text" />
|
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:outputLabel value="Nuevo centro de atención primaria:" for="newCenter" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:selectOneMenu id="newCenter" value="#{ChangeCAP.newCenter}" converter="omnifaces.SelectItemsConverter" required="true"
|
||||||
|
requiredMessage="Por favor, selecciona un nuevo centro de antención primaria">
|
||||||
|
<f:selectItem itemLabel="Seleccione un nuevo centro de antención primario..." itemValue="" noSelectionOption="true" />
|
||||||
|
<f:selectItems value="#{ChangeCAP.phcList}" var="phc" itemLabel="#{phc.displayDescription}" itemValue="#{phc}" />
|
||||||
|
<p:column headerText="Nombre"><h:outputText value="#{phc.name}" /></p:column>
|
||||||
|
<p:column headerText="Localización"><h:outputText value="#{phc.location}" /></p:column>
|
||||||
|
</p:selectOneMenu>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:message for="newCenter" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-12 ui-g-nopad">
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
<div class="ui-g-4 ui-md-4"></div>
|
<div class="ui-g-4 ui-md-4" />
|
||||||
<div class="ui-g-2 ui-md-2 ">
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
<p:commandButton validateClient="true" value="Guardar" update="mesgs" icon="pi pi-check" />
|
<p:commandButton validateClient="true" value="Guardar" update="frmChangePHCC" action="#{ChangeCAP.saveData}" icon="pi pi-check" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4"></div>
|
<div class="ui-g-4 ui-md-4" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</p:panel>
|
</p:panel>
|
||||||
</h:form>
|
</h:form>
|
||||||
</ui:define>
|
</ui:define>
|
||||||
|
|||||||
@@ -6,21 +6,6 @@
|
|||||||
|
|
||||||
<ui:composition template="../header.xhtml">
|
<ui:composition template="../header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:outputScript>
|
|
||||||
function handleRequest(xhr, status, args) {
|
|
||||||
if(args.specs) {
|
|
||||||
$('#panCentros').slideUp();
|
|
||||||
$('#panEspecialidades').slideDown();
|
|
||||||
}
|
|
||||||
else if (args.caps) {
|
|
||||||
$('#panEspecialidades').slideUp();
|
|
||||||
$('#panCentros').slideDown();
|
|
||||||
} else {
|
|
||||||
$('#panCentros').slideUp();
|
|
||||||
$('#panEspecialidades').slideUp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</h:outputScript>
|
|
||||||
<h:form id="frmUpdateProfile">
|
<h:form id="frmUpdateProfile">
|
||||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
|
||||||
@@ -42,7 +27,6 @@
|
|||||||
<p:panel id="DatosPersonales" header="Actualizar datos personales">
|
<p:panel id="DatosPersonales" header="Actualizar datos personales">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
<h:outputLabel value="value = 10" rendered="#{row == 10}" />
|
|
||||||
<p:outputLabel value="Código de Identificación Personal (CIP):" rendered="#{UpdateProfile.patient}" for="id" />
|
<p:outputLabel value="Código de Identificación Personal (CIP):" rendered="#{UpdateProfile.patient}" for="id" />
|
||||||
<p:outputLabel value="Número de Profesional:" rendered="#{UpdateProfile.familyDoctor or UpdateProfile.specialistDoctor}" for="id" />
|
<p:outputLabel value="Número de Profesional:" rendered="#{UpdateProfile.familyDoctor or UpdateProfile.specialistDoctor}" for="id" />
|
||||||
</div>
|
</div>
|
||||||
@@ -161,7 +145,7 @@
|
|||||||
<div class="ui-g-12 ui-g-nopad">
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
<div class="ui-g-4 ui-md-4"></div>
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
<div class="ui-g-2 ui-md-2 ">
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
<p:commandButton validateClient="true" value="Guardar" update="mesgs" action="#{UpdateProfile.saveData}" icon="pi pi-check" />
|
<p:commandButton validateClient="true" value="Guardar" update="frmUpdateProfile" action="#{UpdateProfile.saveData}" icon="pi pi-check" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ public class MedicalSpecialtyTO implements Serializable {
|
|||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDisplayDescription() {
|
||||||
|
return String.format("[%s] %s", this.name, this.description);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%s[name=%s]", getClass().getSimpleName(), getName());
|
return String.format("%s[name=%s]", getClass().getSimpleName(), getName());
|
||||||
|
|||||||
@@ -43,8 +43,12 @@ public class PrimaryHealthCareCenterTO implements Serializable {
|
|||||||
this.location = description;
|
this.location = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDisplayDescription() {
|
||||||
|
return String.format("[%s] %s", this.name, this.location);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%s[name=%s]", getClass().getSimpleName(), getName());
|
return String.format("%s[name=%s]", getClass().getSimpleName(), this.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ public enum UserType {
|
|||||||
PATIENT("Paciente"),
|
PATIENT("Paciente"),
|
||||||
FAMILY_DOCTOR("Médico de familia"),
|
FAMILY_DOCTOR("Médico de familia"),
|
||||||
SPECIALIST_DOCTOR("Médico especialista"),
|
SPECIALIST_DOCTOR("Médico especialista"),
|
||||||
ADMINISTRADOR("Administrador");
|
ADMINISTRATOR("Administrador");
|
||||||
|
|
||||||
private String userTypename;
|
private String userTypename;
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
// First try to login as Admin
|
// First try to login as Admin
|
||||||
AdministratorJPA adm = entman.find(AdministratorJPA.class, id);
|
AdministratorJPA adm = entman.find(AdministratorJPA.class, id);
|
||||||
if (adm != null) {
|
if (adm != null) {
|
||||||
usr = new LoggedUserTO(adm.getEmail(), adm.getEmail(), adm.getPassword(), UserType.ADMINISTRADOR);
|
usr = new LoggedUserTO(adm.getEmail(), adm.getEmail(), adm.getPassword(), UserType.ADMINISTRATOR);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
int iId = Integer.parseInt(id);
|
int iId = Integer.parseInt(id);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class MenuMBean implements Serializable {
|
|||||||
tipoUsuario = SessionUtils.getUserType();
|
tipoUsuario = SessionUtils.getUserType();
|
||||||
|
|
||||||
// Administracion Sistema
|
// Administracion Sistema
|
||||||
if (tipoUsuario == UserType.ADMINISTRADOR) {
|
if (tipoUsuario == UserType.ADMINISTRATOR) {
|
||||||
subMenu = new DefaultSubMenu("Administración del sistema", "pi pi-cog");
|
subMenu = new DefaultSubMenu("Administración del sistema", "pi pi-cog");
|
||||||
|
|
||||||
subMenu.addElement(createMenuItem("Gestionar especialidades", "pi pi-calendar", "/systemAdmin/ManageSpecialties", null));
|
subMenu.addElement(createMenuItem("Gestionar especialidades", "pi pi-calendar", "/systemAdmin/ManageSpecialties", null));
|
||||||
@@ -55,12 +55,12 @@ public class MenuMBean implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Visitas
|
// Visitas
|
||||||
if (tipoUsuario == UserType.PATIENT || tipoUsuario == UserType.ADMINISTRADOR || tipoUsuario == UserType.FAMILY_DOCTOR) {
|
if (tipoUsuario == UserType.PATIENT || tipoUsuario == UserType.ADMINISTRATOR || tipoUsuario == UserType.FAMILY_DOCTOR) {
|
||||||
subMenu = new DefaultSubMenu("Visitas", "pi pi-calendar");
|
subMenu = new DefaultSubMenu("Visitas", "pi pi-calendar");
|
||||||
|
|
||||||
if (tipoUsuario == UserType.PATIENT)
|
if (tipoUsuario == UserType.PATIENT)
|
||||||
subMenu.addElement(createMenuItem("Solicitar nueva", "pi pi-calendar", "/visit/VisitView", null));
|
subMenu.addElement(createMenuItem("Solicitar nueva", "pi pi-calendar", "/visit/VisitView", null));
|
||||||
if (tipoUsuario == UserType.PATIENT || tipoUsuario == UserType.ADMINISTRADOR)
|
if (tipoUsuario == UserType.PATIENT || tipoUsuario == UserType.ADMINISTRATOR)
|
||||||
subMenu.addElement(createMenuItem("Modificar fecha/hora", "pi pi-calendar", "/visit/VisitView", null));
|
subMenu.addElement(createMenuItem("Modificar fecha/hora", "pi pi-calendar", "/visit/VisitView", null));
|
||||||
if (tipoUsuario == UserType.PATIENT)
|
if (tipoUsuario == UserType.PATIENT)
|
||||||
subMenu.addElement(createMenuItem("Anular visita", "pi pi-calendar", "/visit/VisitView", null));
|
subMenu.addElement(createMenuItem("Anular visita", "pi pi-calendar", "/visit/VisitView", null));
|
||||||
@@ -121,7 +121,7 @@ public class MenuMBean implements Serializable {
|
|||||||
|
|
||||||
model.addElement(subMenu);
|
model.addElement(subMenu);
|
||||||
} else {
|
} else {
|
||||||
if (tipoUsuario != UserType.ADMINISTRADOR) {
|
if (tipoUsuario != UserType.ADMINISTRATOR) {
|
||||||
subMenu.addElement(createMenuItem("Modificar datos personales", "pi pi-user-edit", "/profile/UpdateProfile", null));
|
subMenu.addElement(createMenuItem("Modificar datos personales", "pi pi-user-edit", "/profile/UpdateProfile", null));
|
||||||
subMenu.addElement(new DefaultSeparator());
|
subMenu.addElement(new DefaultSeparator());
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,10 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.faces.application.FacesMessage;
|
|
||||||
import javax.faces.context.FacesContext;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import common.UserType;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
@@ -21,11 +20,17 @@ public class homeMBean implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private boolean isLogedIn;
|
private boolean isLogedIn;
|
||||||
|
private String userId;
|
||||||
|
private String userName;
|
||||||
|
private UserType userType;
|
||||||
private int refresh;
|
private int refresh;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
isLogedIn = SessionUtils.isLogedIn();
|
isLogedIn = SessionUtils.isLogedIn();
|
||||||
|
userName = SessionUtils.getUserName();
|
||||||
|
userId = SessionUtils.getUserId();
|
||||||
|
userType = SessionUtils.getUserType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Theme> getThemes() {
|
public List<Theme> getThemes() {
|
||||||
@@ -40,15 +45,15 @@ public class homeMBean implements Serializable {
|
|||||||
if (this.isLogedIn == false)
|
if (this.isLogedIn == false)
|
||||||
return "Invitado";
|
return "Invitado";
|
||||||
else
|
else
|
||||||
return SessionUtils.getUserName();
|
return this.userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserId() {
|
public String getUserId() {
|
||||||
return SessionUtils.getUserId();
|
return this.userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserType() {
|
public String getUserType() {
|
||||||
return SessionUtils.getUserType().getUserTypename();
|
return this.userType.getUserTypename();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRefresh() {
|
public int getRefresh() {
|
||||||
@@ -59,4 +64,23 @@ public class homeMBean implements Serializable {
|
|||||||
this.refresh = refresh;
|
this.refresh = refresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPatient() {
|
||||||
|
return (this.userType == UserType.PATIENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFamilyDoctor() {
|
||||||
|
return (this.userType == UserType.FAMILY_DOCTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSpecialistDoctor() {
|
||||||
|
return (this.userType == UserType.SPECIALIST_DOCTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAdministrator() {
|
||||||
|
return (this.userType == UserType.ADMINISTRATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDoctor() {
|
||||||
|
return (isFamilyDoctor() || isSpecialistDoctor());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +1,113 @@
|
|||||||
package managedbean.profile;
|
package managedbean.profile;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Properties;
|
import java.util.Collection;
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.faces.application.FacesMessage;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.naming.Context;
|
|
||||||
import javax.naming.InitialContext;
|
|
||||||
|
|
||||||
import ejb.profile.ProfileFacadeRemote;
|
import TO.FamilyDoctorTO;
|
||||||
|
import TO.LoggedUserTO;
|
||||||
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
|
import common.UserType;
|
||||||
import managedbean.common.ManagedBeanBase;
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
import managedbean.common.SessionUtils;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Named( "ChangePrimaryHealthCareCenterMBean")
|
@Named("ChangeCAP")
|
||||||
@RequestScoped
|
@ViewScoped
|
||||||
public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implements Serializable {
|
public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@EJB
|
private int id;
|
||||||
private ProfileFacadeRemote remoteManager;
|
private PrimaryHealthCareCenterTO currentCenter;
|
||||||
|
private PrimaryHealthCareCenterTO newCenter;
|
||||||
|
private Collection<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
||||||
|
|
||||||
|
public ChangePrimaryHealthCareCenterMBean() {
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor. Inicializa la conexión con el EJB Remoto
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public ChangePrimaryHealthCareCenterMBean() throws Exception {
|
|
||||||
initializeAdminFacadeRemote();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@PostConstruct
|
||||||
* Inicializa la conexión con el EJB Remoto
|
public void init() {
|
||||||
*
|
// Recuperamos el usuario logeado actual
|
||||||
* @throws Exception
|
LoggedUserTO usr = null;
|
||||||
*/
|
try {
|
||||||
private void initializeAdminFacadeRemote() throws Exception {
|
usr = SessionUtils.getloggedOnUser();
|
||||||
Properties props = System.getProperties();
|
|
||||||
Context ctx = new InitialContext(props);
|
if (usr == null)
|
||||||
remoteManager = (ProfileFacadeRemote) ctx
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
||||||
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||||
|
else {
|
||||||
|
this.id = Integer.valueOf(usr.getId());
|
||||||
|
|
||||||
|
if (usr.getUserType() == UserType.FAMILY_DOCTOR) {
|
||||||
|
this.primaryHealthCareCentersList = this.getRemoteManagerSystemAdmin().listAllCAPs();
|
||||||
|
|
||||||
|
FamilyDoctorTO fd = this.getRemoteManagerProfile().retrieveFamilyDoctor(this.id);
|
||||||
|
this.setCurrentCenter(fd.getPrimaryHealthCareCenter());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.manageException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<PrimaryHealthCareCenterTO> getPhcList() {
|
||||||
|
return primaryHealthCareCentersList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveData() {
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
if (this.getNewCenter() == null) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un nuevvo centro de atención primaria.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.getNewCenter().getName().equals(this.getCurrentCenter().getName())) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El centro de atención primeria debe ser diferente", "Por favor, seleccione un centro de atención primaria diferente al cual está actualmente asignado.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error == 0) {
|
||||||
|
try {
|
||||||
|
FamilyDoctorTO fd = this.getRemoteManagerProfile().changePrimaryHealthCareCenter(this.id, this.getNewCenter());
|
||||||
|
this.currentCenter = fd.getPrimaryHealthCareCenter();
|
||||||
|
this.newCenter = null;
|
||||||
|
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Su centro de atención primaria asignado se ha cambiado correctamente.");
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.manageException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrimaryHealthCareCenterTO getCurrentCenter() {
|
||||||
|
return currentCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentCenter(PrimaryHealthCareCenterTO currentCenter) {
|
||||||
|
this.currentCenter = currentCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrimaryHealthCareCenterTO getNewCenter() {
|
||||||
|
return newCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewCenter(PrimaryHealthCareCenterTO newCenter) {
|
||||||
|
this.newCenter = newCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,11 +53,6 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
private Collection<MedicalSpecialtyTO> medicalSpecialitiesList;
|
private Collection<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||||
private Collection<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
private Collection<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor. Inicializa la conexión con el EJB Remoto
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public RegisterUserMBean() {
|
public RegisterUserMBean() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -96,7 +91,7 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.manageException(e);
|
this.manageException(e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ADMINISTRADOR:
|
case ADMINISTRATOR:
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
PrimeFaces.current().ajax().addCallbackParam("pats", true);
|
PrimeFaces.current().ajax().addCallbackParam("pats", true);
|
||||||
break;
|
break;
|
||||||
@@ -106,6 +101,7 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public Collection<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
public Collection<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||||
return medicalSpecialitiesList;
|
return medicalSpecialitiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<PrimaryHealthCareCenterTO> getPhcList() {
|
public Collection<PrimaryHealthCareCenterTO> getPhcList() {
|
||||||
return primaryHealthCareCentersList;
|
return primaryHealthCareCentersList;
|
||||||
}
|
}
|
||||||
@@ -208,7 +204,7 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.id = sd.getId();
|
this.id = sd.getId();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ADMINISTRADOR:
|
case ADMINISTRATOR:
|
||||||
throw new NotSupportedException("No se soporta el registro directo de administradores.");
|
throw new NotSupportedException("No se soporta el registro directo de administradores.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
private String password;
|
private String password;
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
// private HashMap<String, String> userTypes;
|
|
||||||
private List<UserType> userTypes;
|
private List<UserType> userTypes;
|
||||||
private String userType;
|
private String userType;
|
||||||
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||||
@@ -63,11 +62,6 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
private Collection<MedicalSpecialtyTO> medicalSpecialitiesList;
|
private Collection<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||||
private Collection<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
private Collection<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor. Inicializa la conexión con el EJB Remoto
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public UpdateProfileMBean() {
|
public UpdateProfileMBean() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -85,7 +79,8 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
usr = SessionUtils.getloggedOnUser();
|
usr = SessionUtils.getloggedOnUser();
|
||||||
|
|
||||||
if (usr == null)
|
if (usr == null)
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida", "Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
||||||
|
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||||
else {
|
else {
|
||||||
this.userType = usr.getUserType().getName();
|
this.userType = usr.getUserType().getName();
|
||||||
this.id = Integer.valueOf(usr.getId());
|
this.id = Integer.valueOf(usr.getId());
|
||||||
@@ -122,7 +117,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
this.currentPassword = fd.getPassword();
|
this.currentPassword = fd.getPassword();
|
||||||
this.primaryHealthCareCenter = fd.getPrimaryHealthCareCenter();
|
this.primaryHealthCareCenter = fd.getPrimaryHealthCareCenter();
|
||||||
break;
|
break;
|
||||||
case ADMINISTRADOR:
|
case ADMINISTRATOR:
|
||||||
// TODO: Recuperar usuario administrador para editar su perfil ¿?
|
// TODO: Recuperar usuario administrador para editar su perfil ¿?
|
||||||
// this.getRemoteManagerProfile().retrievePatient(usr.getId());
|
// this.getRemoteManagerProfile().retrievePatient(usr.getId());
|
||||||
break;
|
break;
|
||||||
@@ -154,7 +149,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
this.manageException(e);
|
this.manageException(e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ADMINISTRADOR:
|
case ADMINISTRATOR:
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
PrimeFaces.current().ajax().addCallbackParam("pats", true);
|
PrimeFaces.current().ajax().addCallbackParam("pats", true);
|
||||||
break;
|
break;
|
||||||
@@ -246,12 +241,14 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
if (changePassword == true) {
|
if (changePassword == true) {
|
||||||
// el usuario queire cambiar el password Comprobamos que el password especificado coincide con el guardado
|
// el usuario queire cambiar el password Comprobamos que el password
|
||||||
|
// especificado coincide con el guardado
|
||||||
if (this.password == null || this.password.length() < 4) {
|
if (this.password == null || this.password.length() < 4) {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Nueva contraseña incorrectra", "Su nueva contraseña debe tener al menos 4 caracteres.");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Nueva contraseña incorrectra", "Su nueva contraseña debe tener al menos 4 caracteres.");
|
||||||
error++;
|
error++;
|
||||||
} else if (HashUtils.hashMD5(this.oldPassword).equals(this.currentPassword) == false ) {
|
} else if (HashUtils.hashMD5(this.oldPassword).equals(this.currentPassword) == false) {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Contraseña actual incorrecta", "Su actual contraseña es incorrecta. Por favor, especifique su contraseña actual.");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Contraseña actual incorrecta",
|
||||||
|
"Su actual contraseña es incorrecta. Por favor, especifique su contraseña actual.");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,7 +271,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
this.id = sd.getId();
|
this.id = sd.getId();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ADMINISTRADOR:
|
case ADMINISTRATOR:
|
||||||
throw new NotSupportedException("No se soporta la edición de perfiles de tipo administrador.");
|
throw new NotSupportedException("No se soporta la edición de perfiles de tipo administrador.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user