Compare commits
67 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fd9b3fbc2 | ||
|
|
a969e742d6 | ||
|
|
dab756a969 | ||
|
|
6f50dca04d | ||
|
|
9d05680313 | ||
|
|
6c24016662 | ||
|
|
369b3d032a | ||
|
|
c70a4c43cd | ||
|
|
68d6d4a160 | ||
|
|
167f52d062 | ||
|
|
7153a2bd31 | ||
|
|
04080056c4 | ||
|
|
d9dfbe2fc0 | ||
|
|
a45893292c | ||
|
|
59d13b3552 | ||
|
|
1eed84eed1 | ||
|
|
2fe3f77c8f | ||
|
|
9fa31c56b7 | ||
|
|
49eeccfc25 | ||
|
|
ac0b4e9704 | ||
|
|
81b962c50f | ||
|
|
cbe1d3dd55 | ||
|
|
20c445e200 | ||
|
|
45988b9c83 | ||
|
|
e8e06e3ec5 | ||
|
|
1614059eb3 | ||
|
|
f242fecb3d | ||
|
|
3aa971c8a2 | ||
|
|
f81e3011e8 | ||
|
|
52d9ed37e0 | ||
|
|
d57be9d95b | ||
|
|
ec6fa64eb6 | ||
|
|
0891d58146 | ||
|
|
7971350815 | ||
|
|
1c718c1142 | ||
|
|
79ace76c0c | ||
|
|
ebacc50ed1 | ||
|
|
db0bfeb41f | ||
|
|
d9ddc20779 | ||
|
|
68b3e990b9 | ||
|
|
b7a8d25f35 | ||
|
|
8171f761d3 | ||
|
|
1786711c14 | ||
|
|
423ab38a51 | ||
|
|
b12f3497fc | ||
|
|
2fbd8cb08f | ||
|
|
24617e7451 | ||
|
|
3026f7ca40 | ||
|
|
ee52770483 | ||
|
|
d224cdf5f2 | ||
|
|
4079c50f8a | ||
|
|
75ed5e2635 | ||
|
|
7e04274255 | ||
|
|
2d09aa8da8 | ||
|
|
10059aacdb | ||
|
|
3f681a7589 | ||
|
|
e80177be1a | ||
|
|
117feb7754 | ||
|
|
91faac6b63 | ||
|
|
4d6aedd863 | ||
|
|
8aa0db0777 | ||
|
|
7680a6acec | ||
|
|
ea142e1241 | ||
|
|
354560ab37 | ||
|
|
9e543045f9 | ||
|
|
4bb197a3c9 | ||
|
|
303b0abfa1 |
@@ -24,7 +24,7 @@
|
|||||||
</context-param>
|
</context-param>
|
||||||
<context-param>
|
<context-param>
|
||||||
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
|
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
|
||||||
<param-value>client</param-value>
|
<param-value>server</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
<context-param>
|
<context-param>
|
||||||
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
|
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
|
||||||
@@ -52,46 +52,11 @@
|
|||||||
<url-pattern>*.xhtml</url-pattern>
|
<url-pattern>*.xhtml</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<!-- Filters -->
|
|
||||||
<filter>
|
|
||||||
<filter-name>facesExceptionFilter</filter-name>
|
|
||||||
<filter-class>org.omnifaces.filter.FacesExceptionFilter</filter-class>
|
|
||||||
</filter>
|
|
||||||
|
|
||||||
<!-- Filter mappings -->
|
|
||||||
<filter-mapping>
|
|
||||||
<filter-name>facesExceptionFilter</filter-name>
|
|
||||||
<url-pattern>/*</url-pattern>
|
|
||||||
</filter-mapping>
|
|
||||||
|
|
||||||
<!-- Error pages mapping -->
|
<!-- Error pages mapping -->
|
||||||
<error-page>
|
|
||||||
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
|
|
||||||
<location>/error.xhtml?type=expired</location>
|
|
||||||
</error-page>
|
|
||||||
<error-page>
|
|
||||||
<exception-type>java.sql.SQLException</exception-type>
|
|
||||||
<exception-type>org.hibernate.exception.GenericJDBCException</exception-type>
|
|
||||||
<exception-type>java.net.ConnectException</exception-type>
|
|
||||||
<exception-type>javax.persistence.PersistenceException</exception-type>
|
|
||||||
<location>/error.xhtml?type=sql</location>
|
|
||||||
</error-page>
|
|
||||||
<error-page>
|
|
||||||
<exception-type>javax.persistence.PersistenceException</exception-type>
|
|
||||||
<location>/error.xhtml?type=runtime</location>
|
|
||||||
</error-page>
|
|
||||||
<error-page>
|
|
||||||
<exception-type>java.net.ConnectException</exception-type>
|
|
||||||
<location>/error.xhtml?type=sql</location>
|
|
||||||
</error-page>
|
|
||||||
<error-page>
|
<error-page>
|
||||||
<error-code>500</error-code>
|
<error-code>500</error-code>
|
||||||
<location>/error.xhtml</location>
|
<location>/error.xhtml</location>
|
||||||
</error-page>
|
</error-page>
|
||||||
<error-page>
|
|
||||||
<error-code>401</error-code>
|
|
||||||
<location>/error.xhtml?type=expired</location>
|
|
||||||
</error-page>
|
|
||||||
|
|
||||||
<session-config>
|
<session-config>
|
||||||
<session-timeout>30</session-timeout>
|
<session-timeout>30</session-timeout>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<!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" xmlns:o="http://omnifaces.org/ui">
|
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui" xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions" xmlns:of="http://omnifaces.org/functions">
|
||||||
|
|
||||||
<ui:composition template="./header.xhtml">
|
<ui:composition template="./header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
@@ -12,34 +12,43 @@
|
|||||||
<div class="ui-g-8 ui-md-8">
|
<div class="ui-g-8 ui-md-8">
|
||||||
<p:panel id="ErrorPanel">
|
<p:panel id="ErrorPanel">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<p:outputLabel rendered="#{param.type == 'sql'}" value="No se puede conectar con la base de datos" />
|
<p:outputLabel rendered="#{error.errorType == 'sql'}" value="No se puede conectar con la base de datos" />
|
||||||
<p:outputLabel rendered="#{param.type == 'auth'}" value="Se ha producido un error de autorización" />
|
<p:outputLabel rendered="#{error.errorType == 'auth'}" value="Se ha producido un error de autorización" />
|
||||||
<p:outputLabel rendered="#{param.type == 'expired'}" value="Su sesión ha caducado" />
|
<p:outputLabel rendered="#{error.errorType == 'expired'}" value="Su sesión ha caducado" />
|
||||||
<p:outputLabel rendered="#{param.type == 'runtime'}" value="Se producido un error en tiempo de ejecución" />
|
<p:outputLabel rendered="#{error.errorType == 'runtime'}" value="Se producido un error en tiempo de ejecución" />
|
||||||
<p:outputLabel rendered="#{param.type == '' or param.type == null}" value="Se ha producido un error desconocido" />
|
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-12">
|
||||||
<p:outputLabel rendered="#{param.type == 'sql'}"
|
<p:outputLabel rendered="#{error.errorType == 'sql'}"
|
||||||
value="No ha sido posible realizar una conexión con el servidor de base de datos subyante, o ha ocurrido un error grave cuando se intentaba realizar la conexión. Por favor contacte con el equipo de soporte." />
|
value="No ha sido posible realizar una conexión con el servidor de base de datos subyante, o ha ocurrido un error grave cuando se intentaba realizar la conexión. Por favor contacte con el equipo de soporte." />
|
||||||
<p:outputLabel rendered="#{param.type == 'auth'}"
|
<p:outputLabel rendered="#{error.errorType == 'auth'}"
|
||||||
value="No está autorizado a ver la url consultada. Por favor, vaya a la página principal y utilice el menú de la aplicación para acceder las funcionalidades disponibles." />
|
value="No está autorizado a ver la url consultada. Por favor, vaya a la página principal y utilice el menú de la aplicación para acceder las funcionalidades disponibles." />
|
||||||
<p:outputLabel rendered="#{param.type == 'expired'}" value="Su sesión ha caducado. Por favor, incie sesión de nuevo en el sistema." />
|
<p:outputLabel rendered="#{error.errorType == 'expired'}" value="Su sesión ha caducado. Por favor, incie sesión de nuevo en el sistema." />
|
||||||
<p:outputLabel rendered="#{param.type == 'runtime'}"
|
<p:outputLabel rendered="#{error.errorType == 'runtime'}"
|
||||||
value="Se ha producido un error en el servidor durante la ejecución de la última acción. Por favor, intentelo de nuevo o contacte con el equipo de soporte." />
|
value="Se ha producido un error en el servidor durante la ejecución de la última acción. Por favor, intentelo de nuevo o contacte con el equipo de soporte." />
|
||||||
<p:outputLabel rendered="#{param.type == '' or param.type == null}"
|
|
||||||
value="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>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-12">
|
||||||
<p:messages id="errorMessage" showDetail="true" closable="false" autoupdate="true" showSummary="true" showIcon="true" />
|
<p:messages id="errorMessage" showDetail="true" closable="false" autoupdate="true" showSummary="true" showIcon="true" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-4" />
|
<ui:fragment rendered="#{error.renderBack == false}">
|
||||||
<div class="ui-g-4">
|
<div class="ui-g-4" />
|
||||||
<p:button value="Ir a la página principal" outcome="home" icon="pi pi-home" />
|
<div class="ui-g-4">
|
||||||
</div>
|
<p:button value="Ir a la página principal" outcome="home" icon="pi pi-home" />
|
||||||
<div class="ui-g-4" />
|
</div>
|
||||||
|
<div class="ui-g-4" />
|
||||||
|
</ui:fragment>
|
||||||
|
<ui:fragment rendered="#{error.renderBack == true}">
|
||||||
|
<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" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4">
|
||||||
|
<p:button rendered="#{error.renderBack}" value="Volver atrás" href="#{error.requestURI}" icon="pi pi-chevron-left" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2" />
|
||||||
|
</ui:fragment>
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
<p:growl id="messages" globalOnly="true" sticky="false" showDetail="true" life="15000" />
|
<p:growl id="messages" globalOnly="true" sticky="false" showDetail="true" life="15000" />
|
||||||
<div id="layout">
|
<div id="layout">
|
||||||
<div id="top" class="top">
|
<div id="top" class="top">
|
||||||
<h:graphicImage library="images" name="logo-small.png" height="116" alt="MyHealth by Grupo 2"/>
|
<h:graphicImage library="images" name="logo-small.png" height="116" alt="MyHealth by Grupo 2" />
|
||||||
</div>
|
</div>
|
||||||
<div id="menuDiv" style="margin-bottom: 10px;">
|
<div id="menuDiv" style="padding: 8px;">
|
||||||
<p:ajaxStatus style="width:32px; height:32px; position:fixed; right:48px; bottom:48px" onerror="onAjaxError()">
|
<p:ajaxStatus style="width:32px; height:32px; position:fixed; right:48px; bottom:48px" onerror="onAjaxError()">
|
||||||
<f:facet name="start">
|
<f:facet name="start">
|
||||||
<i id="loginSpin" class="pi pi-spin pi-spinner" style="font-size: 3em" />
|
<i id="loginSpin" class="pi pi-spin pi-spinner" style="font-size: 3em" />
|
||||||
@@ -47,32 +47,20 @@
|
|||||||
<p:password id="password" value="#{loginView.password}" placeholder="Contraseña" />
|
<p:password id="password" value="#{loginView.password}" placeholder="Contraseña" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6">
|
<div class="ui-g-6">
|
||||||
<p:commandButton widgetVar="btnLogin" value="Login" update="messages" icon="pi pi-sign-in" action="#{loginView.login}" onstart="startLogin()"
|
<p:commandButton widgetVar="btnLogin" value="Entrar" update="messages" icon="pi pi-sign-in" action="#{loginView.login}" onstart="startLogin()"
|
||||||
oncomplete="handleLoginRequest(xhr, status, args)" />
|
oncomplete="handleLoginRequest(xhr, status, args)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6">
|
<div class="ui-g-6">
|
||||||
<p:commandButton value="Cancel" icon="pi pi-ban" onclick="PF('dlgLogin').hide();" />
|
<p:commandButton value="Cancelar" icon="pi pi-ban" onclick="PF('dlgLogin').hide();" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p:dialog>
|
</p:dialog>
|
||||||
</h:form>
|
</h:form>
|
||||||
<h:form id="frmMenu">
|
<h:form id="frmMenu">
|
||||||
<p:menubar model="#{menuView.model}">
|
<p:menubar model="#{menuView.model}" />
|
||||||
<f:facet name="options">
|
|
||||||
<ui:fragment rendered="#{home.logedIn}">
|
|
||||||
<h:outputText value="Bienvenido, #{home.userDisplayName} (#{home.userType}) " />
|
|
||||||
<p:commandButton value="Logout" icon="pi pi-sign-out" action="#{loginView.logout}" />
|
|
||||||
</ui:fragment>
|
|
||||||
<ui:fragment rendered="#{not home.logedIn}">
|
|
||||||
<h:outputText value="hola, invitado " />
|
|
||||||
<p:commandButton value="login" icon="pi pi-sign-in" onclick="PF('dlgLogin').show();" title="login" />
|
|
||||||
<p:button value="Registrarse" icon="pi pi-user-plus" outcome="/profile/RegisterUser" />
|
|
||||||
</ui:fragment>
|
|
||||||
</f:facet>
|
|
||||||
</p:menubar>
|
|
||||||
</h:form>
|
</h:form>
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content" style="padding-left: 8px; padding-right: 8px;">
|
||||||
<ui:insert name="content">Content</ui:insert>
|
<ui:insert name="content">Content</ui:insert>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
<p:panel header="Pagina principal">
|
<p:panel header="Pagina principal">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-12 ui-md-12">
|
<div class="ui-g-12 ui-md-12">
|
||||||
Logeado como: <h:outputLabel value="#{home.userDisplayName}" style="font-weight: bold;" />
|
Logeado como:
|
||||||
|
<h:outputLabel value="#{home.userDisplayName}" style="font-weight: bold;" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
<p:outputLabel for="selectorTema" value="Cambio de tema" />
|
<p:outputLabel for="selectorTema" value="Cambio de tema" />
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-6">
|
<div class="ui-g-6">
|
||||||
<p:commandButton value="Login" update="frmMenu, messages" icon="pi pi-sign-in" action="#{loginView.login}" onstart="startLogin()"
|
<p:commandButton value="Entrar" update="frmMenu, messages" icon="pi pi-sign-in" action="#{loginView.login}" onstart="startLogin()"
|
||||||
oncomplete="handleLoginRequest(xhr, status, args)" />
|
oncomplete="handleLoginRequest(xhr, status, args)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6">
|
<div class="ui-g-6">
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
<div class="ui-g-3">Fecha:</div>
|
<div class="ui-g-3">Fecha:</div>
|
||||||
<div class="ui-g-9">
|
<div class="ui-g-9">
|
||||||
<h:outputText value="#{mt.selected.date}">
|
<h:outputText value="#{mt.selected.date}">
|
||||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" timeStyle="short" />
|
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" timeStyle="short" locale="es" />
|
||||||
</h:outputText>
|
</h:outputText>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-3">Hora:</div>
|
<div class="ui-g-3">Hora:</div>
|
||||||
@@ -89,21 +89,23 @@
|
|||||||
<p:outputPanel rendered="#{mt.selected.type != 'BLOOD_TEST'}">
|
<p:outputPanel rendered="#{mt.selected.type != 'BLOOD_TEST'}">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-3">Imagen de alta resolución:</div>
|
<div class="ui-g-3">Imagen de alta resolución:</div>
|
||||||
<div class="ui-g-5">
|
<div class="ui-g-9">
|
||||||
<p:fileUpload rendered="#{mt.specialistDoctor}" value="#{mt.imageUpload}" mode="simple" skinSimple="true" />
|
<p:fileUpload rendered="#{mt.specialistDoctor}" value="#{mt.imageUpload}" fileUploadListener="#{mt.uploadDataListener}" update="frmImage" multiple="false" fileLimit="1"
|
||||||
|
fileLimitMessage="Solo se puede subir una imagen" previewWidth="80" mode="advanced" skinSimple="true" uploadLabel="Subir" cancelLabel="Cancelar" label="Seleccionar" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2" />
|
||||||
|
<div class="ui-g-8" style="align-content: center; text-align: center;">
|
||||||
|
<h:graphicImage rendered="#{mt.selected.highresimage != null}" value="#{mt.selected.highresimage}" alt="Imagen de la prueba mécica" width="400" />
|
||||||
|
<h:outputText rendered="#{mt.selected.highresimage == null}" value="Esta prueba no tiene ninguna imagen asociada" style="font-weight: bold;" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:commandButton rendered="#{mt.specialistDoctor}" value="Subir" icon="pi pi-upload" ajax="false" action="#{mt.addImage}" update="frmImage" />
|
<p:commandButton rendered="#{mt.specialistDoctor and mt.selected.highresimage != null}" value="Eliminar" icon="pi pi-trash" action="#{mt.removeImage}" update="frmImage">
|
||||||
</div>
|
|
||||||
<div class="ui-g-2">
|
|
||||||
<p:commandButton rendered="#{mt.specialistDoctor}" value="Eliminar" icon="pi pi-trash" action="#{mt.removeImage}" disabled="#{mt.selected.highresimage == null}"
|
|
||||||
update="frmImage">
|
|
||||||
<p:confirm header="Confirme la eliminación" message="¿Está seguro de que desea eliminar la imagen?" icon="pi pi-exclamation-triangle" />
|
<p:confirm header="Confirme la eliminación" message="¿Está seguro de que desea eliminar la imagen?" icon="pi pi-exclamation-triangle" />
|
||||||
</p:commandButton>
|
</p:commandButton>
|
||||||
</div>
|
<p />
|
||||||
|
<p:commandButton rendered="#{mt.selected.highresimage != null}" ajax="false" value="Descargar" icon="pi pi-download">
|
||||||
<div class="ui-g-12 ui-md-12" style="align-content: center; text-align: center;">
|
<p:fileDownload value="#{mt.imageDownload}" />
|
||||||
<img src="#{mt.selected.highresimage}" style="max-width: 300px !important;" />
|
</p:commandButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p:outputPanel>
|
</p:outputPanel>
|
||||||
@@ -136,7 +138,7 @@
|
|||||||
|
|
||||||
<div class="ui-g-2">Fecha:</div>
|
<div class="ui-g-2">Fecha:</div>
|
||||||
<div class="ui-g-3">
|
<div class="ui-g-3">
|
||||||
<p:datePicker id="fecha" value="#{mt.testDate}" pattern="dd/MM/yyyy" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="fecha" value="#{mt.testDate}" pattern="dd/MM/yyyy" locale="es" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
requiredMessage="Especifique la fecha de la prueba médica">
|
requiredMessage="Especifique la fecha de la prueba médica">
|
||||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" timeStyle="short" />
|
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" timeStyle="short" />
|
||||||
</p:datePicker>
|
</p:datePicker>
|
||||||
@@ -148,7 +150,7 @@
|
|||||||
|
|
||||||
<div class="ui-g-2">Hora:</div>
|
<div class="ui-g-2">Hora:</div>
|
||||||
<div class="ui-g-3">
|
<div class="ui-g-3">
|
||||||
<p:datePicker id="hora" value="#{mt.testTime}" timeOnly="true" pattern="HH:mm" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="hora" value="#{mt.testTime}" timeOnly="true" pattern="HH:mm" locale="es" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
requiredMessage="Especifique la hora de la prueba médica">
|
requiredMessage="Especifique la hora de la prueba médica">
|
||||||
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||||
</p:datePicker>
|
</p:datePicker>
|
||||||
|
|||||||
@@ -8,82 +8,79 @@
|
|||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="frmQuestions">
|
<h:form id="frmQuestions">
|
||||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
<p:panel id="panelQuestions" header="Preguntas">
|
<div class="ui-g-4">
|
||||||
<div class="ui-g ui-fluid">
|
<p:panel id="panelQuestionList" header="">
|
||||||
<div class="ui-g-4">
|
<f:facet name="header">
|
||||||
<p:panel id="panelQuestionList" header="">
|
<h:outputText rendered="#{Questions.patient}" value="Lista de preguntas realizadas" />
|
||||||
<f:facet name="header">
|
<h:outputText rendered="#{Questions.familyDoctor}" value="Lista de preguntas pendientes" />
|
||||||
<h:outputText rendered="#{Questions.patient}" value="Lista de preguntas realizadas" />
|
</f:facet>
|
||||||
<h:outputText rendered="#{Questions.familyDoctor}" value="Lista de preguntas pendientes" />
|
<f:facet name="actions">
|
||||||
</f:facet>
|
<h:commandLink action="#{Questions.init}" immediate="true" update="frmQuestions" styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
|
||||||
<f:facet name="actions">
|
<h:outputText styleClass="ui-icon pi pi-refresh" />
|
||||||
<h:commandLink action="#{Questions.init}" immediate="true" update="frmQuestions" styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
|
</h:commandLink>
|
||||||
<h:outputText styleClass="ui-icon pi pi-refresh" />
|
<h:commandLink rendered="#{Questions.patient}" action="#{Questions.create}" update="questionDetail" styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
|
||||||
</h:commandLink>
|
<h:outputText styleClass="ui-icon pi pi-plus" />
|
||||||
<h:commandLink rendered="#{Questions.patient}" action="#{Questions.create}" update="questionDetail" styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
|
</h:commandLink>
|
||||||
<h:outputText styleClass="ui-icon pi pi-plus" />
|
</f:facet>
|
||||||
</h:commandLink>
|
<p:orderList value="#{Questions.pendingQuestions}" var="pq" controlsLocation="none" itemValue="#{pq}" responsive="true">
|
||||||
</f:facet>
|
<o:converter converterId="omnifaces.ListConverter" list="#{Questions.pendingQuestions}" />
|
||||||
<p:orderList value="#{Questions.pendingQuestions}" var="pq" controlsLocation="none" itemValue="#{pq}" responsive="true">
|
<p:ajax event="select" listener="#{Questions.onSelect}" update="questionDetail" />
|
||||||
<o:converter converterId="omnifaces.ListConverter" list="#{Questions.pendingQuestions}" />
|
<p:ajax event="unselect" listener="#{Questions.onUnSelect}" update="questionDetail" />
|
||||||
<p:ajax event="select" listener="#{Questions.onSelect}" update="questionDetail" />
|
<p:column headerText="" style="width: 30px;">
|
||||||
<p:ajax event="unselect" listener="#{Questions.onUnSelect}" update="questionDetail" />
|
<h:graphicImage name="images/#{pq.status}.png" alt="#{pq.status}" styleClass="ui-theme" />
|
||||||
<p:column>
|
</p:column>
|
||||||
<h:graphicImage name="images/#{pq.status}.png" alt="#{pq.status}" styleClass="ui-theme" />
|
<p:column headerText="Título" width="auto">
|
||||||
</p:column>
|
<h:outputText value="#{pq.title}" />
|
||||||
<p:column headerText="Título">
|
</p:column>
|
||||||
<h:outputText value="#{pq.title}" />
|
</p:orderList>
|
||||||
</p:column>
|
</p:panel>
|
||||||
</p:orderList>
|
|
||||||
</p:panel>
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-8">
|
|
||||||
<p:outputPanel id="questionDetail">
|
|
||||||
<p:panel id="panelAddQuestion" rendered="#{Questions.addNewMode}" header="Añadir nueva pregunta">
|
|
||||||
<div class="ui-g ui-fluid">
|
|
||||||
<div class="ui-g-12">
|
|
||||||
<h3>Título:</h3>
|
|
||||||
<p:inputText value="#{Questions.selected.title}" required="true" requiredMessage="Es necesario especificar el título de la pregunta" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-12">
|
|
||||||
<h3>Pregunta:</h3>
|
|
||||||
<p:textEditor value="#{Questions.selected.message}" required="true" requiredMessage="Es necesario especificar el texto de la pregunta" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-4" />
|
|
||||||
<div class="ui-g-4">
|
|
||||||
<p:commandButton value="Preguntar" action="#{Questions.addNewQuestion}" update="frmQuestions" icon="pi pi-save" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-4" />
|
|
||||||
</div>
|
|
||||||
</p:panel>
|
|
||||||
<p:panel id="panelDetail" rendered="#{Questions.showPanelDetail}" header="Pregunta de #{Questions.selected.patient.displayName}">
|
|
||||||
<!-- Responder pregunta -->
|
|
||||||
<div class="ui-g ui-fluid">
|
|
||||||
<div class="ui-g-12">
|
|
||||||
<h3>Título:</h3>
|
|
||||||
<p:inputText value="#{Questions.selected.title}" readonly="true" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-12">
|
|
||||||
<h3>Pregunta:</h3>
|
|
||||||
<p:textEditor value="#{Questions.selected.message}" toolbarVisible="false" readonly="true" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-12">
|
|
||||||
<h3>Respuesta:</h3>
|
|
||||||
<p:textEditor value="#{Questions.selected.response}" toolbarVisible="#{Questions.respuestaEditable}" readonly="#{not Questions.respuestaEditable}" required="true"
|
|
||||||
requiredMessage="Es necesario especificar una respuesta." />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-4" />
|
|
||||||
<div class="ui-g-4">
|
|
||||||
<p:commandButton value="Responder" rendered="#{Questions.respuestaEditable}" action="#{Questions.save}" update="frmQuestions" icon="pi pi-save" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-4" />
|
|
||||||
</div>
|
|
||||||
</p:panel>
|
|
||||||
</p:outputPanel>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
<div class="ui-g-8">
|
||||||
|
<p:outputPanel id="questionDetail">
|
||||||
|
<p:panel id="panelAddQuestion" rendered="#{Questions.addNewMode}" header="Añadir nueva pregunta">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<h3>Título:</h3>
|
||||||
|
<p:inputText value="#{Questions.selected.title}" required="true" requiredMessage="Es necesario especificar el título de la pregunta" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<h3>Pregunta:</h3>
|
||||||
|
<p:textEditor value="#{Questions.selected.message}" required="true" requiredMessage="Es necesario especificar el texto de la pregunta" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4" />
|
||||||
|
<div class="ui-g-4">
|
||||||
|
<p:commandButton value="Preguntar" action="#{Questions.addNewQuestion}" update="frmQuestions" icon="pi pi-save" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4" />
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
<p:panel id="panelDetail" rendered="#{Questions.showPanelDetail}" header="Pregunta de #{Questions.selected.patient.displayName}">
|
||||||
|
<!-- Responder pregunta -->
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<h3>Título:</h3>
|
||||||
|
<p:inputText value="#{Questions.selected.title}" readonly="true" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<h3>Pregunta:</h3>
|
||||||
|
<p:textEditor value="#{Questions.selected.message}" toolbarVisible="false" readonly="true" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<h3>Respuesta:</h3>
|
||||||
|
<p:textEditor value="#{Questions.selected.response}" toolbarVisible="#{Questions.respuestaEditable}" readonly="#{not Questions.respuestaEditable}" required="true"
|
||||||
|
requiredMessage="Es necesario especificar una respuesta." />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4" />
|
||||||
|
<div class="ui-g-4">
|
||||||
|
<p:commandButton value="Responder" rendered="#{Questions.respuestaEditable}" action="#{Questions.save}" update="frmQuestions" icon="pi pi-save" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4" />
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</p:outputPanel>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</h:form>
|
</h:form>
|
||||||
</ui:define>
|
</ui:define>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|||||||
@@ -15,11 +15,11 @@
|
|||||||
<p:outputLabel for="selMS" value="Especialidad:" />
|
<p:outputLabel for="selMS" value="Especialidad:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6 ui-md-6">
|
<div class="ui-g-6 ui-md-6">
|
||||||
<p:autoComplete id="selMS" dropdown="true" required="true" value="#{sspec.medicalSpeciality}" completeMethod="#{sspec.completeMedicalSpeciality}" var="ms"
|
<p:autoComplete id="selMS" dropdown="true" required="true" value="#{sspec.medicalSpecialty}" completeMethod="#{sspec.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"
|
||||||
placeholder="Seleccione una especialidad médica o teclee para buscar...">
|
placeholder="Seleccione una especialidad médica o teclee para buscar...">
|
||||||
<o:converter converterId="omnifaces.ListConverter" list="#{RegisterUser.medicalSpecialtiesList}" />
|
<o:converter converterId="omnifaces.ListConverter" list="#{sspec.medicalSpecialtiesList}" />
|
||||||
<p:ajax event="itemSelect" update="dtDoctorList" onstart="PF('dtDoctorList').getPaginator().setPage(0);" />
|
<p:ajax event="itemSelect" update="dtDoctorList" oncomplete="PF('dtDoctorList').getPaginator().setPage(0);" />
|
||||||
<p:column headerText="Nombre">
|
<p:column headerText="Nombre">
|
||||||
<h:outputText value="#{ms.name}" />
|
<h:outputText value="#{ms.name}" />
|
||||||
</p:column>
|
</p:column>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-12">
|
||||||
<p:dataTable id="dtDoctorList" widgetVar="dtDoctorList" var="d" value="#{sspec.lazyDataModelDoctorList}" lazy="true" paginator="true" rows="10" paginatorPosition="bottom"
|
<p:dataTable id="dtDoctorList" widgetVar="dtDoctorList" var="d" value="#{sspec.lazyDataModelDoctorList}" lazy="true" paginator="true" rows="10" paginatorPosition="bottom"
|
||||||
paginatorAlwaysVisible="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
|
paginatorAlwaysVisible="true" currentPageReportTemplate="Página {currentPage} de {totalPages}" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
|
||||||
rowsPerPageTemplate="10,20,30,40" emptyMessage="No existe ningún especialista para la especialidad seleccionada.">
|
rowsPerPageTemplate="10,20,30,40" emptyMessage="No existe ningún especialista para la especialidad seleccionada.">
|
||||||
|
|
||||||
<p:column headerText="Núm. Profesional" width="90">
|
<p:column headerText="Núm. Profesional" width="90">
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
<div class="ui-g-10 ui-md-10">
|
<div class="ui-g-10 ui-md-10">
|
||||||
<p:selectOneButton id="selUsertype" value="#{RegisterUser.userType}" required="true" unselectable="false" requiredMessage="Debe especificar un tipo de usuario">
|
<p:selectOneButton id="selUsertype" value="#{RegisterUser.userType}" required="true" unselectable="false" requiredMessage="Debe especificar un tipo de usuario">
|
||||||
<f:selectItems value="#{RegisterUser.availableUserTypes}" var="item" itemLabel="#{item.userTypename}" />
|
<f:selectItems value="#{RegisterUser.availableUserTypes}" var="item" itemLabel="#{item.userTypename}" />
|
||||||
<p:ajax listener="#{RegisterUser.onUserTypeChange}" update="panCombos" />
|
<p:ajax listener="#{RegisterUser.onUserTypeChange}" update="panCombos" oncomplete="nifCheckClick();" />
|
||||||
</p:selectOneButton>
|
</p:selectOneButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -66,10 +66,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<div class="ui-inputgroup">
|
<div class="ui-inputgroup">
|
||||||
<p:inputText id="nif" widgetVar="nif" value="#{RegisterUser.nif}" validator="nifValidator" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF">
|
<p:inputText id="nif" widgetVar="nif" value="#{RegisterUser.nif}" validator="nifValidator" binding="#{nif}" maxlength="20" required="true"
|
||||||
<p:ajax event="blur" update="nifmsg" listener="#{RegisterUser.handleNIFValueChange}" oncomplete="handleNIFResponse(xhr, status, args)" />
|
requiredMessage="Por favor, indque su NIF">
|
||||||
|
<f:validator validatorId="nifValidator" for="nif">
|
||||||
|
<f:attribute name="managedBean" value="#{RegisterUser}" />
|
||||||
|
</f:validator>
|
||||||
|
<p:ajax event="change" update="nifmsg,nifButton" />
|
||||||
</p:inputText>
|
</p:inputText>
|
||||||
<p:commandButton widgetVar="nifButton" icon="pi pi-times" styleClass="red-button" />
|
<p:commandButton id="nifButton" widgetVar="nifButton" onclick="nifCheckClick();" icon="pi #{nif.valid ? 'pi-check' : 'pi-times'}"
|
||||||
|
styleClass="#{nif.valid ? 'green-button' : 'red-button'}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6 ui-md-6">
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
|||||||
@@ -41,14 +41,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<div class="ui-inputgroup">
|
<div class="ui-inputgroup">
|
||||||
<p:inputText id="nif" widgetVar="nif" value="#{UpdateProfile.nif}" validator="nifValidator" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF">
|
<p:inputText id="nif" widgetVar="nif" value="#{UpdateProfile.nif}" validator="nifValidator" binding="#{nif}" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF">
|
||||||
<p:ajax event="blur" update="nifmsg" listener="#{UpdateProfile.handleNIFValueChange}" oncomplete="handleNIFResponse(xhr, status, args)" />
|
<f:validator validatorId="nifValidator" for="nif">
|
||||||
|
<f:attribute name="managedBean" value="#{UpdateProfile}" />
|
||||||
|
</f:validator>
|
||||||
|
<p:ajax event="change" update="nifmsg,nifButton" />
|
||||||
</p:inputText>
|
</p:inputText>
|
||||||
<p:commandButton widgetVar="nifButton" icon="pi pi-check" styleClass="green-button" />
|
<p:commandButton id="nifButton" widgetVar="nifButton" onclick="nifCheckClick();" icon="pi #{nif.valid ? 'pi-check' : 'pi-times'}"
|
||||||
|
styleClass="#{nif.valid ? 'green-button' : 'red-button'}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6 ui-md-6">
|
<div class="ui-g-6 ui-md-6">
|
||||||
<p:message id="nifmsg" for="nif" display="text" />
|
<p:message id="nifmsg" for="nif" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
body {
|
body {
|
||||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
min-width: 1280px !important;
|
||||||
|
min-height: 800px !important;
|
||||||
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hide {
|
.hide {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.background-light-blue {
|
||||||
|
background-image: url("#{resource['images/fondo.png']}");
|
||||||
|
}
|
||||||
|
|
||||||
.nopadding {
|
.nopadding {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
|
|||||||
BIN
1.sources/MyHealth/docroot/resources/images/fondo.png
Normal file
BIN
1.sources/MyHealth/docroot/resources/images/fondo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 431 B |
Binary file not shown.
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 28 KiB |
@@ -1,9 +1,107 @@
|
|||||||
/**
|
/**
|
||||||
* Funciones comunes JavaScript para el proyecto MyHealth
|
* Funciones comunes JavaScript para el proyecto MyHealth
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Configuración de locales para los componentes interfaz de primefaces. Descargado de: https://github.com/primefaces/primefaces/wiki/Locales */
|
||||||
|
/** ******************************************************************************************************************************************* */
|
||||||
|
PrimeFaces.locales['es'] = {
|
||||||
|
closeText : 'Cerrar',
|
||||||
|
prevText : 'Anterior',
|
||||||
|
nextText : 'Siguiente',
|
||||||
|
monthNames : [ 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre' ],
|
||||||
|
monthNamesShort : [ 'Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic' ],
|
||||||
|
dayNames : [ 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado', 'Domingo' ],
|
||||||
|
dayNamesShort : [ 'Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab' ],
|
||||||
|
dayNamesMin : [ 'D', 'L', 'M', 'X', 'J', 'V', 'S' ],
|
||||||
|
weekHeader : 'Semana',
|
||||||
|
firstDayOfWeek : 1,
|
||||||
|
firstDay : 1,
|
||||||
|
isRTL : false,
|
||||||
|
showMonthAfterYear : false,
|
||||||
|
yearSuffix : '',
|
||||||
|
timeOnlyTitle : 'Sólo hora',
|
||||||
|
timeText : 'Tiempo',
|
||||||
|
hourText : 'Hora',
|
||||||
|
minuteText : 'Minuto',
|
||||||
|
secondText : 'Segundo',
|
||||||
|
currentText : 'Fecha actual',
|
||||||
|
today : "Hoy",
|
||||||
|
clear : "Limpiar",
|
||||||
|
ampm : false,
|
||||||
|
month : 'Mes',
|
||||||
|
week : 'Semana',
|
||||||
|
day : 'Día',
|
||||||
|
allDayText : 'Todo el día',
|
||||||
|
messages : { // optional for Client Side Validation
|
||||||
|
'javax.faces.component.UIInput.REQUIRED' : '{0}: Error de validación: se necesita un valor.',
|
||||||
|
'javax.faces.converter.IntegerConverter.INTEGER' : '{2}: \'{0}\' debe ser un número formado por uno o varios dígitos.',
|
||||||
|
'javax.faces.converter.IntegerConverter.INTEGER_detail' : '{2}: \'{0}\' debe ser un número entre -2147483648 y 2147483647. Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.DoubleConverter.DOUBLE' : '{2}: \'{0}\' debe ser un número formado por uno o varios dígitos.',
|
||||||
|
'javax.faces.converter.DoubleConverter.DOUBLE_detail' : '{2}: \'{0}\' debe ser un número entre 4.9E-324 y 1.7976931348623157E308 Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.BigDecimalConverter.DECIMAL' : '{2}: \'{0}\' debe ser un número decimal positivo o negativo.',
|
||||||
|
'javax.faces.converter.BigDecimalConverter.DECIMAL_detail' : '{2}: \'{0}\' debe ser un número decimal positivo o negativo formado por cero o más dígitos, que pueden incluir a continuación una coma decimal y una fracción. Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.BigIntegerConverter.BIGINTEGER' : '{2}: \'{0}\' debe ser un número formado por uno o varios dígitos.',
|
||||||
|
'javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail' : '{2}: \'{0}\' debe ser un número formado por uno o varios dígitos. Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.ByteConverter.BYTE' : '{2}: \'{0}\' debe ser un número entre 0 y 255.',
|
||||||
|
'javax.faces.converter.ByteConverter.BYTE_detail' : '{2}: \'{0}\' debe ser un número entre 0 y 255. Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.CharacterConverter.CHARACTER' : '{1}: \'{0}\' debe ser un carácter válido.',
|
||||||
|
'javax.faces.converter.CharacterConverter.CHARACTER_detail' : '{1}: \'{0}\' debe ser un carácter ASCII válido.',
|
||||||
|
'javax.faces.converter.ShortConverter.SHORT' : '{2}: \'{0}\' debe ser un número formado por uno o varios dígitos.',
|
||||||
|
'javax.faces.converter.ShortConverter.SHORT_detail' : '{2}: \'{0}\' debe ser un número entre -32768 y 32767 Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.BooleanConverter.BOOLEAN' : '{1}: \'{0}\' debe ser \'true\' o \'false\'',
|
||||||
|
'javax.faces.converter.BooleanConverter.BOOLEAN_detail' : '{1}: \'{0}\' debe ser \'true\' o \'false\'. Cualquier valor diferente a \'true\' se evaluará como \'false\'.',
|
||||||
|
'javax.faces.validator.LongRangeValidator.MAXIMUM' : '{1}: Error de validación: el valor es mayor que el máximo permitido de \'{0}\'',
|
||||||
|
'javax.faces.validator.LongRangeValidator.MINIMUM' : '{1}: Error de validación: el valor es inferior que el mínimo permitido de \'{0}\'',
|
||||||
|
'javax.faces.validator.LongRangeValidator.NOT_IN_RANGE' : '{2}: Error de validación: el atributo especificado no está entre los valores esperados {0} y {1}.',
|
||||||
|
'javax.faces.validator.LongRangeValidator.TYPE={0}' : 'Error de validación: el valor no tiene el tipo correcto.',
|
||||||
|
'javax.faces.validator.DoubleRangeValidator.MAXIMUM' : '{1}: Error de validación: el valor es mayor que el máximo permitido de \'{0}\'',
|
||||||
|
'javax.faces.validator.DoubleRangeValidator.MINIMUM' : '{1}: Error de validación: el valor es inferior que el mínimo permitido de \'{0}\'',
|
||||||
|
'javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE' : '{2}: Error de validación: el atributo especificado no está entre los valores esperados {0} y {1}',
|
||||||
|
'javax.faces.validator.DoubleRangeValidator.TYPE={0}' : 'Error de validación: el valor no tiene el tipo correcto.',
|
||||||
|
'javax.faces.converter.FloatConverter.FLOAT' : '{2}: \'{0}\' debe ser un número formado por uno o varios dígitos.',
|
||||||
|
'javax.faces.converter.FloatConverter.FLOAT_detail' : '{2}: \'{0}\' debe ser un número entre 1.4E-45 y 3.4028235E38 Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.DateTimeConverter.DATE' : '{2}: \'{0}\' no se ha podido reconocer como fecha.',
|
||||||
|
'javax.faces.converter.DateTimeConverter.DATE_detail' : '{2}: \'{0}\' no se ha podido reconocer como fecha. Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.DateTimeConverter.TIME' : '{2}: \'{0}\' no se ha podido reconocer como hora.',
|
||||||
|
'javax.faces.converter.DateTimeConverter.TIME_detail' : '{2}: \'{0}\' no se ha podido reconocer como hora. Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.DateTimeConverter.DATETIME' : '{2}: \'{0}\' no se ha podido reconocer como fecha y hora.',
|
||||||
|
'javax.faces.converter.DateTimeConverter.DATETIME_detail' : '{2}: \'{0}\' no se ha podido reconocer como fecha y hora. Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.DateTimeConverter.PATTERN_TYPE' : '{1}: debe especificarse el atributo \'pattern\' o \'type\' para convertir el valor \'{0}\'',
|
||||||
|
'javax.faces.converter.NumberConverter.CURRENCY' : '{2}: \'{0}\' no se ha podido reconocer como un valor de divisa.',
|
||||||
|
'javax.faces.converter.NumberConverter.CURRENCY_detail' : '{2}: \'{0}\' no se ha podido reconocer como un valor de divisa. Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.NumberConverter.PERCENT' : '{2}: \'{0}\' no se ha podido reconocer como porcentaje.',
|
||||||
|
'javax.faces.converter.NumberConverter.PERCENT_detail' : '{2}: \'{0}\' no se ha podido reconocer como porcentaje. Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.NumberConverter.NUMBER' : '{2}: \'{0}\' no se ha podido reconocer como fecha.',
|
||||||
|
'javax.faces.converter.NumberConverter.NUMBER_detail' : '{2}: \'{0}\' no es un número. Ejemplo: {1}',
|
||||||
|
'javax.faces.converter.NumberConverter.PATTERN' : '{2}: \'{0}\' no es un patrón numérico.',
|
||||||
|
'javax.faces.converter.NumberConverter.PATTERN_detail' : '{2}: \'{0}\' no es un patrón numérico. Ejemplo: {1}',
|
||||||
|
'javax.faces.validator.LengthValidator.MINIMUM' : '{1}: Error de validación: el largo es inferior que el mínimo permitido de \'{0}\'',
|
||||||
|
'javax.faces.validator.LengthValidator.MAXIMUM' : '{1}: Error de validación: el largo es mayor que el máximo permitido de \'{0}\'',
|
||||||
|
'javax.faces.validator.RegexValidator.PATTERN_NOT_SET' : 'Se debe establecer el patrón de Regex.',
|
||||||
|
'javax.faces.validator.RegexValidator.PATTERN_NOT_SET_detail' : 'El patrón Regex debe establecerse en un valor no vacío.',
|
||||||
|
'javax.faces.validator.RegexValidator.NOT_MATCHED' : 'El patrón Regex no coincide',
|
||||||
|
'javax.faces.validator.RegexValidator.NOT_MATCHED_detail' : 'El patrón Regex de \'{0}\' no coincide',
|
||||||
|
'javax.faces.validator.RegexValidator.MATCH_EXCEPTION' : 'Error en expresión regular.',
|
||||||
|
'javax.faces.validator.RegexValidator.MATCH_EXCEPTION_detail' : 'Error en expresión regular, \'{0}\'',
|
||||||
|
// optional for bean validation integration in client side validation
|
||||||
|
'javax.faces.validator.BeanValidator.MESSAGE' : '{0}',
|
||||||
|
'javax.validation.constraints.AssertFalse.message' : 'debe ser falso',
|
||||||
|
'javax.validation.constraints.AssertTrue.message' : 'debe ser verdadero',
|
||||||
|
'javax.validation.constraints.DecimalMax.message' : 'debe ser menor que o igual a {0}',
|
||||||
|
'javax.validation.constraints.DecimalMin.message' : 'debe ser mayor que o igual a {0}',
|
||||||
|
'javax.validation.constraints.Digits.message' : 'valor numérico fuera de los límites (se esperaba (<{0} digitos>.<{1} digitos>)',
|
||||||
|
'javax.validation.constraints.Future.message' : 'debe ser una fecha futura',
|
||||||
|
'javax.validation.constraints.Max.message' : 'debe ser menor que o igual a {0}',
|
||||||
|
'javax.validation.constraints.Min.message' : 'debe ser mayor que o igual a {0}',
|
||||||
|
'javax.validation.constraints.NotNull.message' : 'no debe ser nulo',
|
||||||
|
'javax.validation.constraints.Null.message' : 'debe ser nulo',
|
||||||
|
'javax.validation.constraints.Past.message' : 'debe ser una fecha pasada',
|
||||||
|
'javax.validation.constraints.Pattern.message' : 'debe coincidir con "{0}"',
|
||||||
|
'javax.validation.constraints.Size.message' : 'el tamaño debe estar entre {0} y {1}'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/** * Fin configuración locale de Primefaces ** */
|
||||||
|
|
||||||
// Gestiona la ventana de login
|
// Gestiona la ventana de login
|
||||||
function handleLoginRequest(xhr, status, args) {
|
function handleLoginRequest(xhr, status, args) {
|
||||||
if (args.validationFailed || !args.loggedIn) {
|
if (args.validationFailed || !args.loggedIn) {
|
||||||
@@ -22,15 +120,28 @@ function startLogin() {
|
|||||||
PF('btnLogin').disable();
|
PF('btnLogin').disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nifCheckClick() {
|
||||||
|
var nif = PF('nif');
|
||||||
|
nif.jq.change();
|
||||||
|
}
|
||||||
|
|
||||||
// Actualiza la interfaz tras validar si un nif está duplicado.
|
// Actualiza la interfaz tras validar si un nif está duplicado.
|
||||||
function handleNIFResponse(xhr, status, args) {
|
function handleNIFResponse(xhr, status, args) {
|
||||||
|
var isValid = false;
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (typeof args.validationFailed != "undefined")
|
||||||
|
isValid = !args.validationFailed;
|
||||||
|
else if (typeof args.NIFisValid != "undefined")
|
||||||
|
isValid = args.NIFisValid;
|
||||||
|
|
||||||
if (args.formattedNIF) {
|
if (args.formattedNIF) {
|
||||||
var nif = PF('nif');
|
var nif = PF('nif');
|
||||||
nif.jq.val(args.formattedNIF);
|
nif.jq.val(args.formattedNIF);
|
||||||
}
|
}
|
||||||
|
|
||||||
var nifButton = PF('nifButton');
|
var nifButton = PF('nifButton');
|
||||||
if (args.NIFisDupe == false) {
|
if (isValid == true) {
|
||||||
nifButton.jq.children(".ui-icon").removeClass("pi pi-times");
|
nifButton.jq.children(".ui-icon").removeClass("pi pi-times");
|
||||||
nifButton.jq.removeClass('red-button');
|
nifButton.jq.removeClass('red-button');
|
||||||
|
|
||||||
|
|||||||
65
1.sources/MyHealth/docroot/systemAdmin/AddAdmin.xhtml
Normal file
65
1.sources/MyHealth/docroot/systemAdmin/AddAdmin.xhtml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?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" xmlns:o="http://omnifaces.org/ui">
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmAddAdmin">
|
||||||
|
<p:growl id="mesgsAdd" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
<p:panel id="PanelNewAdmin" header="Alta de administradores">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:outputLabel value="Correo electrónico: " for="email" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4">
|
||||||
|
<p:inputText id="email" value="#{AddAdmin.email}" required="true" maxlength="120" validator="emailValidator" 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:validator validatorId="emailValidator" for="email">
|
||||||
|
<f:attribute name="managedBean" value="#{AddAdmin}" />
|
||||||
|
</f:validator>
|
||||||
|
</p:inputText>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6">
|
||||||
|
<p:message for="email" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:outputLabel value="Contraseña: " for="password" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4">
|
||||||
|
<p:password id="password" value="#{AddAdmin.password}" match="passwordRepeat" required="true" maxlength="100" requiredMessage="Por favor, especifique una contraseña"
|
||||||
|
feedback="true" promptLabel="Especifique una contraseña segura" weakLabel="La contraseña es débil" goodLabel="La contraseña es buena" strongLabel="La contraseña es segura"
|
||||||
|
validatorMessage="La contraseña y su verificación deben ser iguales" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6">
|
||||||
|
<p:message for="password" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:outputLabel value="Verificación de contraseña: " for="passwordRepeat" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4">
|
||||||
|
<p:password id="passwordRepeat" value="#{AddAdmin.password}" required="true" maxlength="100" requiredMessage="Por favor, escriba la verificación de su contraseña" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6">
|
||||||
|
<p:message for="passwordRepeat" />
|
||||||
|
</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="Crear" update="frmAddAdmin" action="#{AddAdmin.insertData}" 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>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-12">
|
||||||
<p:dataTable id="dtDoctorList" widgetVar="dtDoctorList" var="d" value="#{listDoctors.lazyDataModelDoctorList}" lazy="true" paginator="true" rows="10"
|
<p:dataTable id="dtDoctorList" widgetVar="dtDoctorList" var="d" value="#{listDoctors.lazyDataModelDoctorList}" lazy="true" paginator="true" rows="10"
|
||||||
paginatorPosition="bottom" paginatorAlwaysVisible="true"
|
paginatorPosition="bottom" paginatorAlwaysVisible="true" currentPageReportTemplate="Página {currentPage} de {totalPages}"
|
||||||
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,40"
|
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,40"
|
||||||
emptyMessage="No existe ningún doctor para el centro seleccionado.">
|
emptyMessage="No existe ningún doctor para el centro seleccionado.">
|
||||||
|
|
||||||
|
|||||||
@@ -10,34 +10,43 @@
|
|||||||
<p:growl id="mesgsList" showDetail="true" closable="true" autoupdate="true" />
|
<p:growl id="mesgsList" showDetail="true" closable="true" autoupdate="true" />
|
||||||
<p:panel id="PanelCAPList" style="margin-bottom: 10px;" header="Gestión de Centros de Atención Primaria">
|
<p:panel id="PanelCAPList" style="margin-bottom: 10px;" header="Gestión de Centros de Atención Primaria">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<p:dataTable widgetVar="dtCAP" var="cap" value="#{ManageHealthCareCenters.lazyDataModelCAPsList}" editable="true" lazy="true" paginator="true" rows="10" paginatorPosition="bottom" paginatorAlwaysVisible="true"
|
<p:dataTable id="CAPsTable" widgetVar="dtCAP" var="cap" value="#{ManageHealthCareCenters.lazyDataModelCAPsList}" editable="true" lazy="true" paginator="true" rows="10"
|
||||||
|
paginatorPosition="bottom" paginatorAlwaysVisible="true" currentPageReportTemplate="Página {currentPage} de {totalPages}"
|
||||||
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,40">
|
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,40">
|
||||||
|
|
||||||
<p:ajax event="rowEdit" listener="#{ManageHealthCareCenters.onRowEdit}" update=":frmListCAPs:mesgsList" />
|
<p:ajax event="rowEdit" listener="#{ManageHealthCareCenters.onRowEdit}" update=":frmListCAPs:mesgsList" oncomplete="updateDataTable()"/>
|
||||||
<p:ajax event="rowEditCancel" listener="#{ManageHealthCareCenters.onRowCancel}" update=":frmListCAPs:mesgsList" />
|
<p:ajax event="rowEditCancel" listener="#{ManageHealthCareCenters.onRowCancel}" update=":frmListCAPs:mesgsList" oncomplete="updateDataTable()"/>
|
||||||
|
|
||||||
<p:column headerText="Nombre">
|
<p:column headerText="Nombre">
|
||||||
<p:cellEditor>
|
<p:cellEditor>
|
||||||
<f:facet name="output"><h:outputText value="#{cap.name}" /></f:facet>
|
<f:facet name="output">
|
||||||
<f:facet name="input"><p:inputText value="#{cap.name}" style="width:100%" label="Nombre"/></f:facet>
|
<h:outputText value="#{cap.name}" />
|
||||||
</p:cellEditor>
|
</f:facet>
|
||||||
</p:column>
|
<f:facet name="input">
|
||||||
|
<p:inputText value="#{cap.name}" style="width:100%" label="Nombre" />
|
||||||
|
</f:facet>
|
||||||
|
</p:cellEditor>
|
||||||
|
</p:column>
|
||||||
|
|
||||||
<p:column headerText="Localización">
|
<p:column headerText="Localización">
|
||||||
<p:cellEditor>
|
<p:cellEditor>
|
||||||
<f:facet name="output"><h:outputText value="#{cap.location}" /></f:facet>
|
<f:facet name="output">
|
||||||
<f:facet name="input"><p:inputText value="#{cap.location}" style="width:100%" label="Localización"/></f:facet>
|
<h:outputText value="#{cap.location}" />
|
||||||
</p:cellEditor>
|
</f:facet>
|
||||||
</p:column>
|
<f:facet name="input">
|
||||||
|
<p:inputText value="#{cap.location}" style="width:100%" label="Localización" />
|
||||||
|
</f:facet>
|
||||||
|
</p:cellEditor>
|
||||||
|
</p:column>
|
||||||
|
|
||||||
<p:column style="width:80px; text-align: center;" headerText="Editar">
|
<p:column style="width:80px; text-align: center;" headerText="Editar">
|
||||||
<p:rowEditor />
|
<p:rowEditor />
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
<p:column style="width:80px; text-align: center;" headerText="Eliminar">
|
<p:column style="width:80px; text-align: center;" headerText="Eliminar">
|
||||||
<p:commandLink class="pi pi-trash" actionListener="#{ManageHealthCareCenters.deleteDataById(cap.id)}" update=":frmListCAPs:mesgsList frmListCAPs">
|
<p:commandLink class="pi pi-trash" actionListener="#{ManageHealthCareCenters.deleteDataById(cap.id)}" update=":frmListCAPs:mesgsList frmListCAPs">
|
||||||
<p:confirm header="Eliminar" message="¿Está seguro de que quiere borrar el centro?" icon="pi pi-exclamation-triangle"/>
|
<p:confirm header="Eliminar" message="¿Está seguro de que quiere borrar el centro?" icon="pi pi-exclamation-triangle" />
|
||||||
</p:commandLink>
|
</p:commandLink>
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
<f:facet name="paginatorBottomLeft">
|
<f:facet name="paginatorBottomLeft">
|
||||||
@@ -45,12 +54,14 @@
|
|||||||
</f:facet>
|
</f:facet>
|
||||||
</p:dataTable>
|
</p:dataTable>
|
||||||
|
|
||||||
|
<p:remoteCommand name="updateDataTable" update="CAPsTable" />
|
||||||
|
|
||||||
<p:confirmDialog global="true">
|
<p:confirmDialog global="true">
|
||||||
<p:commandButton value="Sí" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check"/>
|
<p:commandButton value="Sí" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check" />
|
||||||
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times"/>
|
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times" />
|
||||||
</p:confirmDialog>
|
</p:confirmDialog>
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
</h:form>
|
</h:form>
|
||||||
|
|
||||||
<h:form id="frmAddCAPs">
|
<h:form id="frmAddCAPs">
|
||||||
|
|||||||
@@ -6,53 +6,59 @@
|
|||||||
|
|
||||||
<ui:composition template="../header.xhtml">
|
<ui:composition template="../header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="frmEditSpecialties">
|
<h:form id="frmListSpecialties">
|
||||||
|
<p:growl id="mesgsList" showDetail="true" closable="true" autoupdate="true" />
|
||||||
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
|
<p:panel id="PanelSpecialtiesList" style="margin-bottom: 10px;" header="Gestión de Especialidades">
|
||||||
<p:commandButton value="Sí" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check" />
|
|
||||||
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times" />
|
|
||||||
</p:confirmDialog>
|
|
||||||
|
|
||||||
<p:growl id="mesgsEdit" showDetail="true" closable="true" autoupdate="true" />
|
|
||||||
<p:panel id="PanelMS" style="margin-bottom: 10px;" header="Modificación y borrado de especialidades">
|
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-2 ui-md-2">
|
<p:dataTable id="specialtiesTable" widgetVar="dtSpecialty" var="specialty" value="#{ManageSpecialities.lazyDataModelSpecialtiesList}" editable="true" lazy="true" paginator="true" rows="10"
|
||||||
<p:outputLabel for="ms" />
|
paginatorPosition="bottom" paginatorAlwaysVisible="true" currentPageReportTemplate="Página {currentPage} de {totalPages}"
|
||||||
<p:selectOneMenu id="ms" value="#{ManageSpecialities.medicalSpecialty}" converter="omnifaces.SelectItemsIndexConverter" effect="fold" editable="true" filter="true"
|
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,40">
|
||||||
filterMatchMode="startsWith" placeholder="- Selecciona una especialidad -">
|
|
||||||
<f:selectItems value="#{ManageSpecialities.medicalSpecialtiesList}" var="ms" itemValue="#{ms}" itemLabel="#{ms.name}" />
|
<p:ajax event="rowEdit" listener="#{ManageSpecialities.onRowEdit}" update=":frmListSpecialties:mesgsList" oncomplete="updateDataTable()"/>
|
||||||
<f:ajax render="name description" />
|
<p:ajax event="rowEditCancel" listener="#{ManageSpecialities.onRowCancel}" update=":frmListSpecialties:mesgsList" oncomplete="updateDataTable()"/>
|
||||||
</p:selectOneMenu>
|
|
||||||
</div>
|
<p:column headerText="Nombre">
|
||||||
<div class="ui-g-1 ui-md-1">
|
<p:cellEditor>
|
||||||
<p:outputLabel value="Nombre: " for="name" />
|
<f:facet name="output"><h:outputText value="#{specialty.name}" /></f:facet>
|
||||||
</div>
|
<f:facet name="input"><p:inputText value="#{specialty.name}" style="width:100%" label="Nombre"/></f:facet>
|
||||||
<div class="ui-g-2 ui-md-2">
|
</p:cellEditor>
|
||||||
<p:inputText id="name" value="#{ManageSpecialities.medicalSpecialty.name}" converter="omnifaces.TrimConverter" readonly="false" required="true"
|
</p:column>
|
||||||
requiredMessage="Es necesario un nombre" />
|
|
||||||
</div>
|
<p:column headerText="Descripción">
|
||||||
<div class="ui-g-1 ui-md-1">
|
<p:cellEditor>
|
||||||
<p:outputLabel value="Descripción: " for="description" />
|
<f:facet name="output"><h:outputText value="#{specialty.description}" /></f:facet>
|
||||||
</div>
|
<f:facet name="input"><p:inputText value="#{specialty.description}" style="width:100%" label="Descripción"/></f:facet>
|
||||||
<div class="ui-g-4 ui-md-4">
|
</p:cellEditor>
|
||||||
<p:inputText id="description" value="#{ManageSpecialities.medicalSpecialty.description}" converter="omnifaces.TrimConverter" readonly="false" required="true"
|
</p:column>
|
||||||
requiredMessage="Es necesaria una descripción" />
|
|
||||||
</div>
|
<p:column style="width:80px; text-align: center;" headerText="Editar">
|
||||||
<div class="ui-g-1 ui-md-1 ">
|
<p:rowEditor />
|
||||||
<p:commandButton validateClient="true" value="Guardar" update="frmEditSpecialties" action="#{ManageSpecialities.saveData}" icon="pi pi-save" />
|
</p:column>
|
||||||
</div>
|
|
||||||
<div class="ui-g-1 ui-md-1 ">
|
<p:column style="width:80px; text-align: center;" headerText="Eliminar">
|
||||||
<p:commandButton validateClient="true" value="Borrar" update="frmEditSpecialties" action="#{ManageSpecialities.deleteData}" icon="fa fa-remove">
|
<p:commandLink class="pi pi-trash" actionListener="#{ManageSpecialities.deleteDataById(specialty.id)}" update=":frmListSpecialties:mesgsList frmListSpecialties">
|
||||||
<p:confirm header="Confirme la eliminación" message="¿Está seguro de que desea eliminar la especialidad?" icon="pi pi-exclamation-triangle" />
|
<p:confirm header="Eliminar" message="¿Está seguro de que quiere borrar el centro?" icon="pi pi-exclamation-triangle"/>
|
||||||
</p:commandButton>
|
</p:commandLink>
|
||||||
</div>
|
</p:column>
|
||||||
</div>
|
|
||||||
</p:panel>
|
<f:facet name="paginatorBottomLeft">
|
||||||
|
<p:commandButton type="button" icon="pi pi-refresh" onclick="PF('dtSpecialty').getPaginator().setPage(0);" />
|
||||||
|
</f:facet>
|
||||||
|
</p:dataTable>
|
||||||
|
|
||||||
|
<p:remoteCommand name="updateDataTable" update="specialtiesTable" />
|
||||||
|
|
||||||
|
<p:confirmDialog global="true">
|
||||||
|
<p:commandButton value="Sí" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check"/>
|
||||||
|
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times"/>
|
||||||
|
</p:confirmDialog>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
</h:form>
|
</h:form>
|
||||||
|
|
||||||
<h:form id="frmAddSpecialties">
|
<h:form id="frmAddSpecialties">
|
||||||
<p:growl id="mesgsAdd" showDetail="true" closable="true" autoupdate="true" />
|
<p:growl id="mesgsAdd" showDetail="true" closable="true" autoupdate="true" />
|
||||||
<p:panel id="PanelNewMS" header="Alta de especialidades">
|
<p:panel id="PanelNewSpecialty" header="Alta de Especialidades">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-1 ui-md-1">
|
<div class="ui-g-1 ui-md-1">
|
||||||
<p:outputLabel value="Nombre: " for="nameNew" />
|
<p:outputLabel value="Nombre: " for="nameNew" />
|
||||||
@@ -69,7 +75,7 @@
|
|||||||
requiredMessage="Es necesaria una descripción" />
|
requiredMessage="Es necesaria una descripción" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2 ui-md-2 ">
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
<p:commandButton validateClient="true" value="Crear" update="mesgsAdd frmAddSpecialties frmEditSpecialties" action="#{ManageSpecialities.insertData}" icon="pi pi-check" />
|
<p:commandButton validateClient="true" value="Crear" update="mesgsAdd frmListSpecialties frmAddSpecialties" action="#{ManageSpecialities.insertData}" icon="pi pi-check" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
|
|||||||
@@ -14,20 +14,20 @@
|
|||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:outputLabel for="paciente" value="Paciente:" />
|
<p:outputLabel for="paciente" value="Paciente:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-8">
|
<div class="ui-g-6">
|
||||||
<p:inputText id="paciente" value="#{AddVisit.patient.displayName}" readonly="true" />
|
<p:inputText id="paciente" value="#{AddVisit.patient.displayName}" readonly="true" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-4">
|
||||||
<p:message for="paciente" display="text" />
|
<p:message for="paciente" display="text" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:outputLabel for="medico" value="Médico de familia:" />
|
<p:outputLabel for="medico" value="Médico de familia:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-8">
|
<div class="ui-g-6">
|
||||||
<p:inputText id="medico" value="#{AddVisit.familyDoctor.displayName}" readonly="true" />
|
<p:inputText id="medico" value="#{AddVisit.familyDoctorDisplayName}" readonly="true" required="true" requiredMessage="Dese tener asignado un médico de familia. Por favor, cambie su médico de familia." />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-4">
|
||||||
<p:message for="medico" display="text" />
|
<p:message for="medico" display="text" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<div class="ui-inputgroup">
|
<div class="ui-inputgroup">
|
||||||
<p:datePicker id="fecha" widgetVar="fecha" value="#{AddVisit.date}" pattern="dd/MM/yyyy" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="fecha" widgetVar="fecha" value="#{AddVisit.date}" pattern="dd/MM/yyyy" locale="es" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
requiredMessage="Especifique la fecha de la visita.">
|
requiredMessage="Especifique la fecha de la visita.">
|
||||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
||||||
</p:datePicker>
|
</p:datePicker>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<p:outputLabel for="hora" value="Hora:" />
|
<p:outputLabel for="hora" value="Hora:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:datePicker id="hora" value="#{AddVisit.time}" timeOnly="true" pattern="HH:mm" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="hora" value="#{AddVisit.time}" timeOnly="true" pattern="HH:mm" locale="es" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
requiredMessage="Especifique la hora de la visita." validatorMessage="Especifique una hora en el rango de las 06:00 a las 22:00 horas">
|
requiredMessage="Especifique la hora de la visita." validatorMessage="Especifique una hora en el rango de las 06:00 a las 22:00 horas">
|
||||||
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||||
</p:datePicker>
|
</p:datePicker>
|
||||||
|
|||||||
@@ -8,7 +8,11 @@
|
|||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="frmPatientVisitList">
|
<h:form id="frmPatientVisitList">
|
||||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
<p:panel id="PanelUnderConstruction" header="Próximas visitas agendadas">
|
<p:confirmDialog global="true">
|
||||||
|
<p:commandButton value="Sí" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check" />
|
||||||
|
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times" />
|
||||||
|
</p:confirmDialog>
|
||||||
|
<p:panel id="panelAgenda" header="Próximas visitas agendadas">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
|
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
@@ -16,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-3">
|
<div class="ui-g-3">
|
||||||
<div class="ui-inputgroup">
|
<div class="ui-inputgroup">
|
||||||
<p:datePicker id="fecha" value="#{PatientVisitList.selectedDate}" pattern="dd/MM/yyyy" showIcon="true" showButtonBar="true" autocomplete="true">
|
<p:datePicker id="fecha" value="#{PatientVisitList.selectedDate}" pattern="dd/MM/yyyy" locale="es" showIcon="true" showButtonBar="true" autocomplete="true">
|
||||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
||||||
<p:ajax event="dateSelect" listener="#{PatientVisitList.showData}" update="frmPatientVisitList" />
|
<p:ajax event="dateSelect" listener="#{PatientVisitList.showData}" update="frmPatientVisitList" />
|
||||||
</p:datePicker>
|
</p:datePicker>
|
||||||
@@ -45,7 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p:dataTable id="dtPatientVisitList" widgetVar="dtPatientVisitList" var="v" value="#{PatientVisitList.lazyDataModelVisitList}" lazy="true" paginator="true" rows="10"
|
<p:dataTable id="dtPatientVisitList" widgetVar="dtPatientVisitList" var="v" value="#{PatientVisitList.lazyDataModelVisitList}" lazy="true" paginator="true" rows="10"
|
||||||
paginatorPosition="bottom" paginatorAlwaysVisible="true"
|
paginatorPosition="bottom" paginatorAlwaysVisible="true" currentPageReportTemplate="Página {currentPage} de {totalPages}"
|
||||||
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,40"
|
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,40"
|
||||||
emptyMessage="No existen datos para los filtros seleccionados.">
|
emptyMessage="No existen datos para los filtros seleccionados.">
|
||||||
|
|
||||||
@@ -73,12 +77,14 @@
|
|||||||
<h:outputText value="#{v.result}" />
|
<h:outputText value="#{v.result}" />
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
<p:column headerText="Anular" width="90">
|
<p:column headerText="Anular" width="90" rendered="#{not PatientVisitList.admin}">
|
||||||
<p:commandButton value="Anular" action="#{PatientVisitList.removeVisit(v.id)}" update="frmPatientVisitList" icon="pi pi-calendar-times" styleClass="red-button" />
|
<p:commandButton value="Anular" action="#{PatientVisitList.removeVisit(v.id)}" update="frmPatientVisitList" icon="pi pi-calendar-times" styleClass="red-button">
|
||||||
|
<p:confirm header="Eliminar" message="¿Está seguro de que quiere eliminar la visita?" icon="pi pi-exclamation-triangle" />
|
||||||
|
</p:commandButton>
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
<p:column headerText="Modificar" width="100">
|
<p:column headerText="Editar" width="100">
|
||||||
<p:commandButton value="Modificar" action="#{PatientVisitList.editVisit(v.id)}" update="frmPatientVisitList" icon="pi pi-pencil" />
|
<p:commandButton value="Editar" action="#{PatientVisitList.editVisit(v.id)}" update="frmPatientVisitList" icon="pi pi-pencil" />
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
<f:facet name="paginatorBottomLeft">
|
<f:facet name="paginatorBottomLeft">
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
<p:panel id="panelVisit" header="Actualizar detalles de la visita">
|
<p:panel id="panelVisit" header="Actualizar detalles de la visita">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
|
<p:outputPanel rendered="#{UpdateVisit.infoMessage != null}" styleClass="ui-g-12">
|
||||||
|
<p:staticMessage rendered="#{UpdateVisit.infoMessage != null}" summary="Información adicional:" detail="#{UpdateVisit.infoMessage}" severity="info" />
|
||||||
|
</p:outputPanel>
|
||||||
|
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:outputLabel for="paciente" value="Paciente:" />
|
<p:outputLabel for="paciente" value="Paciente:" />
|
||||||
@@ -37,8 +40,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<div class="ui-inputgroup">
|
<div class="ui-inputgroup">
|
||||||
<p:datePicker id="fecha" value="#{UpdateVisit.date}" pattern="dd/MM/yyyy" disabled="#{UpdateVisit.onlyResult}" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="fecha" value="#{UpdateVisit.date}" pattern="dd/MM/yyyy" locale="es" disabled="#{UpdateVisit.readOnly}" showIcon="true" showButtonBar="true"
|
||||||
requiredMessage="Especifique la fecha de la visita." readonly="#{UpdateVisit.onlyResult}">
|
autocomplete="true" required="true" requiredMessage="Especifique la fecha de la visita." readonly="#{UpdateVisit.readOnly}">
|
||||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" timeStyle="short" />
|
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" timeStyle="short" />
|
||||||
</p:datePicker>
|
</p:datePicker>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,8 +54,8 @@
|
|||||||
<p:outputLabel for="hora" value="Hora:" />
|
<p:outputLabel for="hora" value="Hora:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:datePicker id="hora" value="#{UpdateVisit.time}" timeOnly="true" pattern="HH:mm" disabled="#{UpdateVisit.onlyResult}" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="hora" value="#{UpdateVisit.time}" timeOnly="true" pattern="HH:mm" locale="es" disabled="#{UpdateVisit.readOnly}" showIcon="true" showButtonBar="true"
|
||||||
requiredMessage="Especifique la hora de la visita." readonly="#{UpdateVisit.onlyResult}">
|
autocomplete="true" required="true" requiredMessage="Especifique la hora de la visita." readonly="#{UpdateVisit.readOnly}">
|
||||||
<f:convertDateTime type="localTime" pattern="HH:mm" timeStyle="Short" />
|
<f:convertDateTime type="localTime" pattern="HH:mm" timeStyle="Short" />
|
||||||
</p:datePicker>
|
</p:datePicker>
|
||||||
</div>
|
</div>
|
||||||
@@ -64,7 +67,7 @@
|
|||||||
<p:outputLabel for="observaciones" value="Observaciones:" />
|
<p:outputLabel for="observaciones" value="Observaciones:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-8">
|
<div class="ui-g-8">
|
||||||
<p:inputTextarea id="observaciones" value="#{UpdateVisit.observations}" readonly="#{UpdateVisit.onlyResult}" />
|
<p:inputTextarea id="observaciones" value="#{UpdateVisit.observations}" readonly="true" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:message for="observaciones" display="text" />
|
<p:message for="observaciones" display="text" />
|
||||||
@@ -74,7 +77,7 @@
|
|||||||
<p:outputLabel for="resultado" value="Resultado:" />
|
<p:outputLabel for="resultado" value="Resultado:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-8">
|
<div class="ui-g-8">
|
||||||
<p:inputTextarea id="resultado" value="#{UpdateVisit.result}" readonly="#{not UpdateVisit.onlyResult}" />
|
<p:inputTextarea id="resultado" value="#{UpdateVisit.result}" readonly="#{UpdateVisit.resultReadOnly}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:message for="resultado" display="text" />
|
<p:message for="resultado" display="text" />
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="frmVisitList">
|
<h:form id="frmVisitList">
|
||||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
<p:panel id="PanelUnderConstruction" header="Consultar agenda del día">
|
<p:panel id="panelAngenda" header="Consultar agenda del día">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
|
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-3">
|
<div class="ui-g-3">
|
||||||
<div class="ui-inputgroup">
|
<div class="ui-inputgroup">
|
||||||
<p:datePicker id="fecha" value="#{VisitList.selectedDate}" pattern="dd/MM/yyyy" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="fecha" value="#{VisitList.selectedDate}" pattern="dd/MM/yyyy" locale="es" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
requiredMessage="Especifique una fecha para realizar la consulta.">
|
requiredMessage="Especifique una fecha para realizar la consulta.">
|
||||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
||||||
<p:ajax event="dateSelect" listener="#{VisitList.showData}" update="frmVisitList" />
|
<p:ajax event="dateSelect" listener="#{VisitList.showData}" update="frmVisitList" />
|
||||||
@@ -31,8 +31,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p:dataTable id="dtVisitList" widgetVar="dtVisitList" var="v" value="#{VisitList.lazyDataModelVisitList}" lazy="true" paginator="true" rows="10" paginatorPosition="bottom"
|
<p:dataTable id="dtVisitList" widgetVar="dtVisitList" var="v" value="#{VisitList.lazyDataModelVisitList}" lazy="true" paginator="true" rows="10" paginatorPosition="bottom"
|
||||||
paginatorAlwaysVisible="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
|
paginatorAlwaysVisible="true" currentPageReportTemplate="Página {currentPage} de {totalPages}"
|
||||||
rowsPerPageTemplate="10,20,30,40" emptyMessage="No existen datos para los filtros seleccionados.">
|
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,40"
|
||||||
|
emptyMessage="No existen datos para los filtros seleccionados.">
|
||||||
|
|
||||||
<p:column headerText="Fecha" width="90">
|
<p:column headerText="Fecha" width="90">
|
||||||
<h:outputText value="#{v.date}">
|
<h:outputText value="#{v.date}">
|
||||||
@@ -62,8 +63,8 @@
|
|||||||
<p:commandButton value="Ver" action="#{VisitList.showVisit(v.id)}" icon="pi pi-check" />
|
<p:commandButton value="Ver" action="#{VisitList.showVisit(v.id)}" icon="pi pi-check" />
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
<p:column headerText="Modificar" width="100px;">
|
<p:column headerText="Editar" width="100px;">
|
||||||
<p:commandButton value="Modificar" action="#{VisitList.editVisit(v.id)}" icon="pi pi-check" />
|
<p:commandButton value="Editar" action="#{VisitList.editVisit(v.id)}" icon="pi pi-check" />
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
<f:facet name="paginatorBottomLeft">
|
<f:facet name="paginatorBottomLeft">
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<div class="ui-inputgroup">
|
<div class="ui-inputgroup">
|
||||||
<p:datePicker id="fecha" value="#{VisitView.date}" pattern="dd/MM/yyyy" showIcon="true" disabled="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="fecha" value="#{VisitView.date}" pattern="dd/MM/yyyy" locale="es" showIcon="true" disabled="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
requiredMessage="Especifique la fecha de la visita.">
|
requiredMessage="Especifique la fecha de la visita.">
|
||||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
||||||
</p:datePicker>
|
</p:datePicker>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<p:outputLabel for="hora" value="Hora:" />
|
<p:outputLabel for="hora" value="Hora:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:datePicker id="hora" value="#{VisitView.time}" timeOnly="true" pattern="HH:mm" showIcon="true" showButtonBar="true" autocomplete="true" disabled="true" required="true"
|
<p:datePicker id="hora" value="#{VisitView.time}" timeOnly="true" locale="es" pattern="HH:mm" showIcon="true" showButtonBar="true" autocomplete="true" disabled="true" required="true"
|
||||||
requiredMessage="Especifique la hora de la visita.">
|
requiredMessage="Especifique la hora de la visita.">
|
||||||
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||||
</p:datePicker>
|
</p:datePicker>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||||||
*
|
*
|
||||||
* Además esta clase facilita la implementación futura de una Capa SOA (Se
|
* Además esta clase facilita la implementación futura de una Capa SOA (Se
|
||||||
* define la anotación para la serialización de esta clase: @XmlRootElement(name
|
* define la anotación para la serialización de esta clase: @XmlRootElement(name
|
||||||
* = "medicalspeciality")
|
* = "medicalspecialty")
|
||||||
*
|
*
|
||||||
* @author mark
|
* @author mark
|
||||||
*
|
*
|
||||||
@@ -19,11 +19,33 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||||||
public class SystemAdminTO implements Serializable {
|
public class SystemAdminTO implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String email;
|
||||||
|
private String password;
|
||||||
|
|
||||||
public SystemAdminTO() {
|
public SystemAdminTO() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SystemAdminTO(String email, String password) {
|
||||||
|
this.email = email;
|
||||||
|
this.setPassword(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||||||
/**
|
/**
|
||||||
* Transfer object (TO) MedicalSpecialtyTO Para el intercambio de datos entre la capa de interfaz y la capa de negocio
|
* Transfer object (TO) MedicalSpecialtyTO Para el intercambio de datos entre la capa de interfaz y la capa de negocio
|
||||||
*
|
*
|
||||||
* Además esta clase facilita la implementación futura de una Capa SOA (Se define la anotación para la serialización de esta clase: @XmlRootElement(name = "medicalspeciality")
|
* Además esta clase facilita la implementación futura de una Capa SOA (Se define la anotación para la serialización de esta clase: @XmlRootElement(name = "medicalspecialty")
|
||||||
*
|
*
|
||||||
* @author mark
|
* @author mark
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package common;
|
package common;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
import javax.xml.bind.DatatypeConverter;
|
import javax.xml.bind.DatatypeConverter;
|
||||||
|
|
||||||
@@ -18,8 +19,8 @@ public class HashUtils {
|
|||||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
md.update(stringValue.getBytes());
|
md.update(stringValue.getBytes());
|
||||||
digest = md.digest();
|
digest = md.digest();
|
||||||
} catch (Exception ex) {
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
// TODO: Register exception to log.
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (DatatypeConverter.printHexBinary(digest).toUpperCase());
|
return (DatatypeConverter.printHexBinary(digest).toUpperCase());
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import TO.PatientTO;
|
|||||||
import TO.PrimaryHealthCareCenterTO;
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
import TO.QuestionTO;
|
import TO.QuestionTO;
|
||||||
import TO.SpecialistDoctorTO;
|
import TO.SpecialistDoctorTO;
|
||||||
|
import TO.SystemAdminTO;
|
||||||
import TO.VisitTO;
|
import TO.VisitTO;
|
||||||
import common.Utils;
|
import common.Utils;
|
||||||
import jpa.FamilyDoctorJPA;
|
import jpa.FamilyDoctorJPA;
|
||||||
@@ -24,6 +25,7 @@ import jpa.PatientJPA;
|
|||||||
import jpa.PrimaryHealthCareCenterJPA;
|
import jpa.PrimaryHealthCareCenterJPA;
|
||||||
import jpa.QuestionJPA;
|
import jpa.QuestionJPA;
|
||||||
import jpa.SpecialistDoctorJPA;
|
import jpa.SpecialistDoctorJPA;
|
||||||
|
import jpa.SystemAdminJPA;
|
||||||
import jpa.VisitJPA;
|
import jpa.VisitJPA;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -43,8 +45,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
*
|
*
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
||||||
*/
|
*/
|
||||||
public List<MedicalSpecialtyTO> listAllMedicalSpecialities() {
|
public List<MedicalSpecialtyTO> listAllMedicalSpecialties() {
|
||||||
return this.listMedicalSpecialitiesPaged(0, 0);
|
return this.listMedicalSpecialtiesPaged(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,8 +60,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
*
|
*
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
||||||
*/
|
*/
|
||||||
public List<MedicalSpecialtyTO> listMedicalSpecialitiesPaged(int pageNumber, int pageSize) {
|
public List<MedicalSpecialtyTO> listMedicalSpecialtiesPaged(int pageNumber, int pageSize) {
|
||||||
return listMedicalSpecialitiesFiltered(null, pageNumber, pageSize);
|
return listMedicalSpecialtiesFiltered(null, pageNumber, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,7 +77,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
*
|
*
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
||||||
*/
|
*/
|
||||||
public List<MedicalSpecialtyTO> listMedicalSpecialitiesFiltered(String searchTerm, int pageNumber, int pageSize) {
|
public List<MedicalSpecialtyTO> listMedicalSpecialtiesFiltered(String searchTerm, int pageNumber, int pageSize) {
|
||||||
String strQuery = "SELECT ms from MedicalSpecialtyJPA ms %s order by ms.name, ms.description";
|
String strQuery = "SELECT ms from MedicalSpecialtyJPA ms %s order by ms.name, ms.description";
|
||||||
String strFilter = "";
|
String strFilter = "";
|
||||||
if (searchTerm == null)
|
if (searchTerm == null)
|
||||||
@@ -637,4 +639,15 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
|
|
||||||
return qsTO;
|
return qsTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SystemAdminTO getPOJOforSystemAdminJPA(SystemAdminJPA admin) {
|
||||||
|
SystemAdminTO adminTO = null;
|
||||||
|
|
||||||
|
if (admin != null) {
|
||||||
|
adminTO = new SystemAdminTO(admin.getEmail(), admin.getPassword());
|
||||||
|
}
|
||||||
|
|
||||||
|
return adminTO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ import TO.PatientTO;
|
|||||||
import TO.PrimaryHealthCareCenterTO;
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
import TO.QuestionTO;
|
import TO.QuestionTO;
|
||||||
import TO.SpecialistDoctorTO;
|
import TO.SpecialistDoctorTO;
|
||||||
|
import TO.SystemAdminTO;
|
||||||
import TO.VisitTO;
|
import TO.VisitTO;
|
||||||
|
import jpa.SystemAdminJPA;
|
||||||
import jpa.FamilyDoctorJPA;
|
import jpa.FamilyDoctorJPA;
|
||||||
import jpa.MedicalSpecialtyJPA;
|
import jpa.MedicalSpecialtyJPA;
|
||||||
import jpa.MedicalTestJPA;
|
import jpa.MedicalTestJPA;
|
||||||
@@ -29,11 +31,11 @@ import jpa.VisitJPA;
|
|||||||
@Local
|
@Local
|
||||||
public interface CommonFacadeLocal {
|
public interface CommonFacadeLocal {
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> listAllMedicalSpecialities();
|
public List<MedicalSpecialtyTO> listAllMedicalSpecialties();
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> listMedicalSpecialitiesPaged(int pageNumber, int pageSize);
|
public List<MedicalSpecialtyTO> listMedicalSpecialtiesPaged(int pageNumber, int pageSize);
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> listMedicalSpecialitiesFiltered(String searchTerm, int pageNumber, int pageSize);
|
public List<MedicalSpecialtyTO> listMedicalSpecialtiesFiltered(String searchTerm, int pageNumber, int pageSize);
|
||||||
|
|
||||||
public List<PrimaryHealthCareCenterTO> listAllCAPs();
|
public List<PrimaryHealthCareCenterTO> listAllCAPs();
|
||||||
|
|
||||||
@@ -84,4 +86,6 @@ public interface CommonFacadeLocal {
|
|||||||
public MedicalTestTO getPOJOforMedicalTestJPA(MedicalTestJPA mt, int nestedProps);
|
public MedicalTestTO getPOJOforMedicalTestJPA(MedicalTestJPA mt, int nestedProps);
|
||||||
|
|
||||||
public VisitTO getPOJOforVisitJPA(VisitJPA qs, int nestedProps);
|
public VisitTO getPOJOforVisitJPA(VisitJPA qs, int nestedProps);
|
||||||
|
|
||||||
|
public SystemAdminTO getPOJOforSystemAdminJPA(SystemAdminJPA admin);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import TO.SpecialistDoctorTO;
|
|||||||
@Remote
|
@Remote
|
||||||
public interface CommonFacadeRemote {
|
public interface CommonFacadeRemote {
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> listAllMedicalSpecialities();
|
public List<MedicalSpecialtyTO> listAllMedicalSpecialties();
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> listMedicalSpecialitiesPaged(int pageNumber, int pageSize);
|
public List<MedicalSpecialtyTO> listMedicalSpecialtiesPaged(int pageNumber, int pageSize);
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> listMedicalSpecialitiesFiltered(String searchTerm, int pageNumber, int pageSize);
|
public List<MedicalSpecialtyTO> listMedicalSpecialtiesFiltered(String searchTerm, int pageNumber, int pageSize);
|
||||||
|
|
||||||
public List<PrimaryHealthCareCenterTO> listAllCAPs();
|
public List<PrimaryHealthCareCenterTO> listAllCAPs();
|
||||||
|
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
entman.persist(mt);
|
entman.persist(mt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getSpecialistDoctorByMedicalSpecialityCount(int specialityId) {
|
public Long getSpecialistDoctorByMedicalSpecialtyCount(int specialityId) {
|
||||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from SpecialistDoctorJPA q where q.medicalSpecialty.id=:specId", Long.class);
|
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from SpecialistDoctorJPA q where q.medicalSpecialty.id=:specId", Long.class);
|
||||||
query.setParameter("specId", specialityId);
|
query.setParameter("specId", specialityId);
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
*
|
*
|
||||||
* @param speciality
|
* @param speciality
|
||||||
*/
|
*/
|
||||||
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(int specialityId, int pageNumber, int pageSize) {
|
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpecialty(int specialityId, int pageNumber, int pageSize) {
|
||||||
List<SpecialistDoctorTO> pendingQuestions = new ArrayList<SpecialistDoctorTO>();
|
List<SpecialistDoctorTO> pendingQuestions = new ArrayList<SpecialistDoctorTO>();
|
||||||
|
|
||||||
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery(
|
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery(
|
||||||
|
|||||||
@@ -126,12 +126,12 @@ public interface MedicalTestFacadeRemote {
|
|||||||
*/
|
*/
|
||||||
public void removeImage(int idMedicalTest);
|
public void removeImage(int idMedicalTest);
|
||||||
|
|
||||||
public Long getSpecialistDoctorByMedicalSpecialityCount(int specialityId);
|
public Long getSpecialistDoctorByMedicalSpecialtyCount(int specialityId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listar médicos con una especialidad concreta
|
* Listar médicos con una especialidad concreta
|
||||||
*
|
*
|
||||||
* @param speciality
|
* @param speciality
|
||||||
*/
|
*/
|
||||||
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(int specialityId, int pageNumber, int pageSize);
|
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpecialty(int specialityId, int pageNumber, int pageSize);
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
*
|
*
|
||||||
* @return PatientTO Transfer Object correspondiente al paciente registrado.
|
* @return PatientTO Transfer Object correspondiente al paciente registrado.
|
||||||
*/
|
*/
|
||||||
public PatientTO registerPatient(int id, String nif, String name, String surname, String password, String email) {
|
public PatientTO registerPatient(String nif, String name, String surname, String password, String email) {
|
||||||
PatientJPA pat = new PatientJPA(this.getNextPersonalIdentificationCode(), nif, name, surname, HashUtils.hashMD5(password), email, null);
|
PatientJPA pat = new PatientJPA(this.getNextPersonalIdentificationCode(), nif, name, surname, HashUtils.hashMD5(password), email, null);
|
||||||
entman.persist(pat);
|
entman.persist(pat);
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
*
|
*
|
||||||
* @return SpecialistDoctorTO Transfer Object correspondiente al médico especialista registrado.
|
* @return SpecialistDoctorTO Transfer Object correspondiente al médico especialista registrado.
|
||||||
*/
|
*/
|
||||||
public SpecialistDoctorTO registerSpecialistDoctor(int id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty)
|
public SpecialistDoctorTO registerSpecialistDoctor(String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, specialty.getId());
|
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, specialty.getId());
|
||||||
if (ms == null) {
|
if (ms == null) {
|
||||||
@@ -143,7 +143,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
*
|
*
|
||||||
* @return FamilyDoctorTO Transfer Object correspondiente al médico de familia registrado.
|
* @return FamilyDoctorTO Transfer Object correspondiente al médico de familia registrado.
|
||||||
*/
|
*/
|
||||||
public FamilyDoctorTO registerFamilyDoctor(int id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO cap) throws Exception {
|
public FamilyDoctorTO registerFamilyDoctor(String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO cap) throws Exception {
|
||||||
PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, cap.getId());
|
PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, cap.getId());
|
||||||
if (phcC == null) {
|
if (phcC == null) {
|
||||||
throw new Exception("No se encuentra el centro de atención primaria con identificador: " + cap.getName());
|
throw new Exception("No se encuentra el centro de atención primaria con identificador: " + cap.getName());
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ public interface ProfileFacadeRemote {
|
|||||||
|
|
||||||
public PatientTO changeFamilyDoctor(int id, int newDoctor) throws Exception;
|
public PatientTO changeFamilyDoctor(int id, int newDoctor) throws Exception;
|
||||||
|
|
||||||
public PatientTO registerPatient(int id, String nif, String name, String surname, String password, String email);
|
public PatientTO registerPatient(String nif, String name, String surname, String password, String email);
|
||||||
|
|
||||||
public SpecialistDoctorTO registerSpecialistDoctor(int id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty) throws Exception;
|
public SpecialistDoctorTO registerSpecialistDoctor(String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty) throws Exception;
|
||||||
|
|
||||||
public FamilyDoctorTO registerFamilyDoctor(int id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO cap) throws Exception;
|
public FamilyDoctorTO registerFamilyDoctor(String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO cap) throws Exception;
|
||||||
|
|
||||||
public PatientTO updatePatientData(int id, String nif, String name, String surname, String password, String email) throws Exception;
|
public PatientTO updatePatientData(int id, String nif, String name, String surname, String password, String email) throws Exception;
|
||||||
|
|
||||||
|
|||||||
@@ -15,18 +15,19 @@ import TO.MedicalSpecialtyTO;
|
|||||||
import TO.PatientTO;
|
import TO.PatientTO;
|
||||||
import TO.PrimaryHealthCareCenterTO;
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
import TO.SpecialistDoctorTO;
|
import TO.SpecialistDoctorTO;
|
||||||
|
import TO.SystemAdminTO;
|
||||||
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.SystemAdminJPA;
|
||||||
import jpa.FamilyDoctorJPA;
|
import jpa.FamilyDoctorJPA;
|
||||||
import jpa.MedicalSpecialtyJPA;
|
import jpa.MedicalSpecialtyJPA;
|
||||||
import jpa.PrimaryHealthCareCenterJPA;
|
import jpa.PrimaryHealthCareCenterJPA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
* @author David Álvarez González (dalvarezgon@uoc.edu)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Stateless
|
@Stateless
|
||||||
@@ -40,27 +41,32 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
CommonFacadeLocal commonServices;
|
CommonFacadeLocal commonServices;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Si la autenticación no es correcgta devuelve null, sino devuelve un POJO con datos del usuario logeado.
|
* Si la autenticación no es correcta devuelve null, sino devuelve un POJO con datos del usuario logeado.
|
||||||
*
|
*
|
||||||
* La autenticación se realiza en 2 pasos:
|
* La autenticación se realiza en 2 pasos:
|
||||||
*
|
*
|
||||||
* Paso 1. Se intenta localizar un registro de usuario, por orden:
|
* Paso 1. Se intenta localizar un registro de usuario, por orden:
|
||||||
*
|
*
|
||||||
* a. Primero Paciente, si el identificador comienza por los caracteres correctos.
|
* a. Primero, paciente, si el identificador comienza por los caracteres correctos.
|
||||||
*
|
*
|
||||||
* b.Después médico de familia, si el identificador es de profesional
|
* b. Después, médico de familia, si el identificador es de profesional
|
||||||
*
|
*
|
||||||
* c. Si no lo localizamos buscamos el identificador en la tabla de médicos especialistas (el identificador es de profesional)
|
* c. Si no lo localizamos buscamos el identificador en la tabla de médicos especialistas (el identificador es de profesional)
|
||||||
*
|
*
|
||||||
* d. Si no hemos localizado aún al usuario, lo buscamos en la tabla de administradores, aún cuando el identificador comience por cualquier carácter (podría ser una dirección
|
* d. Si no hemos localizado aún al usuario, lo buscamos en la tabla de administradores, aún cuando el identificador comience por cualquier carácter (podría ser una dirección
|
||||||
* de email que comienza por caracteres del identificaodr de paciente o profesional)
|
* de email que comienza por caracteres del identificador de paciente o profesional)
|
||||||
*
|
*
|
||||||
* Paso 2. Si hemos localizado un registro de usuario, verificamos si el password recibido coincide con el de la base de datos, en tal caso la autenticación se compelta y es
|
* Paso 2. Si hemos localizado un registro de usuario, verificamos si el password recibido coincide con el de la base de datos, en tal caso la autenticación se completa y es
|
||||||
* correcta.
|
* correcta.
|
||||||
*/
|
*/
|
||||||
public LoggedUserTO login(String userCode, String pwd) {
|
public LoggedUserTO login(String userCode, String pwd) {
|
||||||
LoggedUserTO usr = null;
|
LoggedUserTO usr = null;
|
||||||
|
|
||||||
|
if (userCode == null)
|
||||||
|
return usr;
|
||||||
|
|
||||||
|
userCode = userCode.trim().toUpperCase();
|
||||||
|
|
||||||
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.
|
||||||
@@ -91,7 +97,8 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
// cual intentamos login contra la tabla de administradores
|
// cual intentamos login contra la tabla de administradores
|
||||||
if (usr == null) {
|
if (usr == null) {
|
||||||
// Intentamos recuperar un registro de administrador
|
// Intentamos recuperar un registro de administrador
|
||||||
AdministratorJPA adm = entman.find(AdministratorJPA.class, userCode);
|
userCode = userCode.toLowerCase();
|
||||||
|
SystemAdminJPA adm = entman.find(SystemAdminJPA.class, userCode);
|
||||||
|
|
||||||
if (adm != null) {
|
if (adm != null) {
|
||||||
usr = new LoggedUserTO(adm.getEmail(), adm.getEmail(), adm.getPassword(), UserType.ADMINISTRATOR, adm.getEmail());
|
usr = new LoggedUserTO(adm.getEmail(), adm.getEmail(), adm.getPassword(), UserType.ADMINISTRATOR, adm.getEmail());
|
||||||
@@ -111,7 +118,12 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
return usr;
|
return usr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public Long getSpecialtiesCount() {
|
||||||
|
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from MedicalSpecialtyJPA", Long.class);
|
||||||
|
|
||||||
|
return query.getSingleResult();
|
||||||
|
}
|
||||||
|
|
||||||
public MedicalSpecialtyTO updateSpecialty(int id, String name, String description) throws Exception {
|
public MedicalSpecialtyTO updateSpecialty(int id, String name, String description) throws Exception {
|
||||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
||||||
|
|
||||||
@@ -128,7 +140,7 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MedicalSpecialtyTO findSpecialtyByName(String searchedName) {
|
public MedicalSpecialtyTO findSpecialtyByName(String searchedName) {
|
||||||
TypedQuery<MedicalSpecialtyJPA> query = entman.createQuery("from MedicalSpecialtyJPA ms where ms.name=:name", MedicalSpecialtyJPA.class);
|
TypedQuery<MedicalSpecialtyJPA> query = entman.createQuery("from MedicalSpecialtyJPA ms where LOWER(ms.name)=LOWER(:name)", MedicalSpecialtyJPA.class);
|
||||||
query.setMaxResults(1);
|
query.setMaxResults(1);
|
||||||
query.setParameter("name", searchedName);
|
query.setParameter("name", searchedName);
|
||||||
|
|
||||||
@@ -139,7 +151,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteSpecialty(int id) throws Exception {
|
public void deleteSpecialty(int id) throws Exception {
|
||||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
||||||
|
|
||||||
@@ -150,7 +161,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
entman.remove(ms);
|
entman.remove(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public MedicalSpecialtyTO insertSpecialty(String name, String description) throws Exception {
|
public MedicalSpecialtyTO insertSpecialty(String name, String description) throws Exception {
|
||||||
MedicalSpecialtyJPA ms = new MedicalSpecialtyJPA(name, description);
|
MedicalSpecialtyJPA ms = new MedicalSpecialtyJPA(name, description);
|
||||||
entman.persist(ms);
|
entman.persist(ms);
|
||||||
@@ -158,7 +168,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
|
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PrimaryHealthCareCenterTO updateHealthCareCenter(int id, String name, String location) throws Exception {
|
public PrimaryHealthCareCenterTO updateHealthCareCenter(int id, String name, String location) throws Exception {
|
||||||
PrimaryHealthCareCenterJPA ms = entman.find(PrimaryHealthCareCenterJPA.class, id);
|
PrimaryHealthCareCenterJPA ms = entman.find(PrimaryHealthCareCenterJPA.class, id);
|
||||||
|
|
||||||
@@ -175,7 +184,7 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PrimaryHealthCareCenterTO findHealthCareCenterByName(String searchedName) {
|
public PrimaryHealthCareCenterTO findHealthCareCenterByName(String searchedName) {
|
||||||
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery("from PrimaryHealthCareCenterJPA cap where cap.name=:name", PrimaryHealthCareCenterJPA.class);
|
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery("from PrimaryHealthCareCenterJPA cap where LOWER(cap.name)=LOWER(:name)", PrimaryHealthCareCenterJPA.class);
|
||||||
query.setMaxResults(1);
|
query.setMaxResults(1);
|
||||||
query.setParameter("name", searchedName);
|
query.setParameter("name", searchedName);
|
||||||
|
|
||||||
@@ -186,7 +195,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteHealthCareCenter(int id) throws Exception {
|
public void deleteHealthCareCenter(int id) throws Exception {
|
||||||
PrimaryHealthCareCenterJPA cap = entman.find(PrimaryHealthCareCenterJPA.class, id);
|
PrimaryHealthCareCenterJPA cap = entman.find(PrimaryHealthCareCenterJPA.class, id);
|
||||||
|
|
||||||
@@ -197,7 +205,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
entman.remove(cap);
|
entman.remove(cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PrimaryHealthCareCenterTO insertHealthCareCenter(String name, String location) throws Exception {
|
public PrimaryHealthCareCenterTO insertHealthCareCenter(String name, String location) throws Exception {
|
||||||
PrimaryHealthCareCenterJPA cap = new PrimaryHealthCareCenterJPA(name, location);
|
PrimaryHealthCareCenterJPA cap = new PrimaryHealthCareCenterJPA(name, location);
|
||||||
entman.persist(cap);
|
entman.persist(cap);
|
||||||
@@ -211,22 +218,11 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
return query.getSingleResult();
|
return query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PrimaryHealthCareCenterTO> listCAPsPaged(int pageNumber, int pageSize) {
|
public Long getFamilyDoctorsByCAPCount(int primaryHealthCareCenterId) {
|
||||||
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery("SELECT c from PrimaryHealthCareCenterJPA c order by c.name", PrimaryHealthCareCenterJPA.class);
|
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from FamilyDoctorJPA d where d.primaryHealthCareCenter.id=:capId", Long.class);
|
||||||
|
query.setParameter("capId", primaryHealthCareCenterId);
|
||||||
|
|
||||||
if (pageSize > 0) {
|
return query.getSingleResult();
|
||||||
query.setFirstResult(pageNumber * pageSize);
|
|
||||||
query.setMaxResults(pageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PrimaryHealthCareCenterJPA> allJPA = query.getResultList();
|
|
||||||
List<PrimaryHealthCareCenterTO> caps = new ArrayList<PrimaryHealthCareCenterTO>();
|
|
||||||
|
|
||||||
for (PrimaryHealthCareCenterJPA item : allJPA) {
|
|
||||||
caps.add(commonServices.getPOJOforPrimaryHealthCareCenterJPA(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
return caps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FamilyDoctorTO> listAllFamilyDoctorsByCAPPaged(int primaryHealthCareCenterId, int pageNumber, int pageSize) {
|
public List<FamilyDoctorTO> listAllFamilyDoctorsByCAPPaged(int primaryHealthCareCenterId, int pageNumber, int pageSize) {
|
||||||
@@ -256,4 +252,23 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
|
|
||||||
return query.getSingleResult();
|
return query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SystemAdminTO findAdminByEmail(String email) {
|
||||||
|
TypedQuery<SystemAdminJPA> query = entman.createQuery("from SystemAdminJPA a where LOWER(a.email)=LOWER(:email)", SystemAdminJPA.class);
|
||||||
|
query.setMaxResults(1);
|
||||||
|
query.setParameter("email", email);
|
||||||
|
|
||||||
|
List<SystemAdminJPA> results = query.getResultList();
|
||||||
|
if (results.size() > 0)
|
||||||
|
return this.commonServices.getPOJOforSystemAdminJPA(results.get(0));
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SystemAdminTO insertAdmin(String email, String password) throws Exception {
|
||||||
|
SystemAdminJPA admin = new SystemAdminJPA(email, password);
|
||||||
|
entman.persist(admin);
|
||||||
|
|
||||||
|
return this.commonServices.getPOJOforSystemAdminJPA(admin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ import TO.FamilyDoctorTO;
|
|||||||
import TO.LoggedUserTO;
|
import TO.LoggedUserTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
import TO.PrimaryHealthCareCenterTO;
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
|
import TO.SystemAdminTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
* @author David Alvarez González (dalvarezgon@uoc.edu)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Remote
|
@Remote
|
||||||
@@ -22,6 +23,8 @@ public interface SystemAdminFacadeRemote {
|
|||||||
|
|
||||||
public LoggedUserTO login(String id, String pwd);
|
public LoggedUserTO login(String id, String pwd);
|
||||||
|
|
||||||
|
public Long getSpecialtiesCount();
|
||||||
|
|
||||||
public MedicalSpecialtyTO updateSpecialty(int id, String name, String description) throws Exception;
|
public MedicalSpecialtyTO updateSpecialty(int id, String name, String description) throws Exception;
|
||||||
|
|
||||||
public MedicalSpecialtyTO findSpecialtyByName(String name);
|
public MedicalSpecialtyTO findSpecialtyByName(String name);
|
||||||
@@ -40,9 +43,13 @@ public interface SystemAdminFacadeRemote {
|
|||||||
|
|
||||||
public Long getCAPCount();
|
public Long getCAPCount();
|
||||||
|
|
||||||
public List<PrimaryHealthCareCenterTO> listCAPsPaged(int pageNumber, int pageSize);
|
public Long getFamilyDoctorsByCAPCount(int primaryHealthCareCenterId);
|
||||||
|
|
||||||
public List<FamilyDoctorTO> listAllFamilyDoctorsByCAPPaged(int primaryHealthCareCenterId, int pageNumber, int pageSize);
|
public List<FamilyDoctorTO> listAllFamilyDoctorsByCAPPaged(int primaryHealthCareCenterId, int pageNumber, int pageSize);
|
||||||
|
|
||||||
public Long getPatientCount(int familyDoctorId);
|
public Long getPatientCount(int familyDoctorId);
|
||||||
|
|
||||||
|
public SystemAdminTO findAdminByEmail(String email);
|
||||||
|
|
||||||
|
public SystemAdminTO insertAdmin(String email, String password) throws Exception;
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ import javax.persistence.Table;
|
|||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "MyHealth.Administrator")
|
@Table(name = "MyHealth.Administrator")
|
||||||
public class AdministratorJPA implements Serializable {
|
public class SystemAdminJPA implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -24,11 +24,11 @@ public class AdministratorJPA implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Class constructor methods
|
* Class constructor methods
|
||||||
*/
|
*/
|
||||||
public AdministratorJPA() {
|
public SystemAdminJPA() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AdministratorJPA(String email, String password) {
|
public SystemAdminJPA(String email, String password) {
|
||||||
this.email = email;
|
this.email = email;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,6 @@ package managedbean.common;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.faces.application.FacesMessage;
|
import javax.faces.application.FacesMessage;
|
||||||
import javax.persistence.PersistenceException;
|
|
||||||
import javax.servlet.Filter;
|
import javax.servlet.Filter;
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.FilterConfig;
|
import javax.servlet.FilterConfig;
|
||||||
@@ -16,11 +15,7 @@ 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.omnifaces.util.Exceptions;
|
|
||||||
|
|
||||||
import common.UserType;
|
import common.UserType;
|
||||||
import common.Utils;
|
|
||||||
import managedbean.systemAdmin.LoginMBean;
|
|
||||||
|
|
||||||
@WebFilter(filterName = "AuthFilter", urlPatterns = { "*.xhtml" })
|
@WebFilter(filterName = "AuthFilter", urlPatterns = { "*.xhtml" })
|
||||||
public class AuthorizationFilter implements Filter {
|
public class AuthorizationFilter implements Filter {
|
||||||
@@ -48,151 +43,118 @@ public class AuthorizationFilter implements Filter {
|
|||||||
HttpServletResponse resp = null;
|
HttpServletResponse resp = null;
|
||||||
HttpSession ses = null;
|
HttpSession ses = null;
|
||||||
|
|
||||||
// Si establecemos esta variable a true se realiza el autologin
|
req = (HttpServletRequest) request;
|
||||||
// TODO: Eliminar esta variable al terminar el desarrollo
|
String reqURI = req.getRequestURI();
|
||||||
boolean Debug = false;
|
ses = req.getSession(false);
|
||||||
try {
|
|
||||||
|
|
||||||
req = (HttpServletRequest) request;
|
resp = (HttpServletResponse) response;
|
||||||
String reqURI = req.getRequestURI();
|
|
||||||
|
|
||||||
resp = (HttpServletResponse) response;
|
// Para recursos publicos permitimos el acceso exista sesión o no.
|
||||||
|
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/profile/RegisterUser.xhtml") >= 0 || reqURI.indexOf("/home.xhtml") >= 0 || reqURI.indexOf("/error.xhtml") >= 0
|
||||||
// TODO: Eliminar este código al terminar el desarrollo.
|
|| reqURI.indexOf("/public/") >= 0 || reqURI.contains("javax.faces.resource")) {
|
||||||
// Realizamos un login automatico (para agilizar el desarrollo.
|
chain.doFilter(request, response);
|
||||||
if (Debug == true) {
|
return;
|
||||||
ses = req.getSession(true);
|
|
||||||
|
|
||||||
if (SessionUtils.isLogedIn(ses) == false) {
|
|
||||||
LoginMBean login = new LoginMBean();
|
|
||||||
login.setUsername("PRO#100");
|
|
||||||
login.setPassword("asdf");
|
|
||||||
boolean result = login.autoLogin(ses);
|
|
||||||
|
|
||||||
if (result == true)
|
|
||||||
SessionUtils.addMessage(ses, FacesMessage.SEVERITY_ERROR, "Login automático correcto", "Se ha realizado un login automático correctamente.");
|
|
||||||
else
|
|
||||||
SessionUtils.addMessage(ses, FacesMessage.SEVERITY_ERROR, "El login automático ha fallado.", "No se ha podido realizar el login automático.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
ses = req.getSession(false);
|
|
||||||
|
|
||||||
// Para recursos publicos permitimos el acceso exista sesión o no.
|
|
||||||
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);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isAJAXRequest(req) == true) {
|
|
||||||
chain.doFilter(request, response);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sesión expirada
|
|
||||||
if (req.isRequestedSessionIdValid() == false && req.getRequestedSessionId() != null) {
|
|
||||||
resp.sendRedirect(req.getContextPath() + "/error.xhtml?type=expired");
|
|
||||||
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/PatientVisitList") > 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/PatientVisitList") > 0)
|
|
||||||
authorized = true;
|
|
||||||
if (reqURI.indexOf("/medicaltest/Questions") > 0)
|
|
||||||
authorized = true;
|
|
||||||
if (reqURI.indexOf("/medicaltest/ViewMedicalTest") > 0)
|
|
||||||
authorized = true;
|
|
||||||
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
|
|
||||||
authorized = true;
|
|
||||||
if (reqURI.indexOf("/medicaltest/SearchSpecialist") > 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/UpdateVisit") > 0)
|
|
||||||
authorized = true;
|
|
||||||
if (reqURI.indexOf("/visit/VisitList") > 0)
|
|
||||||
authorized = true;
|
|
||||||
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
|
|
||||||
authorized = true;
|
|
||||||
if (reqURI.indexOf("/medicaltest/Questions") > 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");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (Exceptions.is(e, PersistenceException.class) == true) {
|
|
||||||
if (ses != null)
|
|
||||||
SessionUtils.addMessage(ses, FacesMessage.SEVERITY_ERROR, "Error al intentar acceder a la base de datos", Utils.getExceptionRootCause(e).getLocalizedMessage());
|
|
||||||
|
|
||||||
resp.sendRedirect(req.getContextPath() + "/error.xhtml?type=sql");
|
|
||||||
} else {
|
|
||||||
SessionUtils.addMessage(ses, FacesMessage.SEVERITY_ERROR, "Error interno del servidor", Utils.getExceptionRootCause(e).getLocalizedMessage());
|
|
||||||
resp.sendRedirect(req.getContextPath() + "/error.xhtml");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.isAJAXRequest(req) == true) {
|
||||||
|
chain.doFilter(request, response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sesión expirada
|
||||||
|
if (req.isRequestedSessionIdValid() == false && req.getRequestedSessionId() != null) {
|
||||||
|
resp.sendRedirect(req.getContextPath() + "/error.xhtml?type=expired");
|
||||||
|
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("/systemAdmin/AddAdmin") > 0)
|
||||||
|
authorized = true;
|
||||||
|
if (reqURI.indexOf("/visit/PatientVisitList") > 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/PatientVisitList") > 0)
|
||||||
|
authorized = true;
|
||||||
|
if (reqURI.indexOf("/medicaltest/Questions") > 0)
|
||||||
|
authorized = true;
|
||||||
|
if (reqURI.indexOf("/medicaltest/ViewMedicalTest") > 0)
|
||||||
|
authorized = true;
|
||||||
|
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
|
||||||
|
authorized = true;
|
||||||
|
if (reqURI.indexOf("/medicaltest/SearchSpecialist") > 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/UpdateVisit") > 0)
|
||||||
|
authorized = true;
|
||||||
|
if (reqURI.indexOf("/visit/VisitList") > 0)
|
||||||
|
authorized = true;
|
||||||
|
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
|
||||||
|
authorized = true;
|
||||||
|
if (reqURI.indexOf("/medicaltest/Questions") > 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");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -124,14 +124,22 @@ public class ManagedBeanBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void manageException(Exception ex) {
|
protected void manageException(Exception ex) {
|
||||||
String strType = "";
|
String strType = "runtime";
|
||||||
|
|
||||||
if (ex.getClass().equals(ViewExpiredException.class)) {
|
if (ex.getClass().equals(ViewExpiredException.class)) {
|
||||||
// Sessión expirada
|
// Sessión expirada
|
||||||
strType = "expired";
|
strType = "expired";
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Su sesión ha caducado", "Su sesión ha caducado, vuelva a logarse en el sistema.");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Su sesión ha caducado", "Su sesión ha caducado, vuelva a logarse en el sistema.");
|
||||||
} else {
|
} else {
|
||||||
this.addFacesMessageKeep(FacesMessage.SEVERITY_ERROR, "Se ha producido un error inesperado", "Descripción del error: " + ex.getLocalizedMessage());
|
String msg = "";
|
||||||
|
Throwable th = ex.getCause();
|
||||||
|
|
||||||
|
if (th != null)
|
||||||
|
msg = th.getLocalizedMessage();
|
||||||
|
else
|
||||||
|
msg = ex.getLocalizedMessage();
|
||||||
|
|
||||||
|
this.addFacesMessageKeep(FacesMessage.SEVERITY_ERROR, "Se ha producido un error inesperado", "Descripción del error: ".concat(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -139,7 +147,6 @@ public class ManagedBeanBase {
|
|||||||
|
|
||||||
ctx.redirect(ctx.getApplicationContextPath() + "/error.xhtml?type=" + strType);
|
ctx.redirect(ctx.getApplicationContextPath() + "/error.xhtml?type=" + strType);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.primefaces.model.menu.DefaultMenuItem;
|
|||||||
import org.primefaces.model.menu.DefaultMenuModel;
|
import org.primefaces.model.menu.DefaultMenuModel;
|
||||||
import org.primefaces.model.menu.DefaultSeparator;
|
import org.primefaces.model.menu.DefaultSeparator;
|
||||||
import org.primefaces.model.menu.DefaultSubMenu;
|
import org.primefaces.model.menu.DefaultSubMenu;
|
||||||
|
import org.primefaces.model.menu.MenuElement;
|
||||||
import org.primefaces.model.menu.MenuModel;
|
import org.primefaces.model.menu.MenuModel;
|
||||||
|
|
||||||
import common.UserType;
|
import common.UserType;
|
||||||
@@ -28,13 +29,16 @@ public class MenuMBean implements Serializable {
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
|
boolean loggedIn = SessionUtils.isLogedIn();
|
||||||
|
|
||||||
model = new DefaultMenuModel();
|
model = new DefaultMenuModel();
|
||||||
DefaultSubMenu subMenu;
|
DefaultSubMenu subMenu;
|
||||||
UserType tipoUsuario = null;
|
UserType tipoUsuario = null;
|
||||||
|
DefaultMenuItem menuItem;
|
||||||
|
|
||||||
model.addElement(createMenuItem("Home", "pi pi-home", "/home", null));
|
model.addElement(createMenuItem("Home", "pi pi-home", "/home", null));
|
||||||
|
|
||||||
if (SessionUtils.isLogedIn() == true) {
|
if (loggedIn == true) {
|
||||||
tipoUsuario = SessionUtils.getUserType();
|
tipoUsuario = SessionUtils.getUserType();
|
||||||
|
|
||||||
// Administracion Sistema
|
// Administracion Sistema
|
||||||
@@ -46,7 +50,7 @@ public class MenuMBean implements Serializable {
|
|||||||
subMenu.addElement(new DefaultSeparator());
|
subMenu.addElement(new DefaultSeparator());
|
||||||
subMenu.addElement(createMenuItem("Ver médicos de un CAP", "fa fa-medkit", "/systemAdmin/ListDoctorsByCenter", null));
|
subMenu.addElement(createMenuItem("Ver médicos de un CAP", "fa fa-medkit", "/systemAdmin/ListDoctorsByCenter", null));
|
||||||
subMenu.addElement(new DefaultSeparator());
|
subMenu.addElement(new DefaultSeparator());
|
||||||
subMenu.addElement(createMenuItem("Añadir usuario Admin", "fa fa-user-secret", "/systemAdmin/ManageSpecialties", null));
|
subMenu.addElement(createMenuItem("Añadir usuario Admin", "fa fa-user-secret", "/systemAdmin/AddAdmin", null));
|
||||||
|
|
||||||
model.addElement(subMenu);
|
model.addElement(subMenu);
|
||||||
}
|
}
|
||||||
@@ -99,12 +103,8 @@ public class MenuMBean implements Serializable {
|
|||||||
|
|
||||||
// Perfil
|
// Perfil
|
||||||
subMenu = new DefaultSubMenu("Gestionar perfil", "fa fa-gears");
|
subMenu = new DefaultSubMenu("Gestionar perfil", "fa fa-gears");
|
||||||
if (SessionUtils.isLogedIn() == false) {
|
if (loggedIn == 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 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);
|
model.addElement(subMenu);
|
||||||
} else {
|
} else {
|
||||||
if (tipoUsuario != UserType.ADMINISTRATOR) {
|
if (tipoUsuario != UserType.ADMINISTRATOR) {
|
||||||
@@ -123,6 +123,30 @@ public class MenuMBean implements Serializable {
|
|||||||
model.addElement(subMenu);
|
model.addElement(subMenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Opciones de menu a la derecha (login, logout, registrase y descripción del usuario logeado
|
||||||
|
if (loggedIn == true) {
|
||||||
|
menuItem = createMenuItem("Salir", "pi pi-sign-out", null, "#{loginView.logout}");
|
||||||
|
menuItem.setContainerStyle("float: right;");
|
||||||
|
model.addElement(menuItem);
|
||||||
|
|
||||||
|
menuItem = createMenuItem("Bienvenido, " + SessionUtils.getUserDisplayName(), null, "/profile/UpdateProfile", null);
|
||||||
|
menuItem.setContainerStyle("float: right;");
|
||||||
|
model.addElement(menuItem);
|
||||||
|
} else {
|
||||||
|
menuItem = createMenuItem("Entrar", "pi pi-sign-in", null, null);
|
||||||
|
menuItem.setOnclick("PF('dlgLogin').show();");
|
||||||
|
menuItem.setContainerStyle("float: right;");
|
||||||
|
model.addElement(menuItem);
|
||||||
|
|
||||||
|
menuItem = createMenuItem("Registrarse", "pi pi-user-plus", "/profile/RegisterUser", null);
|
||||||
|
menuItem.setContainerStyle("float: right;");
|
||||||
|
model.addElement(menuItem);
|
||||||
|
|
||||||
|
menuItem = createMenuItem("hola, invitado", null, null, null);
|
||||||
|
menuItem.setContainerStyle("float: right;");
|
||||||
|
model.addElement(menuItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DefaultMenuItem createMenuItem(String name, String icon, String outcome, String command) {
|
private DefaultMenuItem createMenuItem(String name, String icon, String outcome, String command) {
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ public class SessionPreferences implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateCurrentTheme() {
|
public void updateCurrentTheme() {
|
||||||
// TODO: Se podría guardar el tema seleccionado en base de datos para el usuario
|
// Muestra mensaje al usuario indicando que el tema se utilizará en esta sesión
|
||||||
// (en caso de que esté logeado en el sistema
|
|
||||||
FacesContext.getCurrentInstance().addMessage(null,
|
FacesContext.getCurrentInstance().addMessage(null,
|
||||||
new FacesMessage(FacesMessage.SEVERITY_INFO, "Tema guardado", "El tema seleccionado será utilizado durante esta sesión."));
|
new FacesMessage(FacesMessage.SEVERITY_INFO, "Tema guardado", "El tema seleccionado será utilizado durante esta sesión."));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,12 @@ public class ValidationUtils {
|
|||||||
static final String NIE_LETTERS = "XYZ";
|
static final String NIE_LETTERS = "XYZ";
|
||||||
|
|
||||||
public static String normalizeNIF(String nif) {
|
public static String normalizeNIF(String nif) {
|
||||||
return nif.toUpperCase().replace("-", "").replace(".", "");
|
if (nif == null)
|
||||||
|
return nif;
|
||||||
|
else
|
||||||
|
return nif.toUpperCase().replace("-", "").replace(".", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param nif NIF a validar
|
* @param nif NIF a validar
|
||||||
@@ -57,17 +61,13 @@ public class ValidationUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comprueba si un NIF existe para un tipo de usuario. * No se permite que el
|
* 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
|
||||||
* mismo NIF esté registrado como médico de familia y como especialista. * Se
|
* NIF esté registrado como paciente y como médico (de familia o especialista)
|
||||||
* 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 remoteSvc Servicio Remoto para recuperar datos.
|
||||||
* @param userType Tipo de usuario a comprobar
|
* @param userType Tipo de usuario a comprobar
|
||||||
* @param nif NIF a comprobar.
|
* @param nif NIF a comprobar.
|
||||||
* @param id Parámetro opcional, id del usuario actual (si encuentra el
|
* @param id Parámetro opcional, id del usuario actual (si encuentra el mismo nif y el usuario coincide no se devuelve la coincidencia)
|
||||||
* mismo nif y el usuario coincide no se devuelve la
|
|
||||||
* coincidencia)
|
|
||||||
* @return true si el NIF ya estaba registrado para un usuario diferente.
|
* @return true si el NIF ya estaba registrado para un usuario diferente.
|
||||||
*/
|
*/
|
||||||
public static boolean checkIfNifAlreadyRegistered(CommonFacadeRemote remoteSvc, UserType userType, String nif, Integer id) {
|
public static boolean checkIfNifAlreadyRegistered(CommonFacadeRemote remoteSvc, UserType userType, String nif, Integer id) {
|
||||||
@@ -90,7 +90,7 @@ public class ValidationUtils {
|
|||||||
|
|
||||||
if (sd != null && (id == null || sd.getId().equals(id) == false))
|
if (sd != null && (id == null || sd.getId().equals(id) == false))
|
||||||
nifExists = true;
|
nifExists = true;
|
||||||
} else if (id == null || fd.getId().equals(id) == false )
|
} else if (id == null || fd.getId().equals(id) == false)
|
||||||
// Si se trata de un usuario diferente, entonces está repetido
|
// Si se trata de un usuario diferente, entonces está repetido
|
||||||
nifExists = true;
|
nifExists = true;
|
||||||
|
|
||||||
|
|||||||
141
1.sources/MyHealth/src/managedbean/common/errorMBean.java
Normal file
141
1.sources/MyHealth/src/managedbean/common/errorMBean.java
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
package managedbean.common;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.faces.application.FacesMessage;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import common.Utils;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named("error")
|
||||||
|
@RequestScoped
|
||||||
|
public class errorMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String errorType;
|
||||||
|
private String errorMessage;
|
||||||
|
private String requestURI;
|
||||||
|
private boolean renderBack;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() throws IOException {
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
this.setRenderBack(false);
|
||||||
|
|
||||||
|
if (fc != null) {
|
||||||
|
HttpServletRequest req = (HttpServletRequest) fc.getExternalContext().getRequest();
|
||||||
|
|
||||||
|
Map<String, String> requestParams = fc.getExternalContext().getRequestParameterMap();
|
||||||
|
|
||||||
|
this.errorType = this.getRequestParameter(requestParams, "type");
|
||||||
|
if (this.errorType.equals("") == true) {
|
||||||
|
this.requestURI = this.getRequestAttribute(req, "javax.servlet.error.request_uri");
|
||||||
|
|
||||||
|
if (requestURI.equals("") == true)
|
||||||
|
this.requestURI = req.getContextPath().concat("/home.xhtml");
|
||||||
|
|
||||||
|
setRenderBack(true);
|
||||||
|
|
||||||
|
Throwable rootCause = null;
|
||||||
|
Object obj = req.getAttribute("javax.servlet.error.exception");
|
||||||
|
if (obj != null) {
|
||||||
|
Exception se = Exception.class.cast(obj);
|
||||||
|
|
||||||
|
rootCause = Utils.getExceptionRootCause(se);
|
||||||
|
|
||||||
|
if (rootCause != null) {
|
||||||
|
this.errorType = rootCause.getClass().getName();
|
||||||
|
this.errorMessage = rootCause.getLocalizedMessage();
|
||||||
|
} else {
|
||||||
|
this.errorType = se.getClass().getName();
|
||||||
|
this.errorMessage = se.getCause().getLocalizedMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si no hay error volvemos al home.
|
||||||
|
if (this.errorType.equals("") == true)
|
||||||
|
fc.getExternalContext().redirect(req.getContextPath().concat("/home.xhtml"));
|
||||||
|
|
||||||
|
switch (this.errorType) {
|
||||||
|
case "javax.faces.application.ViewExpiredException":
|
||||||
|
this.errorType = "expired";
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Sesión caducada", "Su sesión ha caducado, debe logearse de nuevo");
|
||||||
|
break;
|
||||||
|
case "java.sql.SQLException":
|
||||||
|
case "org.hibernate.exception.GenericJDBCException":
|
||||||
|
case "java.net.ConnectException":
|
||||||
|
case "javax.persistence.PersistenceException":
|
||||||
|
this.errorType = "sql";
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Error en el acceso a la base de datos", this.errorMessage);
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.errorType = "runtime";
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Error interno del servidor", this.errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getRequestAttribute(HttpServletRequest req, String attrName) {
|
||||||
|
Object attr = req.getAttribute(attrName);
|
||||||
|
|
||||||
|
if (attr != null)
|
||||||
|
return attr.toString();
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getRequestParameter(Map<String, String> pars, String paramName) {
|
||||||
|
Object par = pars.get(paramName);
|
||||||
|
|
||||||
|
if (par != null)
|
||||||
|
return par.toString();
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getErrorType() {
|
||||||
|
return errorType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorType(String errorType) {
|
||||||
|
this.errorType = errorType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRequestURI() {
|
||||||
|
return requestURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequestURI(String requestURI) {
|
||||||
|
this.requestURI = requestURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRenderBack() {
|
||||||
|
return renderBack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRenderBack(boolean renderBack) {
|
||||||
|
this.renderBack = renderBack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getErrorMessage() {
|
||||||
|
return errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorMessage(String errorMessage) {
|
||||||
|
this.errorMessage = errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package managedbean.medicalTest;
|
package managedbean.medicalTest;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
@@ -13,7 +14,10 @@ import javax.faces.event.AjaxBehaviorEvent;
|
|||||||
import javax.faces.view.ViewScoped;
|
import javax.faces.view.ViewScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.primefaces.event.FileUploadEvent;
|
||||||
import org.primefaces.event.SelectEvent;
|
import org.primefaces.event.SelectEvent;
|
||||||
|
import org.primefaces.model.DefaultStreamedContent;
|
||||||
|
import org.primefaces.model.StreamedContent;
|
||||||
import org.primefaces.model.UploadedFile;
|
import org.primefaces.model.UploadedFile;
|
||||||
|
|
||||||
import TO.MedicalTestTO;
|
import TO.MedicalTestTO;
|
||||||
@@ -84,20 +88,40 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.loadMedicalTests();
|
this.loadMedicalTests();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addImage() {
|
public void uploadDataListener(FileUploadEvent event) {
|
||||||
if (this.imageUpload != null) {
|
UploadedFile uploadedFile = event.getFile();
|
||||||
String content = "data:" + imageUpload.getContentType() + ";base64," + Base64.getEncoder().encodeToString(imageUpload.getContents());
|
// String fileName = uploadedFile.getFileName();
|
||||||
System.out.println("FILE Content base64: ");
|
String contentType = uploadedFile.getContentType();
|
||||||
System.out.println(content);
|
byte[] contents = uploadedFile.getContents();
|
||||||
this.selected.setHighresimage(content);
|
|
||||||
getRemoteManagerMedicalTest().addImage(this.selected.getId(), content);
|
if (contents != null && contents.length > 0) {
|
||||||
this.loadMedicalTests();
|
this.selected.setHighresimage(String.format("data:%s;base64,%s", contentType, Base64.getEncoder().encodeToString(contents)));
|
||||||
this.imageUpload = null;
|
|
||||||
|
this.getRemoteManagerMedicalTest().addImage(this.selected.getId(), this.selected.getHighresimage());
|
||||||
|
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Imagen guardada", "La imagen se ha guardado correctamente.");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("IMAGEN SUBIDA ES NULA");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Imagen vacía", "La imagen que itenta subir está vacía o no puede procesarse.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StreamedContent getImageDownload() {
|
||||||
|
DefaultStreamedContent dsc = null;
|
||||||
|
try {
|
||||||
|
String[] data = this.selected.getHighresimage().split(",");
|
||||||
|
String contentType = data[0];
|
||||||
|
|
||||||
|
// Obtenemos la extension del contentType
|
||||||
|
String extension = contentType.split(";")[0].split("/")[1];
|
||||||
|
String base64Image = data[1];
|
||||||
|
|
||||||
|
dsc = new DefaultStreamedContent(new ByteArrayInputStream(javax.xml.bind.DatatypeConverter.parseBase64Binary(base64Image)), contentType, "Imagen.".concat(extension));
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.manageException(e);
|
||||||
|
}
|
||||||
|
return dsc;
|
||||||
|
}
|
||||||
|
|
||||||
public UploadedFile getImageUpload() {
|
public UploadedFile getImageUpload() {
|
||||||
return imageUpload;
|
return imageUpload;
|
||||||
}
|
}
|
||||||
@@ -109,7 +133,8 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public void removeImage() {
|
public void removeImage() {
|
||||||
this.selected.setHighresimage(null);
|
this.selected.setHighresimage(null);
|
||||||
getRemoteManagerMedicalTest().removeImage(this.selected.getId());
|
getRemoteManagerMedicalTest().removeImage(this.selected.getId());
|
||||||
this.loadMedicalTests();
|
// this.loadMedicalTests();
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Imagen eliminada", "La imagen se ha eliminado correctamente.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public MedicalTestTO getSelected() {
|
public MedicalTestTO getSelected() {
|
||||||
@@ -234,7 +259,7 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
|
|
||||||
public void addMT() {
|
public void addMT() {
|
||||||
// Si hay un paciente filtrado en la busqueda de pruebas, lo seleccionamos para la prueba a añadir.
|
// Si hay un paciente filtrado en la busqueda de pruebas, lo seleccionamos para la prueba a añadir.
|
||||||
//this.patSelected = this.patientFilterSelected;
|
// this.patSelected = this.patientFilterSelected;
|
||||||
this.testDate = LocalDate.now();
|
this.testDate = LocalDate.now();
|
||||||
this.testTime = LocalTime.now();
|
this.testTime = LocalTime.now();
|
||||||
this.testObservations = "";
|
this.testObservations = "";
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import javax.annotation.PostConstruct;
|
|||||||
import javax.faces.view.ViewScoped;
|
import javax.faces.view.ViewScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.primefaces.event.SelectEvent;
|
||||||
import org.primefaces.model.LazyDataModel;
|
import org.primefaces.model.LazyDataModel;
|
||||||
import org.primefaces.model.SortOrder;
|
import org.primefaces.model.SortOrder;
|
||||||
|
|
||||||
@@ -22,8 +23,8 @@ public class SearchSpecialistMBean extends ManagedBeanBase implements Serializab
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
private List<MedicalSpecialtyTO> medicalSpecialtiesList;
|
||||||
private MedicalSpecialtyTO medicalSpeciality;
|
private MedicalSpecialtyTO medicalSpecialty;
|
||||||
private String lastUIQueryMS;
|
private String lastUIQueryMS;
|
||||||
private LazyDataModel<SpecialistDoctorTO> lazyDataModelDoctorList;
|
private LazyDataModel<SpecialistDoctorTO> lazyDataModelDoctorList;
|
||||||
|
|
||||||
@@ -33,8 +34,8 @@ public class SearchSpecialistMBean extends ManagedBeanBase implements Serializab
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
// Inicialización de variables y propiedades van aquí.
|
// Inicialización de variables y propiedades van aquí.
|
||||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.medicalSpecialtiesList = this.getRemoteManagerCommon().listMedicalSpecialtiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
this.medicalSpeciality = null;
|
this.medicalSpecialty = null;
|
||||||
this.lastUIQueryMS = "";
|
this.lastUIQueryMS = "";
|
||||||
|
|
||||||
this.lazyDataModelDoctorList = new LazyDataModel<SpecialistDoctorTO>() {
|
this.lazyDataModelDoctorList = new LazyDataModel<SpecialistDoctorTO>() {
|
||||||
@@ -42,14 +43,14 @@ public class SearchSpecialistMBean extends ManagedBeanBase implements Serializab
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SpecialistDoctorTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
public List<SpecialistDoctorTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||||
if (medicalSpeciality == null) {
|
if (medicalSpecialty == null) {
|
||||||
this.setRowCount(0);
|
this.setRowCount(0);
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
Long totalRowCount = getRemoteManagerMedicalTest().getSpecialistDoctorByMedicalSpecialityCount(medicalSpeciality.getId());
|
Long totalRowCount = getRemoteManagerMedicalTest().getSpecialistDoctorByMedicalSpecialtyCount(medicalSpecialty.getId());
|
||||||
this.setRowCount(totalRowCount.intValue());
|
this.setRowCount(totalRowCount.intValue());
|
||||||
|
|
||||||
return getRemoteManagerMedicalTest().findSpecialistDoctorByMedicalSpeciality(medicalSpeciality.getId(), (first / pageSize), pageSize);
|
return getRemoteManagerMedicalTest().findSpecialistDoctorByMedicalSpecialty(medicalSpecialty.getId(), (first / pageSize), pageSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -59,33 +60,29 @@ public class SearchSpecialistMBean extends ManagedBeanBase implements Serializab
|
|||||||
return lazyDataModelDoctorList;
|
return lazyDataModelDoctorList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showData() {
|
public List<MedicalSpecialtyTO> completeMedicalSpecialty(String query) {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> completeMedicalSpeciality(String query) {
|
|
||||||
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
||||||
this.lastUIQueryMS = query;
|
this.lastUIQueryMS = query;
|
||||||
// Recuperamos las 200 primeras coincidencias
|
// Recuperamos las 200 primeras coincidencias
|
||||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.medicalSpecialtiesList = this.getRemoteManagerCommon().listMedicalSpecialtiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
}
|
}
|
||||||
return this.medicalSpecialitiesList;
|
return this.medicalSpecialtiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> getMedicalSpecialitiesList() {
|
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||||
return medicalSpecialitiesList;
|
return medicalSpecialtiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMedicalSpecialitiesList(List<MedicalSpecialtyTO> medicalSpecialitiesList) {
|
public void setMedicalSpecialtiesList(List<MedicalSpecialtyTO> value) {
|
||||||
this.medicalSpecialitiesList = medicalSpecialitiesList;
|
this.medicalSpecialtiesList = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MedicalSpecialtyTO getMedicalSpeciality() {
|
public MedicalSpecialtyTO getMedicalSpecialty() {
|
||||||
return medicalSpeciality;
|
return medicalSpecialty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMedicalSpeciality(MedicalSpecialtyTO medicalSpecialty) {
|
public void setMedicalSpecialty(MedicalSpecialtyTO medicalSpecialty) {
|
||||||
this.medicalSpeciality = medicalSpecialty;
|
this.medicalSpecialty = medicalSpecialty;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,27 +50,21 @@ public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializ
|
|||||||
// Recuperamos el usuario logeado actual
|
// Recuperamos el usuario logeado actual
|
||||||
LoggedUserTO usr = null;
|
LoggedUserTO usr = null;
|
||||||
this.lastUIQuery = "";
|
this.lastUIQuery = "";
|
||||||
try {
|
usr = SessionUtils.getloggedOnUser();
|
||||||
usr = SessionUtils.getloggedOnUser();
|
|
||||||
|
|
||||||
if (usr == null)
|
if (usr == null)
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
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.");
|
||||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
else {
|
||||||
else {
|
this.id = Integer.valueOf(usr.getId());
|
||||||
this.id = Integer.valueOf(usr.getId());
|
|
||||||
|
|
||||||
if (usr.getUserType() == UserType.PATIENT) {
|
if (usr.getUserType() == UserType.PATIENT) {
|
||||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
|
||||||
PatientTO pat = this.getRemoteManagerCommon().findPatientById(this.id);
|
PatientTO pat = this.getRemoteManagerCommon().findPatientById(this.id);
|
||||||
this.currentFamilyDoctor = pat.getFamilyDoctor();
|
this.currentFamilyDoctor = pat.getFamilyDoctor();
|
||||||
} else
|
} else
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil no válido", "Su tipo de usuario no permite que pueda tener acceso a esta página.");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil no válido", "Su tipo de usuario no permite que pueda tener acceso a esta página.");
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,28 +49,22 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen
|
|||||||
LoggedUserTO usr = null;
|
LoggedUserTO usr = null;
|
||||||
this.lastUIQuery = "";
|
this.lastUIQuery = "";
|
||||||
|
|
||||||
try {
|
usr = SessionUtils.getloggedOnUser();
|
||||||
usr = SessionUtils.getloggedOnUser();
|
|
||||||
|
|
||||||
if (usr == null)
|
if (usr == null)
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
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.");
|
||||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
else {
|
||||||
else {
|
this.id = Integer.valueOf(usr.getId());
|
||||||
this.id = Integer.valueOf(usr.getId());
|
|
||||||
|
|
||||||
if (usr.getUserType() == UserType.FAMILY_DOCTOR) {
|
if (usr.getUserType() == UserType.FAMILY_DOCTOR) {
|
||||||
// Recupera la lista de CAPs inicial desde el EJB.
|
// Recupera la lista de CAPs inicial desde el EJB.
|
||||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
|
||||||
FamilyDoctorTO fd = this.getRemoteManagerCommon().findFamilyDoctorById(this.id);
|
FamilyDoctorTO fd = this.getRemoteManagerCommon().findFamilyDoctorById(this.id);
|
||||||
this.setCurrentCenter(fd.getPrimaryHealthCareCenter());
|
this.setCurrentCenter(fd.getPrimaryHealthCareCenter());
|
||||||
} else
|
} else
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil no válido", "Su tipo de usuario no permite que pueda tener acceso a esta página.");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil no válido", "Su tipo de usuario no permite que pueda tener acceso a esta página.");
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import managedbean.common.ValidationUtils;
|
|||||||
public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private int id;
|
|
||||||
private String cipCode;
|
private String cipCode;
|
||||||
private String nif;
|
private String nif;
|
||||||
private String name;
|
private String name;
|
||||||
@@ -51,7 +50,7 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
private UserType userType;
|
private UserType userType;
|
||||||
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||||
private MedicalSpecialtyTO medicalSpecialty;
|
private MedicalSpecialtyTO medicalSpecialty;
|
||||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
private List<MedicalSpecialtyTO> medicalSpecialtiesList;
|
||||||
private List<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
private List<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
||||||
|
|
||||||
public RegisterUserMBean() {
|
public RegisterUserMBean() {
|
||||||
@@ -75,7 +74,7 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
|
|
||||||
this.userType = UserType.PATIENT;
|
this.userType = UserType.PATIENT;
|
||||||
|
|
||||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.medicalSpecialtiesList = this.getRemoteManagerCommon().listMedicalSpecialtiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,22 +90,14 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public void onUserTypeChange() {
|
public void onUserTypeChange() {
|
||||||
switch (this.userType) {
|
switch (this.userType) {
|
||||||
case SPECIALIST_DOCTOR:
|
case SPECIALIST_DOCTOR:
|
||||||
try {
|
// El usuario queire registrarse como médico especialista, lanzamos un evento AJAX de cliente para que la interfaz refleje el cambio en el tipo de usuario
|
||||||
// El usuario queire registrarse como médico especialista, lanzamos un evento AJAX de cliente para que la interfaz refleje el cambio en el tipo de usuario
|
// seleccionado: Se muestra la lista de especialidades médicas para obligar a seleccionar una.
|
||||||
// seleccionado: Se muestra la lista de especialidades médicas para obligar a seleccionar una.
|
PrimeFaces.current().ajax().addCallbackParam("specs", true);
|
||||||
PrimeFaces.current().ajax().addCallbackParam("specs", true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case FAMILY_DOCTOR:
|
case FAMILY_DOCTOR:
|
||||||
try {
|
// El usuario queire registrarse como médico especialista, lanzamos un evento AJAX de cliente para que la interfaz refleje el cambio en el tipo de usuario
|
||||||
// El usuario queire registrarse como médico especialista, lanzamos un evento AJAX de cliente para que la interfaz refleje el cambio en el tipo de usuario
|
// seleccionado: Se muestra la lista de CAPs para obligar a seleccionar uno.
|
||||||
// seleccionado: Se muestra la lista de CAPs para obligar a seleccionar uno.
|
PrimeFaces.current().ajax().addCallbackParam("caps", true);
|
||||||
PrimeFaces.current().ajax().addCallbackParam("caps", true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ADMINISTRATOR:
|
case ADMINISTRATOR:
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
@@ -118,7 +109,7 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||||
return medicalSpecialitiesList;
|
return medicalSpecialtiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
||||||
@@ -150,28 +141,18 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
||||||
this.lastUIQueryMS = query;
|
this.lastUIQueryMS = query;
|
||||||
// Recuperamos las 200 primeras coincidencias
|
// Recuperamos las 200 primeras coincidencias
|
||||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.medicalSpecialtiesList = this.getRemoteManagerCommon().listMedicalSpecialtiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
}
|
}
|
||||||
return this.medicalSpecialitiesList;
|
return this.medicalSpecialtiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gestióna el evento de modficación del NIF del usuario actual. Búsca si el NIF ya está en uso para otro usuario. Solo se permite que el mismo NIF se refistro como paciente y
|
* Búsca si el NIF ya está en uso para otro usuario. Solo se permite que el mismo NIF se refistro como paciente y como médico (especialista o de familia, pero no como ambos).
|
||||||
* como médico (especialista o de familia, pero no como ambos).
|
|
||||||
*
|
*
|
||||||
* Un Médico puede estar registrado como paciente con el mismo NIF, pero como médico de familia y especialista al mismo tiempo.
|
* Un Médico puede estar registrado como paciente con el mismo NIF, pero como médico de familia y especialista al mismo tiempo.
|
||||||
*/
|
*/
|
||||||
public void handleNIFValueChange() {
|
public boolean checkNIFDuplicated(String nifValue, UserType userType) {
|
||||||
boolean isDupe = false;
|
return ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), userType, nifValue, null);
|
||||||
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
|
||||||
|
|
||||||
if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, null) == true) {
|
|
||||||
isDupe = true;
|
|
||||||
this.addFacesMessage("frmRegisterUser:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
|
|
||||||
}
|
|
||||||
|
|
||||||
PrimeFaces.current().ajax().addCallbackParam("NIFisDupe", isDupe);
|
|
||||||
PrimeFaces.current().ajax().addCallbackParam("formattedNIF", this.nif);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPatient() {
|
public boolean isPatient() {
|
||||||
@@ -245,7 +226,7 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
* No se permite el registro de administradores a través de la página de registro pública.
|
* No se permite el registro de administradores a través de la página de registro pública.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void addNewUser() {
|
public void addNewUser() throws Exception {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
||||||
@@ -263,39 +244,34 @@ 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) {
|
if (this.checkNIFDuplicated(this.nif, this.userType) == true) {
|
||||||
this.addFacesMessage("frmRegisterUser:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
|
this.addFacesMessage("frmRegisterUser:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
try {
|
switch (this.userType) {
|
||||||
switch (this.userType) {
|
case PATIENT:
|
||||||
case PATIENT:
|
PatientTO pat = this.getRemoteManagerProfile().registerPatient(nif, name, surname, password, email);
|
||||||
PatientTO pat = this.getRemoteManagerProfile().registerPatient(id, nif, name, surname, password, email);
|
this.cipCode = pat.getPersonalIdentificationCode();
|
||||||
this.cipCode = pat.getPersonalIdentificationCode();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case FAMILY_DOCTOR:
|
case FAMILY_DOCTOR:
|
||||||
FamilyDoctorTO fd = this.getRemoteManagerProfile().registerFamilyDoctor(id, nif, name, surname, password, email, this.primaryHealthCareCenter);
|
FamilyDoctorTO fd = this.getRemoteManagerProfile().registerFamilyDoctor(nif, name, surname, password, email, this.primaryHealthCareCenter);
|
||||||
this.cipCode = fd.getProfessionalNumber();
|
this.cipCode = fd.getProfessionalNumber();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SPECIALIST_DOCTOR:
|
case SPECIALIST_DOCTOR:
|
||||||
SpecialistDoctorTO sd = this.getRemoteManagerProfile().registerSpecialistDoctor(id, nif, name, surname, password, email, this.medicalSpecialty);
|
SpecialistDoctorTO sd = this.getRemoteManagerProfile().registerSpecialistDoctor(nif, name, surname, password, email, this.medicalSpecialty);
|
||||||
this.cipCode = sd.getProfessionalNumber();
|
this.cipCode = sd.getProfessionalNumber();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ADMINISTRATOR:
|
case ADMINISTRATOR:
|
||||||
throw new NotSupportedException("No se soporta el registro directo de administradores.");
|
throw new NotSupportedException("No se soporta el registro directo de administradores.");
|
||||||
}
|
|
||||||
|
|
||||||
this.registered = true;
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Registro realizado", "El usuario " + name + " " + surname + " se ha registrado correctamente.");
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.registered = true;
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Registro realizado", "El usuario " + name + " " + surname + " se ha registrado correctamente.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import javax.faces.view.ViewScoped;
|
|||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.resource.NotSupportedException;
|
import javax.resource.NotSupportedException;
|
||||||
|
|
||||||
import org.primefaces.PrimeFaces;
|
|
||||||
|
|
||||||
import TO.FamilyDoctorTO;
|
import TO.FamilyDoctorTO;
|
||||||
import TO.LoggedUserTO;
|
import TO.LoggedUserTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
@@ -54,7 +52,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
private UserType userType;
|
private UserType userType;
|
||||||
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||||
private MedicalSpecialtyTO medicalSpecialty;
|
private MedicalSpecialtyTO medicalSpecialty;
|
||||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
private List<MedicalSpecialtyTO> medicalSpecialtiesList;
|
||||||
private List<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
private List<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
||||||
private FamilyDoctorTO familyDoctor;
|
private FamilyDoctorTO familyDoctor;
|
||||||
private List<FamilyDoctorTO> familyDoctorList;
|
private List<FamilyDoctorTO> familyDoctorList;
|
||||||
@@ -80,38 +78,31 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
|
|
||||||
// Recuperamos el usuario logeado actual
|
// Recuperamos el usuario logeado actual
|
||||||
LoggedUserTO usr = null;
|
LoggedUserTO usr = null;
|
||||||
try {
|
usr = SessionUtils.getloggedOnUser();
|
||||||
usr = SessionUtils.getloggedOnUser();
|
|
||||||
|
|
||||||
if (usr == null)
|
if (usr == null)
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
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.");
|
||||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
else {
|
||||||
else {
|
this.userType = usr.getUserType();
|
||||||
this.userType = usr.getUserType();
|
this.id = Integer.valueOf(usr.getId());
|
||||||
this.id = Integer.valueOf(usr.getId());
|
|
||||||
|
|
||||||
switch (usr.getUserType()) {
|
switch (usr.getUserType()) {
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
this.setPatientData(this.getRemoteManagerCommon().findPatientById(this.id));
|
this.setPatientData(this.getRemoteManagerCommon().findPatientById(this.id));
|
||||||
break;
|
break;
|
||||||
case SPECIALIST_DOCTOR:
|
case SPECIALIST_DOCTOR:
|
||||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.medicalSpecialtiesList = this.getRemoteManagerCommon().listMedicalSpecialtiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
this.setSpecialistDoctorData(this.getRemoteManagerCommon().findSpecialistDoctorById(this.id));
|
this.setSpecialistDoctorData(this.getRemoteManagerCommon().findSpecialistDoctorById(this.id));
|
||||||
break;
|
break;
|
||||||
case FAMILY_DOCTOR:
|
case FAMILY_DOCTOR:
|
||||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
this.setFamilyDoctorData(this.getRemoteManagerCommon().findFamilyDoctorById(this.id));
|
this.setFamilyDoctorData(this.getRemoteManagerCommon().findFamilyDoctorById(this.id));
|
||||||
break;
|
break;
|
||||||
case ADMINISTRATOR:
|
case ADMINISTRATOR:
|
||||||
// TODO: Recuperar usuario administrador para editar su perfil ¿?
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Usuario sin perfil", "Usted es un usuario de tipo administrador y no puede editar su perfil de usuario.");
|
||||||
// this.getRemoteManagerProfile().retrievePatient(usr.getId());
|
break;
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Usuario sin perfil", "Usted es un usuario de tipo administrador y no puede editar su perfil de usuario.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +159,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||||
return medicalSpecialitiesList;
|
return medicalSpecialtiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
||||||
@@ -200,28 +191,18 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
||||||
this.lastUIQueryMS = query;
|
this.lastUIQueryMS = query;
|
||||||
// Recuperamos las XXX primeras coincidencias
|
// Recuperamos las XXX primeras coincidencias
|
||||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.medicalSpecialtiesList = this.getRemoteManagerCommon().listMedicalSpecialtiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
}
|
}
|
||||||
return this.medicalSpecialitiesList;
|
return this.medicalSpecialtiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gestióna el evento de modficación del NIF del usuario actual. Búsca si el NIF ya está en uso para otro usuario. Solo se permite que el mismo NIF se refistro como paciente y
|
* Búsca si el NIF ya está en uso para otro usuario. Solo se permite que el mismo NIF se refistro como paciente y como médico (especialista o de familia, pero no como ambos).
|
||||||
* como médico (especialista o de familia, pero no como ambos).
|
|
||||||
*
|
*
|
||||||
* Un Médico puede estar registrado como paciente con el mismo NIF, pero como médico de familia y especialista al mismo tiempo.
|
* Un Médico puede estar registrado como paciente con el mismo NIF, pero como médico de familia y especialista al mismo tiempo.
|
||||||
*/
|
*/
|
||||||
public void handleNIFValueChange() {
|
public boolean checkNIFDuplicated(String nifValue, UserType userType, Integer userId) {
|
||||||
boolean isDupe = false;
|
return ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), userType, nifValue, userId);
|
||||||
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
|
||||||
|
|
||||||
if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, this.id) == true) {
|
|
||||||
isDupe = true;
|
|
||||||
this.addFacesMessage("frmUpdateProfile:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
|
|
||||||
}
|
|
||||||
|
|
||||||
PrimeFaces.current().ajax().addCallbackParam("NIFisDupe", isDupe);
|
|
||||||
PrimeFaces.current().ajax().addCallbackParam("formattedNIF", this.nif);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FamilyDoctorTO> getFamilyDoctorList() {
|
public List<FamilyDoctorTO> getFamilyDoctorList() {
|
||||||
@@ -304,12 +285,11 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que guarda los datos realizados en la modificación del perfil.
|
* Método que guarda los datos realizados en la modificación del perfil. Tiene en cuenta el tipo de usuario que está editando su perfil.
|
||||||
* Tiene en cuenta el tipo de usuario que está editando su perfil.
|
|
||||||
*
|
*
|
||||||
* Si el usuario es un médico de familia requiere que se seleccione un CAP para el usuario.
|
* Si el usuario es un médico de familia requiere que se seleccione un CAP para el usuario. Si el usuario es un médico especialista requiere que se seleccione una especialidad
|
||||||
* Si el usuario es un médico especialista requiere que se seleccione una especialidad médica para el usuario.
|
* médica para el usuario. Se comprueba que el NIF especificado sea válido y no pertenezca a otro usuario registrado (ver relgas de NIF permitidos para usuarios en el método
|
||||||
* Se comprueba que el NIF especificado sea válido y no pertenezca a otro usuario registrado (ver relgas de NIF permitidos para usuarios en el método handleNIFValueChange)
|
* handleNIFValueChange)
|
||||||
*
|
*
|
||||||
* Si se especifica una nueva contraseña, entonces se realiz un cambio de contraseña, y se requiere además: Que la nueva contraseña sea diferente a la anterior.
|
* Si se especifica una nueva contraseña, entonces se realiz un cambio de contraseña, y se requiere además: Que la nueva contraseña sea diferente a la anterior.
|
||||||
*
|
*
|
||||||
@@ -322,43 +302,47 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
if (this.userType == null)
|
if (this.userType == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
try {
|
||||||
|
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
||||||
|
|
||||||
boolean changePassword = (this.oldPassword != null && this.oldPassword.equals("") == false) || (this.password != null && this.password.equals("") == false);
|
boolean changePassword = (this.oldPassword != null && this.oldPassword.equals("") == false) || (this.password != null && this.password.equals("") == false);
|
||||||
|
|
||||||
if (this.isUserTypeFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
if (this.userType == UserType.ADMINISTRATOR) {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria.");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil de usuario incorrecto", "Su perfil es de un usuario de tipo administrador y no puede editar su perfil.");
|
||||||
error++;
|
|
||||||
}
|
|
||||||
if (this.isUserTypeSpecialistDoctor() && this.medicalSpecialty == null) {
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Especialidad médica no seleccionada", "Por favor, especifique una especialidad médica.");
|
|
||||||
error++;
|
|
||||||
}
|
|
||||||
if (ValidationUtils.isValid(nif) == false) {
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
|
|
||||||
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) {
|
|
||||||
// el usuario queire cambiar el password Comprobamos que el password
|
|
||||||
// especificado coincide con el guardado
|
|
||||||
if (this.password == null || this.password.length() < 4) {
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Nueva contraseña incorrectra", "Su nueva contraseña debe tener al menos 4 caracteres.");
|
|
||||||
error++;
|
|
||||||
} else if (HashUtils.hashMD5(this.oldPassword).equals(this.currentPassword) == false) {
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Contraseña actual incorrecta",
|
|
||||||
"Su actual contraseña es incorrecta. Por favor, especifique su contraseña actual.");
|
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (error == 0) {
|
if (this.isUserTypeFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||||
try {
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
if (this.isUserTypeSpecialistDoctor() && this.medicalSpecialty == null) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Especialidad médica no seleccionada", "Por favor, especifique una especialidad médica.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
if (ValidationUtils.isValid(nif) == false) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
|
||||||
|
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) {
|
||||||
|
// el usuario queire cambiar el password Comprobamos que el password
|
||||||
|
// especificado coincide con el guardado
|
||||||
|
if (this.password == null || this.password.length() < 4) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Nueva contraseña incorrectra", "Su nueva contraseña debe tener al menos 4 caracteres.");
|
||||||
|
error++;
|
||||||
|
} else if (HashUtils.hashMD5(this.oldPassword).equals(this.currentPassword) == false) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Contraseña actual incorrecta",
|
||||||
|
"Su actual contraseña es incorrecta. Por favor, especifique su contraseña actual.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error == 0) {
|
||||||
LoggedUserTO usr = null;
|
LoggedUserTO usr = null;
|
||||||
|
|
||||||
switch (this.userType) {
|
switch (this.userType) {
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
PatientTO pat = this.getRemoteManagerProfile().updatePatientData(id, nif, name, surname, password, email);
|
PatientTO pat = this.getRemoteManagerProfile().updatePatientData(id, nif, name, surname, password, email);
|
||||||
@@ -379,7 +363,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case ADMINISTRATOR:
|
case ADMINISTRATOR:
|
||||||
throw new NotSupportedException("No se soporta la edición de perfiles de tipo administrador.");
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changePassword == true) {
|
if (changePassword == true) {
|
||||||
@@ -392,9 +376,9 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
SessionUtils.createOrUpdateSession(usr);
|
SessionUtils.createOrUpdateSession(usr);
|
||||||
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos de su perfil se han guardado correctamente.");
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos de su perfil se han guardado correctamente.");
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
this.manageException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package managedbean.systemAdmin;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.faces.application.FacesMessage;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import TO.LoggedUserTO;
|
||||||
|
import common.HashUtils;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
import managedbean.common.SessionUtils;
|
||||||
|
|
||||||
|
@Named("AddAdmin")
|
||||||
|
@RequestScoped
|
||||||
|
public class AddAdminMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String email;
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
public AddAdminMBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@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.");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.manageException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 boolean emailAlreadyRegistered(String email) {
|
||||||
|
return this.getRemoteManagerSystemAdmin().findAdminByEmail(email) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertData() {
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
if (this.emailAlreadyRegistered(email) == true) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Administrador ya existente", "El administrador ya se encuentra dado de alta");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error == 0) {
|
||||||
|
try {
|
||||||
|
this.getRemoteManagerSystemAdmin().insertAdmin(email.toLowerCase(), HashUtils.hashMD5(password));
|
||||||
|
|
||||||
|
this.email = "";
|
||||||
|
this.password = "";
|
||||||
|
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "El administrador se ha dado de alta", "Los datos del administrador se han guardado correctamente.");
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.manageException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -45,7 +45,7 @@ public class ListDoctorsByCenterMBean extends ManagedBeanBase implements Seriali
|
|||||||
this.setRowCount(0);
|
this.setRowCount(0);
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
Long totalRowCount = getRemoteManagerMedicalTest().getSpecialistDoctorByMedicalSpecialityCount(primaryHealthCareCenter.getId());
|
Long totalRowCount = getRemoteManagerSystemAdmin().getFamilyDoctorsByCAPCount(primaryHealthCareCenter.getId());
|
||||||
this.setRowCount(totalRowCount.intValue());
|
this.setRowCount(totalRowCount.intValue());
|
||||||
|
|
||||||
return getRemoteManagerSystemAdmin().listAllFamilyDoctorsByCAPPaged(primaryHealthCareCenter.getId(), (first / pageSize), pageSize);
|
return getRemoteManagerSystemAdmin().listAllFamilyDoctorsByCAPPaged(primaryHealthCareCenter.getId(), (first / pageSize), pageSize);
|
||||||
|
|||||||
@@ -63,27 +63,9 @@ public class LoginMBean extends ManagedBeanBase {
|
|||||||
return viewRedirect;
|
return viewRedirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Realiza un login semi-automatico. Por ejemplo desde el filtro de autorización.
|
|
||||||
* Se debe utilizar con propositos de depuración, para evitar realizar el login manual.
|
|
||||||
*
|
|
||||||
* @param ses
|
|
||||||
*/
|
|
||||||
public boolean autoLogin(HttpSession ses) {
|
|
||||||
//TODO: Eliminar este metodo al terminar el desarrollo.
|
|
||||||
boolean bResult = false;
|
|
||||||
LoggedUserTO usr = this.getRemoteManagerSystemAdmin().login(username, password);
|
|
||||||
|
|
||||||
if (usr != null) {
|
|
||||||
SessionUtils.createOrUpdateSession(ses, usr);
|
|
||||||
bResult = true;
|
|
||||||
}
|
|
||||||
return bResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
// logout event, invalidate session
|
// logout event, invalidate session
|
||||||
public String logout() {
|
public String logout() {
|
||||||
this.addFacesMessageKeep(FacesMessage.SEVERITY_INFO, "Sessión cerrada", "Ha cerrado correctament su sesión. Hasta la vista");
|
this.addFacesMessageKeep(FacesMessage.SEVERITY_INFO, "Sesión cerrada", "Ha cerrado correctamente su sesión. Hasta la vista");
|
||||||
|
|
||||||
SessionUtils.DestroySession();
|
SessionUtils.DestroySession();
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class ManageHealthCareCentersMBean extends ManagedBeanBase implements Ser
|
|||||||
Long totalRowCount = getRemoteManagerSystemAdmin().getCAPCount();
|
Long totalRowCount = getRemoteManagerSystemAdmin().getCAPCount();
|
||||||
this.setRowCount(totalRowCount.intValue());
|
this.setRowCount(totalRowCount.intValue());
|
||||||
|
|
||||||
return getRemoteManagerSystemAdmin().listCAPsPaged((first / pageSize), pageSize);
|
return getRemoteManagerCommon().listCAPsPaged((first / pageSize), pageSize);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -99,44 +99,62 @@ public class ManageHealthCareCentersMBean extends ManagedBeanBase implements Ser
|
|||||||
this.primaryHealthCareCenter = value;
|
this.primaryHealthCareCenter = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRowEdit(RowEditEvent event) {
|
public void onRowEdit(RowEditEvent event) {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
if (((PrimaryHealthCareCenterTO) event.getObject()).getName() == null || ((PrimaryHealthCareCenterTO) event.getObject()).getName().trim().length() == 0) {
|
String newName = ((PrimaryHealthCareCenterTO) event.getObject()).getName();
|
||||||
|
String newLocation = ((PrimaryHealthCareCenterTO) event.getObject()).getLocation();
|
||||||
|
|
||||||
|
if (newName == null || newName.trim().length() == 0) {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre para el centro.");
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre para el centro.");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
if (((PrimaryHealthCareCenterTO) event.getObject()).getLocation() == null || ((PrimaryHealthCareCenterTO) event.getObject()).getLocation().trim().length() == 0) {
|
|
||||||
|
if (newLocation == null || newLocation.trim().length() == 0) {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Localización no rellena", "Por favor, escriba una localización.");
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Localización no rellena", "Por favor, escriba una localización.");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.getRemoteManagerSystemAdmin().findHealthCareCenterByName(newName) != null) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "CAP ya existente", "El CAP ya se encuentra en la base de datos");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
try {
|
try {
|
||||||
this.getRemoteManagerSystemAdmin().updateHealthCareCenter(((PrimaryHealthCareCenterTO) event.getObject()).getId(), ((PrimaryHealthCareCenterTO) event.getObject()).getName(),
|
this.getRemoteManagerSystemAdmin().updateHealthCareCenter(((PrimaryHealthCareCenterTO) event.getObject()).getId(),
|
||||||
((PrimaryHealthCareCenterTO) event.getObject()).getLocation());
|
((PrimaryHealthCareCenterTO) event.getObject()).getName(), ((PrimaryHealthCareCenterTO) event.getObject()).getLocation());
|
||||||
|
|
||||||
this.showPrimaryHealthCareCenterData(null);
|
this.showPrimaryHealthCareCenterData(null);
|
||||||
|
|
||||||
FacesMessage msg = new FacesMessage("CAP editado", ((PrimaryHealthCareCenterTO) event.getObject()).getName());
|
FacesMessage msg = new FacesMessage("CAP editado", ((PrimaryHealthCareCenterTO) event.getObject()).getName());
|
||||||
FacesContext.getCurrentInstance().addMessage(null, msg);
|
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.manageException(e);
|
this.manageException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRowCancel(RowEditEvent event) {
|
public void onRowCancel(RowEditEvent event) {
|
||||||
FacesMessage msg = new FacesMessage("Edición cancelada", ((PrimaryHealthCareCenterTO) event.getObject()).getName());
|
FacesMessage msg = new FacesMessage("Edición cancelada", ((PrimaryHealthCareCenterTO) event.getObject()).getName());
|
||||||
FacesContext.getCurrentInstance().addMessage(null, msg);
|
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteDataById(Integer id) throws IOException {
|
public void deleteDataById(Integer id) throws IOException {
|
||||||
|
int error = 0;
|
||||||
try {
|
try {
|
||||||
this.getRemoteManagerSystemAdmin().deleteHealthCareCenter(id);
|
if (this.getRemoteManagerSystemAdmin().getFamilyDoctorsByCAPCount(id) > 0) {
|
||||||
this.showPrimaryHealthCareCenterData(null);
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "No se puede eliminar este CAP",
|
||||||
|
"Existen médicos de familia asignados a este CPA, por lo cual no se puede eliminar. Asigne los médicos a otro CAP para proceder a eliminar el CAP a continuación.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "El CAP se ha borrado", "Los datos del Centro de Atención Primaria se han borrado correctamente.");
|
if (error == 0) {
|
||||||
|
this.getRemoteManagerSystemAdmin().deleteHealthCareCenter(id);
|
||||||
|
this.showPrimaryHealthCareCenterData(null);
|
||||||
|
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "El CAP se ha borrado", "Los datos del Centro de Atención Primaria se han borrado correctamente.");
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.manageException(e);
|
this.manageException(e);
|
||||||
}
|
}
|
||||||
@@ -149,6 +167,7 @@ public class ManageHealthCareCentersMBean extends ManagedBeanBase implements Ser
|
|||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre para el centro.");
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre para el centro.");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location == null || location.trim().length() == 0) {
|
if (location == null || location.trim().length() == 0) {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Localización no rellena", "Por favor, escriba una localización.");
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Localización no rellena", "Por favor, escriba una localización.");
|
||||||
error++;
|
error++;
|
||||||
|
|||||||
@@ -1,20 +1,25 @@
|
|||||||
package managedbean.systemAdmin;
|
package managedbean.systemAdmin;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
import javax.faces.application.FacesMessage;
|
import javax.faces.application.FacesMessage;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
import TO.LoggedUserTO;
|
import org.primefaces.event.RowEditEvent;
|
||||||
|
import org.primefaces.model.LazyDataModel;
|
||||||
|
import org.primefaces.model.SortOrder;
|
||||||
|
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
import managedbean.common.ManagedBeanBase;
|
import managedbean.common.ManagedBeanBase;
|
||||||
import managedbean.common.SessionUtils;
|
|
||||||
|
|
||||||
@Named("ManageSpecialities")
|
@Named("ManageSpecialities")
|
||||||
@RequestScoped
|
@ViewScoped
|
||||||
public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializable {
|
public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -23,34 +28,29 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
|||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
private MedicalSpecialtyTO medicalSpecialty;
|
private MedicalSpecialtyTO medicalSpecialty;
|
||||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
private LazyDataModel<MedicalSpecialtyTO> lazyDataModelSpecialtiesList;
|
||||||
|
|
||||||
public ManageSpecialitiesMBean() {
|
public ManageSpecialitiesMBean() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
if (this.medicalSpecialty == null) {
|
this.lazyDataModelSpecialtiesList = new LazyDataModel<MedicalSpecialtyTO>() {
|
||||||
this.medicalSpecialty = new MedicalSpecialtyTO();
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
|
||||||
// Recuperamos el usuario logeado actual
|
|
||||||
LoggedUserTO usr = null;
|
|
||||||
try {
|
|
||||||
usr = SessionUtils.getloggedOnUser();
|
|
||||||
|
|
||||||
if (usr == null)
|
@Override
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
public List<MedicalSpecialtyTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
Long totalRowCount = getRemoteManagerSystemAdmin().getSpecialtiesCount();
|
||||||
else {
|
this.setRowCount(totalRowCount.intValue());
|
||||||
this.refreshFormData();
|
|
||||||
|
return getRemoteManagerCommon().listMedicalSpecialtiesPaged((first / pageSize), pageSize);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
};
|
||||||
this.manageException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshFormData() {
|
public LazyDataModel<MedicalSpecialtyTO> getlazyDataModelSpecialtiesList() {
|
||||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listAllMedicalSpecialities();
|
return lazyDataModelSpecialtiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
@@ -91,10 +91,6 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
|
||||||
return medicalSpecialitiesList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MedicalSpecialtyTO getMedicalSpecialty() {
|
public MedicalSpecialtyTO getMedicalSpecialty() {
|
||||||
return medicalSpecialty;
|
return medicalSpecialty;
|
||||||
}
|
}
|
||||||
@@ -103,53 +99,64 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
|||||||
this.medicalSpecialty = value;
|
this.medicalSpecialty = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveData() {
|
public void onRowEdit(RowEditEvent event) {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
if (this.medicalSpecialty.getName() == null || this.medicalSpecialty.getName().trim().length() == 0) {
|
String newName = ((MedicalSpecialtyTO) event.getObject()).getName();
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre de especialidad.");
|
String newDescription = ((MedicalSpecialtyTO) event.getObject()).getDescription();
|
||||||
|
|
||||||
|
if (newName == null || newName.trim().length() == 0) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre para la especialidad.");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
if (this.medicalSpecialty.getDescription() == null || this.medicalSpecialty.getDescription().trim().length() == 0) {
|
|
||||||
|
if (newDescription == null || newDescription.trim().length() == 0) {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Descripción no rellena", "Por favor, escriba una descripción.");
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Descripción no rellena", "Por favor, escriba una descripción.");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.getRemoteManagerSystemAdmin().findSpecialtyByName(newName) != null) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Especialidad ya existente", "La especialidad ya se encuentra en la base de datos");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
try {
|
try {
|
||||||
this.getRemoteManagerSystemAdmin().updateSpecialty(this.medicalSpecialty.getId(), this.medicalSpecialty.getName(),this.medicalSpecialty.getDescription());
|
this.getRemoteManagerSystemAdmin().updateSpecialty(((MedicalSpecialtyTO) event.getObject()).getId(),
|
||||||
this.showSpecialtyData(null);
|
((MedicalSpecialtyTO) event.getObject()).getName(), ((MedicalSpecialtyTO) event.getObject()).getDescription());
|
||||||
this.refreshFormData();
|
|
||||||
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos de la especialidad se han guardado correctamente.");
|
this.showSpecialtyData(null);
|
||||||
|
|
||||||
|
FacesMessage msg = new FacesMessage("Especialidad editada", ((MedicalSpecialtyTO) event.getObject()).getName());
|
||||||
|
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.manageException(e);
|
this.manageException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteData() {
|
public void onRowCancel(RowEditEvent event) {
|
||||||
|
FacesMessage msg = new FacesMessage("Edición cancelada", ((MedicalSpecialtyTO) event.getObject()).getName());
|
||||||
|
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteDataById(Integer id) throws IOException {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
try {
|
||||||
|
if (this.getRemoteManagerMedicalTest().getSpecialistDoctorByMedicalSpecialtyCount(id) > 0) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "No se puede eliminar esta especialidad",
|
||||||
|
"Existen especialistas que tienen asignada esta especialidad médica, por lo cual no puede ser eliminada. Asigne los especialista a otra especialidad para proceder a eliminar la especialidad a continuación.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.medicalSpecialty.getName() == null) {
|
if (error == 0) {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre de especialidad.");
|
this.getRemoteManagerSystemAdmin().deleteSpecialty(id);
|
||||||
error++;
|
|
||||||
}
|
|
||||||
if (this.medicalSpecialty.getDescription() == null) {
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Descripción no rellena", "Por favor, escriba una descripción.");
|
|
||||||
error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error == 0) {
|
|
||||||
try {
|
|
||||||
this.getRemoteManagerSystemAdmin().deleteSpecialty(this.medicalSpecialty.getId());
|
|
||||||
this.showSpecialtyData(null);
|
this.showSpecialtyData(null);
|
||||||
this.refreshFormData();
|
|
||||||
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "La especialidad se ha borrado", "Los datos de la especialidad se han borrado correctamente.");
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "La especialidad se ha borrado", "Los datos de la especialidad se han borrado correctamente.");
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.manageException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +181,6 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
|||||||
try {
|
try {
|
||||||
this.getRemoteManagerSystemAdmin().insertSpecialty(name, description);
|
this.getRemoteManagerSystemAdmin().insertSpecialty(name, description);
|
||||||
this.showSpecialtyData(null);
|
this.showSpecialtyData(null);
|
||||||
this.refreshFormData();
|
|
||||||
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos de la especialidad se han guardado correctamente.");
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos de la especialidad se han guardado correctamente.");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.Map;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import javax.el.ValueExpression;
|
||||||
import javax.faces.application.FacesMessage;
|
import javax.faces.application.FacesMessage;
|
||||||
import javax.faces.component.UIComponent;
|
import javax.faces.component.UIComponent;
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
@@ -13,6 +14,8 @@ import javax.faces.validator.ValidatorException;
|
|||||||
|
|
||||||
import org.primefaces.validate.ClientValidator;
|
import org.primefaces.validate.ClientValidator;
|
||||||
|
|
||||||
|
import managedbean.systemAdmin.AddAdminMBean;
|
||||||
|
|
||||||
@FacesValidator("emailValidator")
|
@FacesValidator("emailValidator")
|
||||||
public class EmailValidator implements Validator<String>, ClientValidator {
|
public class EmailValidator implements Validator<String>, ClientValidator {
|
||||||
|
|
||||||
@@ -23,7 +26,7 @@ public class EmailValidator implements Validator<String>, ClientValidator {
|
|||||||
String strValue = "";
|
String strValue = "";
|
||||||
|
|
||||||
if (value != null)
|
if (value != null)
|
||||||
strValue = String.valueOf(value);
|
strValue = String.valueOf(value).toLowerCase();
|
||||||
|
|
||||||
if (strValue.equals(""))
|
if (strValue.equals(""))
|
||||||
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Correo electrónico no válido", "La dirección " + value + " no es una dirección válida"));
|
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Correo electrónico no válido", "La dirección " + value + " no es una dirección válida"));
|
||||||
@@ -31,6 +34,22 @@ public class EmailValidator implements Validator<String>, ClientValidator {
|
|||||||
Matcher matcher = EMAIL_COMPILED_PATTERN.matcher((String) value);
|
Matcher matcher = EMAIL_COMPILED_PATTERN.matcher((String) value);
|
||||||
if (!matcher.matches())
|
if (!matcher.matches())
|
||||||
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Correo electrónico no válido", "La dirección " + value + " no es una dirección válida"));
|
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Correo electrónico no válido", "La dirección " + value + " no es una dirección válida"));
|
||||||
|
|
||||||
|
boolean emailIsDupe = false;
|
||||||
|
ValueExpression valueExpr = comp.getValueExpression("managedBean");
|
||||||
|
|
||||||
|
if (valueExpr != null) {
|
||||||
|
Object managedBean = comp.getValueExpression("managedBean").getValue(context.getELContext());
|
||||||
|
|
||||||
|
if (managedBean instanceof AddAdminMBean) {
|
||||||
|
AddAdminMBean admBean = AddAdminMBean.class.cast(managedBean);
|
||||||
|
emailIsDupe = admBean.emailAlreadyRegistered(strValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (emailIsDupe == true)
|
||||||
|
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, "Correo electrónico ya registrado",
|
||||||
|
"La dirección de correo electrónico " + strValue + " ya ha sido registrada en el sistema"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> getMetadata() {
|
public Map<String, Object> getMetadata() {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package managedbean.validators;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.el.ValueExpression;
|
||||||
import javax.faces.application.FacesMessage;
|
import javax.faces.application.FacesMessage;
|
||||||
import javax.faces.component.UIComponent;
|
import javax.faces.component.UIComponent;
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
@@ -9,9 +10,12 @@ import javax.faces.validator.FacesValidator;
|
|||||||
import javax.faces.validator.Validator;
|
import javax.faces.validator.Validator;
|
||||||
import javax.faces.validator.ValidatorException;
|
import javax.faces.validator.ValidatorException;
|
||||||
|
|
||||||
|
import org.primefaces.PrimeFaces;
|
||||||
import org.primefaces.validate.ClientValidator;
|
import org.primefaces.validate.ClientValidator;
|
||||||
|
|
||||||
import managedbean.common.ValidationUtils;
|
import managedbean.common.ValidationUtils;
|
||||||
|
import managedbean.profile.RegisterUserMBean;
|
||||||
|
import managedbean.profile.UpdateProfileMBean;
|
||||||
|
|
||||||
@FacesValidator("nifValidator")
|
@FacesValidator("nifValidator")
|
||||||
public class NifValidator implements Validator<String>, ClientValidator {
|
public class NifValidator implements Validator<String>, ClientValidator {
|
||||||
@@ -26,8 +30,32 @@ public class NifValidator implements Validator<String>, ClientValidator {
|
|||||||
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "El NIF no es válido", "El NIF " + strValue + " no es válido"));
|
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "El NIF no es válido", "El NIF " + strValue + " no es válido"));
|
||||||
|
|
||||||
strValue = ValidationUtils.normalizeNIF(strValue);
|
strValue = ValidationUtils.normalizeNIF(strValue);
|
||||||
|
|
||||||
if (ValidationUtils.isValid(strValue) == false)
|
if (ValidationUtils.isValid(strValue) == false)
|
||||||
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "El NIF no es válido", "El NIF " + strValue + " no es válido"));
|
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "El NIF no es válido", "El NIF " + strValue + " no es válido"));
|
||||||
|
|
||||||
|
boolean nifIsDupe = false;
|
||||||
|
ValueExpression valueExpr = comp.getValueExpression("managedBean");
|
||||||
|
|
||||||
|
if (valueExpr != null) {
|
||||||
|
Object managedBean = valueExpr.getValue(context.getELContext());
|
||||||
|
|
||||||
|
if (managedBean instanceof RegisterUserMBean) {
|
||||||
|
RegisterUserMBean ruBean = RegisterUserMBean.class.cast(managedBean);
|
||||||
|
nifIsDupe = ruBean.checkNIFDuplicated(strValue, ruBean.getUserType());
|
||||||
|
} else if (managedBean instanceof UpdateProfileMBean) {
|
||||||
|
UpdateProfileMBean upBean = UpdateProfileMBean.class.cast(managedBean);
|
||||||
|
nifIsDupe = upBean.checkNIFDuplicated(strValue, upBean.getUserType(), upBean.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PrimeFaces.current().ajax().addCallbackParam("formattedNIF", strValue);
|
||||||
|
|
||||||
|
if (nifIsDupe == true)
|
||||||
|
throw new ValidatorException(
|
||||||
|
new FacesMessage(FacesMessage.SEVERITY_WARN, "El NIF está duplicado", "El NIF " + strValue + " pertenece a otro usuario previamente registrado"));
|
||||||
|
|
||||||
|
PrimeFaces.current().ajax().addCallbackParam("NIFisValid", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> getMetadata() {
|
public Map<String, Object> getMetadata() {
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
private String patientDisplayName;
|
private String patientDisplayName;
|
||||||
private String familyDoctorDisplayName;
|
private String familyDoctorDisplayName;
|
||||||
private PatientTO patient;
|
private PatientTO patient;
|
||||||
private FamilyDoctorTO familyDoctor;
|
|
||||||
|
|
||||||
public AddVisitMBean() {
|
public AddVisitMBean() {
|
||||||
}
|
}
|
||||||
@@ -36,17 +35,16 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
// El usuario actual es un medico de familia, recuperamos su Id de la sessión actual
|
// El usuario actual es un medico de familia, recuperamos su Id de la sessión actual
|
||||||
try {
|
Integer patientId = Integer.valueOf(SessionUtils.getUserId());
|
||||||
Integer patientId = Integer.valueOf(SessionUtils.getUserId());
|
|
||||||
|
|
||||||
this.patient = this.getRemoteManagerCommon().findPatientById(patientId);
|
this.patient = this.getRemoteManagerCommon().findPatientById(patientId);
|
||||||
this.familyDoctor = this.patient.getFamilyDoctor();
|
|
||||||
|
|
||||||
this.date = LocalDate.now();
|
if (this.patient.getFamilyDoctor() != null)
|
||||||
} catch (Exception e) {
|
this.familyDoctorDisplayName = this.patient.getFamilyDoctor().getDisplayName();
|
||||||
this.manageException(e);
|
else
|
||||||
}
|
this.familyDoctorDisplayName = null;
|
||||||
|
|
||||||
|
this.date = LocalDate.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveData() {
|
public void saveData() {
|
||||||
@@ -54,6 +52,11 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
|
if (this.patient.getFamilyDoctor() == null) {
|
||||||
|
this.addFacesMessage("visitForm:medico", FacesMessage.SEVERITY_ERROR, "Médico de familia no asignado",
|
||||||
|
"Es necesario que tenga un médico de familia asignado, por favor, cambie el médico de familia que tiene asignado");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
if (this.date.isBefore(today)) {
|
if (this.date.isBefore(today)) {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Fecha incorrecta", "La cita fijada es anterior al momento actual");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Fecha incorrecta", "La cita fijada es anterior al momento actual");
|
||||||
error++;
|
error++;
|
||||||
@@ -66,6 +69,12 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
try {
|
try {
|
||||||
this.getRemoteManagerVisit().addVisit(this.patient.getId(), this.date, this.time, this.observations);
|
this.getRemoteManagerVisit().addVisit(this.patient.getId(), this.date, this.time, this.observations);
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Visita creada", "La nueva visita se ha registrado correctamente en el sistema.");
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Visita creada", "La nueva visita se ha registrado correctamente en el sistema.");
|
||||||
|
|
||||||
|
this.observations = "";
|
||||||
|
this.date=null;
|
||||||
|
this.time=null;
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.manageException(e);
|
this.manageException(e);
|
||||||
}
|
}
|
||||||
@@ -113,6 +122,10 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
return familyDoctorDisplayName;
|
return familyDoctorDisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFamilyDoctorDisplayName(String value) {
|
||||||
|
this.familyDoctorDisplayName = value;
|
||||||
|
}
|
||||||
|
|
||||||
public PatientTO getPatient() {
|
public PatientTO getPatient() {
|
||||||
return patient;
|
return patient;
|
||||||
}
|
}
|
||||||
@@ -121,14 +134,6 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.patient = patient;
|
this.patient = patient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FamilyDoctorTO getFamilyDoctor() {
|
|
||||||
return familyDoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFamilyDoctor(FamilyDoctorTO familyDoctor) {
|
|
||||||
this.familyDoctor = familyDoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package managedbean.visit;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -95,8 +96,34 @@ public class PatientVisitListMBean extends ManagedBeanBase implements Serializab
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeVisit(Integer visitId) throws IOException {
|
public void removeVisit(Integer visitId) throws IOException {
|
||||||
this.getRemoteManagerVisit().removeVisit(visitId);
|
int error = 0;
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Visita eliminada", String.format("La visita con Id: %d se ha eliminado correctamente", visitId));
|
|
||||||
|
if (SessionUtils.getUserType() == UserType.PATIENT) {
|
||||||
|
VisitTO vi = null;
|
||||||
|
try {
|
||||||
|
vi = this.getRemoteManagerVisit().getVisit(visitId);
|
||||||
|
|
||||||
|
if (vi == null) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "La visita no se puede eliminar",
|
||||||
|
"La visita que intenta eliminar ya no existe o no se ha podido recuperar. Por favor, refresque los datos de la pagina actual e intentelo de nuevo.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
this.manageException(ex);
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vi != null && vi.getResult() != null && vi.getResult().trim().equals("") == false) {
|
||||||
|
// Si tiene resultado entonces no se puede eliminar.
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "La visita no se puede eliminar", "La visita ya tiene un resultado asignado y no se puede eliminar.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
if (error == 0) {
|
||||||
|
this.getRemoteManagerVisit().removeVisit(visitId);
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Visita eliminada", String.format("La visita con Id: %d se ha eliminado correctamente", visitId));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Error de autorización", "Su perfil de usuario no tiene permisos para eliminar una visita.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editVisit(Integer visitId) throws IOException {
|
public void editVisit(Integer visitId) throws IOException {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import javax.inject.Named;
|
|||||||
import TO.FamilyDoctorTO;
|
import TO.FamilyDoctorTO;
|
||||||
import TO.PatientTO;
|
import TO.PatientTO;
|
||||||
import TO.VisitTO;
|
import TO.VisitTO;
|
||||||
|
import common.UserType;
|
||||||
import managedbean.common.ManagedBeanBase;
|
import managedbean.common.ManagedBeanBase;
|
||||||
import managedbean.common.SessionUtils;
|
import managedbean.common.SessionUtils;
|
||||||
|
|
||||||
@@ -30,14 +31,21 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
private String result;
|
private String result;
|
||||||
private PatientTO patient;
|
private PatientTO patient;
|
||||||
private FamilyDoctorTO familyDoctor;
|
private FamilyDoctorTO familyDoctor;
|
||||||
private boolean onlyResult;
|
private UserType userType;
|
||||||
private String fromPage;
|
private String fromPage;
|
||||||
|
private String infoMessage;
|
||||||
|
|
||||||
public UpdateVisitMBean() {
|
public UpdateVisitMBean() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
|
this.userType = SessionUtils.getUserType();
|
||||||
|
if (this.userType == UserType.SPECIALIST_DOCTOR) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Acesso denegado", "Su perfil de usuario no está autorizado acceder a esta página.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FacesContext context = FacesContext.getCurrentInstance();
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
Map<String, String> requestParams = context.getExternalContext().getRequestParameterMap();
|
Map<String, String> requestParams = context.getExternalContext().getRequestParameterMap();
|
||||||
VisitTO vi = null;
|
VisitTO vi = null;
|
||||||
@@ -61,38 +69,40 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.result = vi.getResult();
|
this.result = vi.getResult();
|
||||||
this.patient = vi.getPatient();
|
this.patient = vi.getPatient();
|
||||||
this.familyDoctor = vi.getFamilyDoctor();
|
this.familyDoctor = vi.getFamilyDoctor();
|
||||||
|
|
||||||
|
this.setInfoMessage();
|
||||||
} else {
|
} else {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Identificador de visita no válido",
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Identificador de visita no válido",
|
||||||
"No se ha podido recuperar el identificador de visita especificado. Por favor, vuelva a intentarlo seleccionando de nuevo la visita.");
|
"No se ha podido recuperar el identificador de visita especificado. Por favor, vuelva a intentarlo seleccionando de nuevo la visita.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Si el usuario es un paciente listamos las visitas de ese paciente, si es
|
private void setInfoMessage() {
|
||||||
// admnistrador listamos todas.
|
switch (this.userType) {
|
||||||
switch (SessionUtils.getUserType()) {
|
|
||||||
case ADMINISTRATOR:
|
case ADMINISTRATOR:
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
// Administrador y paciente pueden actualizar cualquier dato de la visita
|
if (this.result != null && this.result.trim().equals("") == false)
|
||||||
// (excepto esl resultado)
|
this.infoMessage = "La cita ya tiene un resultado y no es editable.";
|
||||||
this.onlyResult = false;
|
|
||||||
break;
|
break;
|
||||||
case FAMILY_DOCTOR:
|
case FAMILY_DOCTOR:
|
||||||
// El médico de familia solo puede actualizar el resultado.
|
// El médico de familia solo puede actualizar el resultado.
|
||||||
this.onlyResult = true;
|
if (this.date.isAfter(LocalDate.now()))
|
||||||
|
this.infoMessage = "La cita es posterior a la fecha actual y no se puede actualizar el resultado.";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
case SPECIALIST_DOCTOR:
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Acesso denegado", "Su perfil de usuario no está autorizado acceder a esta página.");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveData() {
|
public void saveData() {
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch (SessionUtils.getUserType()) {
|
switch (this.userType) {
|
||||||
case ADMINISTRATOR:
|
case ADMINISTRATOR:
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
// Administrador y paciente pueden actualizar la fecha y hora de la visita (excepto el resultado)
|
// Administrador y paciente pueden actualizar la fecha y hora de la visita (excepto el resultado)
|
||||||
// Comprobamos que la fecha fijada para la visita no sea anterior a la actual
|
// Comprobamos que la fecha fijada para la visita no sea anterior a la actual
|
||||||
int error = 0;
|
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
if (this.date.isBefore(today)) {
|
if (this.date.isBefore(today)) {
|
||||||
@@ -110,9 +120,14 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
break;
|
break;
|
||||||
case FAMILY_DOCTOR:
|
case FAMILY_DOCTOR:
|
||||||
// El médico de familia solo puede actualizar el resultado.
|
// El médico de familia solo puede actualizar el resultado.
|
||||||
// TODO: implementar método EJB para actualizar el resultado.
|
if (this.date.isAfter(LocalDate.now())) {
|
||||||
this.getRemoteManagerVisit().addResultToVisit(this.id, this.result);
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Fecha incorrecta", "La cita fijada es posterior a la fecha actual y no se puede actualizar el resultado.");
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Resultado actualizado", "El resultado de la visita se ha actualizado correctamente.");
|
error++;
|
||||||
|
}
|
||||||
|
if (error == 0) {
|
||||||
|
this.getRemoteManagerVisit().addResultToVisit(this.id, this.result);
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Resultado actualizado", "El resultado de la visita se ha actualizado correctamente.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SPECIALIST_DOCTOR:
|
case SPECIALIST_DOCTOR:
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Acesso denegado", "Su perfil de usuario no está autorizado acceder a esta página.");
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Acesso denegado", "Su perfil de usuario no está autorizado acceder a esta página.");
|
||||||
@@ -179,12 +194,30 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOnlyResult() {
|
public boolean isReadOnly() {
|
||||||
return onlyResult;
|
switch (this.userType) {
|
||||||
|
case ADMINISTRATOR:
|
||||||
|
case PATIENT:
|
||||||
|
// Si no tiene resultado entonces es editable.
|
||||||
|
return (this.result != null && this.result.trim().equals("") == false);
|
||||||
|
case FAMILY_DOCTOR:
|
||||||
|
case SPECIALIST_DOCTOR:
|
||||||
|
default:
|
||||||
|
// Para los medicos siempres es de solo lectura (el especialista no pdrá ni ver la página, se incluye pro completitud.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnlyResult(boolean onlyResult) {
|
// Un médico de familia siempre puede editar el resultado de una visita si la visita sucedió en el pasado, o está programada para el día de hoy
|
||||||
this.onlyResult = onlyResult;
|
public boolean isResultReadOnly() {
|
||||||
|
if (this.userType == UserType.FAMILY_DOCTOR)
|
||||||
|
// Si la visita sucede en el futuro (a partir de mañana) el resultado no es editable.
|
||||||
|
if (this.date.isAfter(LocalDate.now()))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFromPage() {
|
public String getFromPage() {
|
||||||
@@ -195,4 +228,7 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.fromPage = fromPage;
|
this.fromPage = fromPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getInfoMessage() {
|
||||||
|
return infoMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
# Dudas para la reunión
|
|
||||||
|
|
||||||
1. en las anotaciones de los JPA aparece el nombre del schema y la tabla con mayusculas y en el script de creación de database en minúsculas. ¿Qué formato de los dos?
|
|
||||||
Reference in New Issue
Block a user