This commit is contained in:
Roberto Orden Erena
2019-12-15 19:45:22 +01:00
40 changed files with 456 additions and 965 deletions

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <ui:define name="content">
@@ -9,24 +10,29 @@
<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" />
<div class="ui-g-8 ui-md-8"> <div class="ui-g-8 ui-md-8">
<p:panel id="ErrorPanel" header="Se ha producido un error inesperado"> <p:panel id="ErrorPanel">
<f:facet name="header">
<p:outputLabel value="Se ha producido un error de autorización" rendered="#{param.type == 'auth'}" />
<p:outputLabel value="Se ha producido un error desconocido" rendered="#{param.type == null}" />
</f:facet>
<div class="ui-g ui-fluid"> <div class="ui-g ui-fluid">
<div class="ui-g-12">La acción que estaba realizando a causado un error inesperado en el sistema. A continuación podrá ver un descripción detallada del error para que <div class="ui-g-12">La acción que estaba realizando a causado un error inesperado en el sistema. A continuación podrá ver un descripción detallada del error para que
pueda comunicarlo al equipo de soporte.</div> pueda comunicarlo al equipo de soporte.</div>
<div class="ui-g-12" style="font-weight: bold;"> <div class="ui-g-12" style="font-weight: bold;">
Descripción del error <!-- <p:outputLabel value="No está autorizado a acceder a la página solicitada. Por favor, utilice el menú principal de la aplicación." rendered="#{param.type == 'auth'}" /> -->
<!-- <p:outputLabel value="Se ha producido un error desconocido. Si vuelve a repetirse, por favor, contacte con el equipo de soporte." rendered="#{param.type == null}" /> -->
</div> </div>
<div class="ui-g-12"> <div class="ui-g-12">
<h:messages fatalClass="ErrorMessage" showDetail="true" showSummary="true" globalOnly="true" /> <p:messages id="errorMessage" showDetail="true" closable="false" autoupdate="true" showSummary="true" showIcon="true" />
</div> </div>
<div class="ui-g-5" /> <div class="ui-g-4" />
<div class="ui-g-2"> <div class="ui-g-4">
<p:button value="Ir a la página principal" outcome="home" icon="pi pi-home" /> <p:button value="Ir a la página principal" outcome="home" icon="pi pi-home" />
</div> </div>
<div class="ui-g-5" /> <div class="ui-g-4" />
</div> </div>
</p:panel> </p:panel>
</div> </div>

View File

@@ -33,7 +33,7 @@
</div> </div>
<hr /> <hr />
<div id="menuDiv"> <div id="menuDiv">
<p:growl id="messages" sticky="false" showDetail="true" life="15000" /> <p:growl id="messages" globalOnly="true" sticky="false" showDetail="true" life="15000" />
<p:ajaxStatus style="width:32px; height:32px; position:fixed; right:32px; bottom:32px"> <p:ajaxStatus style="width:32px; height:32px; position:fixed; right:32px; bottom:32px">
<f:facet name="start"> <f:facet name="start">
<i id="loginSpin" class="pi pi-spin pi-spinner" style="font-size: 3em"></i> <i id="loginSpin" class="pi pi-spin pi-spinner" style="font-size: 3em"></i>

View File

@@ -1,39 +0,0 @@
<?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"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="../header.xhtml">
<ui:define name="content">
<h:form id="frmRegisterUser">
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
<p:panel id="DatosPersonales" header="Añadir un nuevo médico de familia">
<div class="ui-g ui-fluid">
<div class="ui-g-2 ui-md-2">
<p:outputLabel value="Campo1:" for="campo1" />
</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" />
</div>
<div class="ui-g-6 ui-md-6">
<p:message for="campo1" display="text" />
</div>
<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="Guardar" update="mesgs" 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>
</div>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</html>

View File

@@ -1,38 +0,0 @@
<?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"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="../header.xhtml">
<ui:define name="content">
<h:form id="frmRegisterUser">
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
<p:panel id="DatosPersonales" header="Añadir un nuevo paciente">
<div class="ui-g ui-fluid">
<div class="ui-g-2 ui-md-2">
<p:outputLabel value="Campo1:" for="campo1" />
</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" />
</div>
<div class="ui-g-6 ui-md-6">
<p:message for="campo1" display="text" />
</div>
<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="Guardar" update="mesgs" 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>
</div>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</html>

View File

@@ -1,37 +0,0 @@
<?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"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="../header.xhtml">
<ui:define name="content">
<h:form id="frmRegisterUser">
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
<p:panel id="DatosPersonales" header="Añadir un nuevo médico especialista">
<div class="ui-g ui-fluid">
<div class="ui-g-2 ui-md-2">
<p:outputLabel value="Campo1:" for="campo1" />
</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" />
</div>
<div class="ui-g-6 ui-md-6">
<p:message for="campo1" display="text" />
</div>
<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="Guardar" update="mesgs" 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>
</div>
</p:panel>
</h:form>
</ui:define> </ui:composition>
</html>

View File

@@ -47,7 +47,7 @@
itemLabel="#{fd.displayName}" itemValue="#{fd}" forceSelection="true" requiredMessage="Por favor, selecciona un médico de familia"> itemLabel="#{fd.displayName}" itemValue="#{fd}" forceSelection="true" requiredMessage="Por favor, selecciona un médico de familia">
<o:converter converterId="omnifaces.ListConverter" list="#{ChangeFD.familyDoctorList}" /> <o:converter converterId="omnifaces.ListConverter" list="#{ChangeFD.familyDoctorList}" />
<p:column headerText="Num. Prof."> <p:column headerText="Num. Prof.">
<h:outputText value="#{fd.id}" /> <h:outputText value="#{fd.professionalNumber}" />
</p:column> </p:column>
<p:column headerText="Nombre"> <p:column headerText="Nombre">
<h:outputText value="#{fd.name}" /> <h:outputText value="#{fd.name}" />

View File

@@ -61,7 +61,7 @@
*/ */
} }
</h:outputScript> </h:outputScript>
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" /> <p:messages id="mesgs" globalOnly="true" showDetail="true" closable="true" autoupdate="true" />
<p:panel id="tipoUsuario" header="Especifique el tipo de usuario que desea registrarse"> <p:panel id="tipoUsuario" header="Especifique el tipo de usuario que desea registrarse">
<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">
@@ -83,10 +83,12 @@
<p:outputLabel value="NIF:" for="nif" /> <p:outputLabel value="NIF:" for="nif" />
</div> </div>
<div class="ui-g-4 ui-md-4"> <div class="ui-g-4 ui-md-4">
<p:inputText id="nif" value="#{RegisterUser.nif}" validator="nifValidator" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF" /> <p:inputText id="nif" value="#{RegisterUser.nif}" validator="nifValidator" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF">
<p:ajax event="blur" update="nifmsg" listener="#{RegisterUser.hadleNIFValueChange}" />
</p:inputText>
</div> </div>
<div class="ui-g-6 ui-md-6"> <div class="ui-g-6 ui-md-6">
<p:message for="nif" display="text" showDetail="true" showSummary="true" /> <p:message id="nifmsg" for="nif" />
</div> </div>
<div class="ui-g-2 ui-md-2"> <div class="ui-g-2 ui-md-2">
@@ -114,12 +116,12 @@
</div> </div>
<div class="ui-g-4 ui-md-4"> <div class="ui-g-4 ui-md-4">
<p:inputText id="email" value="#{RegisterUser.email}" required="true" maxlength="120" validator="emailValidator" <p:inputText id="email" value="#{RegisterUser.email}" required="true" maxlength="120" validator="emailValidator"
validatorMessage="La dirección #{RegisterUser.email} no es válida" requiredMessage="Por favor, especifique su correo electrónico"> validatorMessage="La dirección de correo electrónico #{RegisterUser.email} no es válida" requiredMessage="Por favor, especifique su correo electrónico">
<f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" /> <f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
</p:inputText> </p:inputText>
</div> </div>
<div class="ui-g-6 ui-md-6"> <div class="ui-g-6 ui-md-6">
<p:message for="email" display="text" showDetail="true" showSummary="true" /> <p:message for="email" />
</div> </div>
<div class="ui-g-2 ui-md-2"> <div class="ui-g-2 ui-md-2">
<p:outputLabel value="Contraseña" for="password" /> <p:outputLabel value="Contraseña" for="password" />
@@ -148,8 +150,8 @@
<p:outputLabel value="Centro:" for="selPHC" /> <p:outputLabel value="Centro:" for="selPHC" />
</div> </div>
<div class="ui-g-4 ui-md-4"> <div class="ui-g-4 ui-md-4">
<p:autoComplete id="selPHC" dropdown="true" value="#{RegisterUser.primaryHealthCareCenter}" completeMethod="#{RegisterUser.completePrimaryHealCareCenter}" var="phc" <p:autoComplete id="selPHC" dropdown="true" required="true" value="#{RegisterUser.primaryHealthCareCenter}" completeMethod="#{RegisterUser.completePrimaryHealCareCenter}"
itemLabel="#{phc.displayName}" itemValue="#{phc}" forceSelection="true" requiredMessage="Por favor, selecciona un nuevo centro de antención primaria"> var="phc" itemLabel="#{phc.displayName}" itemValue="#{phc}" forceSelection="true" requiredMessage="Por favor, selecciona un nuevo centro de antención primaria">
<o:converter converterId="omnifaces.ListConverter" list="#{RegisterUser.phcList}" /> <o:converter converterId="omnifaces.ListConverter" list="#{RegisterUser.phcList}" />
<p:column headerText="Nombre"> <p:column headerText="Nombre">
<h:outputText value="#{phc.name}" /> <h:outputText value="#{phc.name}" />
@@ -169,7 +171,7 @@
<p:outputLabel value="Especialidad médica:" for="selMS" /> <p:outputLabel value="Especialidad médica:" for="selMS" />
</div> </div>
<div class="ui-g-4 ui-md-4"> <div class="ui-g-4 ui-md-4">
<p:autoComplete id="selMS" dropdown="true" value="#{RegisterUser.medicalSpecialty}" completeMethod="#{RegisterUser.completeMedicalSpecialty}" var="ms" <p:autoComplete id="selMS" dropdown="true" required="true" value="#{RegisterUser.medicalSpecialty}" completeMethod="#{RegisterUser.completeMedicalSpecialty}" var="ms"
itemLabel="#{ms.displayName}" itemValue="#{ms}" forceSelection="true" requiredMessage="Por favor, selecciona una especialidad médica"> itemLabel="#{ms.displayName}" itemValue="#{ms}" forceSelection="true" requiredMessage="Por favor, selecciona una especialidad médica">
<o:converter converterId="omnifaces.ListConverter" list="#{RegisterUser.medicalSpecialtiesList}" /> <o:converter converterId="omnifaces.ListConverter" list="#{RegisterUser.medicalSpecialtiesList}" />
<p:column headerText="Nombre"> <p:column headerText="Nombre">

View File

@@ -1,38 +0,0 @@
<?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"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="../header.xhtml">
<ui:define name="content">
<h:form id="frmRegisterUser">
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
<p:panel id="DatosPersonales" header="Consultar datos de médico de familia">
<div class="ui-g ui-fluid">
<div class="ui-g-2 ui-md-2">
<p:outputLabel value="Campo1:" for="campo1" />
</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" />
</div>
<div class="ui-g-6 ui-md-6">
<p:message for="campo1" display="text" />
</div>
<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="Guardar" update="mesgs" 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>
</div>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</html>

View File

@@ -1,38 +0,0 @@
<?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"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="../header.xhtml">
<ui:define name="content">
<h:form id="frmRegisterUser">
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
<p:panel id="DatosPersonales" header="Consultar datos de paciente">
<div class="ui-g ui-fluid">
<div class="ui-g-2 ui-md-2">
<p:outputLabel value="Campo1:" for="campo1" />
</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" />
</div>
<div class="ui-g-6 ui-md-6">
<p:message for="campo1" display="text" />
</div>
<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="Guardar" update="mesgs" 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>
</div>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</html>

View File

@@ -1,38 +0,0 @@
<?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"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="../header.xhtml">
<ui:define name="content">
<h:form id="frmRegisterUser">
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
<p:panel id="DatosPersonales" header="Consultar datos de especialista">
<div class="ui-g ui-fluid">
<div class="ui-g-2 ui-md-2">
<p:outputLabel value="Campo1:" for="campo1" />
</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" />
</div>
<div class="ui-g-6 ui-md-6">
<p:message for="campo1" display="text" />
</div>
<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="Guardar" update="mesgs" 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>
</div>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</html>

View File

@@ -1,39 +0,0 @@
<?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"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="../header.xhtml">
<ui:define name="content">
<h:form id="frmRegisterUser">
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
<p:panel id="DatosPersonales" header="Actualizar médico de familia">
<div class="ui-g ui-fluid">
<div class="ui-g-2 ui-md-2">
<p:outputLabel value="Campo1:" for="campo1" />
</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" />
</div>
<div class="ui-g-6 ui-md-6">
<p:message for="campo1" display="text" />
</div>
<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="Guardar" update="mesgs" 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>
</div>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</html>

View File

@@ -1,39 +0,0 @@
<?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"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="../header.xhtml">
<ui:define name="content">
<h:form id="frmRegisterUser">
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
<p:panel id="DatosPersonales" header="Actualizar paciente">
<div class="ui-g ui-fluid">
<div class="ui-g-2 ui-md-2">
<p:outputLabel value="Campo1:" for="campo1" />
</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" />
</div>
<div class="ui-g-6 ui-md-6">
<p:message for="campo1" display="text" />
</div>
<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="Guardar" update="mesgs" 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>
</div>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</html>

View File

@@ -31,7 +31,7 @@
<p:outputLabel value="Número de Profesional:" rendered="#{UpdateProfile.userTypeDoctor}" for="cipCode" /> <p:outputLabel value="Número de Profesional:" rendered="#{UpdateProfile.userTypeDoctor}" for="cipCode" />
</div> </div>
<div class="ui-g-4 ui-md-4"> <div class="ui-g-4 ui-md-4">
<p:inputText id="cipCode" value="#{UpdateProfile.cipCode}" disabled="true" required="true" requiredMessage="Es necesario un código de identificación" /> <p:inputText id="cipCode" value="#{UpdateProfile.cipCode}" readonly="true" required="true" requiredMessage="Es necesario un código de identificación" />
</div> </div>
<div class="ui-g-6 ui-md-6"> <div class="ui-g-6 ui-md-6">
<p:message for="cipCode" display="text" /> <p:message for="cipCode" display="text" />
@@ -41,10 +41,12 @@
<p:outputLabel value="NIF:" for="nif" /> <p:outputLabel value="NIF:" for="nif" />
</div> </div>
<div class="ui-g-4 ui-md-4"> <div class="ui-g-4 ui-md-4">
<p:inputText id="nif" value="#{UpdateProfile.nif}" validator="nifValidator" required="true" maxlength="50" requiredMessage="Por favor, indque su NIF" /> <p:inputText id="nif" value="#{UpdateProfile.nif}" validator="nifValidator" required="true" maxlength="50" requiredMessage="Por favor, indque su NIF">
<p:ajax event="blur" update="nifmsg" listener="#{UpdateProfile.hadleNIFValueChange}" />
</p:inputText>
</div> </div>
<div class="ui-g-6 ui-md-6"> <div class="ui-g-6 ui-md-6">
<p:message for="nif" display="text" /> <p:message id="nifmsg" for="nif" display="text" />
</div> </div>
<div class="ui-g-2 ui-md-2"> <div class="ui-g-2 ui-md-2">
@@ -71,8 +73,8 @@
<p:outputLabel value="Correo electrónico:" for="email" /> <p:outputLabel value="Correo electrónico:" for="email" />
</div> </div>
<div class="ui-g-4 ui-md-4"> <div class="ui-g-4 ui-md-4">
<p:inputText id="email" value="#{UpdateProfile.email}" required="true" maxlength="120" validator="emailValidator" validatorMessage="La dirección #{RegisterUser.email} no es válida" <p:inputText id="email" value="#{UpdateProfile.email}" required="true" maxlength="120" validator="emailValidator"
requiredMessage="Por favor, especifique su correo electrónico"> validatorMessage="La dirección #{RegisterUser.email} no es válida" requiredMessage="Por favor, especifique su correo electrónico">
<f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" /> <f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
</p:inputText> </p:inputText>
</div> </div>
@@ -156,11 +158,11 @@
<p:outputLabel value="Médico de familia:" for="FamilyDoc" /> <p:outputLabel value="Médico de familia:" for="FamilyDoc" />
</div> </div>
<div class="ui-g-4 ui-md-4"> <div class="ui-g-4 ui-md-4">
<p:autoComplete id="FamilyDoc" disabled="true" dropdown="true" required="true" value="#{UpdateProfile.familyDoctor}" completeMethod="#{UpdateProfile.completeFamilyDoctor}" <p:autoComplete id="FamilyDoc" readonly="true" dropdown="true" required="true" value="#{UpdateProfile.familyDoctor}" completeMethod="#{UpdateProfile.completeFamilyDoctor}"
var="fd" itemLabel="#{fd.displayName}" itemValue="#{fd}" forceSelection="true" requiredMessage="Por favor, selecciona un médico de familia"> var="fd" itemLabel="#{fd.displayName}" itemValue="#{fd}" forceSelection="true" requiredMessage="Por favor, selecciona un médico de familia">
<o:converter converterId="omnifaces.ListConverter" list="#{UpdateProfile.familyDoctorList}" /> <o:converter converterId="omnifaces.ListConverter" list="#{UpdateProfile.familyDoctorList}" />
<p:column headerText="Num. Prof."> <p:column headerText="Num. Prof.">
<h:outputText value="#{fd.id}" /> <h:outputText value="#{fd.professionalNumber}" />
</p:column> </p:column>
<p:column headerText="Nombre"> <p:column headerText="Nombre">
<h:outputText value="#{fd.name}" /> <h:outputText value="#{fd.name}" />

View File

@@ -1,38 +0,0 @@
<?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"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="../header.xhtml">
<ui:define name="content">
<h:form id="frmRegisterUser">
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
<p:panel id="DatosPersonales" header="Consultar médico especialista">
<div class="ui-g ui-fluid">
<div class="ui-g-2 ui-md-2">
<p:outputLabel value="Campo1:" for="campo1" />
</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" />
</div>
<div class="ui-g-6 ui-md-6">
<p:message for="campo1" display="text" />
</div>
<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="Guardar" update="mesgs" 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>
</div>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</html>

View File

@@ -86,7 +86,7 @@ public class FamilyDoctorTO implements Serializable {
} }
public String getDisplayName() { public String getDisplayName() {
return String.format("[%d] %s %s", this.id, this.name, this.surname); return String.format("[%s] %s %s", this.professionalNumber, this.name, this.surname);
} }
public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() { public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() {

View File

@@ -90,6 +90,10 @@ public class PatientTO implements Serializable {
this.id = id; this.id = id;
} }
public String getDisplayName() {
return String.format("[%s] %s %s", this.personalIdentificationCode, this.name, this.surname);
}
public FamilyDoctorTO getFamilyDoctor() { public FamilyDoctorTO getFamilyDoctor() {
return familyDoctor; return familyDoctor;
} }

View File

@@ -85,6 +85,10 @@ public class SpecialistDoctorTO implements Serializable {
this.id = id; this.id = id;
} }
public String getDisplayName() {
return String.format("[%s] %s %s", this.professionalNumber, this.name, this.surname);
}
public MedicalSpecialtyTO getMedicalSpecialty() { public MedicalSpecialtyTO getMedicalSpecialty() {
return medicalSpecialty; return medicalSpecialty;
} }

View File

@@ -188,7 +188,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
ms = sd.getMedicalSpecialty(); ms = sd.getMedicalSpecialty();
nestedProps--; nestedProps--;
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), this.getPOJOforMedicalSpecialtyJPA(ms)); sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(),
this.getPOJOforMedicalSpecialtyJPA(ms));
} }
return sdTO; return sdTO;
@@ -203,7 +204,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
phc = fd.getPrimaryHealthCareCenter(); phc = fd.getPrimaryHealthCareCenter();
nestedProps--; nestedProps--;
fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), this.getPOJOforPrimaryHealthCareCenterJPA(phc)); fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(),
this.getPOJOforPrimaryHealthCareCenterJPA(phc));
} }
return fdTO; return fdTO;
@@ -218,7 +220,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
fd = pat.getFamilyDoctor(); fd = pat.getFamilyDoctor();
nestedProps--; nestedProps--;
paTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), this.getPOJOforFamilyDoctorJPA(fd, nestedProps)); paTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(),
this.getPOJOforFamilyDoctorJPA(fd, nestedProps));
} }
return paTO; return paTO;
@@ -229,30 +232,54 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
return this.getPOJOforPatientJPA(entman.find(PatientJPA.class, patientId), 1); return this.getPOJOforPatientJPA(entman.find(PatientJPA.class, patientId), 1);
} }
public PatientTO findPatientByCode(String code) {
public PatientJPA findPatientByCode(String code) {
TypedQuery<PatientJPA> query = entman.createQuery("from PatientJPA pat where pat.personalIdentificationCode=:code", PatientJPA.class); TypedQuery<PatientJPA> query = entman.createQuery("from PatientJPA pat where pat.personalIdentificationCode=:code", PatientJPA.class);
query.setMaxResults(1);
query.setParameter("code", code); query.setParameter("code", code);
List<PatientJPA> results = query.getResultList(); List<PatientJPA> results = query.getResultList();
if (results.size() > 0) if (results.size() > 0)
return results.get(0); return this.getPOJOforPatientJPA(results.get(0), 1);
else else
return null; } return null;
}
public PatientTO findPatientByNif(String searchValue) {
TypedQuery<PatientJPA> query = entman.createQuery("from PatientJPA pat where pat.nif=:nif", PatientJPA.class);
query.setMaxResults(1);
query.setParameter("nif", searchValue);
List<PatientJPA> results = query.getResultList();
if (results.size() > 0)
return this.getPOJOforPatientJPA(results.get(0), 1);
else
return null;
}
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId) { public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId) {
return this.getPOJOforFamilyDoctorJPA(entman.find(FamilyDoctorJPA.class, ProfessionalNumberId), 1); return this.getPOJOforFamilyDoctorJPA(entman.find(FamilyDoctorJPA.class, ProfessionalNumberId), 1);
} }
public FamilyDoctorJPA findFamilyDoctorByCode(String code) { public FamilyDoctorTO findFamilyDoctorByCode(String code) {
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.professionalNumber=:code", FamilyDoctorJPA.class); TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.professionalNumber=:code", FamilyDoctorJPA.class);
query.setParameter("code", code); query.setParameter("code", code);
List<FamilyDoctorJPA> results = query.getResultList(); List<FamilyDoctorJPA> results = query.getResultList();
if (results.size() > 0) if (results.size() > 0)
return results.get(0); return this.getPOJOforFamilyDoctorJPA(results.get(0), 1);
else
return null;
}
public FamilyDoctorTO findFamilyDoctorByNif(String searchValue) {
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.nif=:nif", FamilyDoctorJPA.class);
query.setMaxResults(1);
query.setParameter("nif", searchValue);
List<FamilyDoctorJPA> results = query.getResultList();
if (results.size() > 0)
return this.getPOJOforFamilyDoctorJPA(results.get(0), 1);
else else
return null; return null;
} }
@@ -261,14 +288,26 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
return this.getPOJOforSpecialistDoctorJPA(entman.find(SpecialistDoctorJPA.class, ProfessionalNumberId), 1); return this.getPOJOforSpecialistDoctorJPA(entman.find(SpecialistDoctorJPA.class, ProfessionalNumberId), 1);
} }
public SpecialistDoctorJPA findSpecialistDoctorByCode(String code) { public SpecialistDoctorTO findSpecialistDoctorByCode(String code) {
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.professionalNumber=:code", SpecialistDoctorJPA.class); TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.professionalNumber=:code", SpecialistDoctorJPA.class);
query.setParameter("code", code); query.setParameter("code", code);
List<SpecialistDoctorJPA> results = query.getResultList(); List<SpecialistDoctorJPA> results = query.getResultList();
if (results.size() > 0) if (results.size() > 0)
return results.get(0); return this.getPOJOforSpecialistDoctorJPA(results.get(0), 1);
else
return null;
}
public SpecialistDoctorTO findSpecialistDoctorByNif(String searchValue) {
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.nif=:nif", SpecialistDoctorJPA.class);
query.setMaxResults(1);
query.setParameter("nif", searchValue);
List<SpecialistDoctorJPA> results = query.getResultList();
if (results.size() > 0)
return this.getPOJOforSpecialistDoctorJPA(results.get(0), 1);
else else
return null; return null;
} }

View File

@@ -44,15 +44,21 @@ public interface CommonFacadeLocal {
public PatientTO findPatientById(int patientId); public PatientTO findPatientById(int patientId);
public PatientJPA findPatientByCode(String code); public PatientTO findPatientByCode(String code);
public PatientTO findPatientByNif(String searchValue);
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId); public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId);
public FamilyDoctorJPA findFamilyDoctorByCode(String code); public FamilyDoctorTO findFamilyDoctorByCode(String code);
public FamilyDoctorTO findFamilyDoctorByNif(String searchValue);
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId); public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId);
public SpecialistDoctorJPA findSpecialistDoctorByCode(String code); public SpecialistDoctorTO findSpecialistDoctorByCode(String code);
public SpecialistDoctorTO findSpecialistDoctorByNif(String searchValue);
public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms); public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms);

View File

@@ -42,14 +42,20 @@ public interface CommonFacadeRemote {
public PatientTO findPatientById(int patientId); public PatientTO findPatientById(int patientId);
public PatientJPA findPatientByCode(String code); public PatientTO findPatientByCode(String code);
public PatientTO findPatientByNif(String searchValue);
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId); public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId);
public FamilyDoctorJPA findFamilyDoctorByCode(String code); public FamilyDoctorTO findFamilyDoctorByCode(String code);
public FamilyDoctorTO findFamilyDoctorByNif(String searchValue);
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId); public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId);
public SpecialistDoctorJPA findSpecialistDoctorByCode(String code); public SpecialistDoctorTO findSpecialistDoctorByCode(String code);
public SpecialistDoctorTO findSpecialistDoctorByNif(String searchValue);
} }

View File

@@ -41,7 +41,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
} }
private String getNextPersonalIdentificationCode() { private String getNextPersonalIdentificationCode() {
Query q = entman.createNativeQuery("select nextval('myhealth.profesionalnumber')"); Query q = entman.createNativeQuery("select nextval('myhealth.codigoidentificacionpaciente')");
return Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX.concat(String.valueOf(q.getSingleResult())); return Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX.concat(String.valueOf(q.getSingleResult()));
} }

View File

@@ -5,15 +5,15 @@ import javax.ejb.Stateless;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
import TO.FamilyDoctorTO;
import TO.LoggedUserTO; import TO.LoggedUserTO;
import TO.PatientTO;
import TO.SpecialistDoctorTO;
import common.Constants; import common.Constants;
import common.HashUtils; import common.HashUtils;
import common.UserType; import common.UserType;
import ejb.common.CommonFacadeLocal; import ejb.common.CommonFacadeLocal;
import jpa.AdministratorJPA; import jpa.AdministratorJPA;
import jpa.FamilyDoctorJPA;
import jpa.PatientJPA;
import jpa.SpecialistDoctorJPA;
/** /**
* *
@@ -61,20 +61,20 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
if (userCode.startsWith(Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX)) { if (userCode.startsWith(Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX)) {
// Si el identificador de usuario es de tipo paciente, intentamos realizar el // Si el identificador de usuario es de tipo paciente, intentamos realizar el
// login. // login.
PatientJPA pat = this.commonServices.findPatientByCode(userCode); PatientTO pat = this.commonServices.findPatientByCode(userCode);
if (pat != null) { if (pat != null) {
usr = new LoggedUserTO(String.valueOf(pat.getId()), pat.getName(), pat.getPassword(), UserType.PATIENT); usr = new LoggedUserTO(String.valueOf(pat.getId()), pat.getName(), pat.getPassword(), UserType.PATIENT);
} }
} else if (userCode.startsWith(Constants.PROFESSIONAL_NUMBER_PREFIX)) { } else if (userCode.startsWith(Constants.PROFESSIONAL_NUMBER_PREFIX)) {
// Si el identificador de usuario es de tipo profesional, intentamos realizar el // Si el identificador de usuario es de tipo profesional, intentamos realizar el
// login, primero como médico de familia, después como especialista // login, primero como médico de familia, después como especialista
FamilyDoctorJPA fd = this.commonServices.findFamilyDoctorByCode(userCode); FamilyDoctorTO fd = this.commonServices.findFamilyDoctorByCode(userCode);
if (fd != null) { if (fd != null) {
usr = new LoggedUserTO(String.valueOf(fd.getId()), fd.getName(), fd.getPassword(), UserType.FAMILY_DOCTOR); usr = new LoggedUserTO(String.valueOf(fd.getId()), fd.getName(), fd.getPassword(), UserType.FAMILY_DOCTOR);
} else { } else {
// No era un código de médico de familia, intenamos logearlo como especialista // No era un código de médico de familia, intenamos logearlo como especialista
SpecialistDoctorJPA sd = this.commonServices.findSpecialistDoctorByCode(userCode); SpecialistDoctorTO sd = this.commonServices.findSpecialistDoctorByCode(userCode);
if (sd != null) { if (sd != null) {
usr = new LoggedUserTO(String.valueOf(sd.getId()), sd.getName(), sd.getPassword(), UserType.SPECIALIST_DOCTOR); usr = new LoggedUserTO(String.valueOf(sd.getId()), sd.getName(), sd.getPassword(), UserType.SPECIALIST_DOCTOR);

View File

@@ -2,7 +2,11 @@
package managedbean.common; package managedbean.common;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.servlet.Filter; import javax.servlet.Filter;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
import javax.servlet.FilterConfig; import javax.servlet.FilterConfig;
@@ -14,6 +18,11 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.primefaces.model.menu.DefaultSeparator;
import org.primefaces.model.menu.DefaultSubMenu;
import common.UserType;
@WebFilter(filterName = "AuthFilter", urlPatterns = { "*.xhtml" }) @WebFilter(filterName = "AuthFilter", urlPatterns = { "*.xhtml" })
public class AuthorizationFilter implements Filter { public class AuthorizationFilter implements Filter {
@@ -34,10 +43,100 @@ public class AuthorizationFilter implements Filter {
HttpSession ses = req.getSession(false); HttpSession ses = req.getSession(false);
String reqURI = req.getRequestURI(); String reqURI = req.getRequestURI();
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/RegisterUser.xhtml") >= 0 || reqURI.indexOf("/home.xhtml") >= 0 || reqURI.indexOf("/public/") >= 0
|| reqURI.contains("javax.faces.resource") || SessionUtils.isLogedIn(ses) == true) // Para recursos publicos permitimos el acceso
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/profile/RegisterUser.xhtml") >= 0 || reqURI.indexOf("/home.xhtml") >= 0
|| reqURI.indexOf("/error.xhtml") >= 0 || reqURI.indexOf("/public/") >= 0 || reqURI.contains("javax.faces.resource")) {
chain.doFilter(request, response); chain.doFilter(request, response);
else return;
}
// Si el usuario está logeado comprobamos si está autorizado a ver la página
// solicitada.
if (SessionUtils.isLogedIn(ses) == true) {
UserType tipoUsuario = SessionUtils.getUserType(ses);
boolean authorized = false;
switch (tipoUsuario) {
case ADMINISTRATOR:
if (reqURI.indexOf("/systemAdmin/ManageSpecialties") > 0)
authorized = true;
if (reqURI.indexOf("/systemAdmin/ManageHealthCareCenters") > 0)
authorized = true;
if (reqURI.indexOf("/systemAdmin/ListDoctorsByCenter") > 0)
authorized = true;
if (reqURI.indexOf("/visit/VisitView") > 0)
authorized = true;
if (reqURI.indexOf("/visit/UpdateVisit") > 0)
authorized = true;
break;
case PATIENT:
if (reqURI.indexOf("/visit/VisitView") > 0)
authorized = true;
if (reqURI.indexOf("/visit/AddVisit") > 0)
authorized = true;
if (reqURI.indexOf("/visit/UpdateVisit") > 0)
authorized = true;
if (reqURI.indexOf("/visit/CancelVisit") > 0)
authorized = true;
if (reqURI.indexOf("/medicaltest/AddQuestion") > 0)
authorized = true;
if (reqURI.indexOf("/medicaltest/ViewMedicalTest") > 0)
authorized = true;
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
authorized = true;
if (reqURI.indexOf("/medicaltest/SearchSpecialistBySpecialty") > 0)
authorized = true;
if (reqURI.indexOf("/profile/UpdateProfile") > 0)
authorized = true;
if (reqURI.indexOf("/profile/ChangeFamilyDoctor") > 0)
authorized = true;
break;
case FAMILY_DOCTOR:
if (reqURI.indexOf("/visit/VisitView") > 0)
authorized = true;
if (reqURI.indexOf("/visit/VisitAddResult") > 0)
authorized = true;
if (reqURI.indexOf("/visit/VisitViewSchedules") > 0)
authorized = true;
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
authorized = true;
if (reqURI.indexOf("/medicaltest/AnswerQuestion") > 0)
authorized = true;
if (reqURI.indexOf("/medicaltest/PendingQuestions") > 0)
authorized = true;
if (reqURI.indexOf("/medicaltest/ViewMedicalTest") > 0)
authorized = true;
if (reqURI.indexOf("/profile/UpdateProfile") > 0)
authorized = true;
if (reqURI.indexOf("/profile/ChangePrimaryHealthCareCenter") > 0)
authorized = true;
break;
case SPECIALIST_DOCTOR:
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
authorized = true;
if (reqURI.indexOf("/medicaltest/AddMedicalTest") > 0)
authorized = true;
if (reqURI.indexOf("/medicaltest/ViewMedicalTest") > 0)
authorized = true;
if (reqURI.indexOf("/medicaltest/AddImageToMedicalTest") > 0)
authorized = true;
if (reqURI.indexOf("/profile/UpdateProfile") > 0)
authorized = true;
break;
}
if (authorized == true) {
chain.doFilter(request, response);
return;
} else {
SessionUtils.addMessage(ses, FacesMessage.SEVERITY_ERROR, "No está autorizado a acceder a la página solicitada. Por favor, utilice el menú principal de la aplicación.", String.format("Se ha producido una expción de autorización, su usuario no está autorizado a acceder a la página: (%s).", reqURI));
resp.sendRedirect(req.getContextPath() + "/error.xhtml?type=auth");
return;
}
}
resp.sendRedirect(req.getContextPath() + "/login.xhtml"); resp.sendRedirect(req.getContextPath() + "/login.xhtml");
} catch (Exception e) { } catch (Exception e) {
System.out.println(e.getMessage()); System.out.println(e.getMessage());

View File

@@ -95,17 +95,29 @@ public class ManagedBeanBase {
protected void addFacesMessageKeep(FacesMessage.Severity severity, String summary, String detail) { protected void addFacesMessageKeep(FacesMessage.Severity severity, String summary, String detail) {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
this.addFacesMessage(FacesContext.getCurrentInstance(), severity, summary, detail); this.addFacesMessage(FacesContext.getCurrentInstance(), null, severity, summary, detail);
context.getExternalContext().getFlash().setKeepMessages(true); context.getExternalContext().getFlash().setKeepMessages(true);
} }
protected void addFacesMessage(FacesMessage.Severity severity, String summary, String detail) { protected void addFacesMessage(FacesMessage.Severity severity, String summary, String detail) {
this.addFacesMessage(FacesContext.getCurrentInstance(), severity, summary, detail); this.addFacesMessage(FacesContext.getCurrentInstance(), null, severity, summary, detail);
} }
protected void addFacesMessage(FacesContext context, FacesMessage.Severity severity, String summary, String detail) { protected void addFacesMessage(String clientId, FacesMessage.Severity severity, String summary, String detail) {
context.addMessage(null, new FacesMessage(severity, summary, detail)); this.addFacesMessage(FacesContext.getCurrentInstance(), clientId, severity, summary, detail);
}
protected void addFacesMessage(FacesContext context, String clientId, FacesMessage.Severity severity, String summary, String detail) {
this.addFacesMessage(context, clientId, new FacesMessage(severity, summary, detail));
}
protected void addFacesMessage(FacesMessage facesMsg, String clientId) {
this.addFacesMessage(FacesContext.getCurrentInstance(), clientId, facesMsg);
}
protected void addFacesMessage(FacesContext context, String clientId, FacesMessage facesMsg) {
context.addMessage(clientId, facesMsg);
} }
protected void manageException(Exception ex) { protected void manageException(Exception ex) {

View File

@@ -114,9 +114,9 @@ public class MenuMBean implements Serializable {
subMenu = new DefaultSubMenu("Gestionar perfil", "fa fa-gears"); subMenu = new DefaultSubMenu("Gestionar perfil", "fa fa-gears");
if (SessionUtils.isLogedIn() == false) { if (SessionUtils.isLogedIn() == false) {
subMenu.addElement(createMenuItem("Registro de usuario", "fa fa-user-plus", "/profile/RegisterUser", 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 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 médico", "fa fa-user-md", "/profile/AddFamilyDoctor", null));
subMenu.addElement(createMenuItem("Registro de especialista", "fa fa-user-md", "/profile/AddSpecialistDoctor", null)); // subMenu.addElement(createMenuItem("Registro de especialista", "fa fa-user-md", "/profile/AddSpecialistDoctor", null));
model.addElement(subMenu); model.addElement(subMenu);
} else { } else {

View File

@@ -1,6 +1,7 @@
package managedbean.common; package managedbean.common;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -14,6 +15,7 @@ public class SessionUtils {
public static final String SESSION_VAR_USERID = "userId"; public static final String SESSION_VAR_USERID = "userId";
public static final String SESSION_VAR_USERTYPE = "userType"; public static final String SESSION_VAR_USERTYPE = "userType";
public static final String SESSION_VAR_USER = "loggedOnUser"; public static final String SESSION_VAR_USER = "loggedOnUser";
public static final String SESSION_VAR_MESSAGE = "facesMessage";
public static HttpSession getSession() { public static HttpSession getSession() {
FacesContext ctx = FacesContext.getCurrentInstance(); FacesContext ctx = FacesContext.getCurrentInstance();
@@ -72,7 +74,10 @@ public class SessionUtils {
} }
public static UserType getUserType() { public static UserType getUserType() {
HttpSession session = getSession(); return getUserType(getSession());
}
public static UserType getUserType(HttpSession session) {
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE) != null) if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE) != null)
return UserType.class.cast(session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE)); return UserType.class.cast(session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE));
else else
@@ -86,4 +91,24 @@ public class SessionUtils {
else else
return null; return null;
} }
public static FacesMessage getMessage() {
HttpSession session = getSession();
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_MESSAGE) != null) {
FacesMessage msg = FacesMessage.class.cast(session.getAttribute(SessionUtils.SESSION_VAR_MESSAGE));
session.removeAttribute(SessionUtils.SESSION_VAR_MESSAGE);
return msg;
} else
return null;
}
public static void addMessage(FacesMessage.Severity severity, String summary, String detail) {
addMessage(getSession(), severity, summary, detail);
}
public static void addMessage(HttpSession session, FacesMessage.Severity severity, String summary, String detail) {
if (session != null)
session.setAttribute(SessionUtils.SESSION_VAR_MESSAGE, new FacesMessage(severity, summary, detail));
}
} }

View File

@@ -1,5 +1,11 @@
package managedbean.common; package managedbean.common;
import TO.FamilyDoctorTO;
import TO.PatientTO;
import TO.SpecialistDoctorTO;
import common.UserType;
import ejb.common.CommonFacadeRemote;
/*** /***
* *
* @author Marcos García Núñez (mgarcianun@uoc.edu) * @author Marcos García Núñez (mgarcianun@uoc.edu)
@@ -47,4 +53,51 @@ public class ValidationUtils {
return false; return false;
} }
/**
* Comprueba si un NIF existe para un tipo de usuario. * No se permite que el
* mismo NIF esté registrado como médico de familia y como especialista. * Se
* permite que el mismo NIF esté registrado como paciente y como médico (de
* familia o especialista)
*
* @param remoteSvc Servicio Remoto para recuperar datos.
* @param userType Tipo de usuario a comprobar
* @param nif NIF a comprobar.
* @param id Parámetro opcional, id del usuario actual (si encuentra el
* mismo nif y el usuario coincide no se devuelve la
* coincidencia)
* @return true si el NIF ya estaba registrado para un usuario diferente.
*/
public static boolean checkIfNifAlreadyRegistered(CommonFacadeRemote remoteSvc, UserType userType, String nif, Integer id) {
boolean nifExists = false;
switch (userType) {
case ADMINISTRATOR:
break;
case FAMILY_DOCTOR:
case SPECIALIST_DOCTOR:
FamilyDoctorTO fd = remoteSvc.findFamilyDoctorByNif(nif);
if (fd == null) {
// Si el nif no está en uso para un médico de familia, reivsamos si está en uso
// para los especialistas
SpecialistDoctorTO sd = remoteSvc.findSpecialistDoctorByNif(nif);
if (sd != null && (id == null || fd.getId() != id))
nifExists = true;
} else if (id == null || fd.getId() != id)
// Si se trata de un usuario diferente, entonces está repetido
nifExists = true;
break;
case PATIENT:
PatientTO pat = remoteSvc.findPatientByNif(nif);
// Si se trata de un usuario diferente, entonces está repetido
if (pat != null && (id == null || pat.getId() != id))
nifExists = true;
break;
}
return nifExists;
}
} }

View File

@@ -5,6 +5,7 @@ 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.inject.Named; import javax.inject.Named;
import common.UserType; import common.UserType;
@@ -16,7 +17,7 @@ import common.UserType;
*/ */
@Named("home") @Named("home")
@RequestScoped @RequestScoped
public class homeMBean implements Serializable { public class homeMBean extends ManagedBeanBase implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private boolean isLogedIn; private boolean isLogedIn;
@@ -31,6 +32,12 @@ public class homeMBean implements Serializable {
userName = SessionUtils.getUserName(); userName = SessionUtils.getUserName();
userId = SessionUtils.getUserId(); userId = SessionUtils.getUserId();
userType = SessionUtils.getUserType(); userType = SessionUtils.getUserType();
FacesMessage message = SessionUtils.getMessage();
if (message != null) {
this.addFacesMessage(message, null);
}
} }
public List<Theme> getThemes() { public List<Theme> getThemes() {

View File

@@ -1,29 +0,0 @@
package managedbean.profile;
import java.io.Serializable;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import managedbean.common.ManagedBeanBase;
/***
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
*
*/
@Named("AddFamilyDoctorMBean")
@RequestScoped
public class AddFamilyDoctorMBean extends ManagedBeanBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Constructor. Inicializa la conexión con el EJB Remoto
*
* @throws Exception
*/
public AddFamilyDoctorMBean() {
}
}

View File

@@ -1,112 +0,0 @@
package managedbean.profile;
import java.io.Serializable;
import javax.enterprise.context.RequestScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Named;
import managedbean.common.ManagedBeanBase;
/**
* ManagedBEan que gestiona la edición y actualización de una especialidad
* médica.
*
* @author mark
*
*/
@Named("addPatientMBean")
@RequestScoped
public class AddPatientMBean extends ManagedBeanBase implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private String nif;
private String name;
private String surname;
private String password;
private String passwordRepeat;
private String email;
private String primaryHealthCareCenter;
private String medicalSpecialty;
/**
* Constructor. Inicializa la conexión con el EJB Remoto
*
* @throws Exception
*/
public AddPatientMBean() {
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNif() {
return nif;
}
public void setNif(String nif) {
this.nif = nif;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public void save() {
FacesMessage msg;
try {
msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Alta realizada", "El usuario " + name + " " + surname + " se ha registrado correctamente.");
} catch (Exception e) {
msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Se ha producido un error inesperado: " + e.getLocalizedMessage());
}
FacesContext.getCurrentInstance().addMessage(null, msg);
}
public String getPasswordRepeat() {
return passwordRepeat;
}
public void setPasswordRepeat(String passwordRepeat) {
this.passwordRepeat = passwordRepeat;
}
}

View File

@@ -1,34 +0,0 @@
package managedbean.profile;
import java.io.Serializable;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import ejb.profile.ProfileFacadeRemote;
import managedbean.common.ManagedBeanBase;
/***
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
*
*/
@Named( "AddSpecialistDoctorMBean")
@RequestScoped
public class AddSpecialistDoctorMBean extends ManagedBeanBase implements Serializable {
private static final long serialVersionUID = 1L;
@EJB
private ProfileFacadeRemote remoteManager;
/**
* Constructor. Inicializa la conexión con el EJB Remoto
*
* @throws Exception
*/
public AddSpecialistDoctorMBean() {
}
}

View File

@@ -128,6 +128,11 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
return this.medicalSpecialitiesList; return this.medicalSpecialitiesList;
} }
public void hadleNIFValueChange() {
if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, null) == true)
this.addFacesMessage("frmRegisterUser:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
}
public boolean isPatient() { public boolean isPatient() {
return (this.userType == UserType.PATIENT); return (this.userType == UserType.PATIENT);
} }
@@ -199,6 +204,10 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido."); this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
error++; error++;
} }
if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, null) == true) {
this.addFacesMessage("frmRegisterUser:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
error++;
}
if (error == 0) { if (error == 0) {
try { try {

View File

@@ -1,50 +0,0 @@
package managedbean.profile;
import java.io.Serializable;
import java.util.Properties;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.naming.Context;
import javax.naming.InitialContext;
import ejb.profile.ProfileFacadeRemote;
import managedbean.common.ManagedBeanBase;
/***
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
*
*/
@Named( "ShowFamilyDoctorMBean")
@RequestScoped
public class ShowFamilyDoctorMBean extends ManagedBeanBase implements Serializable {
private static final long serialVersionUID = 1L;
@EJB
private ProfileFacadeRemote remoteManager;
/**
* Constructor. Inicializa la conexión con el EJB Remoto
*
* @throws Exception
*/
public ShowFamilyDoctorMBean() 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");
}
}

View File

@@ -1,49 +0,0 @@
package managedbean.profile;
import java.io.Serializable;
import java.util.Properties;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.naming.Context;
import javax.naming.InitialContext;
import ejb.profile.ProfileFacadeRemote;
import managedbean.common.ManagedBeanBase;
/***
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
*
*/
@Named("ShowPatientMBean")
@RequestScoped
public class ShowPatientMBean extends ManagedBeanBase implements Serializable {
private static final long serialVersionUID = 1L;
@EJB
private ProfileFacadeRemote remoteManager;
/**
* Constructor. Inicializa la conexión con el EJB Remoto
*
* @throws Exception
*/
public ShowPatientMBean() 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");
}
}

View File

@@ -1,50 +0,0 @@
package managedbean.profile;
import java.io.Serializable;
import java.util.Properties;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.naming.Context;
import javax.naming.InitialContext;
import ejb.profile.ProfileFacadeRemote;
import managedbean.common.ManagedBeanBase;
/***
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
*
*/
@Named( "ShowSpecialistDoctorMBean")
@RequestScoped
public class ShowSpecialistDoctorMBean extends ManagedBeanBase implements Serializable {
private static final long serialVersionUID = 1L;
@EJB
private ProfileFacadeRemote remoteManager;
/**
* Constructor. Inicializa la conexión con el EJB Remoto
*
* @throws Exception
*/
public ShowSpecialistDoctorMBean() 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");
}
}

View File

@@ -1,49 +0,0 @@
package managedbean.profile;
import java.io.Serializable;
import java.util.Properties;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.naming.Context;
import javax.naming.InitialContext;
import ejb.profile.ProfileFacadeRemote;
import managedbean.common.ManagedBeanBase;
/***
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
*
*/
@Named("UpdateFamilyDoctorMBean")
@RequestScoped
public class UpdateFamilyDoctorMBean extends ManagedBeanBase implements Serializable {
private static final long serialVersionUID = 1L;
@EJB
private ProfileFacadeRemote remoteManager;
/**
* Constructor. Inicializa la conexión con el EJB Remoto
*
* @throws Exception
*/
public UpdateFamilyDoctorMBean() 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");
}
}

View File

@@ -1,49 +0,0 @@
package managedbean.profile;
import java.io.Serializable;
import java.util.Properties;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.naming.Context;
import javax.naming.InitialContext;
import ejb.profile.ProfileFacadeRemote;
import managedbean.common.ManagedBeanBase;
/***
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
*
*/
@Named("UpdatePatientMBean")
@RequestScoped
public class UpdatePatientMBean extends ManagedBeanBase implements Serializable {
private static final long serialVersionUID = 1L;
@EJB
private ProfileFacadeRemote remoteManager;
/**
* Constructor. Inicializa la conexión con el EJB Remoto
*
* @throws Exception
*/
public UpdatePatientMBean() 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");
}
}

View File

@@ -172,6 +172,11 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
return this.medicalSpecialitiesList; return this.medicalSpecialitiesList;
} }
public void hadleNIFValueChange() {
if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, this.id) == true)
this.addFacesMessage("frmUpdateProfile:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
}
public List<FamilyDoctorTO> getFamilyDoctorList() { public List<FamilyDoctorTO> getFamilyDoctorList() {
return familyDoctorList; return familyDoctorList;
} }
@@ -261,6 +266,10 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido."); this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
error++; error++;
} }
if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, this.id) == true) {
this.addFacesMessage("frmUpdateProfile:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
error++;
}
if (changePassword == true) { if (changePassword == true) {
// el usuario queire cambiar el password Comprobamos que el password // el usuario queire cambiar el password Comprobamos que el password
// especificado coincide con el guardado // especificado coincide con el guardado

View File

@@ -1,49 +0,0 @@
package managedbean.profile;
import java.io.Serializable;
import java.util.Properties;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.naming.Context;
import javax.naming.InitialContext;
import ejb.profile.ProfileFacadeRemote;
import managedbean.common.ManagedBeanBase;
/***
*
* @author Marcos García Núñez (mgarcianun@uoc.edu)
*
*/
@Named("UpdateSpecialistDoctorMBean")
@RequestScoped
public class UpdateSpecialistDoctorMBean extends ManagedBeanBase implements Serializable {
private static final long serialVersionUID = 1L;
@EJB
private ProfileFacadeRemote remoteManager;
/**
* Constructor. Inicializa la conexión con el EJB Remoto
*
* @throws Exception
*/
public UpdateSpecialistDoctorMBean() 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");
}
}

View File

@@ -1,61 +1,84 @@
--Inserta usuarios administradores (contraseña Hash MD5 'admin' para todos) --Inserta usuarios administradores (contraseña Hash MD5 'admin' para todos)
insert into myhealth.administrator (email, password) values ('admin@example.com', '21232F297A57A5A743894A0E4A801FC3'); insert into myhealth.administrator (email, password) values
insert into myhealth.administrator (email, password) values ('marcos@example.com', '21232F297A57A5A743894A0E4A801FC3'); ('admin@example.com', '21232F297A57A5A743894A0E4A801FC3')
,('marcos@example.com', '21232F297A57A5A743894A0E4A801FC3');
-- Insertar Algunos centros médicos -- Insertar Algunos centros médicos
INSERT INTO myhealth.primaryhealthcarecenter(name, location) VALUES INSERT INTO myhealth.primaryhealthcarecenter(name, location) VALUES
('CENTRO SAUDE A DOBLADA',' CALLE RUA FAISAN S/N '), ('Centro Saude A Doblada',' Calle Rua Faisan S/N')
('CENTRO SAUDE BEMBRIVE',' CARRETERA BEMBRIVE 259 '), ,('Centro Saude Bembrive',' Carretera Bembrive 259')
('CENTRO SAUDE BOLIVIA',' CALLE PIZARRO 22 '), ,('Centro Saude Bolivia',' Calle Pizarro 22')
('CENTRO SAUDE CASCO VELLO',' PLAZA CONSTITUCION 7 '), ,('Centro Saude Casco Vello',' Plaza Constitucion 7')
('CENTRO SAUDE COIA',' CALLE PONTEAREAS S/N '), ,('Centro Saude Coia',' Calle Ponteareas S/N')
('CENTRO SAUDE COLMEIRO',' CALLE PINTOR COLMEIRO 11 '), ,('Centro Saude Colmeiro',' Calle Pintor Colmeiro 11')
('CENTRO SAUDE CORUXO',' CALLE RUA JOSE RIVAS CARRASQUEIRA S/N '), ,('Centro Saude Coruxo',' Calle Rua Jose Rivas Carrasqueira S/N')
('CENTRO SAUDE LAVADORES',' TRAVESIA BARREIRO 1 36 '), ,('Centro Saude Lavadores',' Travesia Barreiro 1 36')
('CENTRO SAUDE LOPEZ MORA',' CALLE LOPEZ MORA 54 '), ,('Centro Saude Lopez Mora',' Calle Lopez Mora 54')
('CENTRO SAUDE MATAMA',' CAMINO CAMIÑO BABIO-AS CARNEIRAS S/N '), ,('Centro Saude Matama',' Camino Camiño Babio-As Carneiras S/N')
('CENTRO SAUDE NICOLAS PEÑA',' CAMINO CAMIÑO REGUEIRO S/N '), ,('Centro Saude Nicolas Peña',' Camino Camiño Regueiro S/N')
('CENTRO SAUDE ROSALIA DE CASTRO-BEIRAMAR',' CALLE ROSALIA DE CASTRO 21 '), ,('Centro Saude Rosalia De Castro-Beiramar',' Calle Rosalia De Castro 21')
('CENTRO SAUDE RUA CUBA',' CALLE CUBA 10 '), ,('Centro Saude Rua Cuba',' Calle Cuba 10')
('CENTRO SAUDE SAN PAIO DE NAVIA',' CALLE POZA CABALO S/N '), ,('Centro Saude San Paio De Navia',' Calle Poza Cabalo S/N')
('CENTRO SAUDE SARDOMA',' CALLE RUA CANTEIRA DE BALIN 76 '), ,('Centro Saude Sardoma',' Calle Rua Canteira De Balin 76')
('CENTRO SAUDE TEIS',' CALLE ANGELA IGLESIAS REBOLLAR S/N '); ,('Centro Saude Teis',' Calle Angela Iglesias Rebollar S/N');
-- Inserta Especialidades médicas -- Inserta Especialidades médicas
insert into MyHealth.MedicalSpecialty(name, description) insert into MyHealth.MedicalSpecialty(name, description) values
values ('Alergologia','Especialidad médica de Alergologia'); ('Alergologia','Especialidad médica de Alergologia')
insert into MyHealth.MedicalSpecialty(name, description) ,('Cirugía cardiaca','Especialidad médica de Cirugía cardiaca')
values ('Cirugía cardiaca','Especialidad médica de Cirugía cardiaca'); ,('Cirugía general','Especialidad médica de Cirugía general')
insert into MyHealth.MedicalSpecialty(name, description) ,('Cirugía plastica','Especialidad médica de Cirugía plastica')
values ('Cirugía general','Especialidad médica de Cirugía general'); ,('Cirugía de mama','Especialidad médica de Cirugía de mama')
insert into MyHealth.MedicalSpecialty(name, description) ,('Cirugía maxilofacial','Especialidad médica de Cirugía maxilofacial')
values ('Cirugía plastica','Especialidad médica de Cirugía plastica'); ,('Cirugía vascular','Especialidad médica de Cirugía vascular')
insert into MyHealth.MedicalSpecialty(name, description) ,('Dermatología','Especialidad médica de Dermatología')
values ('Cirugía de mama','Especialidad médica de Cirugía de mama'); ,('Endocrinología y nutrición','Especialidad médica de Endocrinología y nutrición')
insert into MyHealth.MedicalSpecialty(name, description) ,('Gastroenterología- digestivo','Especialidad médica de Gastroenterología- digestivo')
values ('Cirugía maxilofacial','Especialidad médica de Cirugía maxilofacial'); ,('Neurocirugía','Especialidad médica de Neurocirugía')
insert into MyHealth.MedicalSpecialty(name, description) ,('Oftalmología','Especialidad médica de Oftalmología')
values ('Cirugía vascular','Especialidad médica de Cirugía vascular'); ,('Otorrinolaringologia','Especialidad médica de Otorrinolaringologia')
insert into MyHealth.MedicalSpecialty(name, description) ,('Oncología','Especialidad médica de Oncología')
values ('Dermatología','Especialidad médica de Dermatología'); ,('Pediatría','Especialidad médica de Pediatría');
insert into MyHealth.MedicalSpecialty(name, description)
values ('Endocrinología y nutrición','Especialidad médica de Endocrinología y nutrición'); -- Insertar médicos de familia
insert into MyHealth.MedicalSpecialty(name, description) INSERT INTO myhealth.familydoctor(professionalnumber, password, nif, surname, email, name, primaryhealthcarecenterid) VALUES
values ('Gastroenterología- digestivo','Especialidad médica de Gastroenterología- digestivo'); ('PRO#100','912EC803B2CE49E4A541068D495AB570','95874388S','Moran Ortiz', 'Xian@example.ecom','Xian', 1)
insert into MyHealth.MedicalSpecialty(name, description) ,('PRO#101','912EC803B2CE49E4A541068D495AB570','59546140Z','Zambrano Rivas', 'Belen@example.ecom','Belen', 2)
values ('Neurocirugía','Especialidad médica de Neurocirugía'); ,('PRO#102','912EC803B2CE49E4A541068D495AB570','16354100L','Cuevas Luque', 'Fernando@example.ecom','Fernando', 3)
insert into MyHealth.MedicalSpecialty(name, description) ,('PRO#103','912EC803B2CE49E4A541068D495AB570','32662259M','Becerra Muñiz', 'Luis@example.ecom','Luis', 4)
values ('Oftalmología','Especialidad médica de Oftalmología'); ,('PRO#104','912EC803B2CE49E4A541068D495AB570','70600712G','Aznar Silva', 'Ana@example.ecom','Ana', 5)
insert into MyHealth.MedicalSpecialty(name, description) ,('PRO#105','912EC803B2CE49E4A541068D495AB570','08003806J','Galvez Sancho', 'Alfonso@example.ecom','Alfonso', 6)
values ('Otorrinolaringologia','Especialidad médica de Otorrinolaringologia'); ,('PRO#106','912EC803B2CE49E4A541068D495AB570','19567288S','Criado Marti', 'Jordi@example.ecom','Jordi', 7)
insert into MyHealth.MedicalSpecialty(name, description) ,('PRO#107','912EC803B2CE49E4A541068D495AB570','95413653Q','Estevez Mena', 'Barbara@example.ecom','Barbara', 8)
values ('Oncología','Especialidad médica de Oncología'); ,('PRO#108','912EC803B2CE49E4A541068D495AB570','90914444K','Godoy Alcaide', 'Amalia@example.ecom','Amalia', 9)
insert into MyHealth.MedicalSpecialty(name, description) ,('PRO#109','912EC803B2CE49E4A541068D495AB570','05709869G','Lucas Wang', 'Carmelo@example.ecom','Carmelo', 10);
values ('Pediatría','Especialidad médica de Pediatría');
-- Insertar médicos especialistas
INSERT INTO myhealth.specialistdoctor(professionalnumber, password, nif, surname, email, name, medicalspecialtyid) VALUES
('PRO#110','912EC803B2CE49E4A541068D495AB570','87719252N','Vazquez Cruz', 'Luciano@example.ecom','Luciano', 1)
,('PRO#111','912EC803B2CE49E4A541068D495AB570','79412306E','Alcaide Mesa', 'Gregorio@example.ecom','Gregorio', 2)
,('PRO#112','912EC803B2CE49E4A541068D495AB570','45727688P','Herranz Soria', 'Candida@example.ecom','Candida', 3)
,('PRO#113','912EC803B2CE49E4A541068D495AB570','65061962E','Galvez Vives', 'Nora@example.ecom','Nora', 4)
,('PRO#114','912EC803B2CE49E4A541068D495AB570','07359870P','Rojas Alonso', 'Anton@example.ecom','Anton', 5)
,('PRO#115','912EC803B2CE49E4A541068D495AB570','14117403A','Lorente Carmona', 'Sheila@example.ecom','Sheila', 6)
,('PRO#116','912EC803B2CE49E4A541068D495AB570','79864477J','Gonzalo Bonet', 'Nicolas@example.ecom','Nicolas', 7)
,('PRO#117','912EC803B2CE49E4A541068D495AB570','22761129F','Bonet Ariza', 'Aroa@example.ecom','Aroa', 8)
,('PRO#118','912EC803B2CE49E4A541068D495AB570','99693813Z','Soria Singh', 'Cristian@example.ecom','Cristian', 9)
,('PRO#119','912EC803B2CE49E4A541068D495AB570','04431824T','Requena Calderon', 'Ferran@example.ecom','Ferran', 10)
,('PRO#120','912EC803B2CE49E4A541068D495AB570','27476123R','Angulo Zamora', 'Ana@example.ecom','Ana', 11);
--Insertar Pacientes
INSERT INTO myhealth.patient(personalidentificationcode, password, nif, surname, email, name, familydoctorid) VALUES
('PAT#100','912EC803B2CE49E4A541068D495AB570','97758900E','Singh Vila', 'Soledad@example.ecom','Soledad', 1)
,('PAT#101','912EC803B2CE49E4A541068D495AB570','Z9518183Y','Jimenez Merino', 'Ainhoa@example.ecom','Ainhoa', 2)
,('PAT#102','912EC803B2CE49E4A541068D495AB570','97758900E','Jesus Chen Barba', 'Abel@example.ecom','Abel', 3)
,('PAT#103','912EC803B2CE49E4A541068D495AB570','95014341F','Lorenzo Tapia Navas', 'Francisco@example.ecom','Francisco', 4)
,('PAT#104','912EC803B2CE49E4A541068D495AB570','17873499S','Gimenez Gutierrez', 'Teodora@example.ecom','Teodora', 5)
,('PAT#105','912EC803B2CE49E4A541068D495AB570','07320674G','Escobar Marquez', 'Jorge@example.ecom','Jorge', 6)
,('PAT#106','912EC803B2CE49E4A541068D495AB570','63888801E','Marin Reina', 'Marti@example.ecom','Marti', 7)
,('PAT#107','912EC803B2CE49E4A541068D495AB570','36676167E','Bosch Zapata', 'Abril@example.ecom','Abril', 8)
,('PAT#108','912EC803B2CE49E4A541068D495AB570','73569670F','Bosch Zapata', 'Esperanza@example.ecom','Esperanza', 9)
,('PAT#109','912EC803B2CE49E4A541068D495AB570','53986482P','Carretero Ayala', 'Eduardo@example.ecom','Eduardo', 10);
INSERT INTO myhealth.primaryhealthcarecenter(name, location)
VALUES ('Centro A', 'Descripción centro A');
INSERT INTO myhealth.primaryhealthcarecenter(name, location)
VALUES ('Centro Medico Azul', 'Descripción centro medico azul');
INSERT INTO myhealth.primaryhealthcarecenter(name, location)
VALUES ('Centro Medico 23', 'Descripción centro medico 23');