Merge branch 'master' into rorden
This commit is contained in:
@@ -45,7 +45,6 @@
|
||||
</p:ajaxStatus>
|
||||
|
||||
<h:form id="frmLogin">
|
||||
|
||||
<p:dialog header="Acceder al sistema" width="350px" widgetVar="dlgLogin" resizable="false" modal="true" closeOnEscape="true">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-12">
|
||||
@@ -81,8 +80,6 @@
|
||||
</ui:fragment>
|
||||
</f:facet>
|
||||
</p:menubar>
|
||||
|
||||
|
||||
</h:form>
|
||||
</div>
|
||||
<div id="content">
|
||||
|
||||
@@ -1,24 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="errorForm">
|
||||
<div align="center">
|
||||
<h1>Medical Tests</h1>
|
||||
<hr/>
|
||||
<div>Medical Tests TestPage:</div>
|
||||
<div>
|
||||
Medical Tests content
|
||||
<h:form id="TestForm">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="PanelUnderConstruction" header="Pagina en construcción de Pruebas médicas">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo" value="Etiqueta para campo de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo" value="Valor del campo del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo2" value="Etiqueta para campo 2 de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo2" value="Valor del campo 2 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo3" value="Etiqueta para campo 3 de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo3" value="Valor del campo 3 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="TestForm" action="#{BeanName.actionMethod}" icon="pi pi-check" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home" />
|
||||
</p>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -1,39 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="frmRegisterUser">
|
||||
<h:form id="frmChangeFD">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
|
||||
<p:panel id="DatosPersonales" header="Cambiar médico de familia">
|
||||
<p:panel id="badProfile" rendered="#{not home.patient}">
|
||||
<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-2 ui-md-2">
|
||||
<p:outputLabel value="Campo1:" for="campo1" />
|
||||
<div class="ui-g-12">
|
||||
Su perfil de usuario no permite que pueda cambiar su Médico de Familia 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="PanelPHC" header="Cambiar médico de familia asignado" rendered="#{home.patient}">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel value="Médico de familia actualmente asignado:" />
|
||||
</div>
|
||||
<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" style="font-weight: bold;" value="#{ChangeFD.currentFamilyDoctor.displayDescription}" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="campo1" display="text" />
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel value="Nuevo médico de familia:" for="newFamilyDoc" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:selectOneMenu id="newFamilyDoc" value="#{ChangeFD.newFamilyDoctor}" 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="#{ChangeFD.familyDoctorList}" var="fd" itemLabel="#{fd.displayDescription}" itemValue="#{fd}" />
|
||||
<p:column headerText="Num. Prof."><h:outputText value="#{fd.id}" /></p:column>
|
||||
<p:column headerText="Nombre"><h:outputText value="#{fd.name}" /></p:column>
|
||||
<p:column headerText="Apellido"><h:outputText value="#{fd.surname}" /></p:column>
|
||||
</p:selectOneMenu>
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="newFamilyDoc" />
|
||||
</div>
|
||||
|
||||
<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 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="mesgs" icon="pi pi-check" />
|
||||
<p:commandButton validateClient="true" value="Guardar" update="frmChangeFD" action="#{ChangeFD.saveData}" icon="pi pi-check" />
|
||||
</div>
|
||||
<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 class="ui-g-4 ui-md-4"></div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<p:outputLabel value="Centro de antención primaria actualmente asignado:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel id="lblCurrentCenter" value="#{ChangeCAP.currentCenter.displayDescription}" />
|
||||
<p:outputLabel id="lblCurrentCenter" style="font-weight: bold;" value="#{ChangeCAP.currentCenter.displayDescription}" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-4"></div>
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Registrarse" update="mesgs" action="#{RegisterUser.addNewUser}" icon="pi pi-check" />
|
||||
<p:commandButton validateClient="true" value="Registrarse" ajax="false" update="frmRegisterUserResult, frmRegisterUser" action="#{RegisterUser.addNewUser}" icon="pi pi-check" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
|
||||
@@ -1,24 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="errorForm">
|
||||
<div align="center">
|
||||
<h1>System Admin Page</h1>
|
||||
<hr/>
|
||||
<div>System Admin TestPage:</div>
|
||||
<div>
|
||||
System Admin page content
|
||||
<h:form id="TestForm">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="PanelUnderConstruction" header="Pagina en construcción de Administrador">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo" value="Etiqueta para campo de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo" value="Valor del campo del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo2" value="Etiqueta para campo 2 de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo2" value="Valor del campo 2 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo3" value="Etiqueta para campo 3 de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo3" value="Valor del campo 3 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="TestForm" action="#{BeanName.actionMethod}" icon="pi pi-check" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home" />
|
||||
</p>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -1,24 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="errorForm">
|
||||
<div align="center">
|
||||
<h1>Visit Page</h1>
|
||||
<hr/>
|
||||
<div>Visit TestPage:</div>
|
||||
<div>
|
||||
Visit page content
|
||||
<h:form id="TestForm">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="PanelUnderConstruction" header="Pagina en construcción de Visitas">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo" value="Etiqueta para campo de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo" value="Valor del campo del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo2" value="Etiqueta para campo 2 de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo2" value="Valor del campo 2 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo3" value="Etiqueta para campo 3 de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo3" value="Valor del campo 3 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="TestForm" action="#{BeanName.actionMethod}" icon="pi pi-check" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home" />
|
||||
</p>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -83,6 +83,10 @@ public class FamilyDoctorTO implements Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDisplayDescription() {
|
||||
return String.format("[%d] %s %s", this.id, this.name, this.surname);
|
||||
}
|
||||
|
||||
public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() {
|
||||
return primaryHealthCareCenter;
|
||||
}
|
||||
|
||||
152
1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java
Normal file
152
1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java
Normal file
@@ -0,0 +1,152 @@
|
||||
package ejb.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import jpa.FamilyDoctorJPA;
|
||||
import jpa.MedicalSpecialtyJPA;
|
||||
import jpa.PatientJPA;
|
||||
import jpa.PrimaryHealthCareCenterJPA;
|
||||
import jpa.SpecialistDoctorJPA;
|
||||
|
||||
@Stateless
|
||||
public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
// Persistence Unit Context
|
||||
@PersistenceContext(unitName = "MyHealth")
|
||||
private EntityManager entman;
|
||||
|
||||
/**
|
||||
* Metodo que devuelve todas las especialidades medicas
|
||||
*/
|
||||
public Collection<MedicalSpecialtyTO> listAllMedicalSpecialities() {
|
||||
return this.listPagedMedicalSpecialities(0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metodo que devuelve las especialidades médicas de forma paginada
|
||||
*
|
||||
* Acepta como parametro la página (comenzando en 0) y el número de elementos de
|
||||
* cada página
|
||||
*
|
||||
*/
|
||||
public Collection<MedicalSpecialtyTO> listPagedMedicalSpecialities(int pageNumber, int pageSize) {
|
||||
Query query = entman.createQuery("from MedicalSpecialtyJPA order by name");
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<MedicalSpecialtyJPA> allJPA = query.getResultList();
|
||||
Collection<MedicalSpecialtyTO> allSpecialities = new ArrayList<MedicalSpecialtyTO>();
|
||||
|
||||
for (MedicalSpecialtyJPA ms : allJPA) {
|
||||
allSpecialities.add(new MedicalSpecialtyTO(ms.getName(), ms.getDescription()));
|
||||
}
|
||||
|
||||
return allSpecialities;
|
||||
}
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listAllCAPs() {
|
||||
return this.listPagedAllCAPs(0, 0);
|
||||
}
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listPagedAllCAPs(int pageNumber, int pageSize) {
|
||||
Query query = entman.createQuery("from PrimaryHealthCareCenterJPA order by name");
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<PrimaryHealthCareCenterJPA> allJPA = query.getResultList();
|
||||
Collection<PrimaryHealthCareCenterTO> allCAPs = new ArrayList<PrimaryHealthCareCenterTO>();
|
||||
|
||||
for (PrimaryHealthCareCenterJPA cap : allJPA) {
|
||||
allCAPs.add(new PrimaryHealthCareCenterTO(cap.getName(), cap.getLocation()));
|
||||
}
|
||||
|
||||
return allCAPs;
|
||||
}
|
||||
|
||||
public Collection<FamilyDoctorTO> listAllFamilyDoctors() {
|
||||
return this.listAllFamilyDoctors(0, 0);
|
||||
}
|
||||
|
||||
public Collection<FamilyDoctorTO> listAllFamilyDoctors(int pageNumber, int pageSize) {
|
||||
Query query = entman.createQuery("from FamilyDoctorJPA order by name, surname");
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<FamilyDoctorJPA> allFDsJPA = query.getResultList();
|
||||
Collection<FamilyDoctorTO> allFDTOs = new ArrayList<FamilyDoctorTO>();
|
||||
|
||||
for (FamilyDoctorJPA item : allFDsJPA) {
|
||||
allFDTOs.add(new FamilyDoctorTO(item.getId(), item.getNif(), item.getName(), item.getSurname(), item.getPassword(), item.getEmail(), null));
|
||||
}
|
||||
|
||||
return allFDTOs;
|
||||
}
|
||||
|
||||
public PatientTO retrievePatient(int patientId) throws Exception {
|
||||
PatientJPA pat = entman.find(PatientJPA.class, patientId);
|
||||
|
||||
if (pat == null) {
|
||||
throw new Exception("No se pueden actualizar los datos del paciente porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(patientId));
|
||||
}
|
||||
|
||||
FamilyDoctorTO fdTO = null;
|
||||
if (pat.getFamilyDoctor() != null) {
|
||||
FamilyDoctorJPA fd = pat.getFamilyDoctor();
|
||||
fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), null);
|
||||
}
|
||||
|
||||
PatientTO paTO = new PatientTO(pat.getId(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), fdTO);
|
||||
return paTO;
|
||||
}
|
||||
|
||||
public FamilyDoctorTO retrieveFamilyDoctor(int ProfessionalNumberId) throws Exception {
|
||||
FamilyDoctorJPA fd = entman.find(FamilyDoctorJPA.class, ProfessionalNumberId);
|
||||
if (fd == null) {
|
||||
throw new Exception("No se encuentra en la base de datos ningún médico de familia con id: " + String.valueOf(ProfessionalNumberId));
|
||||
}
|
||||
|
||||
PrimaryHealthCareCenterTO phc = null;
|
||||
if (fd.getPrimaryHealthCareCenter() != null)
|
||||
phc = new PrimaryHealthCareCenterTO(fd.getPrimaryHealthCareCenter().getName(), fd.getPrimaryHealthCareCenter().getLocation());
|
||||
|
||||
FamilyDoctorTO fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), phc);
|
||||
return fdTO;
|
||||
}
|
||||
|
||||
public SpecialistDoctorTO retrieveSpecialistDoctor(int professionalId) throws Exception {
|
||||
SpecialistDoctorJPA sd = entman.find(SpecialistDoctorJPA.class, professionalId);
|
||||
if (sd == null) {
|
||||
throw new Exception(
|
||||
"No se pueden actualizar los datos del médico de familia porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(professionalId));
|
||||
}
|
||||
|
||||
MedicalSpecialtyTO ms = null;
|
||||
if (sd.getMedicalSpecialty() != null)
|
||||
ms = new MedicalSpecialtyTO(sd.getMedicalSpecialty().getName(), sd.getMedicalSpecialty().getDescription());
|
||||
|
||||
SpecialistDoctorTO sdTO = new SpecialistDoctorTO(sd.getId(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), ms);
|
||||
return sdTO;
|
||||
}
|
||||
}
|
||||
38
1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java
Normal file
38
1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package ejb.common;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Local
|
||||
public interface CommonFacadeLocal {
|
||||
|
||||
public Collection<MedicalSpecialtyTO> listAllMedicalSpecialities();
|
||||
|
||||
public Collection<MedicalSpecialtyTO> listPagedMedicalSpecialities(int pageNumber, int pageSize);
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listAllCAPs();
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listPagedAllCAPs(int pageNumber, int pageSize);
|
||||
|
||||
public Collection<FamilyDoctorTO> listAllFamilyDoctors();
|
||||
|
||||
public Collection<FamilyDoctorTO> listAllFamilyDoctors(int pageNumber, int pageSize);
|
||||
|
||||
public PatientTO retrievePatient(int patientId) throws Exception;
|
||||
|
||||
public FamilyDoctorTO retrieveFamilyDoctor(int ProfessionalNumberId) throws Exception;
|
||||
|
||||
public SpecialistDoctorTO retrieveSpecialistDoctor(int ProfessionalNumberId) throws Exception;
|
||||
}
|
||||
38
1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java
Normal file
38
1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package ejb.common;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Remote
|
||||
public interface CommonFacadeRemote {
|
||||
|
||||
public Collection<MedicalSpecialtyTO> listAllMedicalSpecialities();
|
||||
|
||||
public Collection<MedicalSpecialtyTO> listPagedMedicalSpecialities(int pageNumber, int pageSize);
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listAllCAPs();
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listPagedAllCAPs(int pageNumber, int pageSize);
|
||||
|
||||
public Collection<FamilyDoctorTO> listAllFamilyDoctors();
|
||||
|
||||
public Collection<FamilyDoctorTO> listAllFamilyDoctors(int pageNumber, int pageSize);
|
||||
|
||||
public PatientTO retrievePatient(int patientId) throws Exception;
|
||||
|
||||
public FamilyDoctorTO retrieveFamilyDoctor(int ProfessionalNumberId) throws Exception;
|
||||
|
||||
public SpecialistDoctorTO retrieveSpecialistDoctor(int ProfessionalNumberId) throws Exception;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package ejb.profile;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.ejb.Stateless;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
@@ -10,6 +11,9 @@ import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import common.HashUtils;
|
||||
import ejb.common.CommonFacadeBean;
|
||||
import ejb.common.CommonFacadeLocal;
|
||||
import ejb.common.CommonFacadeRemote;
|
||||
import jpa.FamilyDoctorJPA;
|
||||
import jpa.MedicalSpecialtyJPA;
|
||||
import jpa.PatientJPA;
|
||||
@@ -28,6 +32,9 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
||||
@PersistenceContext(unitName = "MyHealth")
|
||||
private EntityManager entman;
|
||||
|
||||
@EJB
|
||||
CommonFacadeLocal commonServices;
|
||||
|
||||
public PatientTO changeFamilyDoctor(int patientId, int ProfessionalNumberId) throws Exception {
|
||||
PatientJPA pat = entman.find(PatientJPA.class, patientId);
|
||||
if (pat == null) {
|
||||
@@ -44,7 +51,8 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
||||
pat.setFamilyDoctor(fd);
|
||||
entman.persist(pat);
|
||||
|
||||
return this.retrievePatient(pat.getId());
|
||||
//CommonFacadeRemote common = new CommonFacadeBean();
|
||||
return commonServices.retrievePatient(pat.getId());
|
||||
}
|
||||
|
||||
public PatientTO registerPatient(int id, String nif, String name, String surname, String password, String email) {
|
||||
@@ -188,50 +196,4 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
||||
|
||||
return fdTO;
|
||||
}
|
||||
|
||||
public PatientTO retrievePatient(int patientId) throws Exception {
|
||||
PatientJPA pat = entman.find(PatientJPA.class, patientId);
|
||||
|
||||
if (pat == null) {
|
||||
throw new Exception("No se pueden actualizar los datos del paciente porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(patientId));
|
||||
}
|
||||
|
||||
FamilyDoctorTO fdTO = null;
|
||||
if (pat.getFamilyDoctor() != null) {
|
||||
FamilyDoctorJPA fd = pat.getFamilyDoctor();
|
||||
fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), null);
|
||||
}
|
||||
|
||||
PatientTO paTO = new PatientTO(pat.getId(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), fdTO);
|
||||
return paTO;
|
||||
}
|
||||
|
||||
public FamilyDoctorTO retrieveFamilyDoctor(int ProfessionalNumberId) throws Exception {
|
||||
FamilyDoctorJPA fd = entman.find(FamilyDoctorJPA.class, ProfessionalNumberId);
|
||||
if (fd == null) {
|
||||
throw new Exception("No se encuentra en la base de datos ningún médico de familia con id: " + String.valueOf(ProfessionalNumberId));
|
||||
}
|
||||
|
||||
PrimaryHealthCareCenterTO phc = null;
|
||||
if (fd.getPrimaryHealthCareCenter() != null)
|
||||
phc = new PrimaryHealthCareCenterTO(fd.getPrimaryHealthCareCenter().getName(), fd.getPrimaryHealthCareCenter().getLocation());
|
||||
|
||||
FamilyDoctorTO fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), phc);
|
||||
return fdTO;
|
||||
}
|
||||
|
||||
public SpecialistDoctorTO retrieveSpecialistDoctor(int professionalId) throws Exception {
|
||||
SpecialistDoctorJPA sd = entman.find(SpecialistDoctorJPA.class, professionalId);
|
||||
if (sd == null) {
|
||||
throw new Exception(
|
||||
"No se pueden actualizar los datos del médico de familia porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(professionalId));
|
||||
}
|
||||
|
||||
MedicalSpecialtyTO ms = null;
|
||||
if (sd.getMedicalSpecialty() != null)
|
||||
ms = new MedicalSpecialtyTO(sd.getMedicalSpecialty().getName(), sd.getMedicalSpecialty().getDescription());
|
||||
|
||||
SpecialistDoctorTO sdTO = new SpecialistDoctorTO(sd.getId(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), ms);
|
||||
return sdTO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,9 +32,4 @@ public interface ProfileFacadeRemote {
|
||||
|
||||
public FamilyDoctorTO changePrimaryHealthCareCenter(int ProfessionalNumberId, PrimaryHealthCareCenterTO newCenter) throws Exception;
|
||||
|
||||
public PatientTO retrievePatient(int patientId) throws Exception;
|
||||
|
||||
public FamilyDoctorTO retrieveFamilyDoctor(int ProfessionalNumberId) throws Exception;
|
||||
|
||||
public SpecialistDoctorTO retrieveSpecialistDoctor(int ProfessionalNumberId) throws Exception;
|
||||
}
|
||||
@@ -32,62 +32,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
@PersistenceContext(unitName = "MyHealth")
|
||||
private EntityManager entman;
|
||||
|
||||
/**
|
||||
* Metodo que devuelve todas las especialidades medicas
|
||||
*/
|
||||
public Collection<MedicalSpecialtyTO> listAllMedicalSpecialities() {
|
||||
return this.listPagedMedicalSpecialities(0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metodo que devuelve las especialidades médicas de forma paginada
|
||||
*
|
||||
* Acepta como parametro la página (comenzando en 0) y el número de elementos de
|
||||
* cada página
|
||||
*
|
||||
*/
|
||||
public Collection<MedicalSpecialtyTO> listPagedMedicalSpecialities(int pageNumber, int pageSize) {
|
||||
Query query = entman.createQuery("from MedicalSpecialtyJPA order by name");
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<MedicalSpecialtyJPA> allJPA = query.getResultList();
|
||||
Collection<MedicalSpecialtyTO> allSpecialities = new ArrayList<MedicalSpecialtyTO>();
|
||||
|
||||
for (MedicalSpecialtyJPA ms : allJPA) {
|
||||
allSpecialities.add(new MedicalSpecialtyTO(ms.getName(), ms.getDescription()));
|
||||
}
|
||||
|
||||
return allSpecialities;
|
||||
}
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listAllCAPs() {
|
||||
return this.listPagedAllCAPs(0, 0);
|
||||
}
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listPagedAllCAPs(int pageNumber, int pageSize) {
|
||||
Query query = entman.createQuery("from PrimaryHealthCareCenterJPA order by name");
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<PrimaryHealthCareCenterJPA> allJPA = query.getResultList();
|
||||
Collection<PrimaryHealthCareCenterTO> allCAPs = new ArrayList<PrimaryHealthCareCenterTO>();
|
||||
|
||||
for (PrimaryHealthCareCenterJPA cap : allJPA) {
|
||||
allCAPs.add(new PrimaryHealthCareCenterTO(cap.getName(), cap.getLocation()));
|
||||
}
|
||||
|
||||
return allCAPs;
|
||||
}
|
||||
|
||||
public LoggedUserTO login(String id, String pwd) {
|
||||
LoggedUserTO usr = null;
|
||||
|
||||
|
||||
@@ -18,9 +18,7 @@ public interface SystemAdminFacadeRemote {
|
||||
/**
|
||||
* Definimos la interfaz remota
|
||||
*/
|
||||
public Collection<MedicalSpecialtyTO> listAllMedicalSpecialities();
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listAllCAPs();
|
||||
|
||||
public LoggedUserTO login(String id, String pwd);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import ejb.common.CommonFacadeRemote;
|
||||
import ejb.medicalTest.MedicalTestFacadeRemote;
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import ejb.systemAdmin.SystemAdminFacadeRemote;
|
||||
@@ -20,6 +21,8 @@ import ejb.visit.VisitFacadeRemote;
|
||||
*
|
||||
*/
|
||||
public class ManagedBeanBase {
|
||||
@EJB
|
||||
protected CommonFacadeRemote remoteManagerCommon;
|
||||
@EJB
|
||||
protected ProfileFacadeRemote remoteManagerProfile;
|
||||
@EJB
|
||||
@@ -49,6 +52,14 @@ public class ManagedBeanBase {
|
||||
return retObj;
|
||||
}
|
||||
|
||||
protected CommonFacadeRemote getRemoteManagerCommon() {
|
||||
if (remoteManagerCommon == null) {
|
||||
remoteManagerCommon = this.getContext("java:app/MyHealth.jar/CommonFacadeBean!ejb.common.CommonFacadeRemote", CommonFacadeRemote.class);
|
||||
}
|
||||
|
||||
return remoteManagerCommon;
|
||||
}
|
||||
|
||||
protected ProfileFacadeRemote getRemoteManagerProfile() {
|
||||
if (remoteManagerProfile == null) {
|
||||
remoteManagerProfile = this.getContext("java:app/MyHealth.jar/ProfileFacadeBean!ejb.profile.ProfileFacadeRemote", ProfileFacadeRemote.class);
|
||||
@@ -67,7 +78,7 @@ public class ManagedBeanBase {
|
||||
|
||||
protected VisitFacadeRemote getRemoteManagerVisit() {
|
||||
if (remoteManagerVisit == null) {
|
||||
remoteManagerVisit = this.getContext("java:app/MyHealth.jar/VisitFacadeBean!ejb.systemAdmin.VisitFacadeRemote", VisitFacadeRemote.class);
|
||||
remoteManagerVisit = this.getContext("java:app/MyHealth.jar/VisitFacadeBean!ejb.visit.VisitFacadeRemote", VisitFacadeRemote.class);
|
||||
}
|
||||
|
||||
return remoteManagerVisit;
|
||||
@@ -75,7 +86,7 @@ public class ManagedBeanBase {
|
||||
|
||||
protected MedicalTestFacadeRemote getRemoteManagerMedicalTest() {
|
||||
if (remoteManagerMedicalTest == null) {
|
||||
remoteManagerMedicalTest = this.getContext("java:app/MyHealth.jar/MedicalTestFacadeBean!ejb.systemAdmin.MedicalTestFacadeRemote", MedicalTestFacadeRemote.class);
|
||||
remoteManagerMedicalTest = this.getContext("java:app/MyHealth.jar/MedicalTestFacadeBean!ejb.medicalTest.MedicalTestFacadeRemote", MedicalTestFacadeRemote.class);
|
||||
}
|
||||
|
||||
return remoteManagerMedicalTest;
|
||||
|
||||
@@ -31,7 +31,6 @@ public class MenuMBean implements Serializable {
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
model = new DefaultMenuModel();
|
||||
DefaultMenuItem item;
|
||||
DefaultSubMenu subMenu;
|
||||
UserType tipoUsuario = null;
|
||||
|
||||
@@ -42,91 +41,91 @@ public class MenuMBean implements Serializable {
|
||||
|
||||
// Administracion Sistema
|
||||
if (tipoUsuario == UserType.ADMINISTRATOR) {
|
||||
subMenu = new DefaultSubMenu("Administración del sistema", "pi pi-cog");
|
||||
subMenu = new DefaultSubMenu("Administración del sistema", "fa-wrench");
|
||||
|
||||
subMenu.addElement(createMenuItem("Gestionar especialidades", "pi pi-calendar", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(createMenuItem("Centros At. Primaria", "pi pi-briefcase", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(createMenuItem("Gestionar especialidades", "fa fa-file-text-o", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(createMenuItem("Centros At. Primaria", "fa fa-hospital-o", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
subMenu.addElement(createMenuItem("Ver médicos de un CAP", "pi pi-calendar", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(createMenuItem("Ver médicos de un CAP", "fa fa-medkit", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
subMenu.addElement(createMenuItem("Añadir usuario Admin", "pi pi-calendar", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(createMenuItem("Añadir usuario Admin", "fa fa-user-secret", "/systemAdmin/ManageSpecialties", null));
|
||||
|
||||
model.addElement(subMenu);
|
||||
}
|
||||
|
||||
// Visitas
|
||||
if (tipoUsuario == UserType.PATIENT || tipoUsuario == UserType.ADMINISTRATOR || tipoUsuario == UserType.FAMILY_DOCTOR) {
|
||||
subMenu = new DefaultSubMenu("Visitas", "pi pi-calendar");
|
||||
subMenu = new DefaultSubMenu("Visitas", "fa fa-calendar");
|
||||
|
||||
if (tipoUsuario == UserType.PATIENT)
|
||||
subMenu.addElement(createMenuItem("Solicitar nueva", "pi pi-calendar", "/visit/VisitView", null));
|
||||
subMenu.addElement(createMenuItem("Solicitar nueva", "fa fa-calendar-o", "/visit/VisitView", null));
|
||||
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", "fa fa-briefcase", "/visit/VisitView", null));
|
||||
if (tipoUsuario == UserType.PATIENT)
|
||||
subMenu.addElement(createMenuItem("Anular visita", "pi pi-calendar", "/visit/VisitView", null));
|
||||
subMenu.addElement(createMenuItem("Anular visita", "fa fa-remove", "/visit/VisitView", null));
|
||||
if (tipoUsuario == UserType.FAMILY_DOCTOR)
|
||||
subMenu.addElement(createMenuItem("Añadir resultado", "pi pi-briefcase", "/visit/VisitView", null));
|
||||
subMenu.addElement(createMenuItem("Añadir resultado", "fa fa-align-left", "/visit/VisitView", null));
|
||||
if (tipoUsuario == UserType.FAMILY_DOCTOR)
|
||||
subMenu.addElement(createMenuItem("Ver agenda del día", "pi pi-calendar", "/visit/VisitView", null));
|
||||
subMenu.addElement(createMenuItem("Ver agenda del día", "fa fa-repeat", "/visit/VisitView", null));
|
||||
|
||||
model.addElement(subMenu);
|
||||
}
|
||||
|
||||
// Pruebas médicas
|
||||
if (tipoUsuario == UserType.PATIENT || tipoUsuario == UserType.SPECIALIST_DOCTOR || tipoUsuario == UserType.FAMILY_DOCTOR) {
|
||||
subMenu = new DefaultSubMenu("Especialista", "pi pi-clone");
|
||||
subMenu = new DefaultSubMenu("Especialista", "fa fa-heartbeat");
|
||||
|
||||
if (tipoUsuario == UserType.SPECIALIST_DOCTOR)
|
||||
subMenu.addElement(createMenuItem("Añadir prueba", "pi pi-clone", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(createMenuItem("Añadir prueba", "fa fa-server", "/medicaltest/MedicalTests", null));
|
||||
|
||||
// Todos pueden consultar (P S F)
|
||||
subMenu.addElement(createMenuItem("Consultar prueba", "pi pi-briefcase", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(createMenuItem("Consultar prueba", "fa fa-search", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
|
||||
if (tipoUsuario == UserType.SPECIALIST_DOCTOR) {
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
subMenu.addElement(createMenuItem("Gestionar imagen de una prueba", "pi pi-search", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(createMenuItem("Gestionar imagen de una prueba", "fa fa-briefcase", "/medicaltest/MedicalTests", null));
|
||||
}
|
||||
|
||||
if (tipoUsuario == UserType.PATIENT)
|
||||
subMenu.addElement(createMenuItem("Buscar especialista...", "pi pi-list", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(createMenuItem("Buscar especialista...", "fa fa-heartbeat", "/medicaltest/MedicalTests", null));
|
||||
|
||||
model.addElement(subMenu);
|
||||
}
|
||||
|
||||
// Preguntas médicas
|
||||
if (tipoUsuario == UserType.PATIENT || tipoUsuario == UserType.FAMILY_DOCTOR) {
|
||||
subMenu = new DefaultSubMenu("Preguntas", "pi pi-clone");
|
||||
subMenu = new DefaultSubMenu("Preguntas", "fa fa-question-circle");
|
||||
|
||||
if (tipoUsuario == UserType.PATIENT)
|
||||
subMenu.addElement(createMenuItem("Hacer pregunta", "pi pi-clone", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(createMenuItem("Hacer pregunta", "fa fa-comment-o", "/medicaltest/MedicalTests", null));
|
||||
|
||||
if (tipoUsuario == UserType.FAMILY_DOCTOR)
|
||||
subMenu.addElement(createMenuItem("Responder pregunta", "pi pi-question", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(createMenuItem("Responder pregunta", "fa fa-comments", "/medicaltest/MedicalTests", null));
|
||||
|
||||
if (tipoUsuario == UserType.FAMILY_DOCTOR)
|
||||
subMenu.addElement(createMenuItem("Ver preguntas pendientes", "pi pi-question", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(createMenuItem("Ver preguntas pendientes", "fa fa-comments-o", "/medicaltest/MedicalTests", null));
|
||||
|
||||
model.addElement(subMenu);
|
||||
}
|
||||
}
|
||||
|
||||
// Perfil
|
||||
subMenu = new DefaultSubMenu("Gestionar perfil", "pi pi-id-card");
|
||||
subMenu = new DefaultSubMenu("Gestionar perfil", "fa fa-gears");
|
||||
if (SessionUtils.isLogedIn() == false) {
|
||||
subMenu.addElement(createMenuItem("Registro de usuario", "pi pi-users", "/profile/RegisterUser", null));
|
||||
subMenu.addElement(createMenuItem("Registro de paciente", "pi pi-user-plus", "/profile/AddPatient", null));
|
||||
subMenu.addElement(createMenuItem("Registro de médico", "pi pi-user-plus", "/profile/AddFamilyDoctor", null));
|
||||
subMenu.addElement(createMenuItem("Registro de especialista", "pi pi-user-plus", "/profile/AddSpecialistDoctor", null));
|
||||
subMenu.addElement(createMenuItem("Registro de usuario", "fa fa-user-plus", "/profile/RegisterUser", null));
|
||||
subMenu.addElement(createMenuItem("Registro de paciente", "fa fa-user-plus", "/profile/AddPatient", null));
|
||||
subMenu.addElement(createMenuItem("Registro de médico", "fa fa-user-md", "/profile/AddFamilyDoctor", null));
|
||||
subMenu.addElement(createMenuItem("Registro de especialista", "fa fa-user-md", "/profile/AddSpecialistDoctor", null));
|
||||
|
||||
model.addElement(subMenu);
|
||||
} else {
|
||||
if (tipoUsuario != UserType.ADMINISTRATOR) {
|
||||
subMenu.addElement(createMenuItem("Modificar datos personales", "pi pi-user-edit", "/profile/UpdateProfile", null));
|
||||
subMenu.addElement(createMenuItem("Modificar datos personales", "fa fa-user", "/profile/UpdateProfile", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
|
||||
if (tipoUsuario == UserType.PATIENT) {
|
||||
subMenu.addElement(createMenuItem("Cambiar médico de familia", "pi pi-chevron-circle-right", "/profile/ChangeFamilyDoctor", null));
|
||||
subMenu.addElement(createMenuItem("Cambiar médico de familia", "fa fa-user-md", "/profile/ChangeFamilyDoctor", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
}
|
||||
|
||||
@@ -152,58 +151,4 @@ public class MenuMBean implements Serializable {
|
||||
public MenuModel getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
addMessage("Success", "Data saved");
|
||||
}
|
||||
|
||||
public void update() {
|
||||
addMessage("Success", "Data updated");
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
addMessage("Success", "Data deleted");
|
||||
}
|
||||
|
||||
public String goManageSpecialties() {
|
||||
|
||||
return "ManageSpecialties";
|
||||
}
|
||||
|
||||
public String goVisit() {
|
||||
return "VisitView";
|
||||
}
|
||||
|
||||
public String goMedicalTests() {
|
||||
return "MedicalTests";
|
||||
}
|
||||
|
||||
public String goListSpecialistDoctors() {
|
||||
return "header";
|
||||
}
|
||||
|
||||
public String goListSpecialistDoctorsBySpecialty() {
|
||||
return "header";
|
||||
}
|
||||
|
||||
public String goListaFamilyDoctors() {
|
||||
return "header";
|
||||
}
|
||||
|
||||
public String goChangeDoctor() {
|
||||
return "header";
|
||||
}
|
||||
|
||||
public String goChangeCAP() {
|
||||
return "header";
|
||||
}
|
||||
|
||||
public String goAddPatient() {
|
||||
return "profile/AddPaciente";
|
||||
}
|
||||
|
||||
public void addMessage(String summary, String detail) {
|
||||
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, summary, detail);
|
||||
FacesContext.getCurrentInstance().addMessage(null, message);
|
||||
}
|
||||
}
|
||||
@@ -1,50 +1,114 @@
|
||||
package managedbean.profile;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Properties;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.LoggedUserTO;
|
||||
import TO.PatientTO;
|
||||
import common.UserType;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
/***
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Named( "ChangeFamilyDoctorMBean")
|
||||
@RequestScoped
|
||||
@Named("ChangeFD")
|
||||
@ViewScoped
|
||||
public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EJB
|
||||
private ProfileFacadeRemote remoteManager;
|
||||
private int id;
|
||||
private FamilyDoctorTO currentFamilyDoctor;
|
||||
private FamilyDoctorTO newFamilyDoctor;
|
||||
private Collection<FamilyDoctorTO> familyDoctorList;
|
||||
|
||||
public ChangeFamilyDoctorMBean() {
|
||||
|
||||
/**
|
||||
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public ChangeFamilyDoctorMBean() throws Exception {
|
||||
initializeAdminFacadeRemote();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private void initializeAdminFacadeRemote() throws Exception {
|
||||
Properties props = System.getProperties();
|
||||
Context ctx = new InitialContext(props);
|
||||
remoteManager = (ProfileFacadeRemote) ctx
|
||||
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Recuperamos el usuario logeado actual
|
||||
LoggedUserTO usr = null;
|
||||
try {
|
||||
usr = SessionUtils.getloggedOnUser();
|
||||
|
||||
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.");
|
||||
else {
|
||||
this.id = Integer.valueOf(usr.getId());
|
||||
|
||||
if (usr.getUserType() == UserType.PATIENT) {
|
||||
this.familyDoctorList = this.getRemoteManagerCommon().listAllFamilyDoctors();
|
||||
|
||||
PatientTO pat = this.getRemoteManagerCommon().retrievePatient(this.id);
|
||||
this.setCurrentFamilyDoctor(pat.getFamilyDoctor());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Collection<FamilyDoctorTO> getFamilyDoctorList() {
|
||||
return familyDoctorList;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
int error = 0;
|
||||
|
||||
if (this.getNewFamilyDoctor() == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nuevo médico de familia no seleccionado", "Por favor, especifique un nuevvo médico de familia.");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (this.getCurrentFamilyDoctor() != null && this.getNewFamilyDoctor().getId() == this.getCurrentFamilyDoctor().getId()) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El médico de familia debe ser diferente",
|
||||
"Por favor, seleccione un médico de familia diferente al que tiene actualmente asignado.");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (error == 0) {
|
||||
try {
|
||||
PatientTO paTO = this.getRemoteManagerProfile().changeFamilyDoctor(this.getId(), this.newFamilyDoctor.getId());
|
||||
this.currentFamilyDoctor = paTO.getFamilyDoctor();
|
||||
this.newFamilyDoctor = null;
|
||||
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Su médico de familia asignado se ha cambiado correctamente.");
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FamilyDoctorTO getCurrentFamilyDoctor() {
|
||||
return currentFamilyDoctor;
|
||||
}
|
||||
|
||||
public void setCurrentFamilyDoctor(FamilyDoctorTO familyDoctor) {
|
||||
this.currentFamilyDoctor = familyDoctor;
|
||||
}
|
||||
|
||||
public FamilyDoctorTO getNewFamilyDoctor() {
|
||||
return newFamilyDoctor;
|
||||
}
|
||||
|
||||
public void setNewFamilyDoctor(FamilyDoctorTO familyDoctor) {
|
||||
this.newFamilyDoctor = familyDoctor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,9 +48,9 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen
|
||||
this.id = Integer.valueOf(usr.getId());
|
||||
|
||||
if (usr.getUserType() == UserType.FAMILY_DOCTOR) {
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerSystemAdmin().listAllCAPs();
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listAllCAPs();
|
||||
|
||||
FamilyDoctorTO fd = this.getRemoteManagerProfile().retrieveFamilyDoctor(this.id);
|
||||
FamilyDoctorTO fd = this.getRemoteManagerCommon().retrieveFamilyDoctor(this.id);
|
||||
this.setCurrentCenter(fd.getPrimaryHealthCareCenter());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
this.userType = UserType.PATIENT.name();
|
||||
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerSystemAdmin().listAllMedicalSpecialities();
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerSystemAdmin().listAllCAPs();
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listAllMedicalSpecialities();
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listAllCAPs();
|
||||
}
|
||||
|
||||
public List<UserType> getUserTypes() {
|
||||
|
||||
@@ -87,7 +87,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
|
||||
switch (usr.getUserType()) {
|
||||
case PATIENT:
|
||||
PatientTO pat = this.getRemoteManagerProfile().retrievePatient(this.id);
|
||||
PatientTO pat = this.getRemoteManagerCommon().retrievePatient(this.id);
|
||||
|
||||
this.name = pat.getName();
|
||||
this.surname = pat.getName();
|
||||
@@ -96,8 +96,8 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
this.currentPassword = pat.getPassword();
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerSystemAdmin().listAllMedicalSpecialities();
|
||||
SpecialistDoctorTO sd = this.getRemoteManagerProfile().retrieveSpecialistDoctor(this.id);
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listAllMedicalSpecialities();
|
||||
SpecialistDoctorTO sd = this.getRemoteManagerCommon().retrieveSpecialistDoctor(this.id);
|
||||
|
||||
this.name = sd.getName();
|
||||
this.surname = sd.getName();
|
||||
@@ -107,8 +107,8 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
this.medicalSpecialty = sd.getMedicalSpecialty();
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerSystemAdmin().listAllCAPs();
|
||||
FamilyDoctorTO fd = this.getRemoteManagerProfile().retrieveFamilyDoctor(this.id);
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listAllCAPs();
|
||||
FamilyDoctorTO fd = this.getRemoteManagerCommon().retrieveFamilyDoctor(this.id);
|
||||
|
||||
this.name = fd.getName();
|
||||
this.surname = fd.getName();
|
||||
|
||||
Reference in New Issue
Block a user