Compare commits
186 Commits
revert-4ae
...
master
| 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 | ||
|
|
44f61ee745 | ||
|
|
e3174faf34 | ||
|
|
893431851b | ||
|
|
875f664586 | ||
|
|
4d22327267 | ||
|
|
eb0366c7e7 | ||
|
|
e07ed75132 | ||
|
|
e9f103123d | ||
|
|
37be658b42 | ||
|
|
1dbd8ef883 | ||
|
|
9435964e9e | ||
|
|
2c55a78bc8 | ||
|
|
756c6dff84 | ||
|
|
501a07df31 | ||
|
|
5269237787 | ||
|
|
a7ec876ca7 | ||
|
|
f80ad15f01 | ||
|
|
ba4a4e123c | ||
|
|
d0e41c5d5f | ||
|
|
b6e4116d0f | ||
|
|
ea5f0a4352 | ||
|
|
20e6ccd184 | ||
|
|
7f886a0922 | ||
|
|
1b377f2f38 | ||
|
|
d1ac1fe6ba | ||
|
|
b305c59054 | ||
|
|
4442100826 | ||
|
|
5fa3d1525a | ||
|
|
9cd602f8cf | ||
|
|
8dc561f876 | ||
|
|
47caa1fc54 | ||
|
|
2e0cc8bf36 | ||
|
|
be08aaff6e | ||
|
|
d889bdbd6c | ||
|
|
627ee49afa | ||
|
|
b2258e7ba0 | ||
|
|
74bef5814a | ||
|
|
e7d995aa60 | ||
|
|
8bfad1cea5 | ||
|
|
316b42f1f4 | ||
|
|
c7b302c695 | ||
|
|
2fe4176ef9 | ||
|
|
af0a2cf98c | ||
|
|
308fa17eba | ||
|
|
1ee2c3be90 | ||
|
|
9f3dc38744 | ||
|
|
1bd894fda1 | ||
|
|
3f944207cc | ||
|
|
8321d770a0 | ||
|
|
a3a3a410c6 | ||
|
|
069bd78520 | ||
|
|
6fae518032 | ||
|
|
ccf1137fd4 | ||
|
|
697a8e9cf7 | ||
|
|
974b524006 | ||
|
|
2b89caf1ba | ||
|
|
bf05547827 | ||
|
|
ac3d81fe07 | ||
|
|
553cc1550e | ||
|
|
b7697b7bd5 | ||
|
|
01b0615d68 | ||
|
|
43b2793494 | ||
|
|
3d5be6849c | ||
|
|
ec3b1dc1cd | ||
|
|
1d0118bcc8 | ||
|
|
e8df59352f | ||
|
|
bd243631f5 | ||
|
|
7f36ca323c | ||
|
|
c3da3bdc95 | ||
|
|
a851f139f7 | ||
|
|
c27a28f3a5 | ||
|
|
85f2cd100c | ||
|
|
0e861e01c6 | ||
|
|
c8b16d7295 | ||
|
|
0a9b2180cb | ||
|
|
6fd9e7ca6c | ||
|
|
85f6cf9644 | ||
|
|
87da9ccbf1 | ||
|
|
c7de5401ad | ||
|
|
2726d2564a | ||
|
|
066ddeba51 | ||
|
|
b2f5cf88e4 | ||
|
|
e6aef82ba1 | ||
|
|
6c8fb202ce | ||
|
|
a35d7fe7fe | ||
|
|
a5eb912504 | ||
|
|
3aa63a8cd1 | ||
|
|
0e309052ee | ||
|
|
3bd6399340 | ||
|
|
ed54eb8905 | ||
|
|
017d685538 | ||
|
|
244bb76eec | ||
|
|
61932f6a18 | ||
|
|
31b794e4c9 | ||
|
|
aa50eccbac | ||
|
|
b37fe33906 | ||
|
|
96e19feb00 | ||
|
|
c9cfbb3b7e | ||
|
|
de70fa1e8c | ||
|
|
592a0a0f97 | ||
|
|
06e42a6189 | ||
|
|
3fe7a211ce | ||
|
|
d861796289 | ||
|
|
eac96114e6 | ||
|
|
4e8cd37a3c | ||
|
|
74d4162a99 | ||
|
|
a329ed6a32 | ||
|
|
7af0d261ab | ||
|
|
524b3bb8c7 | ||
|
|
b0f5c69a47 | ||
|
|
74ec842f54 | ||
|
|
7cf4a93c2c | ||
|
|
000e2a8721 | ||
|
|
9bc06ccedd | ||
|
|
94fde1e93b | ||
|
|
4f5c5943e7 | ||
|
|
3555348f71 | ||
|
|
1d341cdf90 | ||
|
|
5a04f0bd4f |
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/WildFly 14.0 Runtime"/>
|
||||
<classpathentry kind="lib" path="docroot/WEB-INF/lib/primefaces-7.0.jar" />
|
||||
<classpathentry kind="lib" path="docroot/WEB-INF/lib/omnifaces-3.4.1.jar" />
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/WildFly 14.0 Runtime"/>
|
||||
<classpathentry kind="lib" path="docroot/WEB-INF/lib/primefaces-7.0.jar" />
|
||||
<classpathentry kind="lib" path="docroot/WEB-INF/lib/omnifaces-3.4.1.jar" />
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<fileset dir="docroot/WEB-INF" flatten="false" inWorkspace="true" includes="**/*">
|
||||
<properties/>
|
||||
</fileset>
|
||||
<folder name="classes\managedbean">
|
||||
<folder name="classes/managedbean">
|
||||
<fileset dir="bin/managedbean" flatten="false" inWorkspace="true" includes="**">
|
||||
<properties/>
|
||||
</fileset>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
@@ -18,9 +18,13 @@
|
||||
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
|
||||
<param-value>client</param-value>
|
||||
<param-value>server</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
|
||||
@@ -34,7 +38,7 @@
|
||||
<param-name>primefaces.THEME</param-name>
|
||||
<param-value>#{sessionPreferences.currentTheme}</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<!-- JSF mapping -->
|
||||
<servlet>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
@@ -48,46 +52,11 @@
|
||||
<url-pattern>*.xhtml</url-pattern>
|
||||
</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-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-code>500</error-code>
|
||||
<location>/error.xhtml</location>
|
||||
</error-page>
|
||||
<error-page>
|
||||
<error-code>401</error-code>
|
||||
<location>/error.xhtml?type=expired</location>
|
||||
</error-page>
|
||||
|
||||
<session-config>
|
||||
<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">
|
||||
|
||||
<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:define name="content">
|
||||
@@ -12,34 +12,43 @@
|
||||
<div class="ui-g-8 ui-md-8">
|
||||
<p:panel id="ErrorPanel">
|
||||
<f:facet name="header">
|
||||
<p:outputLabel rendered="#{param.type == '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="#{param.type == '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="#{param.type == '' or param.type == null}" value="Se ha producido un error desconocido" />
|
||||
<p:outputLabel rendered="#{error.errorType == 'sql'}" value="No se puede conectar con la base de datos" />
|
||||
<p:outputLabel rendered="#{error.errorType == 'auth'}" value="Se ha producido un error de autorización" />
|
||||
<p:outputLabel rendered="#{error.errorType == 'expired'}" value="Su sesión ha caducado" />
|
||||
<p:outputLabel rendered="#{error.errorType == 'runtime'}" value="Se producido un error en tiempo de ejecución" />
|
||||
</f:facet>
|
||||
<div class="ui-g ui-fluid">
|
||||
<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." />
|
||||
<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." />
|
||||
<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="#{param.type == 'runtime'}"
|
||||
<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="#{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." />
|
||||
<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 class="ui-g-12">
|
||||
<p:messages id="errorMessage" showDetail="true" closable="false" autoupdate="true" showSummary="true" showIcon="true" />
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</p:panel>
|
||||
</div>
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
<p:growl id="messages" globalOnly="true" sticky="false" showDetail="true" life="15000" />
|
||||
<div id="layout">
|
||||
<div id="top" class="top">
|
||||
<h:graphicImage library="images" name="logo-small.png" />
|
||||
<h:graphicImage library="images" name="logo-small.png" height="116" alt="MyHealth by Grupo 2" />
|
||||
</div>
|
||||
<div id="menuDiv" style="margin-bottom: 10px;">
|
||||
<p:ajaxStatus style="width:32px; height:32px; position:fixed; right:32px; bottom:32px" onerror="onAjaxError()">
|
||||
<div id="menuDiv" style="padding: 8px;">
|
||||
<p:ajaxStatus style="width:32px; height:32px; position:fixed; right:48px; bottom:48px" onerror="onAjaxError()">
|
||||
<f:facet name="start">
|
||||
<i id="loginSpin" class="pi pi-spin pi-spinner" style="font-size: 3em" />
|
||||
</f:facet>
|
||||
@@ -47,32 +47,20 @@
|
||||
<p:password id="password" value="#{loginView.password}" placeholder="Contraseña" />
|
||||
</div>
|
||||
<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)" />
|
||||
</div>
|
||||
<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>
|
||||
</p:dialog>
|
||||
</h:form>
|
||||
<h:form id="frmMenu">
|
||||
<p:menubar model="#{menuView.model}">
|
||||
<f:facet name="options">
|
||||
<ui:fragment rendered="#{home.logedIn}">
|
||||
<h:outputText value="logeado como #{home.userName} (#{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>
|
||||
<p:menubar model="#{menuView.model}" />
|
||||
</h:form>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="content" style="padding-left: 8px; padding-right: 8px;">
|
||||
<ui:insert name="content">Content</ui:insert>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,9 +6,12 @@
|
||||
<ui:composition template="./header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form>
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel header="Pagina principal">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-12 ui-md-12">
|
||||
Logeado como:
|
||||
<h:outputLabel value="#{home.userDisplayName}" style="font-weight: bold;" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel for="selectorTema" value="Cambio de tema" />
|
||||
</div>
|
||||
@@ -20,35 +23,9 @@
|
||||
</p:themeSwitcher>
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:commandButton value="Usar tema en este sesión" update="mesgs" action="#{sessionPreferences.updateCurrentTheme}" icon="pi pi-save" />
|
||||
<p:commandButton value="Usar tema" update="messages" action="#{sessionPreferences.updateCurrentTheme}" icon="pi pi-save" />
|
||||
</div>
|
||||
<div class="ui-g-5 ui-md-5" />
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<div class="ui-inputgroup">
|
||||
<p:calendar pattern="dd/MM/yyyy" showButtonPanel="true" autocomplete="true" />
|
||||
<p:commandButton value="Fecha" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-g-10 ui-md-10" />
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<h:outputLabel value="Fecha" />
|
||||
<p:calendar pattern="dd/MM/yyyy" showButtonPanel="true" autocomplete="true" />
|
||||
</div>
|
||||
<div class="ui-g-10 ui-md-10" />
|
||||
|
||||
<div class="ui-g-12">
|
||||
<h:outputLabel value="Rich Text Editor" />
|
||||
</div>
|
||||
<div class="ui-g-12 ui-md-12">
|
||||
<p:editor />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12 ui-md-12">
|
||||
<h:outputLabel value="Logeado como:" />
|
||||
<p:inputText readonly="true" value="#{home.userName}" />
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
|
||||
<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)" />
|
||||
</div>
|
||||
<div class="ui-g-6">
|
||||
|
||||
@@ -2,58 +2,190 @@
|
||||
<!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:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="TestForm">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="PanelUnderConstruction" header="Pagina en construcción de Pruebas médicas">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo" value="Etiqueta para campo de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo" value="Valor del campo del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-5 ui-md-5">
|
||||
<h:form id="frmMT">
|
||||
<p:panel id="mainPanel" header="Pruebas médicas">
|
||||
<f:facet name="actions">
|
||||
<h:commandLink rendered="#{mt.specialistDoctor}" action="#{mt.addMT}" update="frmMT,frmNEW" styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
|
||||
<h:outputText styleClass="ui-icon pi pi-plus" />
|
||||
</h:commandLink>
|
||||
<h:commandLink rendered="#{mt.patSelector}" action="#{mt.clearFilteredPatient}" immediate="true" update="frmMT,frmNEW"
|
||||
styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
|
||||
<h:outputText styleClass="ui-icon pi pi-refresh" title="Quitar filtro y ver todos los registros" />
|
||||
</h:commandLink>
|
||||
</f:facet>
|
||||
<p:autoComplete rendered="#{mt.patSelector}" id="filterPatient" widgetVar="filterPatient" dropdown="true" value="#{mt.patientFilterSelected}"
|
||||
completeMethod="#{mt.completePatientFilter}" var="p" itemLabel="#{p.displayName}" itemValue="#{p}" forceSelection="true"
|
||||
placeholder="Seleccione un paciente o teclee para buscar...">
|
||||
<o:converter converterId="omnifaces.ListConverter" list="#{mt.patientWithTestList}" />
|
||||
<f:selectItem itemLabel="Ver todos" itemValue="">
|
||||
<p:column headerText="Num. Prof.">
|
||||
<h:outputText value="Ver todos" />
|
||||
</p:column>
|
||||
</f:selectItem>
|
||||
<p:column headerText="Num. Prof.">
|
||||
<h:outputText value="#{p.personalIdentificationCode}" />
|
||||
</p:column>
|
||||
<p:column headerText="Nombre">
|
||||
<h:outputText value="#{p.name}" />
|
||||
</p:column>
|
||||
<p:column headerText="Apellidos">
|
||||
<h:outputText value="#{p.surname}" />
|
||||
</p:column>
|
||||
<p:ajax event="itemSelect" listener="#{mt.onSelectPatient}" update="medicalTestList" />
|
||||
<p:ajax event="change" listener="#{mt.onChangePatient}" update="medicalTestList" />
|
||||
</p:autoComplete>
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo2" value="Etiqueta para campo 2 de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo2" value="Valor del campo 2 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
<p:orderList id="medicalTestList" value="#{mt.medicalTests}" var="el" itemValue="#{el}" controlsLocation="none" responsive="true">
|
||||
<p:ajax event="select" listener="#{mt.onSelectMT}" update="frmNEW,frmImage" />
|
||||
<o:converter converterId="omnifaces.ListConverter" list="#{mt.medicalTests}" />
|
||||
<p:column>
|
||||
<h:outputText value="#{el.date}">
|
||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
||||
</h:outputText>
|
||||
- <h:outputText value="#{el.type.testTypeName}" />
|
||||
<br />
|
||||
<h:outputText rendered="#{mt.patientFilterSelected == null}" value="#{el.patient.displayName}" style="font-size: 0.8em !important; font-style: italic;" />
|
||||
</p:column>
|
||||
</p:orderList>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</div>
|
||||
<div class="ui-g-7 ui-md-7">
|
||||
<h:form id="frmImage" enctype="multipart/form-data">
|
||||
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
|
||||
<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 class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo3" value="Etiqueta para campo 3 de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo3" value="Valor del campo 3 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
<p:panel rendered="#{mt.viewEdit}" id="detailPanel" header="Detalle de prueba médica">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-3">Fecha:</div>
|
||||
<div class="ui-g-9">
|
||||
<h:outputText value="#{mt.selected.date}">
|
||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" timeStyle="short" locale="es" />
|
||||
</h:outputText>
|
||||
</div>
|
||||
<div class="ui-g-3">Hora:</div>
|
||||
<div class="ui-g-9">
|
||||
<h:outputText value="#{mt.selected.time}" />
|
||||
</div>
|
||||
<div class="ui-g-3">Observaciones:</div>
|
||||
<div class="ui-g-9">
|
||||
<h:outputText escape="false" value="#{mt.selected.observations}" />
|
||||
</div>
|
||||
<div class="ui-g-3">Tipo de prueba:</div>
|
||||
<div class="ui-g-9">
|
||||
<h:outputText value="#{mt.selected.type.testTypeName}" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="TestForm" action="#{BeanName.actionMethod}" icon="pi pi-check" />
|
||||
<div class="ui-g-12">
|
||||
<p:outputPanel rendered="#{mt.selected.type != 'BLOOD_TEST'}">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-3">Imagen de alta resolución:</div>
|
||||
<div class="ui-g-9">
|
||||
<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 class="ui-g-2">
|
||||
<p:commandButton rendered="#{mt.specialistDoctor and mt.selected.highresimage != null}" value="Eliminar" icon="pi pi-trash" action="#{mt.removeImage}" update="frmImage">
|
||||
<p:confirm header="Confirme la eliminación" message="¿Está seguro de que desea eliminar la imagen?" icon="pi pi-exclamation-triangle" />
|
||||
</p:commandButton>
|
||||
<p />
|
||||
<p:commandButton rendered="#{mt.selected.highresimage != null}" ajax="false" value="Descargar" icon="pi pi-download">
|
||||
<p:fileDownload value="#{mt.imageDownload}" />
|
||||
</p:commandButton>
|
||||
</div>
|
||||
</div>
|
||||
</p:outputPanel>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
</p:panel>
|
||||
</h:form>
|
||||
<h:form id="frmNEW">
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
|
||||
<p:panel rendered="#{mt.viewCreate}" id="createPanel" header="Añadir una nueva prueba médica">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-2">Paciente:</div>
|
||||
<div class="ui-g-10">
|
||||
<p:autoComplete id="addTestPatient" dropdown="true" value="#{mt.patSelected}" completeMethod="#{mt.completePatient}" var="p" itemLabel="#{p.displayName}" itemValue="#{p}"
|
||||
forceSelection="true" placeholder="Seleccione un paciente o teclee para buscar..." required="true"
|
||||
requiredMessage="Por favor, seleccione un paciente al cual aádir la prueba.">
|
||||
<o:converter converterId="omnifaces.ListConverter" list="#{mt.patientList}" />
|
||||
<p:column headerText="Num. Prof.">
|
||||
<h:outputText value="#{p.personalIdentificationCode}" />
|
||||
</p:column>
|
||||
<p:column headerText="Nombre">
|
||||
<h:outputText value="#{p.name}" />
|
||||
</p:column>
|
||||
<p:column headerText="Apellidos">
|
||||
<h:outputText value="#{p.surname}" />
|
||||
</p:column>
|
||||
</p:autoComplete>
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">Fecha:</div>
|
||||
<div class="ui-g-3">
|
||||
<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">
|
||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" timeStyle="short" />
|
||||
</p:datePicker>
|
||||
</div>
|
||||
<div class="ui-g-1" />
|
||||
<div class="ui-g-6">
|
||||
<p:message for="fecha" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">Hora:</div>
|
||||
<div class="ui-g-3">
|
||||
<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">
|
||||
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||
</p:datePicker>
|
||||
</div>
|
||||
<div class="ui-g-1" />
|
||||
<div class="ui-g-6">
|
||||
<p:message for="hora" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">Observaciones:</div>
|
||||
<div class="ui-g-10">
|
||||
<p:textEditor value="#{mt.testObservations}" required="true" requiredMessage="Debe indicar las observaciones de la prueba" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">Tipo de prueba:</div>
|
||||
<div class="ui-g-5">
|
||||
<p:selectOneMenu id="selUsertype" value="#{mt.testType}" required="true" unselectable="false" requiredMessage="Debe especificar un tipo de prueba médica">
|
||||
<f:selectItems value="#{mt.medicalTestTypes}" var="item" itemLabel="#{item.testTypeName}" />
|
||||
</p:selectOneMenu>
|
||||
</div>
|
||||
<div class="ui-g-1" />
|
||||
<div class="ui-g-4">
|
||||
<p:message for="selUsertype" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:commandButton value="Guardar" action="#{mt.save}" icon="pi pi-save" update="frmMT,frmImage,frmNEW" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</div>
|
||||
</div>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
</html>
|
||||
@@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="TestForm">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="panelPendingQuestions" header="Listado de preguntas pendientes de respuesta">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo" value="Etiqueta para campo de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo" value="Valor del campo del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo2" value="Etiqueta para campo 2 de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo2" value="Valor del campo 2 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo3" value="Etiqueta para campo 3 de formulario:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo3" value="Valor del campo 3 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
</div>
|
||||
|
||||
<p:dataTable widgetVar="dtPendingQuestions" var="qs" value="#{PendingQuestions.lazyDataModelQuestionList}" lazy="true" paginator="true" rows="10" paginatorPosition="bottom" paginatorAlwaysVisible="true"
|
||||
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,40">
|
||||
<p:column headerText="Id" width="60px;">
|
||||
<h:outputText value="#{qs.id}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Title" width="auto">
|
||||
<h:outputText value="#{qs.title}"/>
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Patient" width="auto">
|
||||
<h:outputText value="#{qs.patient.displayName}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Status" width="90px;">
|
||||
<h:outputText value="#{qs.status}" />
|
||||
</p:column>
|
||||
<p:column headerText="Acción" width="80px;">
|
||||
<h:outputText value="Responder" />
|
||||
</p:column>
|
||||
|
||||
<f:facet name="paginatorBottomLeft">
|
||||
<p:commandButton type="button" icon="pi pi-refresh" onclick="PF('dtPendingQuestions').getPaginator().setPage(0);" />
|
||||
</f:facet>
|
||||
</p:dataTable>
|
||||
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="TestForm" action="#{PendingQuestions.saveData}" icon="pi pi-check" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
87
1.sources/MyHealth/docroot/medicaltest/Questions.xhtml
Normal file
@@ -0,0 +1,87 @@
|
||||
<?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="frmQuestions">
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-4">
|
||||
<p:panel id="panelQuestionList" header="">
|
||||
<f:facet name="header">
|
||||
<h:outputText rendered="#{Questions.patient}" value="Lista de preguntas realizadas" />
|
||||
<h:outputText rendered="#{Questions.familyDoctor}" value="Lista de preguntas pendientes" />
|
||||
</f:facet>
|
||||
<f:facet name="actions">
|
||||
<h:commandLink action="#{Questions.init}" immediate="true" update="frmQuestions" styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
|
||||
<h:outputText styleClass="ui-icon pi pi-refresh" />
|
||||
</h:commandLink>
|
||||
<h:commandLink rendered="#{Questions.patient}" action="#{Questions.create}" update="questionDetail" styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
|
||||
<h:outputText styleClass="ui-icon pi pi-plus" />
|
||||
</h:commandLink>
|
||||
</f:facet>
|
||||
<p:orderList value="#{Questions.pendingQuestions}" var="pq" controlsLocation="none" itemValue="#{pq}" responsive="true">
|
||||
<o:converter converterId="omnifaces.ListConverter" list="#{Questions.pendingQuestions}" />
|
||||
<p:ajax event="select" listener="#{Questions.onSelect}" update="questionDetail" />
|
||||
<p:ajax event="unselect" listener="#{Questions.onUnSelect}" update="questionDetail" />
|
||||
<p:column headerText="" style="width: 30px;">
|
||||
<h:graphicImage name="images/#{pq.status}.png" alt="#{pq.status}" styleClass="ui-theme" />
|
||||
</p:column>
|
||||
<p:column headerText="Título" width="auto">
|
||||
<h:outputText value="#{pq.title}" />
|
||||
</p:column>
|
||||
</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>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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="TestForm">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="frmSSbD" header="Búsqueda de médicos especialista por especialidad">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel for="selMS" value="Especialidad:" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<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"
|
||||
placeholder="Seleccione una especialidad médica o teclee para buscar...">
|
||||
<o:converter converterId="omnifaces.ListConverter" list="#{sspec.medicalSpecialtiesList}" />
|
||||
<p:ajax event="itemSelect" update="dtDoctorList" oncomplete="PF('dtDoctorList').getPaginator().setPage(0);" />
|
||||
<p:column headerText="Nombre">
|
||||
<h:outputText value="#{ms.name}" />
|
||||
</p:column>
|
||||
<p:column headerText="Descripción">
|
||||
<h:outputText value="#{ms.description}" />
|
||||
</p:column>
|
||||
</p:autoComplete>
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
|
||||
<div class="ui-g-12">
|
||||
<p:dataTable id="dtDoctorList" widgetVar="dtDoctorList" var="d" value="#{sspec.lazyDataModelDoctorList}" 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" emptyMessage="No existe ningún especialista para la especialidad seleccionada.">
|
||||
|
||||
<p:column headerText="Núm. Profesional" width="90">
|
||||
<h:outputText value="#{d.professionalNumber}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Nombre" width="150">
|
||||
<h:outputText value="#{d.name}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Apellidos" width="auto">
|
||||
<h:outputText value="#{d.surname}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Correo electrónico" width="auto">
|
||||
<h:outputText value="#{d.email}" />
|
||||
</p:column>
|
||||
|
||||
<f:facet name="paginatorBottomLeft">
|
||||
<p:commandButton type="button" icon="pi pi-refresh" onclick="PF('dtDoctorList').getPaginator().setPage(0);" />
|
||||
</f:facet>
|
||||
</p:dataTable>
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
@@ -35,7 +35,7 @@
|
||||
<div class="ui-g-6">
|
||||
<p:button value="Ir a la página principal" outcome="/home" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-3"></div>
|
||||
<div class="ui-g-3" />
|
||||
</div>
|
||||
|
||||
</p:panel>
|
||||
@@ -53,7 +53,7 @@
|
||||
<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">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@@ -66,10 +66,15 @@
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-inputgroup">
|
||||
<p:inputText id="nif" value="#{RegisterUser.nif}" validator="nifValidator" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF">
|
||||
<p:ajax event="blur" update="nifmsg" listener="#{RegisterUser.hadleNIFValueChange}" oncomplete="handleNIFResponse(xhr, status, args)" />
|
||||
<p:inputText id="nif" widgetVar="nif" value="#{RegisterUser.nif}" validator="nifValidator" binding="#{nif}" maxlength="20" required="true"
|
||||
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: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 class="ui-g-6 ui-md-6">
|
||||
|
||||
@@ -41,14 +41,18 @@
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<div class="ui-inputgroup">
|
||||
<p:inputText id="nif" value="#{UpdateProfile.nif}" validator="nifValidator" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF">
|
||||
<p:ajax event="blur" update="nifmsg" listener="#{UpdateProfile.hadleNIFValueChange}" oncomplete="handleNIFResponse(xhr, status, args)" />
|
||||
<p:inputText id="nif" widgetVar="nif" value="#{UpdateProfile.nif}" validator="nifValidator" binding="#{nif}" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF">
|
||||
<f:validator validatorId="nifValidator" for="nif">
|
||||
<f:attribute name="managedBean" value="#{UpdateProfile}" />
|
||||
</f:validator>
|
||||
<p:ajax event="change" update="nifmsg,nifButton" />
|
||||
</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 class="ui-g-6 ui-md-6">
|
||||
<p:message id="nifmsg" for="nif" display="text" />
|
||||
<p:message id="nifmsg" for="nif" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
@@ -145,7 +149,7 @@
|
||||
<p:column headerText="Nombre">
|
||||
<h:outputText value="#{ms.name}" />
|
||||
</p:column>
|
||||
<p:column headerText="Localización">
|
||||
<p:column headerText="Descripción">
|
||||
<h:outputText value="#{ms.description}" />
|
||||
</p:column>
|
||||
</p:autoComplete>
|
||||
@@ -176,6 +180,7 @@
|
||||
</p:autoComplete>
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:button icon="fa fa-edit" outcome="ChangeFamilyDoctor" alt="Modificar médico de familia" />
|
||||
<p:message for="FamilyDoc" />
|
||||
</div>
|
||||
</h:panelGroup>
|
||||
@@ -183,7 +188,7 @@
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-4"></div>
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="frmUpdateProfile" action="#{UpdateProfile.saveData}" icon="pi pi-check" />
|
||||
<p:commandButton validateClient="true" value="Guardar" update="frmUpdateProfile,frmMenu" action="#{UpdateProfile.saveData}" icon="pi pi-check" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
BODY {
|
||||
body {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
min-width: 1280px !important;
|
||||
min-height: 800px !important;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.background-light-blue {
|
||||
background-image: url("#{resource['images/fondo.png']}");
|
||||
}
|
||||
|
||||
.nopadding {
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
@@ -16,6 +25,10 @@ ul.ui-menu-list {
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
.ui-orderlist.ui-grid-responsive .ui-orderlist-list {
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
.green-button.ui-button.ui-state-default {
|
||||
background-color: #5cb85c;
|
||||
border-color: #5cb85c;
|
||||
@@ -36,4 +49,9 @@ ul.ui-menu-list {
|
||||
.red-button.ui-button.ui-state-default:enabled:hover, .red-button.ui-button.ui-state-default:focus {
|
||||
background-color: #d43f3a;
|
||||
border-color: #d9534f;
|
||||
}
|
||||
|
||||
.ui-orderlist .ui-orderlist-list {
|
||||
height: 62vh !important;
|
||||
width: 25vw !important;
|
||||
}
|
||||
BIN
1.sources/MyHealth/docroot/resources/images/ANSWERED.png
Normal file
|
After Width: | Height: | Size: 775 B |
9
1.sources/MyHealth/docroot/resources/images/ANSWERED.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="215.434px" height="215.434px" viewBox="0 0 215.434 215.434" enable-background="new 0 0 215.434 215.434" xml:space="preserve">
|
||||
<g>
|
||||
<circle fill="#54C147" cx="107.717" cy="107.717" r="106.299"/>
|
||||
<polygon fill="#FFFFFF" points="96.977,121.718 145.084,50.79 168.752,69.02 103.583,164.647 46.678,120.299 63.562,96.402 "/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 696 B |
BIN
1.sources/MyHealth/docroot/resources/images/PENDING.png
Normal file
|
After Width: | Height: | Size: 909 B |
248
1.sources/MyHealth/docroot/resources/images/PENDING.svg
Normal file
@@ -0,0 +1,248 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="71.337982mm"
|
||||
height="65.062035mm"
|
||||
viewBox="0 0 71.337982 65.062035"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
||||
sodipodi:docname="Pendiente.svg">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.4"
|
||||
inkscape:cx="21.631587"
|
||||
inkscape:cy="107.22382"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1015"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Capa 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-46.72982,-68.677315)">
|
||||
<circle
|
||||
style="fill:#ffdd55;fill-opacity:1;stroke-width:0.31121486"
|
||||
id="path3813"
|
||||
cx="81.031158"
|
||||
cy="99.249031"
|
||||
r="29.009672" />
|
||||
<path
|
||||
style="fill:#000000;stroke:none;stroke-width:0.03527778"
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 74.462809,68.91145 c -3.457222,0.529167 -8.854723,2.504722 -12.065001,4.409722 -4.833056,2.892778 -9.771945,8.219723 -12.347223,13.370279 -1.446389,2.8575 -2.751667,7.408334 -3.139722,11.112501 -1.516945,13.864168 6.632222,27.728338 19.438057,33.196388 4.727222,2.01084 7.408333,2.54 13.052778,2.54 6.138334,0 7.231945,-0.28222 7.231945,-1.69333 v -1.02306 l -6.526389,-0.0353 c -6.385278,0 -6.596945,-0.0353 -9.877779,-1.16417 -4.691944,-1.55222 -8.396111,-3.84528 -11.818056,-7.26722 -6.0325,-6.0325 -8.960556,-12.91167 -8.995834,-21.13139 0,-11.394726 6.279445,-21.695838 16.404168,-26.775839 5.856111,-2.963333 13.687779,-3.915833 20.073057,-2.434166 9.136945,2.116666 16.93333,8.466667 20.74333,16.862778 1.23473,2.751667 2.39889,7.090834 2.39889,8.960557 0,1.199444 0.70556,2.43417 1.37584,2.43417 0.14111,0 0.56444,-0.21167 0.91722,-0.493893 0.635,-0.458611 0.635,-0.670277 0.21167,-3.421944 -0.59973,-3.880556 -2.04612,-8.149167 -3.95112,-11.465279 -1.79916,-3.175 -6.20888,-7.972778 -9.348607,-10.230556 -2.963334,-2.116667 -7.549445,-4.198056 -11.112501,-5.08 C 83.67031,68.735061 77.708365,68.417561 74.462809,68.91145 Z"
|
||||
id="path3790" />
|
||||
<path
|
||||
style="fill:#000000;stroke:none;stroke-width:0.03527778"
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 78.625587,74.908673 c -0.599722,0.3175 -0.635,1.199444 -0.635,10.548056 v 10.195278 l -1.023056,0.529167 c -2.434166,1.27 -3.668889,4.056946 -2.892778,6.526386 l 0.423334,1.27 -4.797778,4.62139 c -2.610556,2.54 -4.762501,4.86834 -4.762501,5.18584 0,0.67027 0.881945,1.41111 1.552223,1.23472 0.282222,-0.0706 2.645833,-2.11667 5.221111,-4.55084 3.880556,-3.66888 4.833056,-4.40972 5.397501,-4.16277 1.375833,0.52916 3.845278,0.35277 5.044722,-0.38806 3.4925,-2.15194 3.421945,-7.725833 -0.176389,-9.489722 L 80.812809,95.863674 V 85.738951 c 0,-8.713612 -0.07055,-10.195278 -0.564444,-10.65389 -0.635,-0.670277 -0.811389,-0.670277 -1.622778,-0.176388 z m 2.8575,24.518057 c 1.023056,1.30528 0.917222,2.46944 -0.3175,3.73944 -0.917222,0.88195 -1.27,1.02306 -2.2225,0.84667 -3.421945,-0.67028 -2.998611,-5.503333 0.493889,-5.503333 1.023056,0 1.481667,0.211667 2.046111,0.917223 z"
|
||||
id="path3792" />
|
||||
<path
|
||||
style="fill:#000000;stroke:none;stroke-width:0.03527778"
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 99.192533,104.01284 c -7.47889,2.01083 -12.347223,9.45445 -11.077223,16.93334 1.093611,6.27944 5.644445,11.04194 11.88861,12.3825 2.32834,0.49389 3.10445,0.52916 5.22111,0.17639 5.04473,-0.88195 9.2075,-3.95112 11.25361,-8.32556 2.18723,-4.69195 2.11667,-8.74889 -0.21166,-13.51139 -3.06917,-6.20889 -10.33639,-9.48972 -17.074447,-7.65528 z m 8.254997,2.99861 c 2.57528,0.9525 5.50334,3.66889 6.77334,6.24417 0.88194,1.76389 0.98777,2.39889 0.98777,5.36222 0,2.96334 -0.10583,3.59834 -0.98777,5.36222 -3.70417,7.51417 -13.58195,9.34862 -19.579171,3.66889 -2.751667,-2.57527 -3.704167,-4.62139 -3.880556,-8.32555 -0.211666,-4.445 1.164167,-7.65528 4.480278,-10.44223 3.03389,-2.54 8.254999,-3.35138 12.206109,-1.86972 z"
|
||||
id="path3794" />
|
||||
<circle
|
||||
style="fill:#ffdd55;fill-opacity:1;stroke-width:0.13077107"
|
||||
id="path3813-3"
|
||||
cx="102.99097"
|
||||
cy="118.6227"
|
||||
r="12.189734" />
|
||||
<image
|
||||
y="106.07389"
|
||||
x="90.484489"
|
||||
id="image3875"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOAAAADhCAYAAADRcblEAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
|
||||
WXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4wwWCB4YJbjQ/wAAABl0RVh0Q29tbWVudABDcmVhdGVk
|
||||
IHdpdGggR0lNUFeBDhcAACAASURBVHja7Z19fFTVue9/a+29ZybJJANJIJFgMEbUIHIsFGsLVw9e
|
||||
IyCF1k8tbZVaX6CeW6niKcrRWqvo0RtfEKnoUQQ5GGsvxcMxHFo58cqlhc/HQsPxAA0oxEggMSEv
|
||||
MJkJs2f23mvdPyYBQl7Iy7ztmef3V4Aws1/Wdz0v61nPYlJKkOIsaRRJoRfK0ImLpdE6BqY3Txon
|
||||
RkujOUda7SNhnfJIcdoN4c+A0F1S+DQAKkQHAyABmOAZBgCd8cwOMO4Hc3iZVnAS3NPKVM8Jpo1q
|
||||
YtqoBqblHmOqpw7ayFrGXQDT6PnHUYwAjJlcACaJQM1EqddNkMGjV4rAwfEyWFMsjeOKFC1gTAPA
|
||||
On/dATCl8+dOSJg6CKjNzh+Mzj9bAELhH2UIACzGc2uYNvYwcxYf4mkl1cw57gBzFe7jacU6vS4C
|
||||
0O6aLAI13xAd1VNFx/4pomPHJGl8DkABY45zANMGB1bEra8ZhrQT0DCc1j7umlrFXNfsUTKn/oWn
|
||||
X7GXuQrpjRKACa2pUq+bYfk/vV74dk0X/h2esFVzACwt/qANGcwApAx5Gc/dyTO+9See9ffbFfc1
|
||||
ewhIAjDeypaW7xbR/teZ1qkPS4VvW56UfjDmDls2lpaEsaoJSB1S+puYkl/JM2/epoyc9Qcl82tt
|
||||
FEsSgLFQgbR837VO/r/vWKe2lsrTO8IxG0tLTuAuCGQAkKcBsErunvWBMnLuvyueb9aDu2ikEIAR
|
||||
Uyak8UPr1M7vW23vl1r+Dzvdyix7uZQxgTEAQFZy9+zfKznf+53imeajB0MADlUzhX//ArN184+E
|
||||
9z0lbOkIukHAaAF4j3sWlKujf7CNpxXTcyEAL6gcCP1es/n9u8zWDSXSqAHjntR0LyMIoxTeg9x5
|
||||
zXol9861avbNreSiEoDna7II1Nxnnnh3kXXqbcaYB2AusnYRBdEEpC6l9K5RRix6QxuzaC/TRhGA
|
||||
KQ5gqfDvX2w0rp4nOj4iaxdbq1ihZM57Vc1bWMkzJhCAKaa5wr9/idFQdqMIfALGc8naxQ3Eto95
|
||||
2rSVWsFjW1IRxFQDcLbw73/YaCibQeAllnsqRct2nnHTC1rBw39MpYRNqgA4TXRUP2rUPztHBHaB
|
||||
8TwCL2FBbNqqZM1/Thu7dFcqxIjJDmCRNJp/ZRx77m7LV0EWz14x4ttqzuKntTH/UJvMWdNkBvAJ
|
||||
o+HNJ83m5xklV2wq4ZcAnlTHLF+u5s4jAG2iW6323f9sHH2gBFIHuJsGsu1BbDsI9eJfOsa9vDnZ
|
||||
EjXJBOAYCL0s9OVjCyxfBZiSTwM36eLDlnJlxD3LHOMeayAAE0uLrLbKF4zjD3pStjA6ddxSL5jy
|
||||
sDbu9TVK1rUEYJxVAKGvDH352G1k9VLMIFqNm5QRdy5xFD5ab+etUHYG8HbLu+s3xtFF2WT1UtYa
|
||||
toG7f+645PXfcvfVtrwFbtNHvzp09Nl3Q1/+JBs8m+BLVXF3NqT5brBm3mqj4U2ygDHQFKnXvRH8
|
||||
YtEUmE2U4SSdYw3bqphr8n2O4termJJJAEZB95gtW94y6h9itKBO6j0wDEgACx1F69fZxSW1iwv6
|
||||
Uujos2uN+ocYU/IJPlIf5iSNgaWtDdbMe8lsepcsYASULS3fhtDhu+fI0BFyOUmDcElbt/LMeXc6
|
||||
israCMChabLU68qDh+eXAAYlWkhDgNB/kDkuW+C8vHxvotaTJqoLOtdq371D/+zGkk7XggYTaQij
|
||||
210ijeM79L9Nmyv1OgJwgLrXbNlSEar9gZviPdLwfTzVDWgVwc9n3iv8+wnAC+gRs3H9W0b9A2BK
|
||||
AQ0eUqQgBHjOW8GaeY9YbZUUA/ahp43jKx83W1+lkjJS1CSt+me0glW/UnPnEoDn6MXQ0eW/EN73
|
||||
AJ5Do4QUbQhf0i4qW6qOnk8AAngldHT5A8L7O4Bn0+ggxQrCVVr+Mw+qeXekdAxI8JHiY3mUggeM
|
||||
xsdfMRvXpyyAL4aOPkvwkeILYdMzL5onNqYcgE8bx1f+QnjfIfhIcYYw/xfGV8ueNlu2pAyAj5iN
|
||||
6x83W1+lhAspUSzh40b9A49Y3l2x/+4YJ2HuDe9ooHU+UuJJWvULnZdtXRvLxk+xBHCu1b67IlT7
|
||||
A4KPlLgSbfOcJTu2xKopcKwAnCwCNTuCn9/kJvhIiW0GTT+YeoPrqu17Y9FrJhYxYLa0fOWhI3e4
|
||||
Gc+jF0xK8IBQdUMGyoOH745JdjAWAG4IHb67c1cDFVaT7ABhWonUD2wIHV1uewBfCh1dHt5MS/CR
|
||||
7CTunmOd2vCS2VJh2xjwHrOlYq1R/49UXE2yb0ho1d/rvGzrumhlRqMF4BQRqNkT/HwmI/hIdmcQ
|
||||
MjDVddWuqmjsqo+OCyqNN0I1Pwl3LyORbB4RAngjeGShbWLA1aHaZVMgAxT3kZIEwbQpUt+7OhqF
|
||||
25EG8HazpeJnlq+C+riQkks8+2dG01O3i47qhI0BC6TRvE+vvjabFttJyRkNmm1QPJNcE7bVJ6IF
|
||||
XBmqfSibFttJyeuKqtkwm1aGjj6bcC7oIvPExtukvpfiPlKSu6Lu26xT6xZFqsNaJFzQMdJortar
|
||||
r/WQ60lKEVfUC6ZOcE3cOeyTeiNhActCtQ95yPUkpZAr6oHwlxn1q+Pugt5qtmxZIPUqcj1JqeaK
|
||||
LjBbXr51uB23h+eCCr1aP/C1EtrZTkpRV/Qgc142wXl5eVws4BOhYytKwNLpRZBS1RUtkXrVE9bJ
|
||||
7TG3gEUiUFMT/PwmRokXUqrbQUiz2DXxz7VD2cA7VAv4K+PYrxklXkgkMEj9V0M9EHQoFnCa5d21
|
||||
M/TlT2ibEYnUJdE63XnV7l2DPZ9+KBbwUaN+OWinA4l0rilLf9Q4/puou6CzrbbKOTDraNmBROoG
|
||||
YNoc69Sa2dJojiqADxsNT1FDXRKpNwZ59sPG8RejBuBcs2XLDIg2etIkUu9WcIbV/v6gjsMeDIBL
|
||||
zMYyOsuBROrXCnqWGE3rIw5gqdVWeSNZPxLpglbwRuvU26UDjQUHCuBio/FFgGXRAyaRLhwLLjYa
|
||||
1kQMwMlW++550qihzCeJNDArOE94yydLyxcRAO8zG1fRuh+JNCg57rMG0NT3QpUwOVKva9Y/u4Fq
|
||||
PkmkwUlCBka5rq5qHY4FvNdoKmeMMp8k0qAdUcjT917o0M/+ART6XcK7kVoMkkhDQtBzl9n8zpAB
|
||||
nGm2VZYAIXqQJNKQAFRLRMdHM/tbkugvrbnAavlXWnq4oKdvAjCi/CJj6IHIQJS/QEupbDpj7gVm
|
||||
8+Zt2pif9v7vfSRhMqVed1L/7EaFthz156L7wd03Akp0M8Si/f3YQMgzwDNuiC7fwWrIYEodV2cB
|
||||
GOmauNM3GAv4Q7PtQ4UxN0HWj6Vg6dfBcemK6L699t0Q3vKoAyitejiLtiJax3B1KXjotlQbKQpE
|
||||
6w+Ff/8a7r56wDHg961T7wOcAOx7xJ6Go+iFqH+N2bgq+mGAaIOauzTq8An/fojgp6lX0MHSv2+2
|
||||
bund6ejl7wpER3WpNGoIsj6tRSO0sasw2N3Pg/4evQ4i8El0B6w0AfViaAX3R38yaS4H457UGzAs
|
||||
rVS0v18wUAC/a538z9R8UAN0PZWs70HJLo3+gG35t6i/Byla4Lx0TfQfm+WD1Z7CS1ry9Het9t0D
|
||||
AvA71qlNtPbXjxzjnopN9N62PrrvQbRBy38KzFUY/XtpqQBjKTyps/TvWCc/uiCA2SJQUyqtRqKs
|
||||
L9dz3OuIxlHFPeGrRFTXYKUJ5poMNe+OmDw7s3UDwFwpDGBaqWivyL4QgLcI759B2c9eMwhQRtwJ
|
||||
Jeva2AzYaK/BSi8cRS/HxpK37wb1EQIgvbeIQE2/AM60vH9I7Zmqz0RFHhzjnogN64GaqCZfziSR
|
||||
tFGxAbB5A8AopwA4Zwrvn/sGUFq+UqHvoZmqR6KiCY5xL8fs+8wT/yd6yRcZgOKeFZMkEgBIoxmW
|
||||
fyuNKQBgrlKr/aM+AZwq/PvyGCVfeiQqYrFGds6IhXVqXVSTL46iF2M3mTRvTu3kSzcA1TwR2DUV
|
||||
Qu8VwBnWqR2U/Tw/UeGYEJM1srPJig/BmCNKrmc9tMJVMUkinXE/2zZQQce5DLK0GZavqlcArxcd
|
||||
OwBo9JTOdT0vWRHT74xaAbzwQxlxNxTPtNjdi3cXIFppIHUjMO164f+0J4DSaJ5OmarurqeW/0xM
|
||||
1sjOfGVHdXRKtaQJcDcchY/G9BGaTa9T8qWHtOnCt70HgJPF6c89AKPn0+V6xnCN7MyAbdkUleSL
|
||||
FE1wFL2JoRyfNeTvjEUZnT3jQI8MVZ9p2NQF4DeEbw/Ff2cGbEvM1sjOmj8d1qm3I/8OhD+2SaQz
|
||||
k8m/UTlj3yPsGzLwZTcAp4rTf6X4D51rZAUvx2yN7OyAjUKpVuf6ZSyTSGfiv5Pv0ITep5xTxemD
|
||||
3QCcIgK7yF2QASiZ86Dmzo35V5stayNeABGrQuse8LVVxmBnvZ3dUGWK6Kg6A6BL6nWTAIUejLSg
|
||||
xajQuruXuB8Rb3wcw0LrnpMJtTLpH8C0SSLwqasLwEni9GdRW3uyles5bnXU9/j1OmAjvU8uTkkk
|
||||
IPpldEkz3ozPJ0Ho4AAmCr0WQAoD2FVoHcM1srPg+2BFuueLbI99EqlrMolmGV0yGUHmmiiC9eAA
|
||||
JsjAvtQtwI7TGtmZeKn5/YjuPpFWI9QxZTFPInVO6zHpX5MkCE6QgS+gArhSBA+nrisgmuAsrojp
|
||||
Gln3eOmtyJVqdRZaxyOJBITL6EgDleNKodeCQ+jjYbWkps8u/FBzHkRv3apiYv3ad0e8VEu75Lm4
|
||||
PU7qIzsYA+gaL/VD4NLyFUvhTU3XU82DNnZJ/AZsBPfJSase2rjX45JEAqJYRpe8KpahOqgy2Kgw
|
||||
lnoL8NL6G5yXfRq/7zeaYfk/REQaH3cVWsdot37vrvQmSr4MygKqijQbi7g0WpByNaCiDVr+b8DT
|
||||
iuM3YJs3Ryb50pVEitFu/d6fZ5TK6JJ+HLYWqjLUgJRaguhaI8u/K66XYbWui0jy5UwSKY4yU73j
|
||||
2VDfnTQuVqXRDLDUqYKRogXOoi3xhc+7C5BegOUM25KruUvjlkQ6C+Ba6iM0FC+UaWO4tNqRMkXY
|
||||
ohVawYr4rJF1cz/fGX7yJYYdrfsPP6NQRpc6COZxaTSkiOkLgKXfADV3Xnwvw2iG8L8bGUseh0Lr
|
||||
HpNJ62akYhIvMnKM5jBTZA1QBmJymMoF5zxtFJxXdKbrh7pjQLRBy3s8LoXWPYbQuCegZN8HauY8
|
||||
JOVwaabAgxOt4fKsOK2RnS+eVgzXhI/AtKLBQ9jpesY7iXSutLFL4Lj4dUirnpAa1GysjOTJb/lM
|
||||
MOfVcSvP6ptCF5xXbgJzlgwKQila4Ch8MeEes5JdCscl5WQJBydP0gMoRRO0sU8m7PU5Ly8Pn7Ar
|
||||
zQFNJop7Vtyznn1C6JkGrWAFQThwuZMbQGmCZ8yMeT+UQUM4vjy8LDGAyUQd81BC34uaOw/KiDsB
|
||||
4Se8Luy8ZyQ5gF5o+fcn/GUybRTUvMcB0db/ZJI2La7VOwOVo/BRasY7MLmSF0BpAmphwrprPSxH
|
||||
3h2AenHfrqj0Qs1/wCbJBQ1awdPUlPeCz0nVkhhAHWrOnfZySC76p75dUZ4T12LrQceDI2cAauHA
|
||||
YtvUlZq0AErph5J9s62uWRk5A+C9lKfJAJQRt9lvdI2+H5DthFk/NjA5AZQmuGty3EvOhgRhdi8J
|
||||
DHkayoj/ab97GTmDELvASE1SAHUonlvs6ZNkz4KUPTOIdollu03vSiZ4xo3khvYtM0ld0CC4e4o9
|
||||
fRJXYfdNutIES7/Btm+Ce2aSG9q3jKQEUEodPH28fQdt5s1nq2OkDp4+2bb3orj/DlKGCLXepXPw
|
||||
jOSLbJWCmB5CGXEAM64BpNX5pxB4xlX2fReuQgAWodZ7rqKDM8WTbDcFnn6trW+BOfIBBDuteajz
|
||||
z/YVd06hOLB3+TmU7CR7OAaYo9DeAzatCFIaYRiZA8wx2t4TirMYgEG49ZQ3CS2gBaaOsPc9cNfZ
|
||||
szpYmv03vFK3tL6MxUnOtIuSb3bi6UlwE2cBtHM8CwBMJQD7UCtPjsF6rkJg6kh7D1imhRtlSRNJ
|
||||
kSRj2jlJJdI53toJztQRyfdwbN5iQ0qDBmxKKNTEmbMAQHKt00grGfaihcITieiw/62I0ynV+nIQ
|
||||
auBMyQIgk+ieHICw+fHIQj+7eC1NQNo7Rg+3viT19HRCxzhz5p9JeSeH+6kg3O3bxvwFas9mQWU7
|
||||
pNDtPdAC+5AyvWcHF+vXcaZkWpE8IDL+0iD0Q/YesPqXOHtcgITUj9l7QglWUePenrLAc2o5uKsG
|
||||
al4STSsq5Okd9h6wHVXnxExOiMARG1vzGgAU//WcZc0apo0BB3CYOYqSqhpGSqPzxdt00Pq2nT1p
|
||||
iCkQvl02vpcqJJeHFSkZh5mjCBzAIe66Esm0GM+YG6L9E3sOWP9+dNWBhm8mDcK3xbbvwjpVQQe3
|
||||
9GolrEM8fRI4gGrmujS51p2YC9bJzba8dLN1M8B6FkdYXvtZQWk0QwQ+ofivV4WqmesScAAHuKuo
|
||||
+6ybBHGgCH5qOzdUWj4I7+96HnTJsmC1vGe/yaTpXTo1t88wKXSAOy8GB7CPp4+HlHpS3SDjuTC/
|
||||
Wm2vAdu4Ab0elspUWP4P7TWhCB1m66t0am7f2sdcheAAdHDXPqYUJNftMRWWb7NtBq20fDBbXu6z
|
||||
oS3jHltNKEbDv5D16/Nlm/t42nU6AHS1pKjiGdOGflxWwlrBPBh1j9pjwB79df8DlqXB8m2G1b47
|
||||
8Y1foAZm6ytk/fp+21U8/es4F8A9PGNKUhZly+ABmCc2JvRlWie3w/JVXHDAhieUf0z40jTj6DIw
|
||||
nkec9WkBA3t4xt91A/AvPGMikioR0yWeDeOrZRAd1Yn5LoxmhOoWde+E1s+EAhlA6IvEPaAldHQ5
|
||||
ZOgIZT77e+cy9BfuntgNwL087VIv4EzKG2ZKAUJf3ANpNCdcoiJ4eAEYzx3EzaRBdHwMo+HNhHvO
|
||||
5omNsE5toINZ+peXKfl7u5pGn21LyF07mWtiUjfPCX52a0JBGDyyELCGcEQ4z4bZ/DzMxvWJ40a3
|
||||
VcL46rGBWfLUdj938oxpZ1/lOf/0JyXrJiDJliO6u28mgodmxT0zKi0fgodugwweHHKigin5ME+U
|
||||
IXT02YSwfKFjPyX4Bvby/8Qzp/cK4PZwN+lg8t48UwGWhuDnM2G2VMTH6+yoRvDgbEjj+PCzhDwH
|
||||
wluO4JF/gLR8cYv5wpavgOAaUPzn3a54rjs7JKXsthm3Ud9XktfrCT3JJtEKln4DHOOejtkhLkbD
|
||||
mzCbnwtnCCOZpJABQJ6GNnYVlOzSmE0koaMPAWYTxXwDVxN4Rr5rwrZeLSAAVHL37NRoospzIAN7
|
||||
EDx4fTihEcXUvtW+G/qB6bBaXgtbikhnCFkawHNgHH8Awc8XRDXjKy0fQkeXI3hkDmB5Cb7BTZSV
|
||||
Stbs7sPwvF/ZxrNmpM5hGp0D12p5DYF9l8M4vhJSr4uQidBhndwOvXomQrW3d3Y4c0d/UgkeQfDI
|
||||
HAQ/mx8u4I7QxCI6qhGqXQb9wCSI9g+iM5EkPYCnt/Gsb3Ufgue5oNnSaG4NHrweKeGG9uLKSeEF
|
||||
04qhjPgeuPsaKO5JA+7LKfU6WP7/hmjfDuH/GOHGSlnxGajS7JxIHeCZM8Ezp0PxXDdwd1vosPz7
|
||||
IHx7YHkrII2acKUOVbcMYxZry3Fd/d9tOKfR8vkAAsB/Bg/dVhpOEqToDCfNzmxwEFLqYMwD5poI
|
||||
po4GlBHnmwbIYA1E8NPwA2Xu8P63RHp2MhCeXGQIgAWmXQ7mKAJTPN37jooOSMsLGdgDKdrAWFoY
|
||||
OIIuIu4nd990s6OorNtf9zZKPlBG3lpqNr0ApOpOZqZ23rsbrOv5BY9ABo+g943LWmKn4DshYmeC
|
||||
Ui9k4FPIPu4FLI2ympEH8ANlxKyer6YXC1gg9brj+mc30EsgkSLmfraOdU38r/rzw5neDuisZ67C
|
||||
SjpSikSKoPuZOa++t1xCXyfk/l4ZeWvyVsWQSDEF8PTvlex5vUcHvbigAJApLd9J/cDXFCovIpGG
|
||||
JQvCP9I16dNeS5X6soA+pmS+xzNuIjeURBqe+/mekn1Xn3WCvJ//Wq6O+jEgvfQQSaSh8ie85UrO
|
||||
XAwFwG2KZ9pBMOrrQSINjT7zIHdN3sbTiocEIACsV7J/DAg/PUwSadAAtq9XRy3q91f6SsJ0KUca
|
||||
zc169bWM1gRJpMHhB9E6yjXpYGt/v3QhC9jKtFFrlMxbk65jGokUVQn/GiVnceuFfo0P4KPeUPMW
|
||||
QgpKxpBIA1fwDXX0fEQCwL08Y0IFT7uOliRIpAE5n4EKnjlv70B2nvABfuSrat7/oiUJEmkg/Im2
|
||||
V7WL7h/Q7w4UwErFM+1jqIVkBUmkfukzP1bccyqZqzCiAALASu2ifyIrSCL1a/1aVqpjBt44eTAA
|
||||
blFGzthOVpBE6tP6bVfcs7b0t/A+HAAB4AWt4AlI0UIPm0TqYf2aXtAKHhnU/xksgH9UPNO2cuc1
|
||||
ZAVJpG70BbYqWfP/ONDYb6gAAsBz2thfkxUkkbpZP+9z2tilg/5/QwFwF3df/TZtVSKROiX8b6s5
|
||||
i3cNpcHzhWpB+1KR1Otq9M9uoBpRUsobP8hAseuqXbUDbV85XAsIALXMVfikmvMg7ZQgpbj1a31S
|
||||
vejJIcE3HAvYyb5Rre+fWkLtyUmpafvMg0wbO8F55aYhfwQf1gUw7Zfa2BcgrUZ6GaTU40+0/FIb
|
||||
Vzasz+DDvIbNSnZpOSVkSKnnevrL1ZzFmwez6B55FzSsMdJortarr/VQQoaUIvICmOCauLNhuB/E
|
||||
I3AxDUwb9bB2URkg2ujVkJLf9bQaH9YKVzRE4rN4hK5pjTp6/ibmmkyuKCnZXc9Nyoh71ihZ10bk
|
||||
4yLhgnapQBrN+/Tqb2ZTM19Scpo+sw2KZ5Jrwrb6SH0kj+Dl1TNt1M+1gpcpK0pKTv5Ey88dRa/V
|
||||
R/IzeYSv8bdq7tzXlKzvURMnUpK5nm2vaXmP/3a4Wc9ouqDnTBXGX/UD/2NK+BvoGGOS3U1foIo5
|
||||
S77uvLw84h/No3LBTLvPcdm7Uoomenkk2+MHaPc5L3srKh/Oo3TRVTyteKF2URnFgyR702fVL3Rc
|
||||
uq5qqLWe8QIQANapo+evUEbcSQXbJJvC17hCu6hsHc+YELXviE4M2F3/ETx02xxpHKd4kGQfCf9W
|
||||
njnz246isqh+TSwAzJaWb2ew+u9LwNLoxZJsYPoCB5mjeLrzio1RL+3iMbidNqZkLnBcttEvrXp6
|
||||
uaQEh8/0A9oC5/gNMamr5DG6rb08rfh2R+E6EISkxAbQe7tz/Ma90Uq6xAtAINxXlDKjpMRlz6pf
|
||||
6Lh045bBdjazC4AAsFYdPX+ZmrMYEK30xkmJBN8yx8VvruXuq2P6vTwO9/q8NnbJM9zzI9q+REoU
|
||||
+J7RCl55Xskujfl3xyIL2pdeDNUu+4XwbQF4No0CUpzga3xJy39qqZp3R1y+P54AAsArodplDxCE
|
||||
pDjBt0rLf+rBeMEXLxf0XD3oKCpbxTPnkjtKij18eY/HFb5EALALwpcIQlIMY76XtPynHlTz74r7
|
||||
tfAEeSZLHUVlz3DPAsqOkqIN3zNawStL4235EiUGPF+PGPWry8yWl0FtLUhRgG+Zo3Dd88rIGQlz
|
||||
TYkGIADca57Y+Jbx1TJQm0NSZMgzAdm+0FG8aW00dzYkC4AAMNdqq/xt6NhP3QQhaXjwBfyAdrtz
|
||||
fGwrXOwOIABMFh3V5aGa20vAXLSViTR4Cf9B5rx8gXP8hpjVdg5WPIEf316eMWG6s6RyKxQPbeol
|
||||
DRK+1q08c+Z05xUbExa+RAcQANqYNurbrgnbVvDMmZQhJQ3M67TqV6h5j3/bUVSW8OtaieyCnq97
|
||||
zKZ33zIaH6dDQUl9xXsS0lqoXfLmukh1riYAu2uK6Kh+I/TFjztbHtIOe9IZl7OKuabc5yh+vYop
|
||||
mba5bLsB2Pmw9dWh2qU/Ex3/F+A5NPhS2uqZkKLlNS3/qfsTZXE9+QEM63bzxMbfGF8ty2Y8j7Kk
|
||||
KWn1/G1Q837uKHot4h2rCcCBqUAazStDX9x/mwweoB0VqWT4rMZNyog7lzjGPWHrHid2B7BLi8zG
|
||||
9S8YTU95yBomvdXzgrke1satWmOXREsqAAgAY6ReVxaqe2yB1KsoNkzOWK9czVm8TBu7pCFZbiuZ
|
||||
AOzSrWbLln82Gx4pAUunTGlSWL3Wg8xx1S8dl6zYnIjlZARgry9NfyJ0bMWT1qk1jNxS27qbEsz1
|
||||
pFbw9PJ49GshAIevIqnX/Sp0/Nm7RcdHYDyXQLSFuxmAFN631dyHntbG/LQWTEvaW012ALs0zWrf
|
||||
/ajZ8PwcGfobwDwEYsKC17ZVyZr/nDZ26S6mjUr6W04VALs02zq5/WHjq/89A2YdgZhYFm+7kjnv
|
||||
BW3Mkj8mW5xHAPbUXKutconR+OKNBGLcLd7HSuatK7UxS7akEnipDmCXSi3vrsVm4yvzhL6XYsRY
|
||||
SfgBBCu450evanl3VaYieARgd00W/v33GY2rF4mObYzxbFq+iLi1MwHZLqUMrVFzH3pDHT1/byrE
|
||||
eATg4JQj9bp7jabyu0T7+yWQAYBlkVUcfnx3kDuvWa/k3rlWzZndmsxZTQIwYgPHmGm1715gNr/z
|
||||
I9HxkcKYG9QaY+DQQQYsAO9xz4JydfQPttm1WJoAjL8ypdH8Q7N58/etU++XSqMGBGOf0AFAJc+c
|
||||
+3tlxKzfKSOm+8jaEYCRVIEI1HxXeP/8HevUf5TK0N8AsNR1U2UAkKcBOCt55swPlBGz/l3xfLM+
|
||||
kXuwEIDJo2xpNN9ieT+ZaZ3aWio6PspjTANYOgAtOYGUJiB1SOltYtrllUrW7G0861t/UDK/1kaW
|
||||
jgCMd8w41fL91wzh23O98G2fLkPVHkACcNrTXZUmACOcRJEhL1Pyd/L0a//E3ddtV7Ku25PKSwcE
|
||||
oB3Gr+WbjWy65QAAAPBJREFULDoOfkMGDk8VHVVTRMeOSVK0gTFXJ5RKYljKM6BZAEKQMgTA2sfT
|
||||
plXx9K/v4elX/YWnX7GXgCMA7S6XtHyTZODLiUKvnSD1L64U+qHxMlRbDLNOkdIAY1o4poSjE1AM
|
||||
HVJpdv5gdM0IAELhH2UIACzGc2uYNvYwcxYf4mkl1cw57gBzFe7jacU6vS4CMJWsZRGMk4XS9F4s
|
||||
rfYxMlifJ43m0dL05sBsGCnNEx5ped0AMiA6XGEqoXbSKgF0mjHoADrAM/xMHeVl6uiTUHJbmeo5
|
||||
wbRRTUwb1QAl4xh35NdBG1nLuAsUu8VX/x83CvbHNjG9MAAAAABJRU5ErkJggg==
|
||||
"
|
||||
preserveAspectRatio="none"
|
||||
height="25.097618"
|
||||
width="25.012953" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 17 KiB |
BIN
1.sources/MyHealth/docroot/resources/images/clock.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
36
1.sources/MyHealth/docroot/resources/images/clock.svg
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="225.000000pt" height="225.000000pt" viewBox="0 0 225.000000 225.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
|
||||
<g transform="translate(0.000000,225.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M900 2009 c-98 -15 -251 -71 -342 -125 -137 -82 -277 -233 -350 -379
|
||||
-41 -81 -78 -210 -89 -315 -43 -393 188 -786 551 -941 134 -57 210 -72 370
|
||||
-72 174 0 205 8 205 48 l0 29 -185 1 c-181 0 -187 1 -280 33 -133 44 -238 109
|
||||
-335 206 -171 171 -254 366 -255 599 0 323 178 615 465 759 166 84 388 111
|
||||
569 69 259 -60 480 -240 588 -478 35 -78 68 -201 68 -254 0 -34 20 -69 39 -69
|
||||
4 0 16 6 26 14 18 13 18 19 6 97 -17 110 -58 231 -112 325 -51 90 -176 226
|
||||
-265 290 -84 60 -214 119 -315 144 -98 24 -267 33 -359 19z"/>
|
||||
<path d="M1018 1839 c-17 -9 -18 -34 -18 -299 l0 -289 -29 -15 c-69 -36 -104
|
||||
-115 -82 -185 l12 -36 -136 -131 c-74 -72 -135 -138 -135 -147 0 -19 25 -40
|
||||
44 -35 8 2 75 60 148 129 110 104 137 125 153 118 39 -15 109 -10 143 11 99
|
||||
61 97 219 -5 269 l-33 16 0 287 c0 247 -2 289 -16 302 -18 19 -23 19 -46 5z
|
||||
m81 -695 c29 -37 26 -70 -9 -106 -26 -25 -36 -29 -63 -24 -97 19 -85 156 14
|
||||
156 29 0 42 -6 58 -26z"/>
|
||||
<path d="M1601 1014 c-212 -57 -350 -268 -314 -480 31 -178 160 -313 337 -351
|
||||
66 -14 88 -15 148 -5 143 25 261 112 319 236 62 133 60 248 -6 383 -87 176
|
||||
-293 269 -484 217z m234 -85 c73 -27 156 -104 192 -177 25 -50 28 -68 28 -152
|
||||
0 -84 -3 -102 -28 -152 -105 -213 -385 -265 -555 -104 -78 73 -105 131 -110
|
||||
236 -6 126 33 217 127 296 86 72 234 95 346 53z"/>
|
||||
<path d="M1768 836 c-55 -15 -111 -55 -141 -102 -19 -29 -27 -34 -64 -34 -39
|
||||
0 -73 -19 -73 -40 0 -18 33 -40 61 -40 26 0 29 -3 29 -30 0 -28 -3 -30 -35
|
||||
-30 -39 0 -59 -24 -44 -52 7 -13 22 -18 57 -18 44 0 48 -3 69 -39 28 -48 101
|
||||
-98 158 -106 65 -10 80 -4 80 30 0 27 -4 30 -42 37 -50 8 -91 28 -117 57 l-19
|
||||
21 50 0 c56 0 79 16 68 50 -6 18 -15 20 -76 20 l-69 0 0 30 0 30 63 0 c65 0
|
||||
87 11 87 42 0 23 -30 38 -77 38 l-38 1 32 29 c18 16 49 32 70 35 49 8 67 18
|
||||
71 39 5 22 -16 46 -37 45 -9 0 -37 -6 -63 -13z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
BIN
1.sources/MyHealth/docroot/resources/images/fondo.png
Normal file
|
After Width: | Height: | Size: 431 B |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 28 KiB |
BIN
1.sources/MyHealth/docroot/resources/images/quote.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
11
1.sources/MyHealth/docroot/resources/images/quote.svg
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="225.000000pt" height="225.000000pt" viewBox="0 0 225.000000 225.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
|
||||
<g transform="translate(0.000000,225.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 438 B |
@@ -1,9 +1,107 @@
|
||||
/**
|
||||
* 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
|
||||
function handleLoginRequest(xhr, status, args) {
|
||||
if (args.validationFailed || !args.loggedIn) {
|
||||
@@ -22,20 +120,38 @@ function startLogin() {
|
||||
PF('btnLogin').disable();
|
||||
}
|
||||
|
||||
// Valida si un NIF está duplicado.
|
||||
function nifCheckClick() {
|
||||
var nif = PF('nif');
|
||||
nif.jq.change();
|
||||
}
|
||||
|
||||
// Actualiza la interfaz tras validar si un nif está duplicado.
|
||||
function handleNIFResponse(xhr, status, args) {
|
||||
var nif = PF('nifButton');
|
||||
if (args.NIFisDupe == false) {
|
||||
nif.jq.children(".ui-icon").removeClass("pi pi-times");
|
||||
nif.jq.removeClass('red-button');
|
||||
var isValid = false;
|
||||
return;
|
||||
|
||||
nif.jq.children(".ui-icon").addClass("pi pi-check");
|
||||
nif.jq.addClass('green-button');
|
||||
} else if (nif.jq.hasClass('red-button') == false) {
|
||||
nif.jq.children(".ui-icon").removeClass("pi pi-check");
|
||||
nif.jq.removeClass('green-button');
|
||||
if (typeof args.validationFailed != "undefined")
|
||||
isValid = !args.validationFailed;
|
||||
else if (typeof args.NIFisValid != "undefined")
|
||||
isValid = args.NIFisValid;
|
||||
|
||||
nif.jq.children(".ui-icon").addClass("pi pi-times");
|
||||
nif.jq.addClass('red-button');
|
||||
if (args.formattedNIF) {
|
||||
var nif = PF('nif');
|
||||
nif.jq.val(args.formattedNIF);
|
||||
}
|
||||
|
||||
var nifButton = PF('nifButton');
|
||||
if (isValid == true) {
|
||||
nifButton.jq.children(".ui-icon").removeClass("pi pi-times");
|
||||
nifButton.jq.removeClass('red-button');
|
||||
|
||||
nifButton.jq.children(".ui-icon").addClass("pi pi-check");
|
||||
nifButton.jq.addClass('green-button');
|
||||
} else if (nifButton.jq.hasClass('red-button') == false) {
|
||||
nifButton.jq.children(".ui-icon").removeClass("pi pi-check");
|
||||
nifButton.jq.removeClass('green-button');
|
||||
|
||||
nifButton.jq.children(".ui-icon").addClass("pi pi-times");
|
||||
nifButton.jq.addClass('red-button');
|
||||
}
|
||||
}
|
||||
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>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?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="TestForm">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="frmListDoctors" header="Listado de médicos por Centro de Antención Primaria">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel for="selPHC" value="Centro de atención primaria:" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:autoComplete id="selPHC" dropdown="true" value="#{listDoctors.primaryHealthCareCenter}" completeMethod="#{listDoctors.completePrimaryHealCareCenter}" var="phc"
|
||||
itemLabel="#{phc.displayName}" itemValue="#{phc}" forceSelection="true" required="true" requiredMessage="Por favor, seleccione un centro de antención primaria" placeholder="Seleccione un centro o escriba para buscar...">
|
||||
<o:converter converterId="omnifaces.ListConverter" list="#{listDoctors.primaryHealthCareCenterList}" />
|
||||
<p:ajax event="itemSelect" update="dtDoctorList" onstart="PF('dtDoctorList').getPaginator().setPage(0);" />
|
||||
<p:column headerText="Nombre">
|
||||
<h:outputText value="#{phc.name}" />
|
||||
</p:column>
|
||||
<p:column headerText="Localización">
|
||||
<h:outputText value="#{phc.location}" />
|
||||
</p:column>
|
||||
</p:autoComplete>
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
|
||||
<div class="ui-g-12">
|
||||
<p:dataTable id="dtDoctorList" widgetVar="dtDoctorList" var="d" value="#{listDoctors.lazyDataModelDoctorList}" 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"
|
||||
emptyMessage="No existe ningún doctor para el centro seleccionado.">
|
||||
|
||||
<p:column headerText="Número Profesional" style="width:100px;">
|
||||
<h:outputText value="#{d.professionalNumber}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Nombre" style="width:150px;">
|
||||
<h:outputText value="#{d.name}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Apellidos" style="width:auto;">
|
||||
<h:outputText value="#{d.surname}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Correo electrónico" style="width:auto;">
|
||||
<h:outputText value="#{d.email}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Número de pacientes" style="width:100px; text-align: center;">
|
||||
<h:outputText value="#{listDoctors.getPatientsByDoctor(d.id)}" />
|
||||
</p:column>
|
||||
|
||||
<f:facet name="paginatorBottomLeft">
|
||||
<p:commandButton type="button" icon="pi pi-refresh" onclick="PF('dtDoctorList').getPaginator().setPage(0);" />
|
||||
</f:facet>
|
||||
</p:dataTable>
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
@@ -0,0 +1,93 @@
|
||||
<?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="frmListCAPs">
|
||||
<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">
|
||||
<div class="ui-g ui-fluid">
|
||||
<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">
|
||||
|
||||
<p:ajax event="rowEdit" listener="#{ManageHealthCareCenters.onRowEdit}" update=":frmListCAPs:mesgsList" oncomplete="updateDataTable()"/>
|
||||
<p:ajax event="rowEditCancel" listener="#{ManageHealthCareCenters.onRowCancel}" update=":frmListCAPs:mesgsList" oncomplete="updateDataTable()"/>
|
||||
|
||||
<p:column headerText="Nombre">
|
||||
<p:cellEditor>
|
||||
<f:facet name="output">
|
||||
<h:outputText value="#{cap.name}" />
|
||||
</f:facet>
|
||||
<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:cellEditor>
|
||||
<f:facet name="output">
|
||||
<h:outputText value="#{cap.location}" />
|
||||
</f:facet>
|
||||
<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:rowEditor />
|
||||
</p:column>
|
||||
|
||||
<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:confirm header="Eliminar" message="¿Está seguro de que quiere borrar el centro?" icon="pi pi-exclamation-triangle" />
|
||||
</p:commandLink>
|
||||
</p:column>
|
||||
|
||||
<f:facet name="paginatorBottomLeft">
|
||||
<p:commandButton type="button" icon="pi pi-refresh" onclick="PF('dtCAP').getPaginator().setPage(0);" />
|
||||
</f:facet>
|
||||
</p:dataTable>
|
||||
|
||||
<p:remoteCommand name="updateDataTable" update="CAPsTable" />
|
||||
|
||||
<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 id="frmAddCAPs">
|
||||
<p:growl id="mesgsAdd" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="PanelNewCAP" header="Alta de Centros de Atención Primaria">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-1 ui-md-1">
|
||||
<p:outputLabel value="Nombre: " for="nameNew" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:inputText id="nameNew" value="#{ManageHealthCareCenters.name}" readonly="false" required="ManageHealthCareCenters.medicalSpecialty.name eq null"
|
||||
requiredMessage="Es necesario un nombre" />
|
||||
</div>
|
||||
<div class="ui-g-1 ui-md-1">
|
||||
<p:outputLabel value="Localización: " for="locationNew" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:inputText id="locationNew" value="#{ManageHealthCareCenters.location}" readonly="false" required="ManageHealthCareCenters.medicalSpecialty.location eq null"
|
||||
requiredMessage="Es necesaria una localización" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Crear" update="mesgsAdd frmListCAPs frmAddCAPs" action="#{ManageHealthCareCenters.insertData}" icon="pi pi-check" />
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
@@ -6,59 +6,79 @@
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="frmManageSpecialties">
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="PanelMS" header="Modificación y borrado de especialidades">
|
||||
<h:form id="frmListSpecialties">
|
||||
<p:growl id="mesgsList" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="PanelSpecialtiesList" style="margin-bottom: 10px;" header="Gestión de Especialidades">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel for="ms"/>
|
||||
<p:selectOneMenu id="ms" value="#{ManageSpecialities.medicalSpecialty}" converter="omnifaces.SelectItemsIndexConverter"
|
||||
effect="fold" editable="true" filter="true" filterMatchMode="startsWith"
|
||||
placeholder="- Selecciona una especialidad -">
|
||||
<f:selectItems value="#{ManageSpecialities.medicalSpecialtiesList}" var="ms" itemValue="#{ms}" itemLabel="#{ms.name}" />
|
||||
<f:ajax render="name description" />
|
||||
</p:selectOneMenu>
|
||||
</div>
|
||||
<div class="ui-g-1 ui-md-1" >
|
||||
<p:outputLabel value="Nombre: " for="name"/>
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:inputText id="name" value="#{ManageSpecialities.medicalSpecialty.name}" readonly="false" required="true" requiredMessage="Es necesario un nombre" />
|
||||
</div>
|
||||
<div class="ui-g-1 ui-md-1">
|
||||
<p:outputLabel value="Descripción: " for="description" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="description" value="#{ManageSpecialities.medicalSpecialty.description}" readonly="false" required="true" requiredMessage="Es necesaria una descripción" />
|
||||
</div>
|
||||
<div class="ui-g-1 ui-md-1 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="mesgs" action="#{ManageSpecialities.saveData}" icon="pi pi-save" />
|
||||
</div>
|
||||
<div class="ui-g-1 ui-md-1 ">
|
||||
<p:commandButton validateClient="true" value="Borrar" update="mesgs" action="#{ManageSpecialities.deleteData}" icon="fa fa-remove" />
|
||||
</div>
|
||||
<p:dataTable id="specialtiesTable" widgetVar="dtSpecialty" var="specialty" value="#{ManageSpecialities.lazyDataModelSpecialtiesList}" 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">
|
||||
|
||||
<p:ajax event="rowEdit" listener="#{ManageSpecialities.onRowEdit}" update=":frmListSpecialties:mesgsList" oncomplete="updateDataTable()"/>
|
||||
<p:ajax event="rowEditCancel" listener="#{ManageSpecialities.onRowCancel}" update=":frmListSpecialties:mesgsList" oncomplete="updateDataTable()"/>
|
||||
|
||||
<p:column headerText="Nombre">
|
||||
<p:cellEditor>
|
||||
<f:facet name="output"><h:outputText value="#{specialty.name}" /></f:facet>
|
||||
<f:facet name="input"><p:inputText value="#{specialty.name}" style="width:100%" label="Nombre"/></f:facet>
|
||||
</p:cellEditor>
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Descripción">
|
||||
<p:cellEditor>
|
||||
<f:facet name="output"><h:outputText value="#{specialty.description}" /></f:facet>
|
||||
<f:facet name="input"><p:inputText value="#{specialty.description}" style="width:100%" label="Descripción"/></f:facet>
|
||||
</p:cellEditor>
|
||||
</p:column>
|
||||
|
||||
<p:column style="width:80px; text-align: center;" headerText="Editar">
|
||||
<p:rowEditor />
|
||||
</p:column>
|
||||
|
||||
<p:column style="width:80px; text-align: center;" headerText="Eliminar">
|
||||
<p:commandLink class="pi pi-trash" actionListener="#{ManageSpecialities.deleteDataById(specialty.id)}" update=":frmListSpecialties:mesgsList frmListSpecialties">
|
||||
<p:confirm header="Eliminar" message="¿Está seguro de que quiere borrar el centro?" icon="pi pi-exclamation-triangle"/>
|
||||
</p:commandLink>
|
||||
</p:column>
|
||||
|
||||
<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>
|
||||
|
||||
<p:panel id="PanelNewMS" header="Alta de especialidades">
|
||||
<h:form id="frmAddSpecialties">
|
||||
<p:growl id="mesgsAdd" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="PanelNewSpecialty" header="Alta de Especialidades">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-1 ui-md-1" >
|
||||
<p:outputLabel value="Nombre: " for="nameNew"/>
|
||||
<div class="ui-g-1 ui-md-1">
|
||||
<p:outputLabel value="Nombre: " for="nameNew" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:inputText id="nameNew" value="#{ManageSpecialities.name}" readonly="false" required="ManageSpecialities.medicalSpecialty.name eq null" requiredMessage="Es necesario un nombre" />
|
||||
<p:inputText id="nameNew" value="#{ManageSpecialities.name}" readonly="false" required="ManageSpecialities.medicalSpecialty.name eq null"
|
||||
requiredMessage="Es necesario un nombre" />
|
||||
</div>
|
||||
<div class="ui-g-1 ui-md-1">
|
||||
<p:outputLabel value="Descripción: " for="descriptionNew" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:inputText id="descriptionNew" value="#{ManageSpecialities.description}" readonly="false" required="ManageSpecialities.medicalSpecialty.description eq null" requiredMessage="Es necesaria una descripción" />
|
||||
<p:inputText id="descriptionNew" value="#{ManageSpecialities.description}" readonly="false" required="ManageSpecialities.medicalSpecialty.description eq null"
|
||||
requiredMessage="Es necesaria una descripción" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Crear" update="mesgs" 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>
|
||||
</p:panel>
|
||||
</div>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
|
||||
87
1.sources/MyHealth/docroot/visit/AddVisit.xhtml
Normal file
@@ -0,0 +1,87 @@
|
||||
<?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="visitForm">
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="panelVisit" header="Detalles de la visita">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="paciente" value="Paciente:" />
|
||||
</div>
|
||||
<div class="ui-g-6">
|
||||
<p:inputText id="paciente" value="#{AddVisit.patient.displayName}" readonly="true" />
|
||||
</div>
|
||||
<div class="ui-g-4">
|
||||
<p:message for="paciente" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="medico" value="Médico de familia:" />
|
||||
</div>
|
||||
<div class="ui-g-6">
|
||||
<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 class="ui-g-4">
|
||||
<p:message for="medico" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="fecha" value="Fecha:" />
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<div class="ui-inputgroup">
|
||||
<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.">
|
||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
||||
</p:datePicker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-g-8">
|
||||
<p:message for="fecha" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="hora" value="Hora:" />
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<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">
|
||||
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||
</p:datePicker>
|
||||
</div>
|
||||
<div class="ui-g-8">
|
||||
<p:message for="hora" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="observaciones" value="Observaciones:" />
|
||||
</div>
|
||||
<div class="ui-g-8">
|
||||
<p:inputTextarea id="observaciones" value="#{AddVisit.observations}" />
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<p:message for="observaciones" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="visitForm" action="#{AddVisit.saveData}" icon="pi pi-check" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
107
1.sources/MyHealth/docroot/visit/PatientVisitList.xhtml
Normal file
@@ -0,0 +1,107 @@
|
||||
<?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="frmPatientVisitList">
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<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-2">
|
||||
<p:outputLabel for="fecha" value="Ver agenda del día:" />
|
||||
</div>
|
||||
<div class="ui-g-3">
|
||||
<div class="ui-inputgroup">
|
||||
<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" />
|
||||
<p:ajax event="dateSelect" listener="#{PatientVisitList.showData}" update="frmPatientVisitList" />
|
||||
</p:datePicker>
|
||||
<p:commandButton value="Mostrar" update="frmPatientVisitList" action="#{PatientVisitList.showData}" icon="fa calendar-alt" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-g-1" />
|
||||
<div class="ui-g-2">Paciente:</div>
|
||||
<div class="ui-g-4">
|
||||
<h:outputText rendered="#{not PatientVisitList.admin}" value="#{PatientVisitList.patient.displayName}" style="font-weight: bold;" />
|
||||
<p:autoComplete rendered="#{PatientVisitList.admin}" id="filterPatient" dropdown="true" value="#{PatientVisitList.patient}"
|
||||
completeMethod="#{PatientVisitList.completePatient}" var="p" itemLabel="#{p.displayName}" itemValue="#{p}" forceSelection="true"
|
||||
placeholder="Seleccione un paciente o teclee para buscar...">
|
||||
<o:converter converterId="omnifaces.ListConverter" list="#{PatientVisitList.patientList}" />
|
||||
<p:column headerText="Num. Prof.">
|
||||
<h:outputText value="#{p.personalIdentificationCode}" />
|
||||
</p:column>
|
||||
<p:column headerText="Nombre">
|
||||
<h:outputText value="#{p.name}" />
|
||||
</p:column>
|
||||
<p:column headerText="Apellidos">
|
||||
<h:outputText value="#{p.surname}" />
|
||||
</p:column>
|
||||
<p:ajax event="itemSelect" listener="#{PatientVisitList.showData}" update="frmPatientVisitList" />
|
||||
</p:autoComplete>
|
||||
</div>
|
||||
|
||||
<p:dataTable id="dtPatientVisitList" widgetVar="dtPatientVisitList" var="v" value="#{PatientVisitList.lazyDataModelVisitList}" 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"
|
||||
emptyMessage="No existen datos para los filtros seleccionados.">
|
||||
|
||||
<p:column headerText="Fecha" width="90">
|
||||
<h:outputText value="#{v.date}">
|
||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
||||
</h:outputText>
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Hora" width="60">
|
||||
<h:outputText value="#{v.time}">
|
||||
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||
</h:outputText>
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Paciente" width="auto">
|
||||
<h:outputText value="#{v.patient.displayName}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Observaciones" width="auto">
|
||||
<h:outputText value="#{v.observations}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Resultado" width="auto">
|
||||
<h:outputText value="#{v.result}" />
|
||||
</p:column>
|
||||
|
||||
<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:confirm header="Eliminar" message="¿Está seguro de que quiere eliminar la visita?" icon="pi pi-exclamation-triangle" />
|
||||
</p:commandButton>
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Editar" width="100">
|
||||
<p:commandButton value="Editar" action="#{PatientVisitList.editVisit(v.id)}" update="frmPatientVisitList" icon="pi pi-pencil" />
|
||||
</p:column>
|
||||
|
||||
<f:facet name="paginatorBottomLeft">
|
||||
<p:commandButton update="dtPatientVisitList" action="#{PatientVisitList.showData}" icon="pi pi-refresh" />
|
||||
</f:facet>
|
||||
</p:dataTable>
|
||||
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-5" />
|
||||
<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-5" />
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
101
1.sources/MyHealth/docroot/visit/UpdateVisit.xhtml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?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">
|
||||
|
||||
<f:viewParam name="id" value="#{UpdateVisit.id}" required="true" />
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="visitForm">
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="panelVisit" header="Actualizar detalles de la visita">
|
||||
<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">
|
||||
<p:outputLabel for="paciente" value="Paciente:" />
|
||||
</div>
|
||||
<div class="ui-g-4">
|
||||
<p:inputText id="paciente" value="#{UpdateVisit.patient.displayName}" readonly="true" />
|
||||
</div>
|
||||
<div class="ui-g-6">
|
||||
<p:message for="paciente" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="medico" value="Médico de familia:" />
|
||||
</div>
|
||||
<div class="ui-g-4">
|
||||
<p:inputText id="medico" value="#{UpdateVisit.familyDoctor.displayName}" readonly="true" />
|
||||
</div>
|
||||
<div class="ui-g-6">
|
||||
<p:message for="medico" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="fecha" value="Fecha:" />
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<div class="ui-inputgroup">
|
||||
<p:datePicker id="fecha" value="#{UpdateVisit.date}" pattern="dd/MM/yyyy" locale="es" disabled="#{UpdateVisit.readOnly}" showIcon="true" showButtonBar="true"
|
||||
autocomplete="true" required="true" requiredMessage="Especifique la fecha de la visita." readonly="#{UpdateVisit.readOnly}">
|
||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" timeStyle="short" />
|
||||
</p:datePicker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-g-8">
|
||||
<p:message for="fecha" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="hora" value="Hora:" />
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<p:datePicker id="hora" value="#{UpdateVisit.time}" timeOnly="true" pattern="HH:mm" locale="es" disabled="#{UpdateVisit.readOnly}" showIcon="true" showButtonBar="true"
|
||||
autocomplete="true" required="true" requiredMessage="Especifique la hora de la visita." readonly="#{UpdateVisit.readOnly}">
|
||||
<f:convertDateTime type="localTime" pattern="HH:mm" timeStyle="Short" />
|
||||
</p:datePicker>
|
||||
</div>
|
||||
<div class="ui-g-8">
|
||||
<p:message for="hora" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="observaciones" value="Observaciones:" />
|
||||
</div>
|
||||
<div class="ui-g-8">
|
||||
<p:inputTextarea id="observaciones" value="#{UpdateVisit.observations}" readonly="true" />
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<p:message for="observaciones" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="resultado" value="Resultado:" />
|
||||
</div>
|
||||
<div class="ui-g-8">
|
||||
<p:inputTextarea id="resultado" value="#{UpdateVisit.result}" readonly="#{UpdateVisit.resultReadOnly}" />
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<p:message for="resultado" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="visitForm" action="#{UpdateVisit.saveData}" icon="pi pi-check" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="#{UpdateVisit.fromPage}" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
87
1.sources/MyHealth/docroot/visit/VisitList.xhtml
Normal file
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="frmVisitList">
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="panelAngenda" header="Consultar agenda del día">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="fecha" value="Ver agenda del día:" />
|
||||
</div>
|
||||
<div class="ui-g-3">
|
||||
<div class="ui-inputgroup">
|
||||
<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.">
|
||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
||||
<p:ajax event="dateSelect" listener="#{VisitList.showData}" update="frmVisitList" />
|
||||
</p:datePicker>
|
||||
<p:commandButton value="Mostrar" update="frmVisitList" action="#{VisitList.showData}" icon="fa calendar-alt" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-g-2" />
|
||||
<div class="ui-g-5">
|
||||
Médico de familia:
|
||||
<h:outputText value="#{VisitList.familyDoctorDisplayName}" style="font-weight: bold;" />
|
||||
</div>
|
||||
|
||||
<p:dataTable id="dtVisitList" widgetVar="dtVisitList" var="v" value="#{VisitList.lazyDataModelVisitList}" 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"
|
||||
emptyMessage="No existen datos para los filtros seleccionados.">
|
||||
|
||||
<p:column headerText="Fecha" width="90">
|
||||
<h:outputText value="#{v.date}">
|
||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
||||
</h:outputText>
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Hora" width="60">
|
||||
<h:outputText value="#{v.time}">
|
||||
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||
</h:outputText>
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Paciente" width="auto">
|
||||
<h:outputText value="#{v.patient.displayName}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Observaciones" width="auto">
|
||||
<h:outputText value="#{v.observations}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Resultado" width="auto">
|
||||
<h:outputText value="#{v.result}" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Ver" width="80px;">
|
||||
<p:commandButton value="Ver" action="#{VisitList.showVisit(v.id)}" icon="pi pi-check" />
|
||||
</p:column>
|
||||
|
||||
<p:column headerText="Editar" width="100px;">
|
||||
<p:commandButton value="Editar" action="#{VisitList.editVisit(v.id)}" icon="pi pi-check" />
|
||||
</p:column>
|
||||
|
||||
<f:facet name="paginatorBottomLeft">
|
||||
<p:commandButton update="dtVisitList" action="#{VisitList.showData}" icon="pi pi-refresh" />
|
||||
</f:facet>
|
||||
</p:dataTable>
|
||||
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-5" />
|
||||
<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-5" />
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
@@ -2,52 +2,91 @@
|
||||
<!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:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
||||
|
||||
<f:viewParam name="id" value="#{VisitView.id}" required="true" />
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="TestForm">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="PanelUnderConstruction" header="Pagina en construcción de Visitas">
|
||||
<h:form id="visitForm">
|
||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
<p:panel id="panelVisit" header="Detalles de la visita">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo" value="Etiqueta para campo de formulario:" />
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="paciente" value="Paciente:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo" value="Valor del campo del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
<div class="ui-g-8">
|
||||
<p:inputText id="paciente" value="#{VisitView.patient.displayName}" readonly="true" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
<div class="ui-g-2">
|
||||
<p:message for="paciente" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo2" value="Etiqueta para campo 2 de formulario:" />
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="medico" value="Médico de familia:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo2" value="Valor del campo 2 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
<div class="ui-g-8">
|
||||
<p:inputText id="medico" value="#{VisitView.familyDoctor.displayName}" readonly="true" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
<div class="ui-g-2">
|
||||
<p:message for="medico" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:outputLabel for="campo3" value="Etiqueta para campo 3 de formulario:" />
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="fecha" value="Fecha:" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="campo3" value="Valor del campo 3 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||
<div class="ui-g-2">
|
||||
<div class="ui-inputgroup">
|
||||
<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.">
|
||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" />
|
||||
</p:datePicker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:message for="campo" display="text" />
|
||||
<div class="ui-g-8">
|
||||
<p:message for="fecha" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="hora" value="Hora:" />
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<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.">
|
||||
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||
</p:datePicker>
|
||||
</div>
|
||||
<div class="ui-g-8">
|
||||
<p:message for="hora" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="observaciones" value="Observaciones:" />
|
||||
</div>
|
||||
<div class="ui-g-8">
|
||||
<p:inputTextarea id="observaciones" value="#{VisitView.observations}" readonly="true" />
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<p:message for="observaciones" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel for="resultado" value="Resultado:" />
|
||||
</div>
|
||||
<div class="ui-g-8">
|
||||
<p:inputTextarea id="resultado" value="#{VisitView.result}" readonly="true" />
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<p:message for="resultado" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12 ui-g-nopad">
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-2 ui-md-2 ">
|
||||
<p:commandButton validateClient="true" value="Guardar" update="TestForm" action="#{BeanName.actionMethod}" icon="pi pi-check" />
|
||||
<p:commandButton value="Editar" action="#{VisitView.editVisit(VisitView.id)}" icon="pi pi-time" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
<p:button value="Volver" outcome="#{VisitView.fromPage}" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
|
||||
13
1.sources/MyHealth/ecosystem.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"apps" : [{
|
||||
"name": "ANT",
|
||||
"script": "start.sh",
|
||||
"cwd": "./",
|
||||
"ignore_watch": ["*.ear", "*.jar", "*.war", "./build/*", "./dist/*", "ecosystem.json"],
|
||||
"watch": true
|
||||
},{
|
||||
"name": "Widlfly",
|
||||
"script": "standalone.sh",
|
||||
"cwd": "/opt/wildfly/bin/"
|
||||
}]
|
||||
}
|
||||
@@ -18,20 +18,21 @@ public class LoggedUserTO implements Serializable {
|
||||
private String id;
|
||||
private String password;
|
||||
private String name;
|
||||
private String displayName;
|
||||
private UserType userType;
|
||||
|
||||
public LoggedUserTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
public LoggedUserTO(String usrId, String usrName, String usrPwd, UserType usrType) {
|
||||
|
||||
public LoggedUserTO(String usrId, String usrName, String usrPwd, UserType usrType, String dispName) {
|
||||
id = usrId;
|
||||
name = usrName;
|
||||
password = usrPwd;
|
||||
userType = usrType;
|
||||
|
||||
displayName = dispName;
|
||||
}
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -64,4 +65,12 @@ public class LoggedUserTO implements Serializable {
|
||||
this.userType = value;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package TO;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import common.MedicalTestType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Roberto Orden Erena <rorden@uoc.edu>
|
||||
@@ -16,19 +19,24 @@ public class MedicalTestTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int id;
|
||||
private Date date;
|
||||
private long time;
|
||||
private LocalDate date;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String highresimage;
|
||||
private MedicalTestType type;
|
||||
private PatientTO patient;
|
||||
private SpecialistDoctorTO specialistDoctor;
|
||||
|
||||
public static enum MedicalTestType {
|
||||
BLOD_TEST, MAGNETIC_RESONANCE, TAC
|
||||
}
|
||||
|
||||
public MedicalTestTO(int id, Date date, int time, String observations, String highresimage, MedicalTestType type,
|
||||
|
||||
public MedicalTestTO() {
|
||||
super();
|
||||
this.date = LocalDate.now();
|
||||
this.time = LocalTime.now();
|
||||
this.patient = new PatientTO();
|
||||
this.specialistDoctor = new SpecialistDoctorTO();
|
||||
}
|
||||
|
||||
public MedicalTestTO(int id, LocalDate date, LocalTime time, String observations, String highresimage, MedicalTestType type,
|
||||
PatientTO patiend, SpecialistDoctorTO specialistDoctor) {
|
||||
this.setId(id);
|
||||
this.setDate(date);
|
||||
@@ -48,19 +56,19 @@ public class MedicalTestTO implements Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
public LocalTime getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(long time) {
|
||||
public void setTime(LocalTime time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@@ -103,5 +111,9 @@ public class MedicalTestTO implements Serializable {
|
||||
public void setSpecialistDoctor(SpecialistDoctorTO specialistDoctor) {
|
||||
this.specialistDoctor = specialistDoctor;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Integer.toString(this.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ public class QuestionTO implements Serializable {
|
||||
|
||||
public QuestionTO() {
|
||||
super();
|
||||
this.patient = new PatientTO();
|
||||
this.fdoctor = new FamilyDoctorTO();
|
||||
}
|
||||
|
||||
public QuestionTO(int id, String title, String message, QuestionStatus status, PatientTO patient,
|
||||
@@ -96,5 +98,21 @@ public class QuestionTO implements Serializable {
|
||||
public void setResponse(String response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "{"
|
||||
+ "ObjectID" + super.toString()
|
||||
+ ",id" + this.getId()
|
||||
+ ",title" + this.getTitle()
|
||||
+ ",message" + this.getMessage()
|
||||
+ ",response" + this.getResponse()
|
||||
+ ",status" + this.getStatus()
|
||||
+ ",patient-id" + this.getPatient().getId()
|
||||
+ ",patient-name-surname" + this.getPatient().getName() + " " + this.getPatient().getSurname()
|
||||
+ ",fdoctor-id" + this.getDoctor().getId()
|
||||
+ ",fdoctor-name-surname" + this.getDoctor().getName() + " " + this.getDoctor().getSurname()
|
||||
+ "}";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
*
|
||||
* 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")
|
||||
* = "medicalspecialty")
|
||||
*
|
||||
* @author mark
|
||||
*
|
||||
@@ -19,11 +19,33 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
public class SystemAdminTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String email;
|
||||
private String password;
|
||||
|
||||
public SystemAdminTO() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,31 +1,26 @@
|
||||
package TO;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
|
||||
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
|
||||
*
|
||||
*/
|
||||
@XmlRootElement(name = "Visit")
|
||||
public class VisitTO implements Serializable {
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Integer id;
|
||||
private Date date;
|
||||
private Time time;
|
||||
private LocalDate date;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String result;
|
||||
private FamilyDoctorTO familyDoctor;
|
||||
@@ -34,42 +29,71 @@ public class VisitTO implements Serializable {
|
||||
public VisitTO() {
|
||||
super();
|
||||
}
|
||||
public VisitTO(Integer id, Date date, Time time, String observation, String result) {
|
||||
this.setId(id);
|
||||
this.date=date;
|
||||
//this.time
|
||||
|
||||
public VisitTO(Integer Id, LocalDate date, LocalTime time, String observations, String result, FamilyDoctorTO fd, PatientTO pat) {
|
||||
this.id = Id;
|
||||
this.date = date;
|
||||
this.time = time;
|
||||
this.observations = observations;
|
||||
this.result = result;
|
||||
this.familyDoctor = fd;
|
||||
this.patient = pat;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id=id;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
|
||||
public LocalDate getDate() {
|
||||
return this.date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date=date;
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Time getTime() {
|
||||
|
||||
public LocalTime getTime() {
|
||||
return this.time;
|
||||
}
|
||||
|
||||
public void setTime(Time time) {
|
||||
this.time=time;
|
||||
|
||||
public void setTime(LocalTime time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
|
||||
public String getObservations() {
|
||||
return this.observations;
|
||||
}
|
||||
|
||||
|
||||
public void setObservations(String observations) {
|
||||
this.observations=observations;
|
||||
this.observations = observations;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public FamilyDoctorTO getFamilyDoctor() {
|
||||
return familyDoctor;
|
||||
}
|
||||
|
||||
public void setFamilyDoctor(FamilyDoctorTO familyDoctor) {
|
||||
this.familyDoctor = familyDoctor;
|
||||
}
|
||||
|
||||
public PatientTO getPatient() {
|
||||
return patient;
|
||||
}
|
||||
|
||||
public void setPatient(PatientTO patient) {
|
||||
this.patient = patient;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package common;
|
||||
*
|
||||
*/
|
||||
public class Constants {
|
||||
public static final int MAX_ITEMS_AUTOCOMPLETE_SEARCH = 200;
|
||||
public static final int MAX_ITEMS_AUTOCOMPLETE_SEARCH = 20;
|
||||
public static final String PROFESSIONAL_NUMBER_PREFIX = "PRO#";
|
||||
public static final String PERSONAL_IDENTIFICATION_CODE_PREFIX = "PAT#";
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package common;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
@@ -18,8 +19,8 @@ public class HashUtils {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(stringValue.getBytes());
|
||||
digest = md.digest();
|
||||
} catch (Exception ex) {
|
||||
// TODO: Register exception to log.
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return (DatatypeConverter.printHexBinary(digest).toUpperCase());
|
||||
|
||||
@@ -5,12 +5,12 @@ package common;
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
public enum TestType {
|
||||
public enum MedicalTestType {
|
||||
MAGNETIC_RESONANCE_IMAGING("Imagen por Resonancia Magnética"), CT_SCAN("Tomografía Áxial Computerizada"), BLOOD_TEST("Análisis de sangre");
|
||||
|
||||
private String testTypeName;
|
||||
|
||||
private TestType(String typeName) {
|
||||
private MedicalTestType(String typeName) {
|
||||
this.testTypeName = typeName;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package common;
|
||||
*
|
||||
*/
|
||||
public enum QuestionStatus {
|
||||
ANSWERED("Respondida"), PENDING("Pendiente");
|
||||
ANSWERED("Respondida"), PENDING("Pendiente"), NEW("New");
|
||||
|
||||
private String questionStatusName;
|
||||
|
||||
|
||||
@@ -10,17 +10,23 @@ import javax.persistence.TypedQuery;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.MedicalTestTO;
|
||||
import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.QuestionTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import TO.SystemAdminTO;
|
||||
import TO.VisitTO;
|
||||
import common.Utils;
|
||||
import jpa.FamilyDoctorJPA;
|
||||
import jpa.MedicalSpecialtyJPA;
|
||||
import jpa.MedicalTestJPA;
|
||||
import jpa.PatientJPA;
|
||||
import jpa.PrimaryHealthCareCenterJPA;
|
||||
import jpa.QuestionJPA;
|
||||
import jpa.SpecialistDoctorJPA;
|
||||
import jpa.SystemAdminJPA;
|
||||
import jpa.VisitJPA;
|
||||
|
||||
/***
|
||||
*
|
||||
@@ -34,38 +40,44 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
private EntityManager entman;
|
||||
|
||||
/**
|
||||
* Metodo que devuelve todas las especialidades medicas registradas en el sistema
|
||||
* Metodo que devuelve todas las especialidades medicas registradas en el
|
||||
* sistema
|
||||
*
|
||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
||||
*/
|
||||
public List<MedicalSpecialtyTO> listAllMedicalSpecialities() {
|
||||
return this.listMedicalSpecialitiesPaged(0, 0);
|
||||
public List<MedicalSpecialtyTO> listAllMedicalSpecialties() {
|
||||
return this.listMedicalSpecialtiesPaged(0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Metodo que devuelve las especialidades médicas de forma paginada
|
||||
*
|
||||
* Acepta como parametro la página (comenzando en 0) y el número de elementos de cada página.
|
||||
* Acepta como parametro la página (comenzando en 0) y el número de elementos de
|
||||
* cada página.
|
||||
*
|
||||
* si pageSize == 0, entonces se devuelven todas las especialidades registradas (Se ignora el parámetro).
|
||||
* si pageSize == 0, entonces se devuelven todas las especialidades registradas
|
||||
* (Se ignora el parámetro).
|
||||
*
|
||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
||||
*/
|
||||
public List<MedicalSpecialtyTO> listMedicalSpecialitiesPaged(int pageNumber, int pageSize) {
|
||||
return listMedicalSpecialitiesFiltered(null, pageNumber, pageSize);
|
||||
public List<MedicalSpecialtyTO> listMedicalSpecialtiesPaged(int pageNumber, int pageSize) {
|
||||
return listMedicalSpecialtiesFiltered(null, pageNumber, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que devuelve una lista de espcialidades médicas que tienen una coincidencia parcial en el nombre o en la descripción con el termino de búsqueda (searchTerm)
|
||||
* especificado.
|
||||
* Método que devuelve una lista de espcialidades médicas que tienen una
|
||||
* coincidencia parcial en el nombre o en la descripción con el termino de
|
||||
* búsqueda (searchTerm) especificado.
|
||||
*
|
||||
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
||||
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza
|
||||
* paginación y se devuelven todos los resultados.
|
||||
*
|
||||
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el parámetro y devuelven todas las especialidades existentes.
|
||||
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el
|
||||
* parámetro y devuelven todas las especialidades existentes.
|
||||
*
|
||||
* @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 strFilter = "";
|
||||
if (searchTerm == null)
|
||||
@@ -77,7 +89,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
strFilter = "WHERE lower(ms.name) LIKE :searchTerm OR lower(ms.description) LIKE :searchTerm";
|
||||
}
|
||||
|
||||
TypedQuery<MedicalSpecialtyJPA> query = entman.createQuery(String.format(strQuery, strFilter), MedicalSpecialtyJPA.class);
|
||||
TypedQuery<MedicalSpecialtyJPA> query = entman.createQuery(String.format(strQuery, strFilter),
|
||||
MedicalSpecialtyJPA.class);
|
||||
|
||||
if (searchTerm.length() > 0)
|
||||
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
||||
@@ -107,9 +120,11 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que devuelve una lista de CAPs (Centros de Atención Primarios) de forma paginada
|
||||
* Método que devuelve una lista de CAPs (Centros de Atención Primarios) de
|
||||
* forma paginada
|
||||
*
|
||||
* Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
||||
* Si pageSize == 0 no se realiza paginación y se devuelven todos los
|
||||
* resultados.
|
||||
*
|
||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
||||
*/
|
||||
@@ -118,12 +133,15 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que devuelve una lista de CAPs (Centros de Atención Primarios) que tienen una coincidencia parcial en el nombre o en la localización con el termino de búsqueda
|
||||
* (searchTerm) especificado.
|
||||
* Método que devuelve una lista de CAPs (Centros de Atención Primarios) que
|
||||
* tienen una coincidencia parcial en el nombre o en la localización con el
|
||||
* termino de búsqueda (searchTerm) especificado.
|
||||
*
|
||||
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
||||
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza
|
||||
* paginación y se devuelven todos los resultados.
|
||||
*
|
||||
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el parámetro y devuelven todos los CAPs existentes.
|
||||
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el
|
||||
* parámetro y devuelven todos los CAPs existentes.
|
||||
*
|
||||
* @return Devuelve una Lista de PrimaryHealthCareCenterTO (Transfer Objects).
|
||||
*/
|
||||
@@ -139,7 +157,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
strFilter = "WHERE lower(phc.name) LIKE :searchTerm OR lower(phc.location) LIKE :searchTerm";
|
||||
}
|
||||
|
||||
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery(String.format(strQuery, strFilter), PrimaryHealthCareCenterJPA.class);
|
||||
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery(String.format(strQuery, strFilter),
|
||||
PrimaryHealthCareCenterJPA.class);
|
||||
|
||||
if (searchTerm.length() > 0)
|
||||
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
||||
@@ -160,7 +179,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que devuelve una lista con todos los médicos de familia registrados en el sistema.
|
||||
* Método que devuelve una lista con todos los médicos de familia registrados en
|
||||
* el sistema.
|
||||
*
|
||||
* @return Devuelve una Lista de FamilyDoctorTO (Transfer Objects).
|
||||
*/
|
||||
@@ -169,9 +189,11 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que devuelve una lista con todos los médicos de familia registrados en el sistema de forma paginada.
|
||||
* Método que devuelve una lista con todos los médicos de familia registrados en
|
||||
* el sistema de forma paginada.
|
||||
*
|
||||
* Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
||||
* Si pageSize == 0 no se realiza paginación y se devuelven todos los
|
||||
* resultados.
|
||||
*
|
||||
* @return Devuelve una Lista de FamilyDoctorTO (Transfer Objects).
|
||||
*/
|
||||
@@ -180,11 +202,15 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que devuelve una lista de médicos de familia que tienen una coincidencia parcial en el nombre o en los apellidos con el termino de búsqueda (searchTerm) especificado.
|
||||
* Método que devuelve una lista de médicos de familia que tienen una
|
||||
* coincidencia parcial en el nombre o en los apellidos con el termino de
|
||||
* búsqueda (searchTerm) especificado.
|
||||
*
|
||||
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
||||
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza
|
||||
* paginación y se devuelven todos los resultados.
|
||||
*
|
||||
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el parámetro y devuelven todos los registros existentes.
|
||||
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el
|
||||
* parámetro y devuelven todos los registros existentes.
|
||||
*
|
||||
* @return Devuelve una Lista de FamilyDoctorTO (Transfer Objects).
|
||||
*/
|
||||
@@ -200,7 +226,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
strFilter = "WHERE lower(fd.name) LIKE :searchTerm OR lower(fd.surname) LIKE :searchTerm";
|
||||
}
|
||||
|
||||
TypedQuery<FamilyDoctorJPA> query = entman.createQuery(String.format(strQuery, strFilter), FamilyDoctorJPA.class);
|
||||
TypedQuery<FamilyDoctorJPA> query = entman.createQuery(String.format(strQuery, strFilter),
|
||||
FamilyDoctorJPA.class);
|
||||
|
||||
if (searchTerm.length() > 0)
|
||||
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
||||
@@ -219,9 +246,62 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
|
||||
return allFDTOs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que devuelve una lista con todos los pacientes registrados en el sistema de forma paginada.
|
||||
*
|
||||
* Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
||||
*
|
||||
* @return Devuelve una Lista de PatientTO (Transfer Objects).
|
||||
*/
|
||||
public List<PatientTO> listPatientsPaged(int pageNumber, int pageSize) {
|
||||
return this.listPatientsFiltered(null, pageNumber, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que devuelve una lista de pacientes que tienen una coincidencia parcial en el nombre o en los apellidos con el termino de búsqueda (searchTerm) especificado.
|
||||
*
|
||||
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
||||
*
|
||||
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el parámetro y devuelven todos los registros existentes.
|
||||
*
|
||||
* @return Devuelve una Lista de PatientTO (Transfer Objects).
|
||||
*/
|
||||
public List<PatientTO> listPatientsFiltered(String searchTerm, int pageNumber, int pageSize) {
|
||||
String strQuery = "SELECT p FROM PatientJPA p %s order by p.name, p.surname";
|
||||
String strFilter = "";
|
||||
if (searchTerm == null)
|
||||
searchTerm = "";
|
||||
else
|
||||
searchTerm = Utils.normalizeTerm(searchTerm);
|
||||
|
||||
if (searchTerm.length() > 0) {
|
||||
strFilter = "WHERE lower(p.name) LIKE :searchTerm OR lower(p.surname) LIKE :searchTerm";
|
||||
}
|
||||
|
||||
TypedQuery<PatientJPA> query = entman.createQuery(String.format(strQuery, strFilter), PatientJPA.class);
|
||||
|
||||
if (searchTerm.length() > 0)
|
||||
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
List<PatientJPA> allPAsJPA = query.getResultList();
|
||||
List<PatientTO> allPATOs = new ArrayList<PatientTO>();
|
||||
|
||||
for (PatientJPA item : allPAsJPA) {
|
||||
allPATOs.add(this.getPOJOforPatientJPA(item, 0));
|
||||
}
|
||||
|
||||
return allPATOs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que convierte un objecto de tipo MedicalSpecialtyJPA (JPA) a su equivalente MedicalSpecialtyTO (Tranfer Object)
|
||||
* Método que convierte un objecto de tipo MedicalSpecialtyJPA (JPA) a su
|
||||
* equivalente MedicalSpecialtyTO (Tranfer Object)
|
||||
*
|
||||
* @return MedicalSpecialtyTO (Transfer Object de una especialidad médica)
|
||||
*/
|
||||
@@ -236,7 +316,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que convierte un objecto de tipo PrimaryHealthCareCenterJPA (JPA) a su equivalente PrimaryHealthCareCenterTO (Tranfer Object)
|
||||
* Método que convierte un objecto de tipo PrimaryHealthCareCenterJPA (JPA) a su
|
||||
* equivalente PrimaryHealthCareCenterTO (Tranfer Object)
|
||||
*
|
||||
* @return PrimaryHealthCareCenterTO (Transfer Object de un CAP)
|
||||
*/
|
||||
@@ -251,10 +332,14 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que convierte un objecto de tipo SpecialistDoctorJPA (JPA) a su equivalente SpecialistDoctorTO (Tranfer Object)
|
||||
* Método que convierte un objecto de tipo SpecialistDoctorJPA (JPA) a su
|
||||
* equivalente SpecialistDoctorTO (Tranfer Object)
|
||||
*
|
||||
* El parámetro nestedProps es un valor entero que indica a que nivel de profundidad se debe navegar a través de las propiedades relacionadas para convertirlas de JPA a TO. Un
|
||||
* valor 0 indica que no se convertirá ninguna propiedad que tenga un entidad JPA relacionada (tendrá valor null en el objeto TO).
|
||||
* El parámetro nestedProps es un valor entero que indica a que nivel de
|
||||
* profundidad se debe navegar a través de las propiedades relacionadas para
|
||||
* convertirlas de JPA a TO. Un valor 0 indica que no se convertirá ninguna
|
||||
* propiedad que tenga un entidad JPA relacionada (tendrá valor null en el
|
||||
* objeto TO).
|
||||
*
|
||||
* @return SpecialistDoctorTO (Transfer Object de un médico especialista)
|
||||
*/
|
||||
@@ -267,18 +352,22 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
ms = sd.getMedicalSpecialty();
|
||||
|
||||
nestedProps--;
|
||||
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(),
|
||||
this.getPOJOforMedicalSpecialtyJPA(ms));
|
||||
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(),
|
||||
sd.getSurname(), sd.getPassword(), sd.getEmail(), this.getPOJOforMedicalSpecialtyJPA(ms));
|
||||
}
|
||||
|
||||
return sdTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que convierte un objecto de tipo FamilyDoctorJPA (JPA) a su equivalente FamilyDoctorTO (Tranfer Object)
|
||||
* Método que convierte un objecto de tipo FamilyDoctorJPA (JPA) a su
|
||||
* equivalente FamilyDoctorTO (Tranfer Object)
|
||||
*
|
||||
* El parámetro nestedProps es un valor entero que indica a que nivel de profundidad se debe navegar a través de las propiedades relacionadas para convertirlas de JPA a TO. Un
|
||||
* valor 0 indica que no se convertirá ninguna propiedad que tenga un entidad JPA relacionada (tendrá valor null en el objeto TO).
|
||||
* El parámetro nestedProps es un valor entero que indica a que nivel de
|
||||
* profundidad se debe navegar a través de las propiedades relacionadas para
|
||||
* convertirlas de JPA a TO. Un valor 0 indica que no se convertirá ninguna
|
||||
* propiedad que tenga un entidad JPA relacionada (tendrá valor null en el
|
||||
* objeto TO).
|
||||
*
|
||||
* @return FamilyDoctorTO (Transfer Object de un médico especialista)
|
||||
*/
|
||||
@@ -291,18 +380,22 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
phc = fd.getPrimaryHealthCareCenter();
|
||||
|
||||
nestedProps--;
|
||||
fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(),
|
||||
this.getPOJOforPrimaryHealthCareCenterJPA(phc));
|
||||
fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(),
|
||||
fd.getSurname(), fd.getPassword(), fd.getEmail(), this.getPOJOforPrimaryHealthCareCenterJPA(phc));
|
||||
}
|
||||
|
||||
return fdTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que convierte un objecto de tipo PatientJPA (JPA) a su equivalente PatientTO (Tranfer Object)
|
||||
* Método que convierte un objecto de tipo PatientJPA (JPA) a su equivalente
|
||||
* PatientTO (Tranfer Object)
|
||||
*
|
||||
* El parámetro nestedProps es un valor entero que indica a que nivel de profundidad se debe navegar a través de las propiedades relacionadas para convertirlas de JPA a TO. Un
|
||||
* valor 0 indica que no se convertirá ninguna propiedad que tenga un entidad JPA relacionada (tendrá valor null en el objeto TO).
|
||||
* El parámetro nestedProps es un valor entero que indica a que nivel de
|
||||
* profundidad se debe navegar a través de las propiedades relacionadas para
|
||||
* convertirlas de JPA a TO. Un valor 0 indica que no se convertirá ninguna
|
||||
* propiedad que tenga un entidad JPA relacionada (tendrá valor null en el
|
||||
* objeto TO).
|
||||
*
|
||||
* @return PatientTO (Transfer Object de un médico especialista)
|
||||
*/
|
||||
@@ -315,7 +408,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
fd = pat.getFamilyDoctor();
|
||||
|
||||
nestedProps--;
|
||||
paTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(),
|
||||
paTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(),
|
||||
pat.getSurname(), pat.getPassword(), pat.getEmail(),
|
||||
this.getPOJOforFamilyDoctorJPA(fd, nestedProps));
|
||||
}
|
||||
|
||||
@@ -323,9 +417,11 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que recupera un paciente a partir de su Identificador (Id) de base de datos.
|
||||
* Método que recupera un paciente a partir de su Identificador (Id) de base de
|
||||
* datos.
|
||||
*
|
||||
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
||||
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se
|
||||
* encuentra el objeto buscado
|
||||
*/
|
||||
public PatientTO findPatientById(int patientId) {
|
||||
// Recuperamos propiedades anidadas 1 nivel!
|
||||
@@ -333,12 +429,15 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que recupera un paciente a partir de su CIP (Código de Identificación de Paciente)
|
||||
* Método que recupera un paciente a partir de su CIP (Código de Identificación
|
||||
* de Paciente)
|
||||
*
|
||||
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
||||
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se
|
||||
* encuentra el objeto buscado
|
||||
*/
|
||||
public PatientTO findPatientByCode(String code) {
|
||||
TypedQuery<PatientJPA> query = entman.createQuery("from PatientJPA pat where pat.personalIdentificationCode=:code", PatientJPA.class);
|
||||
TypedQuery<PatientJPA> query = entman
|
||||
.createQuery("from PatientJPA pat where pat.personalIdentificationCode=:code", PatientJPA.class);
|
||||
query.setMaxResults(1);
|
||||
query.setParameter("code", code);
|
||||
|
||||
@@ -352,7 +451,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
/**
|
||||
* Método que recupera un paciente a partir de su NIF
|
||||
*
|
||||
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
||||
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se
|
||||
* encuentra el objeto buscado
|
||||
*/
|
||||
public PatientTO findPatientByNif(String searchedNIF) {
|
||||
TypedQuery<PatientJPA> query = entman.createQuery("from PatientJPA pat where pat.nif=:nif", PatientJPA.class);
|
||||
@@ -367,21 +467,26 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que recupera un médico de familia a partir de su Identificador (Id) de base de datos.
|
||||
* Método que recupera un médico de familia a partir de su Identificador (Id) de
|
||||
* base de datos.
|
||||
*
|
||||
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
||||
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no
|
||||
* se encuentra el objeto buscado
|
||||
*/
|
||||
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId) {
|
||||
return this.getPOJOforFamilyDoctorJPA(entman.find(FamilyDoctorJPA.class, ProfessionalNumberId), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que recupera un médico de familia a partir de su NP (Número de profesional)
|
||||
* Método que recupera un médico de familia a partir de su NP (Número de
|
||||
* profesional)
|
||||
*
|
||||
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
||||
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no
|
||||
* se encuentra el objeto buscado
|
||||
*/
|
||||
public FamilyDoctorTO findFamilyDoctorByCode(String code) {
|
||||
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.professionalNumber=:code", FamilyDoctorJPA.class);
|
||||
TypedQuery<FamilyDoctorJPA> query = entman
|
||||
.createQuery("from FamilyDoctorJPA d where d.professionalNumber=:code", FamilyDoctorJPA.class);
|
||||
|
||||
query.setParameter("code", code);
|
||||
|
||||
@@ -395,10 +500,12 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
/**
|
||||
* Método que recupera un médico de familia a partir de su NIF
|
||||
*
|
||||
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
||||
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no
|
||||
* se encuentra el objeto buscado
|
||||
*/
|
||||
public FamilyDoctorTO findFamilyDoctorByNif(String searchedNIF) {
|
||||
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.nif=:nif", FamilyDoctorJPA.class);
|
||||
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.nif=:nif",
|
||||
FamilyDoctorJPA.class);
|
||||
query.setMaxResults(1);
|
||||
query.setParameter("nif", searchedNIF);
|
||||
|
||||
@@ -410,21 +517,26 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que recupera un médico especialista a partir de su Identificador (Id) de base de datos.
|
||||
* Método que recupera un médico especialista a partir de su Identificador (Id)
|
||||
* de base de datos.
|
||||
*
|
||||
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
||||
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si
|
||||
* no se encuentra el objeto buscado
|
||||
*/
|
||||
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId) {
|
||||
return this.getPOJOforSpecialistDoctorJPA(entman.find(SpecialistDoctorJPA.class, ProfessionalNumberId), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que recupera un médico especialista a partir de su NP (Número de profesional)
|
||||
* Método que recupera un médico especialista a partir de su NP (Número de
|
||||
* profesional)
|
||||
*
|
||||
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
||||
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si
|
||||
* no se encuentra el objeto buscado
|
||||
*/
|
||||
public SpecialistDoctorTO findSpecialistDoctorByCode(String code) {
|
||||
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.professionalNumber=:code", SpecialistDoctorJPA.class);
|
||||
TypedQuery<SpecialistDoctorJPA> query = entman
|
||||
.createQuery("from SpecialistDoctorJPA d where d.professionalNumber=:code", SpecialistDoctorJPA.class);
|
||||
|
||||
query.setParameter("code", code);
|
||||
|
||||
@@ -438,10 +550,11 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
/**
|
||||
* Método que recupera un médico especialista a partir de su NIF
|
||||
*
|
||||
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
||||
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si el objeto JPA es nulo
|
||||
*/
|
||||
public SpecialistDoctorTO findSpecialistDoctorByNif(String searchedNIF) {
|
||||
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.nif=:nif", SpecialistDoctorJPA.class);
|
||||
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.nif=:nif",
|
||||
SpecialistDoctorJPA.class);
|
||||
query.setMaxResults(1);
|
||||
query.setParameter("nif", searchedNIF);
|
||||
|
||||
@@ -453,12 +566,13 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que convierte un objecto de tipo QuestionJPA (JPA) a su equivalente QuestionTO (Tranfer Object)
|
||||
* Método que convierte un objecto de tipo QuestionJPA (JPA) a su equivalente
|
||||
* QuestionTO (Tranfer Object)
|
||||
*
|
||||
* El parámetro nestedProps es un valor entero que indica a que nivel de profundidad se debe navegar a través de las propiedades relacionadas para convertirlas de JPA a TO. Un
|
||||
* valor 0 indica que no se convertirá ninguna propiedad que tenga un entidad JPA relacionada (tendrá valor null en el objeto TO).
|
||||
*
|
||||
* @return QuestionTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
||||
* @return QuestionTO (Transfer Object del objeto recuperado) o null si el objeto JPA es nulo
|
||||
*/
|
||||
public QuestionTO getPOJOforQuestionJPA(QuestionJPA qs, int nestedProps) {
|
||||
QuestionTO qsTO = null;
|
||||
@@ -472,11 +586,68 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
}
|
||||
|
||||
nestedProps--;
|
||||
qsTO = new QuestionTO(qs.getId(), qs.getTitle(), qs.getMessage(), qs.getStatus(), this.getPOJOforPatientJPA(pat, nestedProps),
|
||||
this.getPOJOforFamilyDoctorJPA(fd, nestedProps), qs.getResponse());
|
||||
qsTO = new QuestionTO(qs.getId(), qs.getTitle(), qs.getMessage(), qs.getStatus(),
|
||||
this.getPOJOforPatientJPA(pat, nestedProps), this.getPOJOforFamilyDoctorJPA(fd, nestedProps),
|
||||
qs.getResponse());
|
||||
}
|
||||
|
||||
return qsTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que converite un objeto de tipo VisitJPA a su equivalente VisitTO (Transfer Object)
|
||||
*
|
||||
* El parámetro nestedProps es un valor entero que indica a que nivel de profundidad se debe navegar a través de las propiedades relacionadas para convertirlas de JPA a TO. Un
|
||||
* valor 0 indica que no se convertirá ninguna propiedad que tenga un entidad JPA relacionada (tendrá valor null en el objeto TO).
|
||||
*
|
||||
* @return VisitTO (Transfer Object del objeto recuperado) o null si el objeto JPA es nulo
|
||||
*/
|
||||
public VisitTO getPOJOforVisitJPA(VisitJPA vi, int nestedProps) {
|
||||
VisitTO qsTO = null;
|
||||
|
||||
if (vi != null) {
|
||||
FamilyDoctorJPA fd = null;
|
||||
PatientJPA pat = null;
|
||||
if (nestedProps > 0) {
|
||||
fd = vi.getFamilyDoctor();
|
||||
pat = vi.getPatient();
|
||||
}
|
||||
|
||||
nestedProps--;
|
||||
qsTO = new VisitTO(vi.getId(), vi.getDate(), vi.getTime(), vi.getObservations(), vi.getResult(),
|
||||
this.getPOJOforFamilyDoctorJPA(fd, nestedProps), this.getPOJOforPatientJPA(pat, nestedProps));
|
||||
}
|
||||
|
||||
return qsTO;
|
||||
}
|
||||
|
||||
public MedicalTestTO getPOJOforMedicalTestJPA(MedicalTestJPA mt, int nestedProps) {
|
||||
MedicalTestTO qsTO = null;
|
||||
|
||||
if (mt != null) {
|
||||
SpecialistDoctorJPA fd = null;
|
||||
PatientJPA pat = null;
|
||||
if (nestedProps > 0) {
|
||||
fd = mt.getSpecialistDoctor();
|
||||
pat = mt.getPatient();
|
||||
}
|
||||
|
||||
nestedProps--;
|
||||
qsTO = new MedicalTestTO(mt.getId(), mt.getDate(), mt.getTime(), mt.getObservations(), mt.getHighresimage(), mt.getType(),
|
||||
this.getPOJOforPatientJPA(pat, nestedProps), this.getPOJOforSpecialistDoctorJPA(fd, nestedProps));
|
||||
}
|
||||
|
||||
return qsTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemAdminTO getPOJOforSystemAdminJPA(SystemAdminJPA admin) {
|
||||
SystemAdminTO adminTO = null;
|
||||
|
||||
if (admin != null) {
|
||||
adminTO = new SystemAdminTO(admin.getEmail(), admin.getPassword());
|
||||
}
|
||||
|
||||
return adminTO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,16 +6,22 @@ import javax.ejb.Local;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.MedicalTestTO;
|
||||
import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.QuestionTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import TO.SystemAdminTO;
|
||||
import TO.VisitTO;
|
||||
import jpa.SystemAdminJPA;
|
||||
import jpa.FamilyDoctorJPA;
|
||||
import jpa.MedicalSpecialtyJPA;
|
||||
import jpa.MedicalTestJPA;
|
||||
import jpa.PatientJPA;
|
||||
import jpa.PrimaryHealthCareCenterJPA;
|
||||
import jpa.QuestionJPA;
|
||||
import jpa.SpecialistDoctorJPA;
|
||||
import jpa.VisitJPA;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -25,11 +31,11 @@ import jpa.SpecialistDoctorJPA;
|
||||
@Local
|
||||
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();
|
||||
|
||||
@@ -43,6 +49,10 @@ public interface CommonFacadeLocal {
|
||||
|
||||
public List<FamilyDoctorTO> listFamilyDoctorsFiltered(String searchTerm, int pageNumber, int pageSize);
|
||||
|
||||
public List<PatientTO> listPatientsPaged(int pageNumber, int pageSize);
|
||||
|
||||
public List<PatientTO> listPatientsFiltered(String searchTerm, int pageNumber, int pageSize);
|
||||
|
||||
public PatientTO findPatientById(int patientId);
|
||||
|
||||
public PatientTO findPatientByCode(String code);
|
||||
@@ -52,13 +62,13 @@ public interface CommonFacadeLocal {
|
||||
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId);
|
||||
|
||||
public FamilyDoctorTO findFamilyDoctorByCode(String code);
|
||||
|
||||
|
||||
public FamilyDoctorTO findFamilyDoctorByNif(String searchValue);
|
||||
|
||||
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId);
|
||||
|
||||
public SpecialistDoctorTO findSpecialistDoctorByCode(String code);
|
||||
|
||||
|
||||
public SpecialistDoctorTO findSpecialistDoctorByNif(String searchValue);
|
||||
|
||||
public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms);
|
||||
@@ -72,4 +82,10 @@ public interface CommonFacadeLocal {
|
||||
public PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps);
|
||||
|
||||
public QuestionTO getPOJOforQuestionJPA(QuestionJPA qs, int nestedProps);
|
||||
|
||||
public MedicalTestTO getPOJOforMedicalTestJPA(MedicalTestJPA mt, int nestedProps);
|
||||
|
||||
public VisitTO getPOJOforVisitJPA(VisitJPA qs, int nestedProps);
|
||||
|
||||
public SystemAdminTO getPOJOforSystemAdminJPA(SystemAdminJPA admin);
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@ import TO.SpecialistDoctorTO;
|
||||
@Remote
|
||||
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();
|
||||
|
||||
@@ -36,6 +36,10 @@ public interface CommonFacadeRemote {
|
||||
|
||||
public List<FamilyDoctorTO> listFamilyDoctorsFiltered(String searchTerm, int pageNumber, int pageSize);
|
||||
|
||||
public List<PatientTO> listPatientsPaged(int pageNumber, int pageSize);
|
||||
|
||||
public List<PatientTO> listPatientsFiltered(String searchTerm, int pageNumber, int pageSize);
|
||||
|
||||
public PatientTO findPatientById(int patientId);
|
||||
|
||||
public PatientTO findPatientByCode(String code);
|
||||
@@ -45,13 +49,13 @@ public interface CommonFacadeRemote {
|
||||
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId);
|
||||
|
||||
public FamilyDoctorTO findFamilyDoctorByCode(String code);
|
||||
|
||||
|
||||
public FamilyDoctorTO findFamilyDoctorByNif(String searchValue);
|
||||
|
||||
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId);
|
||||
|
||||
public SpecialistDoctorTO findSpecialistDoctorByCode(String code);
|
||||
|
||||
|
||||
public SpecialistDoctorTO findSpecialistDoctorByNif(String searchValue);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package ejb.medicalTest;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
@@ -10,25 +11,24 @@ import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
import TO.LoggedUserTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.MedicalTestTO.MedicalTestType;
|
||||
import TO.MedicalTestTO;
|
||||
import TO.PatientTO;
|
||||
import TO.QuestionTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import common.MedicalTestType;
|
||||
import common.QuestionStatus;
|
||||
import common.UserType;
|
||||
import common.Utils;
|
||||
import ejb.common.CommonFacadeLocal;
|
||||
import jpa.FamilyDoctorJPA;
|
||||
import jpa.MedicalTestJPA;
|
||||
import jpa.PatientJPA;
|
||||
import jpa.QuestionJPA;
|
||||
import managedbean.common.SessionUtils;
|
||||
import jpa.SpecialistDoctorJPA;
|
||||
|
||||
/**
|
||||
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los
|
||||
* métodos de la capa de negocio que implementan la logica de negocio y la
|
||||
* interacción con la capa de persistencia.
|
||||
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los métodos de la capa de negocio que implementan la logica de negocio y la interacción con la capa de
|
||||
* persistencia.
|
||||
*
|
||||
* Tanto los pacientes como los médicos deben acceder a la vista de pruebas
|
||||
* médicas.
|
||||
* Tanto los pacientes como los médicos deben acceder a la vista de pruebas médicas.
|
||||
*
|
||||
* @author rorden
|
||||
*
|
||||
@@ -52,18 +52,27 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
||||
* @param title
|
||||
* @param message
|
||||
*/
|
||||
@Override
|
||||
public void askQuestion(int professionalNumber, String title, String message) {
|
||||
if (SessionUtils.getUserType() == UserType.PATIENT) {
|
||||
LoggedUserTO user = SessionUtils.getloggedOnUser();
|
||||
// 0. Conseguir el paciente en sesión
|
||||
PatientJPA patient = entman.find(PatientJPA.class, user.getId());
|
||||
// 1. Buscar el médico de familia con ese professionalNumber
|
||||
FamilyDoctorJPA fdoctor = entman.find(FamilyDoctorJPA.class, professionalNumber);
|
||||
// 2. Crear un objeto de Question para ese médico desde el paciente en sesión
|
||||
QuestionJPA question = new QuestionJPA(0, title, message, QuestionStatus.PENDING, patient, fdoctor, null);
|
||||
// 3. Guardar
|
||||
entman.persist(question);
|
||||
public String askQuestion(int userId, String title, String message) {
|
||||
|
||||
PatientJPA pat = entman.find(PatientJPA.class, userId);
|
||||
|
||||
if (pat.getFamilyDoctor() != null) {
|
||||
|
||||
QuestionJPA qjpa = new QuestionJPA();
|
||||
qjpa.setId(0);
|
||||
qjpa.setTitle(title);
|
||||
qjpa.setMessage(message);
|
||||
qjpa.setStatus(QuestionStatus.PENDING);
|
||||
|
||||
qjpa.setPatient(pat);
|
||||
qjpa.setFamilyDoctor(pat.getFamilyDoctor());
|
||||
|
||||
entman.persist(qjpa);
|
||||
|
||||
return "ok";
|
||||
|
||||
} else {
|
||||
return "No tienes médico de familia elegido, por favor acude a la sección 'Gestionar Perfil' -> 'Cambiar médico de familia'";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,32 +82,23 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
||||
* @param question
|
||||
* @param response
|
||||
*/
|
||||
@Override
|
||||
public void answerQuestion(String question, String response) {
|
||||
public void answerQuestion(int questionId, String response) {
|
||||
QuestionJPA qjpa;
|
||||
qjpa = entman.find(QuestionJPA.class, questionId);
|
||||
qjpa.setResponse(response);
|
||||
qjpa.setStatus(QuestionStatus.ANSWERED);
|
||||
|
||||
entman.persist(qjpa);
|
||||
}
|
||||
|
||||
public List<QuestionTO> listAllPendingQuestions(int familyDoctorId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Long getPendingQuestionsCount(int familyDoctorId) {
|
||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from QuestionJPA q where q.status=:status and q.familyDoctor.id=:docId", Long.class);
|
||||
query.setParameter("status", QuestionStatus.PENDING);
|
||||
// TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA
|
||||
// q where q.status=:status and q.familyDoctor.id=:docId order by q.title",
|
||||
// QuestionJPA.class);
|
||||
TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA q where q.familyDoctor.id=:docId order by q.status desc, q.title asc", QuestionJPA.class);
|
||||
// query.setParameter("status", QuestionStatus.PENDING);
|
||||
query.setParameter("docId", familyDoctorId);
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
public List<QuestionTO> listPendingQuestionsPaged(int familyDoctorId, int pageNumber, int pageSize) {
|
||||
TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA q where q.status=:status and q.familyDoctor.id=:docId order by q.title", QuestionJPA.class);
|
||||
query.setParameter("status", QuestionStatus.PENDING);
|
||||
query.setParameter("docId", familyDoctorId);
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
List<QuestionJPA> allJPA = query.getResultList();
|
||||
List<QuestionTO> pendingQuestions = new ArrayList<QuestionTO>();
|
||||
|
||||
@@ -109,13 +109,39 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
||||
return pendingQuestions;
|
||||
}
|
||||
|
||||
public List<QuestionTO> listAllMyQuestions(int userId) {
|
||||
List<QuestionTO> pendingQuestions = new ArrayList<QuestionTO>();
|
||||
// TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA
|
||||
// q where q.status=:status and q.familyDoctor.id=:docId order by q.title",
|
||||
// QuestionJPA.class);
|
||||
TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA q where q.patient.id=:patientId order by q.status desc, q.title asc", QuestionJPA.class);
|
||||
// query.setParameter("status", QuestionStatus.PENDING);
|
||||
query.setParameter("patientId", userId);
|
||||
|
||||
List<QuestionJPA> allJPA = query.getResultList();
|
||||
|
||||
for (QuestionJPA item : allJPA) {
|
||||
pendingQuestions.add(commonServices.getPOJOforQuestionJPA(item, 1));
|
||||
}
|
||||
|
||||
return pendingQuestions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recuperar una pregunta por su String
|
||||
* Recuperar una pregunta por su identificador
|
||||
*
|
||||
* @param question
|
||||
*/
|
||||
@Override
|
||||
public void getQuestion(String question) {
|
||||
public QuestionTO getQuestion(int idQuestion) {
|
||||
QuestionTO resp = new QuestionTO();
|
||||
|
||||
TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA q where q.id=:idquestion", QuestionJPA.class);
|
||||
|
||||
query.setParameter("idquestion", idQuestion);
|
||||
|
||||
resp = commonServices.getPOJOforQuestionJPA(query.getSingleResult(), 1);
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
// *********************************************************************
|
||||
@@ -124,17 +150,23 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
||||
/**
|
||||
* Añadir pruebas médicas a una cita
|
||||
*
|
||||
* Sólo médicos especialistas pueden gestionar pruebas médicas en el sistema.
|
||||
* Dado que será añadida por el médico especialista en sesión no hace falta más información.
|
||||
*
|
||||
* @param idMedicalTest
|
||||
* @param patientiID
|
||||
* @param date
|
||||
* @param time
|
||||
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias
|
||||
* magnéticas y TAC
|
||||
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias magnéticas y TAC
|
||||
* @param observations
|
||||
*/
|
||||
@Override
|
||||
public void addMedicalTest(int idMedicalTest, Date date, long time, MedicalTestType testType, String observations) {
|
||||
public MedicalTestTO addMedicalTest(int patientID, int doctorSpecialistID, LocalDate date, LocalTime time, MedicalTestType testType, String observations) throws Exception {
|
||||
SpecialistDoctorJPA specDoctor = entman.find(SpecialistDoctorJPA.class, doctorSpecialistID);
|
||||
PatientJPA pat = entman.find(PatientJPA.class, patientID);
|
||||
|
||||
MedicalTestJPA mt = new MedicalTestJPA(date, time, observations, null, testType, pat, specDoctor);
|
||||
|
||||
entman.persist(mt);
|
||||
|
||||
return this.commonServices.getPOJOforMedicalTestJPA(mt, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,8 +176,18 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
||||
*
|
||||
* @param idMedicalTest
|
||||
*/
|
||||
@Override
|
||||
public void getMedicalTest(int idMedicalTest) {
|
||||
public MedicalTestTO getMedicalTest(int idMedicalTest) {
|
||||
MedicalTestTO resp = new MedicalTestTO();
|
||||
|
||||
resp = commonServices.getPOJOforMedicalTestJPA(this.getMedicalTestJPA(idMedicalTest), 1);
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
private MedicalTestJPA getMedicalTestJPA(int idMedicalTest) {
|
||||
TypedQuery<MedicalTestJPA> query = entman.createQuery("SELECT q from MedicalTestJPA q where q.id=:idMedicalTest", MedicalTestJPA.class);
|
||||
query.setParameter("idMedicalTest", idMedicalTest);
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,8 +196,11 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
||||
* @param idMedicalTest
|
||||
* @param image
|
||||
*/
|
||||
@Override
|
||||
public void addImage(int idMedicalTest, String image) {
|
||||
MedicalTestJPA mt = this.getMedicalTestJPA(idMedicalTest);
|
||||
mt.setHighresimage(image);
|
||||
|
||||
entman.persist(mt);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,8 +209,8 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
||||
* @param idMedicalTest
|
||||
* @param image
|
||||
*/
|
||||
@Override
|
||||
public void updateImage(int idMedicalTest, String image) {
|
||||
this.addImage(idMedicalTest, image);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,8 +218,18 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
||||
*
|
||||
* @param idMedicalTest
|
||||
*/
|
||||
@Override
|
||||
public void removeImage(int idMedicalTest) {
|
||||
MedicalTestJPA mt = this.getMedicalTestJPA(idMedicalTest);
|
||||
mt.setHighresimage(null);
|
||||
|
||||
entman.persist(mt);
|
||||
}
|
||||
|
||||
public Long getSpecialistDoctorByMedicalSpecialtyCount(int specialityId) {
|
||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from SpecialistDoctorJPA q where q.medicalSpecialty.id=:specId", Long.class);
|
||||
query.setParameter("specId", specialityId);
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,8 +237,172 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
||||
*
|
||||
* @param speciality
|
||||
*/
|
||||
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpecialty(int specialityId, int pageNumber, int pageSize) {
|
||||
List<SpecialistDoctorTO> pendingQuestions = new ArrayList<SpecialistDoctorTO>();
|
||||
|
||||
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery(
|
||||
"SELECT q from SpecialistDoctorJPA q where q.medicalSpecialty.id=:specId order by q.medicalSpecialty.name asc, q.surname asc", SpecialistDoctorJPA.class);
|
||||
query.setParameter("specId", specialityId);
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
List<SpecialistDoctorJPA> allJPA = query.getResultList();
|
||||
|
||||
for (SpecialistDoctorJPA item : allJPA) {
|
||||
pendingQuestions.add(commonServices.getPOJOforSpecialistDoctorJPA(item, 1));
|
||||
}
|
||||
|
||||
return pendingQuestions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findSpecialistDoctorByMedicalSpeciality(MedicalSpecialtyTO speciality) {
|
||||
public List<MedicalTestTO> loadMedicalTestForPatient(int patientID) {
|
||||
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
||||
|
||||
TypedQuery<MedicalTestJPA> query = entman.createQuery("SELECT q from MedicalTestJPA q where q.patient.id=:patientId order by q.id desc", MedicalTestJPA.class);
|
||||
|
||||
query.setParameter("patientId", patientID);
|
||||
|
||||
List<MedicalTestJPA> allJPA = query.getResultList();
|
||||
|
||||
for (MedicalTestJPA item : allJPA) {
|
||||
medicalTests.add(commonServices.getPOJOforMedicalTestJPA(item, 1));
|
||||
}
|
||||
|
||||
return medicalTests;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID) {
|
||||
return this.loadMedicalTestForFamilyDoctor(familyDoctorID, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID) {
|
||||
return this.loadMedicalTestForSpecialistDoctor(specialistDoctorID, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID, int patientID) {
|
||||
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
||||
String extraQuery = "";
|
||||
|
||||
if (patientID >= 0) {
|
||||
extraQuery = " and q.patient.id=:patientID";
|
||||
}
|
||||
|
||||
TypedQuery<MedicalTestJPA> query = entman
|
||||
.createQuery("SELECT q from MedicalTestJPA q where q.patient.familyDoctor.id=:familyDoctorID " + extraQuery + " order by q.id desc", MedicalTestJPA.class);
|
||||
if (patientID >= 0) {
|
||||
query.setParameter("patientID", patientID);
|
||||
}
|
||||
query.setParameter("familyDoctorID", familyDoctorID);
|
||||
|
||||
List<MedicalTestJPA> allJPA = query.getResultList();
|
||||
|
||||
for (MedicalTestJPA item : allJPA) {
|
||||
medicalTests.add(commonServices.getPOJOforMedicalTestJPA(item, 1));
|
||||
}
|
||||
|
||||
return medicalTests;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID, int patientID) {
|
||||
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
||||
String extraQuery = "";
|
||||
|
||||
if (patientID >= 0) {
|
||||
extraQuery = " and q.patient.id=:patientID";
|
||||
}
|
||||
|
||||
TypedQuery<MedicalTestJPA> query = entman
|
||||
.createQuery("SELECT q from MedicalTestJPA q where q.specialistDoctor.id=:specialistDoctorID " + extraQuery + " order by q.id desc", MedicalTestJPA.class);
|
||||
|
||||
if (patientID >= 0) {
|
||||
query.setParameter("patientID", patientID);
|
||||
}
|
||||
query.setParameter("specialistDoctorID", specialistDoctorID);
|
||||
|
||||
List<MedicalTestJPA> allJPA = query.getResultList();
|
||||
|
||||
for (MedicalTestJPA item : allJPA) {
|
||||
medicalTests.add(commonServices.getPOJOforMedicalTestJPA(item, 1));
|
||||
}
|
||||
|
||||
return medicalTests;
|
||||
}
|
||||
|
||||
public List<PatientTO> loadPatientsForSpecialistDoctor(int specialistDoctorID, String searchTerm, int pageNumber, int pageSize) {
|
||||
String strQuery = "SELECT distinct q.patient from MedicalTestJPA q where q.specialistDoctor.id=:specialistDoctorID %s order by q.patient.name, q.patient.surname";
|
||||
String strFilter = "";
|
||||
if (searchTerm == null)
|
||||
searchTerm = "";
|
||||
else
|
||||
searchTerm = Utils.normalizeTerm(searchTerm);
|
||||
|
||||
if (searchTerm.length() > 0) {
|
||||
strFilter = "and (lower(q.patient.name) LIKE :searchTerm OR lower(q.patient.surname) LIKE :searchTerm)";
|
||||
}
|
||||
|
||||
TypedQuery<PatientJPA> query = entman.createQuery(String.format(strQuery, strFilter), PatientJPA.class);
|
||||
|
||||
if (searchTerm.length() > 0)
|
||||
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
||||
|
||||
query.setParameter("specialistDoctorID", specialistDoctorID);
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
List<PatientJPA> allJPA = query.getResultList();
|
||||
List<PatientTO> patsTO = new ArrayList<PatientTO>();
|
||||
|
||||
for (PatientJPA item : allJPA) {
|
||||
patsTO.add(commonServices.getPOJOforPatientJPA(item, 1));
|
||||
}
|
||||
|
||||
return patsTO;
|
||||
}
|
||||
|
||||
public List<PatientTO> loadPatientsForFamilyDoctor(int familyDoctorID, String searchTerm, int pageNumber, int pageSize) {
|
||||
String strQuery = "SELECT distinct q.patient from MedicalTestJPA q where q.patient.familyDoctor.id=:familyDoctorID %s order by q.patient.name, q.patient.surname";
|
||||
|
||||
String strFilter = "";
|
||||
if (searchTerm == null)
|
||||
searchTerm = "";
|
||||
else
|
||||
searchTerm = Utils.normalizeTerm(searchTerm);
|
||||
|
||||
if (searchTerm.length() > 0) {
|
||||
strFilter = "and (lower(q.patient.name) LIKE :searchTerm OR lower(q.patient.surname) LIKE :searchTerm)";
|
||||
}
|
||||
|
||||
TypedQuery<PatientJPA> query = entman.createQuery(String.format(strQuery, strFilter), PatientJPA.class);
|
||||
|
||||
if (searchTerm.length() > 0)
|
||||
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
||||
|
||||
query.setParameter("familyDoctorID", familyDoctorID);
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
List<PatientJPA> allJPA = query.getResultList();
|
||||
List<PatientTO> patsTO = new ArrayList<PatientTO>();
|
||||
|
||||
for (PatientJPA item : allJPA) {
|
||||
patsTO.add(commonServices.getPOJOforPatientJPA(item, 1));
|
||||
}
|
||||
|
||||
return patsTO;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,19 @@
|
||||
package ejb.medicalTest;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.MedicalTestTO.MedicalTestType;
|
||||
import TO.MedicalTestTO;
|
||||
import TO.PatientTO;
|
||||
import TO.QuestionTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import common.MedicalTestType;
|
||||
|
||||
/**
|
||||
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para
|
||||
* los clientes del EJB
|
||||
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para los clientes del EJB
|
||||
*
|
||||
* @author rorden
|
||||
*
|
||||
@@ -25,19 +27,22 @@ public interface MedicalTestFacadeRemote {
|
||||
/**
|
||||
* Realizar una pregunta al médico por un paciente
|
||||
*
|
||||
* @param professionalNumber
|
||||
* @param userID Este parámetro en el enunciado era del doctor, se ha cambiado al del paciente ya que los EJB
|
||||
* no tienen el contexto de la sesión y de esta forma se puede conseguir el médico al que se realiza la
|
||||
* pregunta.
|
||||
* @param title
|
||||
* @param message
|
||||
*/
|
||||
public void askQuestion(int professionalNumber, String title, String message);
|
||||
public String askQuestion(int userID, String title, String message);
|
||||
|
||||
/**
|
||||
* El médico responde a una pregunta
|
||||
*
|
||||
* @param question
|
||||
* @param questionId Se ha cambiado a questionID ya que es más directa la identificación de la pregunta
|
||||
* a la que se va a responder
|
||||
* @param response
|
||||
*/
|
||||
public void answerQuestion(String question, String response);
|
||||
public void answerQuestion(int questionId, String response);
|
||||
|
||||
/**
|
||||
* Recuperar las preguntas sin respuesta para un médico
|
||||
@@ -48,38 +53,55 @@ public interface MedicalTestFacadeRemote {
|
||||
*/
|
||||
public List<QuestionTO> listAllPendingQuestions(int familyDoctorId);
|
||||
|
||||
public Long getPendingQuestionsCount(int familyDoctorId);
|
||||
|
||||
public List<QuestionTO> listPendingQuestionsPaged(int familyDoctorId, int pageNumber, int pageSize);
|
||||
|
||||
/**
|
||||
* Recuperar las preguntas hechas por un paciente
|
||||
*
|
||||
* NEW
|
||||
*/
|
||||
public List<QuestionTO> listAllMyQuestions(int userId);
|
||||
|
||||
/**
|
||||
* Recuperar una pregunta por su String
|
||||
*
|
||||
* @param question
|
||||
* @param idQuestion Se ha cambiado al identificador de la pregunta, ya que es más directa
|
||||
* su identificación.
|
||||
*/
|
||||
public void getQuestion(String question);
|
||||
public QuestionTO getQuestion(int idQuestion);
|
||||
|
||||
// ********************************************************************* MEDICAL
|
||||
// TEST
|
||||
|
||||
public List<MedicalTestTO> loadMedicalTestForPatient(int patientID);
|
||||
|
||||
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID);
|
||||
|
||||
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID);
|
||||
|
||||
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID, int patientID);
|
||||
|
||||
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID, int patientID);
|
||||
|
||||
public List<PatientTO> loadPatientsForSpecialistDoctor(int specialistDoctorID, String searchTerm, int pageNumber, int pageSize);
|
||||
|
||||
public List<PatientTO> loadPatientsForFamilyDoctor(int familyDoctorID, String searchTerm, int pageNumber, int pageSize);
|
||||
|
||||
/**
|
||||
* Añadir una prueba médica a un paciente
|
||||
* Añadir una prueba médica a un paciente Dado que será añadida por el médico especialista en sesión no hace falta más información.
|
||||
*
|
||||
* @param idMedicalTest
|
||||
* @param date
|
||||
* @param time
|
||||
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias
|
||||
* magnéticas y TAC
|
||||
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias magnéticas y TAC
|
||||
* @param observations
|
||||
*/
|
||||
public void addMedicalTest(int id, Date date, long time, MedicalTestType testType, String observations);
|
||||
public MedicalTestTO addMedicalTest(int patientID, int doctorSpecialistID, LocalDate date, LocalTime time, MedicalTestType testType, String observations) throws Exception;
|
||||
|
||||
/**
|
||||
* Recuperar una prueba médica por ID
|
||||
*
|
||||
* @param idMedicalTest
|
||||
*/
|
||||
public void getMedicalTest(int idPatient);
|
||||
public MedicalTestTO getMedicalTest(int idPatient);
|
||||
|
||||
/**
|
||||
* Añadir una imagen a una prueba médica
|
||||
@@ -104,10 +126,12 @@ public interface MedicalTestFacadeRemote {
|
||||
*/
|
||||
public void removeImage(int idMedicalTest);
|
||||
|
||||
public Long getSpecialistDoctorByMedicalSpecialtyCount(int specialityId);
|
||||
|
||||
/**
|
||||
* Listar médicos con una especialidad concreta
|
||||
*
|
||||
* @param speciality
|
||||
*/
|
||||
public void findSpecialistDoctorByMedicalSpeciality(MedicalSpecialtyTO speciality);
|
||||
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.
|
||||
*/
|
||||
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);
|
||||
entman.persist(pat);
|
||||
|
||||
@@ -117,7 +117,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
||||
*
|
||||
* @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 {
|
||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, specialty.getId());
|
||||
if (ms == null) {
|
||||
@@ -143,7 +143,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
||||
*
|
||||
* @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());
|
||||
if (phcC == null) {
|
||||
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 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;
|
||||
|
||||
|
||||
@@ -1,25 +1,33 @@
|
||||
package ejb.systemAdmin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.ejb.Stateless;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.LoggedUserTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import TO.SystemAdminTO;
|
||||
import common.Constants;
|
||||
import common.HashUtils;
|
||||
import common.UserType;
|
||||
import ejb.common.CommonFacadeLocal;
|
||||
import jpa.AdministratorJPA;
|
||||
import jpa.SystemAdminJPA;
|
||||
import jpa.FamilyDoctorJPA;
|
||||
import jpa.MedicalSpecialtyJPA;
|
||||
import jpa.PrimaryHealthCareCenterJPA;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
* @author David Álvarez González (dalvarezgon@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Stateless
|
||||
@@ -33,39 +41,38 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
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:
|
||||
*
|
||||
* 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 de email que comienza por caracteres del
|
||||
* identificaodr de paciente o 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
|
||||
* 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 correcta.
|
||||
* 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.
|
||||
*/
|
||||
public LoggedUserTO login(String userCode, String pwd) {
|
||||
LoggedUserTO usr = null;
|
||||
|
||||
if (userCode == null)
|
||||
return usr;
|
||||
|
||||
userCode = userCode.trim().toUpperCase();
|
||||
|
||||
if (userCode.startsWith(Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX)) {
|
||||
// Si el identificador de usuario es de tipo paciente, intentamos realizar el
|
||||
// login.
|
||||
PatientTO pat = this.commonServices.findPatientByCode(userCode);
|
||||
if (pat != null) {
|
||||
usr = new LoggedUserTO(String.valueOf(pat.getId()), pat.getName(), pat.getPassword(), UserType.PATIENT);
|
||||
usr = new LoggedUserTO(String.valueOf(pat.getId()), pat.getName(), pat.getPassword(), UserType.PATIENT, pat.getDisplayName());
|
||||
}
|
||||
} else if (userCode.startsWith(Constants.PROFESSIONAL_NUMBER_PREFIX)) {
|
||||
// Si el identificador de usuario es de tipo profesional, intentamos realizar el
|
||||
@@ -73,13 +80,13 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
FamilyDoctorTO fd = this.commonServices.findFamilyDoctorByCode(userCode);
|
||||
|
||||
if (fd != null) {
|
||||
usr = new LoggedUserTO(String.valueOf(fd.getId()), fd.getName(), fd.getPassword(), UserType.FAMILY_DOCTOR);
|
||||
usr = new LoggedUserTO(String.valueOf(fd.getId()), fd.getName(), fd.getPassword(), UserType.FAMILY_DOCTOR, fd.getDisplayName());
|
||||
} else {
|
||||
// No era un código de médico de familia, intenamos logearlo como especialista
|
||||
SpecialistDoctorTO sd = this.commonServices.findSpecialistDoctorByCode(userCode);
|
||||
|
||||
if (sd != null) {
|
||||
usr = new LoggedUserTO(String.valueOf(sd.getId()), sd.getName(), sd.getPassword(), UserType.SPECIALIST_DOCTOR);
|
||||
usr = new LoggedUserTO(String.valueOf(sd.getId()), sd.getName(), sd.getPassword(), UserType.SPECIALIST_DOCTOR, sd.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,10 +97,11 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
// cual intentamos login contra la tabla de administradores
|
||||
if (usr == null) {
|
||||
// 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) {
|
||||
usr = new LoggedUserTO(adm.getEmail(), adm.getEmail(), adm.getPassword(), UserType.ADMINISTRATOR);
|
||||
usr = new LoggedUserTO(adm.getEmail(), adm.getEmail(), adm.getPassword(), UserType.ADMINISTRATOR, adm.getEmail());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,9 +117,14 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
|
||||
return usr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MedicalSpecialtyTO updateSpecialtyData(int id, String name, String description) throws Exception {
|
||||
|
||||
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 {
|
||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
||||
|
||||
if (ms == null) {
|
||||
@@ -125,9 +138,20 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
|
||||
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSpecialtyData(int id, String name, String description) throws Exception {
|
||||
|
||||
public MedicalSpecialtyTO findSpecialtyByName(String searchedName) {
|
||||
TypedQuery<MedicalSpecialtyJPA> query = entman.createQuery("from MedicalSpecialtyJPA ms where LOWER(ms.name)=LOWER(:name)", MedicalSpecialtyJPA.class);
|
||||
query.setMaxResults(1);
|
||||
query.setParameter("name", searchedName);
|
||||
|
||||
List<MedicalSpecialtyJPA> results = query.getResultList();
|
||||
if (results.size() > 0)
|
||||
return this.commonServices.getPOJOforMedicalSpecialtyJPA(results.get(0));
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public void deleteSpecialty(int id) throws Exception {
|
||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
||||
|
||||
if (ms == null) {
|
||||
@@ -137,12 +161,114 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
entman.remove(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MedicalSpecialtyTO insertSpecialtyData(String name, String description) throws Exception {
|
||||
|
||||
public MedicalSpecialtyTO insertSpecialty(String name, String description) throws Exception {
|
||||
MedicalSpecialtyJPA ms = new MedicalSpecialtyJPA(name, description);
|
||||
entman.persist(ms);
|
||||
|
||||
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
|
||||
}
|
||||
|
||||
public PrimaryHealthCareCenterTO updateHealthCareCenter(int id, String name, String location) throws Exception {
|
||||
PrimaryHealthCareCenterJPA ms = entman.find(PrimaryHealthCareCenterJPA.class, id);
|
||||
|
||||
if (ms == null) {
|
||||
throw new Exception("No se pueden actualizar los datos del CAP porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(id));
|
||||
}
|
||||
|
||||
ms.setName(name);
|
||||
ms.setLocation(location);
|
||||
|
||||
entman.persist(ms);
|
||||
|
||||
return this.commonServices.getPOJOforPrimaryHealthCareCenterJPA(ms);
|
||||
}
|
||||
|
||||
public PrimaryHealthCareCenterTO findHealthCareCenterByName(String searchedName) {
|
||||
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery("from PrimaryHealthCareCenterJPA cap where LOWER(cap.name)=LOWER(:name)", PrimaryHealthCareCenterJPA.class);
|
||||
query.setMaxResults(1);
|
||||
query.setParameter("name", searchedName);
|
||||
|
||||
List<PrimaryHealthCareCenterJPA> results = query.getResultList();
|
||||
if (results.size() > 0)
|
||||
return this.commonServices.getPOJOforPrimaryHealthCareCenterJPA(results.get(0));
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public void deleteHealthCareCenter(int id) throws Exception {
|
||||
PrimaryHealthCareCenterJPA cap = entman.find(PrimaryHealthCareCenterJPA.class, id);
|
||||
|
||||
if (cap == null) {
|
||||
throw new Exception("No se puede borrar el CAP porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(id));
|
||||
}
|
||||
|
||||
entman.remove(cap);
|
||||
}
|
||||
|
||||
public PrimaryHealthCareCenterTO insertHealthCareCenter(String name, String location) throws Exception {
|
||||
PrimaryHealthCareCenterJPA cap = new PrimaryHealthCareCenterJPA(name, location);
|
||||
entman.persist(cap);
|
||||
|
||||
return this.commonServices.getPOJOforPrimaryHealthCareCenterJPA(cap);
|
||||
}
|
||||
|
||||
public Long getCAPCount() {
|
||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from PrimaryHealthCareCenterJPA", Long.class);
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
public Long getFamilyDoctorsByCAPCount(int primaryHealthCareCenterId) {
|
||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from FamilyDoctorJPA d where d.primaryHealthCareCenter.id=:capId", Long.class);
|
||||
query.setParameter("capId", primaryHealthCareCenterId);
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
public List<FamilyDoctorTO> listAllFamilyDoctorsByCAPPaged(int primaryHealthCareCenterId, int pageNumber, int pageSize) {
|
||||
List<FamilyDoctorTO> familyDoctorsByCAP = new ArrayList<FamilyDoctorTO>();
|
||||
|
||||
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("SELECT d from FamilyDoctorJPA d where d.primaryHealthCareCenter.id=:capId order by d.name asc, d.surname asc",
|
||||
FamilyDoctorJPA.class);
|
||||
query.setParameter("capId", primaryHealthCareCenterId);
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
List<FamilyDoctorJPA> allJPA = query.getResultList();
|
||||
|
||||
for (FamilyDoctorJPA item : allJPA) {
|
||||
familyDoctorsByCAP.add(commonServices.getPOJOforFamilyDoctorJPA(item, 1));
|
||||
}
|
||||
|
||||
return familyDoctorsByCAP;
|
||||
}
|
||||
|
||||
public Long getPatientCount(int familyDoctorId) {
|
||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from PatientJPA p where p.familyDoctor.id=:familyDoctorId", Long.class);
|
||||
query.setParameter("familyDoctorId", familyDoctorId);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package ejb.systemAdmin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.LoggedUserTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.SystemAdminTO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
* @author David Alvarez González (dalvarezgon@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Remote
|
||||
@@ -18,9 +23,33 @@ public interface SystemAdminFacadeRemote {
|
||||
|
||||
public LoggedUserTO login(String id, String pwd);
|
||||
|
||||
public MedicalSpecialtyTO updateSpecialtyData(int id, String name, String description) throws Exception;
|
||||
|
||||
public void deleteSpecialtyData(int id, String name, String description) throws Exception;
|
||||
|
||||
public MedicalSpecialtyTO insertSpecialtyData(String name, String description) throws Exception;
|
||||
public Long getSpecialtiesCount();
|
||||
|
||||
public MedicalSpecialtyTO updateSpecialty(int id, String name, String description) throws Exception;
|
||||
|
||||
public MedicalSpecialtyTO findSpecialtyByName(String name);
|
||||
|
||||
public void deleteSpecialty(int id) throws Exception;
|
||||
|
||||
public MedicalSpecialtyTO insertSpecialty(String name, String description) throws Exception;
|
||||
|
||||
public PrimaryHealthCareCenterTO updateHealthCareCenter(int id, String name, String location) throws Exception;
|
||||
|
||||
public PrimaryHealthCareCenterTO findHealthCareCenterByName(String name);
|
||||
|
||||
public void deleteHealthCareCenter(int id) throws Exception;
|
||||
|
||||
public PrimaryHealthCareCenterTO insertHealthCareCenter(String name, String location) throws Exception;
|
||||
|
||||
public Long getCAPCount();
|
||||
|
||||
public Long getFamilyDoctorsByCAPCount(int primaryHealthCareCenterId);
|
||||
|
||||
public List<FamilyDoctorTO> listAllFamilyDoctorsByCAPPaged(int primaryHealthCareCenterId, int pageNumber, int pageSize);
|
||||
|
||||
public Long getPatientCount(int familyDoctorId);
|
||||
|
||||
public SystemAdminTO findAdminByEmail(String email);
|
||||
|
||||
public SystemAdminTO insertAdmin(String email, String password) throws Exception;
|
||||
}
|
||||
@@ -1,28 +1,158 @@
|
||||
package ejb.visit;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.ejb.Stateless;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
import TO.VisitTO;
|
||||
import ejb.common.CommonFacadeLocal;
|
||||
import jpa.PatientJPA;
|
||||
import jpa.VisitJPA;
|
||||
|
||||
/**
|
||||
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los
|
||||
* métodos de la capa de negocio que implementan la logica de negocio y la
|
||||
* interacción con la capa de persistencia.
|
||||
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los métodos de la capa de negocio que implementan la logica de negocio y la interacción con la capa de
|
||||
* persistencia.
|
||||
*
|
||||
* @author mark
|
||||
*
|
||||
*/
|
||||
@Stateless
|
||||
public class VisitFacadeBean implements VisitFacadeRemote {
|
||||
|
||||
// Persistence Unit Context
|
||||
@PersistenceContext(unitName = "MyHealth")
|
||||
private EntityManager entman;
|
||||
EntityManager entman;
|
||||
|
||||
public void ejbMethod(String parameter)
|
||||
{
|
||||
|
||||
@EJB
|
||||
CommonFacadeLocal commonServices;
|
||||
|
||||
public Long getScheduledVisitsCount(int familyDoctorId, LocalDate date) {
|
||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from VisitJPA v where v.date=:date and v.familyDoctor.id=:docId", Long.class);
|
||||
query.setParameter("date", date);
|
||||
query.setParameter("docId", familyDoctorId);
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
public List<VisitTO> listAllScheduledVisitsPaged(int familyDoctorId, LocalDate date, int pageNumber, int pageSize) {
|
||||
TypedQuery<VisitJPA> query = entman.createQuery("SELECT v from VisitJPA v where v.date=:date and v.familyDoctor.id=:docId order by v.date, v.time", VisitJPA.class);
|
||||
query.setParameter("date", date);
|
||||
query.setParameter("docId", familyDoctorId);
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
List<VisitJPA> allJPA = query.getResultList();
|
||||
List<VisitTO> listTO = new ArrayList<VisitTO>();
|
||||
|
||||
for (VisitJPA item : allJPA) {
|
||||
listTO.add(commonServices.getPOJOforVisitJPA(item, 1));
|
||||
}
|
||||
|
||||
return listTO;
|
||||
}
|
||||
|
||||
public Long getVisitsCount(Integer patientId, LocalDate date) {
|
||||
String strQuery = "SELECT count(1) from VisitJPA v %s";
|
||||
String strFilter = "";
|
||||
if (patientId != null)
|
||||
strFilter = " and v.patient.id=:patientId ";
|
||||
if (date != null)
|
||||
strFilter += " and v.date=:date ";
|
||||
|
||||
if (strFilter.length() > 0) {
|
||||
strFilter = "WHERE 1=1 " + strFilter;
|
||||
}
|
||||
strQuery = String.format(strQuery, strFilter);
|
||||
|
||||
TypedQuery<Long> query = entman.createQuery(strQuery, Long.class);
|
||||
|
||||
if (patientId != null)
|
||||
query.setParameter("patientId", patientId);
|
||||
if (date != null)
|
||||
query.setParameter("date", date);
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
public List<VisitTO> listVisitsPaged(Integer patientId, LocalDate date, int pageNumber, int pageSize) {
|
||||
String strQuery = "SELECT v from VisitJPA v %s order by v.patient, v.date";
|
||||
String strFilter = "";
|
||||
if (patientId != null)
|
||||
strFilter = " and v.patient.id=:patientId ";
|
||||
if (date != null)
|
||||
strFilter += " and v.date=:date ";
|
||||
|
||||
if (strFilter.length() > 0) {
|
||||
strFilter = "WHERE 1=1 " + strFilter;
|
||||
}
|
||||
strQuery = String.format(strQuery, strFilter);
|
||||
|
||||
TypedQuery<VisitJPA> query = entman.createQuery(strQuery, VisitJPA.class);
|
||||
|
||||
if (patientId != null)
|
||||
query.setParameter("patientId", patientId);
|
||||
if (date != null)
|
||||
query.setParameter("date", date);
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
List<VisitJPA> allJPA = query.getResultList();
|
||||
List<VisitTO> listTO = new ArrayList<VisitTO>();
|
||||
|
||||
for (VisitJPA item : allJPA) {
|
||||
listTO.add(commonServices.getPOJOforVisitJPA(item, 1));
|
||||
}
|
||||
|
||||
return listTO;
|
||||
}
|
||||
|
||||
public VisitTO getVisit(int id) throws Exception {
|
||||
VisitJPA vi = entman.find(VisitJPA.class, id);
|
||||
if (vi == null) {
|
||||
throw new Exception("No se encuentra la visita con identificador: " + String.valueOf(id));
|
||||
}
|
||||
|
||||
return this.commonServices.getPOJOforVisitJPA(vi, 1);
|
||||
}
|
||||
|
||||
public void addResultToVisit(int id, String result) {
|
||||
VisitJPA vi = entman.find(VisitJPA.class, id);
|
||||
|
||||
vi.setResult(result);
|
||||
entman.persist(vi);
|
||||
}
|
||||
|
||||
public void removeVisit(int id) {
|
||||
VisitJPA vi = entman.find(VisitJPA.class, id);
|
||||
entman.remove(vi);
|
||||
}
|
||||
|
||||
public void updateVisit(int id, LocalDate date, LocalTime time) {
|
||||
VisitJPA vi = entman.find(VisitJPA.class, id);
|
||||
vi.setDate(date);
|
||||
vi.setTime(time);
|
||||
entman.persist(vi);
|
||||
}
|
||||
|
||||
public VisitTO addVisit(int patientId, LocalDate date, LocalTime time, String observations) {
|
||||
|
||||
PatientJPA pat = entman.find(PatientJPA.class, patientId);
|
||||
|
||||
VisitJPA vi = new VisitJPA(date, time, observations, "", pat, pat.getFamilyDoctor());
|
||||
entman.persist(vi);
|
||||
|
||||
return this.commonServices.getPOJOforVisitJPA(vi, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package ejb.visit;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
|
||||
import TO.VisitTO;
|
||||
|
||||
/**
|
||||
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para
|
||||
* los clientes del EJB
|
||||
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para los clientes del EJB
|
||||
*
|
||||
* @author mark
|
||||
* @author alina
|
||||
*
|
||||
*/
|
||||
@Remote
|
||||
@@ -14,5 +19,23 @@ public interface VisitFacadeRemote {
|
||||
/**
|
||||
* Definimos la interfaz remota
|
||||
*/
|
||||
public void ejbMethod(String parameter);
|
||||
|
||||
public Long getScheduledVisitsCount(int familyDoctorId, LocalDate date);
|
||||
|
||||
public List<VisitTO> listAllScheduledVisitsPaged(int familyDoctorId, LocalDate date, int pageNumber, int pageSize);
|
||||
|
||||
public Long getVisitsCount(Integer patientId, LocalDate date);
|
||||
|
||||
public List<VisitTO> listVisitsPaged(Integer patientId, LocalDate date, int pageNumber, int pageSize);
|
||||
|
||||
public VisitTO getVisit(int id) throws Exception;
|
||||
|
||||
public void addResultToVisit(int id, String result);
|
||||
|
||||
public void removeVisit(int id);
|
||||
|
||||
public void updateVisit(int id, LocalDate date, LocalTime time);
|
||||
|
||||
public VisitTO addVisit(int patientId, LocalDate date, LocalTime time, String observations);
|
||||
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
package jpa;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -14,7 +15,7 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import common.TestType;
|
||||
import common.MedicalTestType;
|
||||
|
||||
/**
|
||||
* Los nombres de los decortadores relacionados con la BBDD pueden estar en
|
||||
@@ -35,14 +36,14 @@ public class MedicalTestJPA implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private int id;
|
||||
private Date date;
|
||||
private long time;
|
||||
private LocalDate date;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String highresimage;
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "type") // Con esto podríamos cambiar los nombres de las propiedades de la clase y
|
||||
// mantener la relación con la BBDD a través de JPA
|
||||
private TestType type;
|
||||
private MedicalTestType type;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "patientid")
|
||||
@@ -56,8 +57,7 @@ public class MedicalTestJPA implements Serializable {
|
||||
super();
|
||||
}
|
||||
|
||||
public MedicalTestJPA(int id, Date date, long time, String observations, String highresimage, TestType type, PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
|
||||
this.id = id;
|
||||
public MedicalTestJPA(LocalDate date, LocalTime time, String observations, String highresimage, MedicalTestType type, PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
|
||||
this.date = date;
|
||||
this.time = time;
|
||||
this.observations = observations;
|
||||
@@ -75,19 +75,19 @@ public class MedicalTestJPA implements Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
public LocalTime getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(long time) {
|
||||
public void setTime(LocalTime time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@@ -107,11 +107,11 @@ public class MedicalTestJPA implements Serializable {
|
||||
this.highresimage = highresimage;
|
||||
}
|
||||
|
||||
public TestType getType() {
|
||||
public MedicalTestType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(TestType type) {
|
||||
public void setType(MedicalTestType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import javax.persistence.Table;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "MyHealth.Administrator")
|
||||
public class AdministratorJPA implements Serializable {
|
||||
public class SystemAdminJPA implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -24,11 +24,11 @@ public class AdministratorJPA implements Serializable {
|
||||
/**
|
||||
* Class constructor methods
|
||||
*/
|
||||
public AdministratorJPA() {
|
||||
public SystemAdminJPA() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AdministratorJPA(String email, String password) {
|
||||
public SystemAdminJPA(String email, String password) {
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package jpa;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -28,13 +28,15 @@ public class VisitJPA implements Serializable {
|
||||
@Column(updatable = false)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
private Date date;
|
||||
private Time time;
|
||||
private LocalDate date;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String result;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "FamilyDoctorId")
|
||||
private FamilyDoctorJPA familyDoctor;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "PatientId")
|
||||
private PatientJPA patient;
|
||||
@@ -46,16 +48,15 @@ public class VisitJPA implements Serializable {
|
||||
super();
|
||||
}
|
||||
|
||||
public VisitJPA(Integer id, Date date, Time time, String observations, String result) {
|
||||
this.id = id;
|
||||
public VisitJPA(LocalDate date, LocalTime time, String observations, String result, PatientJPA patient, FamilyDoctorJPA familydoctor) {
|
||||
this.date = date;
|
||||
this.time = time;
|
||||
this.observations = observations;
|
||||
this.result = result;
|
||||
this.patient = patient;
|
||||
this.familyDoctor = familydoctor;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -64,19 +65,19 @@ public class VisitJPA implements Serializable {
|
||||
this.id = value;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date value) {
|
||||
public void setDate(LocalDate value) {
|
||||
this.date = value;
|
||||
}
|
||||
|
||||
public Time getTime() {
|
||||
public LocalTime getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Time value) {
|
||||
public void setTime(LocalTime value) {
|
||||
this.time = value;
|
||||
}
|
||||
|
||||
@@ -84,8 +85,8 @@ public class VisitJPA implements Serializable {
|
||||
return observations;
|
||||
}
|
||||
|
||||
public void setObservations(String observation) {
|
||||
this.observations = observations;
|
||||
public void setObservations(String value) {
|
||||
this.observations = value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,4 +107,12 @@ public class VisitJPA implements Serializable {
|
||||
public void setPatient(PatientJPA pat) {
|
||||
this.patient = pat;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String value) {
|
||||
this.result = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ package managedbean.common;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
@@ -16,10 +15,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.omnifaces.util.Exceptions;
|
||||
|
||||
import common.UserType;
|
||||
import common.Utils;
|
||||
|
||||
@WebFilter(filterName = "AuthFilter", urlPatterns = { "*.xhtml" })
|
||||
public class AuthorizationFilter implements Filter {
|
||||
@@ -46,129 +42,119 @@ public class AuthorizationFilter implements Filter {
|
||||
HttpServletRequest req = null;
|
||||
HttpServletResponse resp = null;
|
||||
HttpSession ses = null;
|
||||
try {
|
||||
|
||||
req = (HttpServletRequest) request;
|
||||
String reqURI = req.getRequestURI();
|
||||
req = (HttpServletRequest) request;
|
||||
String reqURI = req.getRequestURI();
|
||||
ses = req.getSession(false);
|
||||
|
||||
resp = (HttpServletResponse) response;
|
||||
ses = req.getSession(false);
|
||||
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 || 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/VisitView") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/visit/UpdateVisit") > 0)
|
||||
authorized = true;
|
||||
break;
|
||||
case PATIENT:
|
||||
if (reqURI.indexOf("/visit/VisitView") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/visit/AddVisit") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/visit/UpdateVisit") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/visit/CancelVisit") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/medicaltest/AddQuestion") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/medicaltest/ViewMedicalTest") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/medicaltest/SearchSpecialistBySpecialty") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/profile/UpdateProfile") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/profile/ChangeFamilyDoctor") > 0)
|
||||
authorized = true;
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
if (reqURI.indexOf("/visit/VisitView") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/visit/VisitAddResult") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/visit/VisitViewSchedules") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/medicaltest/AnswerQuestion") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/medicaltest/PendingQuestions") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/medicaltest/ViewMedicalTest") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/profile/UpdateProfile") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/profile/ChangePrimaryHealthCareCenter") > 0)
|
||||
authorized = true;
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/medicaltest/AddMedicalTest") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/medicaltest/ViewMedicalTest") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/medicaltest/AddImageToMedicalTest") > 0)
|
||||
authorized = true;
|
||||
if (reqURI.indexOf("/profile/UpdateProfile") > 0)
|
||||
authorized = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (authorized == true) {
|
||||
chain.doFilter(request, response);
|
||||
return;
|
||||
} else {
|
||||
SessionUtils.addMessage(ses, FacesMessage.SEVERITY_ERROR,
|
||||
"No está autorizado a acceder a la página solicitada. Por favor, utilice el menú principal de la aplicación.",
|
||||
String.format("Se ha producido una expción de autorización, su usuario no está autorizado a acceder a la página: (%s).", reqURI));
|
||||
resp.sendRedirect(req.getContextPath() + "/error.xhtml?type=auth");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
resp.sendRedirect(req.getContextPath() + "/home.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
|
||||
resp.sendRedirect(req.getContextPath() + "/error.xhtml");
|
||||
// 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("/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
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ManagedBeanBase {
|
||||
remoteManagerMedicalTest = this.getContext("java:app/MyHealth.jar/MedicalTestFacadeBean!ejb.medicalTest.MedicalTestFacadeRemote", MedicalTestFacadeRemote.class);
|
||||
}
|
||||
|
||||
return remoteManagerMedicalTest;
|
||||
return remoteManagerMedicalTest;
|
||||
}
|
||||
|
||||
protected void addFacesMessageKeep(FacesMessage.Severity severity, String summary, String detail) {
|
||||
@@ -124,23 +124,29 @@ public class ManagedBeanBase {
|
||||
}
|
||||
|
||||
protected void manageException(Exception ex) {
|
||||
String strType = "";
|
||||
String strType = "runtime";
|
||||
|
||||
if (ex.getClass().equals(ViewExpiredException.class)) {
|
||||
// Sessión expired
|
||||
// Sessión expirada
|
||||
strType = "expired";
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Su sesión ha caducado", "Su sesión ha caducado, vuelva a logarse en el sistema.");
|
||||
} else {
|
||||
this.addFacesMessage(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 {
|
||||
ExternalContext ctx = FacesContext.getCurrentInstance().getExternalContext();
|
||||
|
||||
|
||||
ctx.redirect(ctx.getApplicationContextPath() + "/error.xhtml?type=" + strType);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.primefaces.model.menu.DefaultMenuItem;
|
||||
import org.primefaces.model.menu.DefaultMenuModel;
|
||||
import org.primefaces.model.menu.DefaultSeparator;
|
||||
import org.primefaces.model.menu.DefaultSubMenu;
|
||||
import org.primefaces.model.menu.MenuElement;
|
||||
import org.primefaces.model.menu.MenuModel;
|
||||
|
||||
import common.UserType;
|
||||
@@ -28,25 +29,28 @@ public class MenuMBean implements Serializable {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
boolean loggedIn = SessionUtils.isLogedIn();
|
||||
|
||||
model = new DefaultMenuModel();
|
||||
DefaultSubMenu subMenu;
|
||||
UserType tipoUsuario = null;
|
||||
DefaultMenuItem menuItem;
|
||||
|
||||
model.addElement(createMenuItem("Home", "pi pi-home", "/home", null));
|
||||
|
||||
if (SessionUtils.isLogedIn() == true) {
|
||||
if (loggedIn == true) {
|
||||
tipoUsuario = SessionUtils.getUserType();
|
||||
|
||||
// Administracion Sistema
|
||||
if (tipoUsuario == UserType.ADMINISTRATOR) {
|
||||
subMenu = new DefaultSubMenu("Administración del sistema", "fa-wrench");
|
||||
subMenu = new DefaultSubMenu("Administración del sistema", "fa fa-wrench");
|
||||
|
||||
subMenu.addElement(createMenuItem("Gestionar especialidades", "fa fa-file-text-o", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(createMenuItem("Centros At. Primaria", "fa fa-hospital-o", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(createMenuItem("Centros At. Primaria", "fa fa-hospital-o", "/systemAdmin/ManageHealthCareCenters", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
subMenu.addElement(createMenuItem("Ver médicos de un CAP", "fa fa-medkit", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(createMenuItem("Ver médicos de un CAP", "fa fa-medkit", "/systemAdmin/ListDoctorsByCenter", null));
|
||||
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);
|
||||
}
|
||||
@@ -56,15 +60,15 @@ public class MenuMBean implements Serializable {
|
||||
subMenu = new DefaultSubMenu("Visitas", "fa fa-calendar");
|
||||
|
||||
if (tipoUsuario == UserType.PATIENT)
|
||||
subMenu.addElement(createMenuItem("Solicitar nueva", "fa fa-calendar-o", "/visit/VisitView", null));
|
||||
subMenu.addElement(createMenuItem("Solicitar nueva", "fa fa-calendar-o", "/visit/AddVisit", null));
|
||||
if (tipoUsuario == UserType.PATIENT || tipoUsuario == UserType.ADMINISTRATOR)
|
||||
subMenu.addElement(createMenuItem("Modificar fecha/hora", "fa fa-briefcase", "/visit/VisitView", null));
|
||||
subMenu.addElement(createMenuItem("Modificar fecha/hora", "fa fa-briefcase", "/visit/PatientVisitList", null));
|
||||
if (tipoUsuario == UserType.PATIENT)
|
||||
subMenu.addElement(createMenuItem("Anular visita", "fa fa-remove", "/visit/VisitView", null));
|
||||
subMenu.addElement(createMenuItem("Anular visita", "fa fa-remove", "/visit/PatientVisitList", null));
|
||||
if (tipoUsuario == UserType.FAMILY_DOCTOR)
|
||||
subMenu.addElement(createMenuItem("Añadir resultado", "fa fa-align-left", "/visit/VisitView", null));
|
||||
subMenu.addElement(createMenuItem("Añadir resultado", "fa fa-align-left", "/visit/VisitList", null));
|
||||
if (tipoUsuario == UserType.FAMILY_DOCTOR)
|
||||
subMenu.addElement(createMenuItem("Ver agenda del día", "fa fa-repeat", "/visit/VisitView", null));
|
||||
subMenu.addElement(createMenuItem("Ver agenda del día", "fa fa-repeat", "/visit/VisitList", null));
|
||||
|
||||
model.addElement(subMenu);
|
||||
}
|
||||
@@ -86,36 +90,21 @@ public class MenuMBean implements Serializable {
|
||||
}
|
||||
|
||||
if (tipoUsuario == UserType.PATIENT)
|
||||
subMenu.addElement(createMenuItem("Buscar especialista...", "fa fa-heartbeat", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(createMenuItem("Buscar especialista...", "fa fa-heartbeat", "/medicaltest/SearchSpecialist", null));
|
||||
|
||||
model.addElement(subMenu);
|
||||
}
|
||||
|
||||
// Preguntas médicas
|
||||
if (tipoUsuario == UserType.PATIENT || tipoUsuario == UserType.FAMILY_DOCTOR) {
|
||||
subMenu = new DefaultSubMenu("Preguntas", "fa fa-question-circle");
|
||||
|
||||
if (tipoUsuario == UserType.PATIENT)
|
||||
subMenu.addElement(createMenuItem("Hacer pregunta", "fa fa-comment-o", "/medicaltest/MedicalTests", null));
|
||||
|
||||
if (tipoUsuario == UserType.FAMILY_DOCTOR)
|
||||
subMenu.addElement(createMenuItem("Responder pregunta", "fa fa-comments", "/medicaltest/MedicalTests", null));
|
||||
|
||||
if (tipoUsuario == UserType.FAMILY_DOCTOR)
|
||||
subMenu.addElement(createMenuItem("Ver preguntas pendientes", "fa fa-comments-o", "/medicaltest/PendingQuestions", null));
|
||||
|
||||
model.addElement(subMenu);
|
||||
model.addElement(createMenuItem("Preguntas", "fa fa-comment-o", "/medicaltest/Questions", null));
|
||||
}
|
||||
}
|
||||
|
||||
// Perfil
|
||||
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 paciente", "fa fa-user-plus", "/profile/AddPatient", null));
|
||||
// subMenu.addElement(createMenuItem("Registro de médico", "fa fa-user-md", "/profile/AddFamilyDoctor", null));
|
||||
// subMenu.addElement(createMenuItem("Registro de especialista", "fa fa-user-md", "/profile/AddSpecialistDoctor", null));
|
||||
|
||||
model.addElement(subMenu);
|
||||
} else {
|
||||
if (tipoUsuario != UserType.ADMINISTRATOR) {
|
||||
@@ -134,6 +123,30 @@ public class MenuMBean implements Serializable {
|
||||
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) {
|
||||
|
||||
@@ -32,8 +32,7 @@ public class SessionPreferences implements Serializable {
|
||||
}
|
||||
|
||||
public void updateCurrentTheme() {
|
||||
// TODO: Se podría guardar el tema seleccionado en base de datos para el usuario
|
||||
// (en caso de que esté logeado en el sistema
|
||||
// Muestra mensaje al usuario indicando que el tema se utilizará en esta sesión
|
||||
FacesContext.getCurrentInstance().addMessage(null,
|
||||
new FacesMessage(FacesMessage.SEVERITY_INFO, "Tema guardado", "El tema seleccionado será utilizado durante esta sesión."));
|
||||
}
|
||||
|
||||
@@ -17,14 +17,18 @@ public class SessionUtils {
|
||||
public static final String SESSION_VAR_USER = "loggedOnUser";
|
||||
public static final String SESSION_VAR_MESSAGE = "facesMessage";
|
||||
|
||||
public static HttpSession getSession() {
|
||||
public static HttpSession getSession(boolean create) {
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
if (ctx != null)
|
||||
return (HttpSession) ctx.getExternalContext().getSession(false);
|
||||
return (HttpSession) ctx.getExternalContext().getSession(create);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static HttpSession getSession() {
|
||||
return getSession(false);
|
||||
}
|
||||
|
||||
public static HttpServletRequest getRequest() {
|
||||
return (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
|
||||
}
|
||||
@@ -33,13 +37,19 @@ public class SessionUtils {
|
||||
return ((HttpServletRequest) request).getSession(false);
|
||||
}
|
||||
|
||||
public static void CreateSession(LoggedUserTO usr) {
|
||||
HttpSession ses = getSession();
|
||||
public static void createOrUpdateSession(LoggedUserTO usr) {
|
||||
createOrUpdateSession(getSession(true), usr);
|
||||
}
|
||||
|
||||
public static void createOrUpdateSession(HttpSession ses, LoggedUserTO usr) {
|
||||
if (ses == null)
|
||||
return;
|
||||
|
||||
ses.setAttribute(SessionUtils.SESSION_VAR_USERNAME, usr.getName());
|
||||
ses.setAttribute(SessionUtils.SESSION_VAR_USERID, usr.getId());
|
||||
ses.setAttribute(SessionUtils.SESSION_VAR_USERTYPE, usr.getUserType());
|
||||
ses.setAttribute(SessionUtils.SESSION_VAR_USER, usr);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DestroySession() {
|
||||
HttpSession ses = getSession();
|
||||
@@ -73,6 +83,16 @@ public class SessionUtils {
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getUserDisplayName() {
|
||||
HttpSession session = getSession();
|
||||
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USER) != null) {
|
||||
LoggedUserTO usr = LoggedUserTO.class.cast(session.getAttribute(SessionUtils.SESSION_VAR_USER));
|
||||
|
||||
return usr.getDisplayName();
|
||||
} else
|
||||
return "";
|
||||
}
|
||||
|
||||
public static UserType getUserType() {
|
||||
return getUserType(getSession());
|
||||
}
|
||||
|
||||
@@ -15,6 +15,13 @@ public class ValidationUtils {
|
||||
static final String NIF_LETTERS = "TRWAGMYFPDXBNJZSQVHLCKE";
|
||||
static final String NIE_LETTERS = "XYZ";
|
||||
|
||||
public static String normalizeNIF(String nif) {
|
||||
if (nif == null)
|
||||
return nif;
|
||||
else
|
||||
return nif.toUpperCase().replace("-", "").replace(".", "");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param nif NIF a validar
|
||||
@@ -24,7 +31,7 @@ public class ValidationUtils {
|
||||
if (nif == null)
|
||||
return false;
|
||||
|
||||
nif = nif.toUpperCase().replace("-", "").replace(".", "");
|
||||
nif = normalizeNIF(nif);
|
||||
|
||||
if (nif.length() < 2 || nif.length() > 9)
|
||||
return false;
|
||||
@@ -54,25 +61,21 @@ public class ValidationUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Comprueba si un NIF existe para un tipo de usuario. * No se permite que el
|
||||
* mismo NIF esté registrado como médico de familia y como especialista. * Se
|
||||
* permite que el mismo NIF esté registrado como paciente y como médico (de
|
||||
* familia o especialista)
|
||||
* Comprueba si un NIF existe para un tipo de usuario. * No se permite que el mismo NIF esté registrado como médico de familia y como especialista. * Se permite que el mismo
|
||||
* NIF esté registrado como paciente y como médico (de familia o especialista)
|
||||
*
|
||||
* @param remoteSvc Servicio Remoto para recuperar datos.
|
||||
* @param userType Tipo de usuario a comprobar
|
||||
* @param nif NIF a comprobar.
|
||||
* @param id Parámetro opcional, id del usuario actual (si encuentra el
|
||||
* mismo nif y el usuario coincide no se devuelve la
|
||||
* coincidencia)
|
||||
* @param id Parámetro opcional, id del usuario actual (si encuentra el mismo nif y el usuario coincide no se devuelve la coincidencia)
|
||||
* @return true si el NIF ya estaba registrado para un usuario diferente.
|
||||
*/
|
||||
public static boolean checkIfNifAlreadyRegistered(CommonFacadeRemote remoteSvc, UserType userType, String nif, Integer id) {
|
||||
boolean nifExists = false;
|
||||
|
||||
|
||||
if (userType == null || remoteSvc == null)
|
||||
return nifExists;
|
||||
|
||||
|
||||
switch (userType) {
|
||||
case ADMINISTRATOR:
|
||||
break;
|
||||
@@ -85,9 +88,9 @@ public class ValidationUtils {
|
||||
// para los especialistas
|
||||
SpecialistDoctorTO sd = remoteSvc.findSpecialistDoctorByNif(nif);
|
||||
|
||||
if (sd != null && (id == null || sd.getId() != id))
|
||||
if (sd != null && (id == null || sd.getId().equals(id) == false))
|
||||
nifExists = true;
|
||||
} else if (id == null || fd.getId() != id)
|
||||
} else if (id == null || fd.getId().equals(id) == false)
|
||||
// Si se trata de un usuario diferente, entonces está repetido
|
||||
nifExists = true;
|
||||
|
||||
@@ -96,7 +99,7 @@ public class ValidationUtils {
|
||||
PatientTO pat = remoteSvc.findPatientByNif(nif);
|
||||
|
||||
// Si se trata de un usuario diferente, entonces está repetido
|
||||
if (pat != null && (id == null || pat.getId() != id))
|
||||
if (pat != null && (id == null || pat.getId().equals(id) == false))
|
||||
nifExists = true;
|
||||
break;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import common.UserType;
|
||||
@@ -16,22 +16,23 @@ import common.UserType;
|
||||
*
|
||||
*/
|
||||
@Named("home")
|
||||
@RequestScoped
|
||||
@ViewScoped
|
||||
public class homeMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private boolean isLogedIn;
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String userDisplayName;
|
||||
private UserType userType;
|
||||
private int refresh;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
isLogedIn = SessionUtils.isLogedIn();
|
||||
userName = SessionUtils.getUserName();
|
||||
userId = SessionUtils.getUserId();
|
||||
userType = SessionUtils.getUserType();
|
||||
this.isLogedIn = SessionUtils.isLogedIn();
|
||||
this.userName = SessionUtils.getUserName();
|
||||
this.userDisplayName = SessionUtils.getUserDisplayName();
|
||||
this.userId = SessionUtils.getUserId();
|
||||
this.userType = SessionUtils.getUserType();
|
||||
|
||||
FacesMessage message = SessionUtils.getMessage();
|
||||
|
||||
@@ -54,6 +55,13 @@ public class homeMBean extends ManagedBeanBase implements Serializable {
|
||||
else
|
||||
return this.userName;
|
||||
}
|
||||
|
||||
public String getUserDisplayName() {
|
||||
if (this.isLogedIn == false)
|
||||
return "Invitado";
|
||||
else
|
||||
return this.userDisplayName;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
@@ -63,14 +71,6 @@ public class homeMBean extends ManagedBeanBase implements Serializable {
|
||||
return this.userType.getUserTypename();
|
||||
}
|
||||
|
||||
public int getRefresh() {
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public void setRefresh(int refresh) {
|
||||
this.refresh = refresh;
|
||||
}
|
||||
|
||||
public boolean isPatient() {
|
||||
return (this.userType == UserType.PATIENT);
|
||||
}
|
||||
|
||||
@@ -1,27 +1,347 @@
|
||||
package managedbean.medicalTest;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.event.AjaxBehaviorEvent;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import org.primefaces.event.FileUploadEvent;
|
||||
import org.primefaces.event.SelectEvent;
|
||||
import org.primefaces.model.DefaultStreamedContent;
|
||||
import org.primefaces.model.StreamedContent;
|
||||
import org.primefaces.model.UploadedFile;
|
||||
|
||||
@Named("MedicalTestMBean")
|
||||
@RequestScoped
|
||||
import TO.MedicalTestTO;
|
||||
import TO.PatientTO;
|
||||
import common.Constants;
|
||||
import common.MedicalTestType;
|
||||
import common.UserType;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@Named("mt")
|
||||
@ViewScoped
|
||||
public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int userID;
|
||||
private UserType userType;
|
||||
private List<MedicalTestTO> medicalTests;
|
||||
private MedicalTestTO selected;
|
||||
private PatientTO patSelected;
|
||||
private PatientTO patientFilterSelected;
|
||||
private boolean addNewMode = false;
|
||||
private UploadedFile imageUpload;
|
||||
private List<PatientTO> patientList;
|
||||
private List<PatientTO> patientWithTestList;
|
||||
private String lastUIQuery;
|
||||
private String lastUIQueryPatFilter;
|
||||
private List<MedicalTestType> medicalTestTypes;
|
||||
private LocalDate testDate;
|
||||
private LocalTime testTime;
|
||||
private String testObservations;
|
||||
private MedicalTestType testType;
|
||||
|
||||
public MedicalTestMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Inicialización de variables y propiedades van aquí.
|
||||
this.userType = SessionUtils.getUserType();
|
||||
this.userID = Integer.valueOf(SessionUtils.getUserId());
|
||||
|
||||
// Como realizar llamadas al EJB Remoto
|
||||
// this.getRemoteManagerSystemAdmin().MetodoEJB
|
||||
this.medicalTestTypes = new ArrayList<MedicalTestType>();
|
||||
this.medicalTestTypes.add(MedicalTestType.BLOOD_TEST);
|
||||
this.medicalTestTypes.add(MedicalTestType.CT_SCAN);
|
||||
this.medicalTestTypes.add(MedicalTestType.MAGNETIC_RESONANCE_IMAGING);
|
||||
|
||||
this.selected = null;
|
||||
this.patSelected = null;
|
||||
this.lastUIQuery = "";
|
||||
this.lastUIQueryPatFilter = "";
|
||||
|
||||
switch (userType) {
|
||||
case ADMINISTRATOR:
|
||||
case PATIENT:
|
||||
this.patientList = null;
|
||||
this.patientWithTestList = null;
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
this.patientList = this.getRemoteManagerCommon().listPatientsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForSpecialistDoctor(userID, null, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
this.patientList = null;
|
||||
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForFamilyDoctor(userID, null, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
|
||||
this.loadMedicalTests();
|
||||
}
|
||||
|
||||
public void uploadDataListener(FileUploadEvent event) {
|
||||
UploadedFile uploadedFile = event.getFile();
|
||||
// String fileName = uploadedFile.getFileName();
|
||||
String contentType = uploadedFile.getContentType();
|
||||
byte[] contents = uploadedFile.getContents();
|
||||
|
||||
if (contents != null && contents.length > 0) {
|
||||
this.selected.setHighresimage(String.format("data:%s;base64,%s", contentType, Base64.getEncoder().encodeToString(contents)));
|
||||
|
||||
this.getRemoteManagerMedicalTest().addImage(this.selected.getId(), this.selected.getHighresimage());
|
||||
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Imagen guardada", "La imagen se ha guardado correctamente.");
|
||||
} else {
|
||||
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() {
|
||||
return imageUpload;
|
||||
}
|
||||
|
||||
public void setImageUpload(UploadedFile imageUpload) {
|
||||
this.imageUpload = imageUpload;
|
||||
}
|
||||
|
||||
public void removeImage() {
|
||||
this.selected.setHighresimage(null);
|
||||
getRemoteManagerMedicalTest().removeImage(this.selected.getId());
|
||||
// this.loadMedicalTests();
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Imagen eliminada", "La imagen se ha eliminado correctamente.");
|
||||
}
|
||||
|
||||
public MedicalTestTO getSelected() {
|
||||
return this.selected;
|
||||
}
|
||||
|
||||
public void setSelected(MedicalTestTO selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public PatientTO getPatSelected() {
|
||||
return this.patSelected;
|
||||
}
|
||||
|
||||
public void setPatSelected(PatientTO s) {
|
||||
this.patSelected = s;
|
||||
}
|
||||
|
||||
public void loadMedicalTests() {
|
||||
Integer patId = -1;
|
||||
if (this.patientFilterSelected != null)
|
||||
patId = this.patientFilterSelected.getId();
|
||||
|
||||
switch (userType) {
|
||||
case PATIENT:
|
||||
// Cargar las pruebas para el paciente en sesión
|
||||
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForPatient(userID);
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
// Cargar las pruebas que el doctor especialista ha creado
|
||||
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForSpecialistDoctor(userID, patId);
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
// Cargar las pruebas para los pacientes del doctor de familia en sesión
|
||||
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForFamilyDoctor(userID, patId);
|
||||
break;
|
||||
case ADMINISTRATOR:
|
||||
this.medicalTests = null;
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Operación no válida para el tipo de usuario actual.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public List<PatientTO> completePatient(String query) {
|
||||
if (query != null && query.equals(this.lastUIQuery) == false) {
|
||||
this.lastUIQuery = query;
|
||||
// Recuperamos las xxx primeras coincidencias
|
||||
this.patientList = this.getRemoteManagerCommon().listPatientsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.patientList;
|
||||
}
|
||||
|
||||
public List<PatientTO> completePatientFilter(String query) {
|
||||
if (query != null && query.equals(this.lastUIQueryPatFilter) == false) {
|
||||
this.lastUIQueryPatFilter = query;
|
||||
|
||||
switch (userType) {
|
||||
case SPECIALIST_DOCTOR:
|
||||
// Cargar los pacientes a los que ha añadido pruebas médicas el médico especialista
|
||||
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForSpecialistDoctor(userID, query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
// Cargar los pacientes del médico de familia que tiene pruebas médicas hechas
|
||||
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForFamilyDoctor(userID, query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
break;
|
||||
case ADMINISTRATOR:
|
||||
case PATIENT:
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Operación no válida para el tipo de usuario actual.");
|
||||
this.patientWithTestList = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this.patientWithTestList;
|
||||
}
|
||||
|
||||
public List<PatientTO> getPatientList() {
|
||||
return patientList;
|
||||
}
|
||||
|
||||
public List<PatientTO> getPatientWithTestList() {
|
||||
return patientWithTestList;
|
||||
}
|
||||
|
||||
public List<MedicalTestTO> getMedicalTests() {
|
||||
return this.medicalTests;
|
||||
}
|
||||
|
||||
public void setMedicalTests(List<MedicalTestTO> list) {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
public boolean isSpecialistDoctor() {
|
||||
return this.userType == UserType.SPECIALIST_DOCTOR;
|
||||
}
|
||||
|
||||
public boolean isPatSelector() {
|
||||
return !(userType == UserType.PATIENT);
|
||||
}
|
||||
|
||||
public void clearFilteredPatient() {
|
||||
this.addNewMode = false;
|
||||
this.selected = null;
|
||||
this.patientFilterSelected = null;
|
||||
this.loadMedicalTests();
|
||||
}
|
||||
|
||||
public void onChangePatient(AjaxBehaviorEvent event) {
|
||||
this.selected = null;
|
||||
this.loadMedicalTests();
|
||||
}
|
||||
|
||||
public void onSelectPatient(SelectEvent event) {
|
||||
this.selected = null;
|
||||
this.patientFilterSelected = (PatientTO) event.getObject();
|
||||
this.loadMedicalTests();
|
||||
}
|
||||
|
||||
public void onSelectMT(SelectEvent event) {
|
||||
this.selected = (MedicalTestTO) event.getObject();
|
||||
this.addNewMode = false;
|
||||
}
|
||||
|
||||
public void addMT() {
|
||||
// Si hay un paciente filtrado en la busqueda de pruebas, lo seleccionamos para la prueba a añadir.
|
||||
// this.patSelected = this.patientFilterSelected;
|
||||
this.testDate = LocalDate.now();
|
||||
this.testTime = LocalTime.now();
|
||||
this.testObservations = "";
|
||||
this.testType = MedicalTestType.BLOOD_TEST;
|
||||
this.addNewMode = true;
|
||||
}
|
||||
|
||||
public boolean isAddNewMode() {
|
||||
return addNewMode;
|
||||
}
|
||||
|
||||
public void setAddNewMode(boolean addNewMode) {
|
||||
this.addNewMode = addNewMode;
|
||||
}
|
||||
|
||||
public boolean getViewCreate() {
|
||||
return addNewMode && userType == UserType.SPECIALIST_DOCTOR;
|
||||
}
|
||||
|
||||
public boolean getViewEdit() {
|
||||
return !addNewMode && this.selected != null;
|
||||
}
|
||||
|
||||
public List<MedicalTestType> getMedicalTestTypes() {
|
||||
return this.medicalTestTypes;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
try {
|
||||
|
||||
MedicalTestTO mt = this.getRemoteManagerMedicalTest().addMedicalTest(this.patSelected.getId(), this.userID, this.testDate, this.testTime, this.testType,
|
||||
this.testObservations);
|
||||
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Éxito", String.format("La prueba médica se ha guardado correctamente, el identificador asignado es: %d", mt.getId()));
|
||||
|
||||
// Volvemos al modo añadir (limpiamos el formulario).
|
||||
this.addMT();
|
||||
|
||||
this.loadMedicalTests();
|
||||
} catch (Exception ex) {
|
||||
this.manageException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public PatientTO getPatientFilterSelected() {
|
||||
return patientFilterSelected;
|
||||
}
|
||||
|
||||
public void setPatientFilterSelected(PatientTO patientFilterSelected) {
|
||||
this.patientFilterSelected = patientFilterSelected;
|
||||
}
|
||||
|
||||
public LocalDate getTestDate() {
|
||||
return testDate;
|
||||
}
|
||||
|
||||
public void setTestDate(LocalDate testDate) {
|
||||
this.testDate = testDate;
|
||||
}
|
||||
|
||||
public LocalTime getTestTime() {
|
||||
return testTime;
|
||||
}
|
||||
|
||||
public void setTestTime(LocalTime testTime) {
|
||||
this.testTime = testTime;
|
||||
}
|
||||
|
||||
public String getTestObservations() {
|
||||
return testObservations;
|
||||
}
|
||||
|
||||
public void setTestObservations(String testObservations) {
|
||||
this.testObservations = testObservations;
|
||||
}
|
||||
|
||||
public MedicalTestType getTestType() {
|
||||
return testType;
|
||||
}
|
||||
|
||||
public void setTestType(MedicalTestType testType) {
|
||||
this.testType = testType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
package managedbean.medicalTest;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.primefaces.model.LazyDataModel;
|
||||
import org.primefaces.model.SortOrder;
|
||||
|
||||
import TO.QuestionTO;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@Named("PendingQuestions")
|
||||
@ViewScoped
|
||||
public class PendingQuestionsMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int familyDoctorId;
|
||||
private LazyDataModel<QuestionTO> lazyDataModelQuestionList;
|
||||
|
||||
public PendingQuestionsMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Inicialización de variables y propiedades van aquí.
|
||||
this.familyDoctorId = Integer.valueOf(SessionUtils.getUserId());
|
||||
|
||||
this.lazyDataModelQuestionList = new LazyDataModel<QuestionTO>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public List<QuestionTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||
Long totalRowCount = getRemoteManagerMedicalTest().getPendingQuestionsCount(familyDoctorId);
|
||||
this.setRowCount(totalRowCount.intValue());
|
||||
|
||||
return getRemoteManagerMedicalTest().listPendingQuestionsPaged(familyDoctorId, (first / pageSize), pageSize);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public LazyDataModel<QuestionTO> getLazyDataModelQuestionList() {
|
||||
return lazyDataModelQuestionList;
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package managedbean.medicalTest;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.primefaces.event.SelectEvent;
|
||||
|
||||
import TO.QuestionTO;
|
||||
import common.QuestionStatus;
|
||||
import common.UserType;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@Named("Questions")
|
||||
@ViewScoped
|
||||
public class QuestionsMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int userID;
|
||||
private UserType userType;
|
||||
private List<QuestionTO> pendingQuestions;
|
||||
private QuestionTO selected;
|
||||
private boolean addNewMode;
|
||||
|
||||
public QuestionsMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Inicialización de variables y propiedades van aquí.
|
||||
this.userType = SessionUtils.getUserType();
|
||||
this.userID = Integer.valueOf(SessionUtils.getUserId());
|
||||
|
||||
this.addNewMode = false;
|
||||
this.selected = null;
|
||||
|
||||
this.loadQuestions();
|
||||
}
|
||||
|
||||
public List<QuestionTO> getPendingQuestions() {
|
||||
return pendingQuestions;
|
||||
}
|
||||
|
||||
public void setPendingQuestions(List<QuestionTO> value) {
|
||||
this.pendingQuestions = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cargará las preguntas enviadas al médico o escritas por el paciente, esto irá en función del tipo de usuario en sesión
|
||||
*/
|
||||
private void loadQuestions() {
|
||||
if (this.userType == UserType.FAMILY_DOCTOR) {
|
||||
// Listar las preguntas destinadas a él
|
||||
// El método disponible del API básico es referente al doctor
|
||||
this.pendingQuestions = getRemoteManagerMedicalTest().listAllPendingQuestions(userID);
|
||||
} else if (this.userType == UserType.PATIENT) {
|
||||
// Listar las preguntas realiadas por él
|
||||
// Para reutilizar la misma view, necesitaremos nuevos métodos para el API de
|
||||
// cara a recoger sus preguntas realizadas.
|
||||
this.pendingQuestions = getRemoteManagerMedicalTest().listAllMyQuestions(userID);
|
||||
}
|
||||
}
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
this.addNewMode = false;
|
||||
this.selected = (QuestionTO) event.getObject();
|
||||
}
|
||||
|
||||
public void onUnSelect(SelectEvent event) {
|
||||
this.selected = null;
|
||||
}
|
||||
|
||||
public void setSelected(QuestionTO selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public QuestionTO getSelected() {
|
||||
return this.selected;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
getRemoteManagerMedicalTest().answerQuestion(this.selected.getId(), this.selected.getResponse());
|
||||
this.loadQuestions();
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Datos guardados", "La respuesta se registrado correctamente en el sistema.");
|
||||
this.selected = null;
|
||||
}
|
||||
|
||||
public void create() {
|
||||
this.addNewMode = true;
|
||||
this.selected = new QuestionTO();
|
||||
this.selected.setId(-1);
|
||||
this.selected.setTitle("");
|
||||
this.selected.setMessage("");
|
||||
}
|
||||
|
||||
public void addNewQuestion() {
|
||||
String result = getRemoteManagerMedicalTest().askQuestion(userID, this.selected.getTitle(), this.selected.getMessage());
|
||||
if(result == "ok") {
|
||||
this.create();
|
||||
this.loadQuestions();
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Datos guardados", "La pregunta se registrado correctamente en el sistema.");
|
||||
} else {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Error", result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isShowPanelDetail() {
|
||||
return this.selected != null && this.addNewMode == false;
|
||||
}
|
||||
|
||||
public boolean isPatient() {
|
||||
return (this.userType == UserType.PATIENT);
|
||||
}
|
||||
|
||||
public boolean isFamilyDoctor() {
|
||||
return (this.userType == UserType.FAMILY_DOCTOR);
|
||||
}
|
||||
|
||||
public boolean isAddNewMode() {
|
||||
return addNewMode;
|
||||
}
|
||||
|
||||
public boolean isRespuestaEditable() {
|
||||
return (this.userType == UserType.FAMILY_DOCTOR && this.selected != null && this.selected.getStatus() == QuestionStatus.PENDING);
|
||||
}
|
||||
|
||||
public void setAddNewMode(boolean addNewMode) {
|
||||
this.addNewMode = addNewMode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package managedbean.medicalTest;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.primefaces.event.SelectEvent;
|
||||
import org.primefaces.model.LazyDataModel;
|
||||
import org.primefaces.model.SortOrder;
|
||||
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import common.Constants;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
@Named("sspec")
|
||||
@ViewScoped
|
||||
public class SearchSpecialistMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<MedicalSpecialtyTO> medicalSpecialtiesList;
|
||||
private MedicalSpecialtyTO medicalSpecialty;
|
||||
private String lastUIQueryMS;
|
||||
private LazyDataModel<SpecialistDoctorTO> lazyDataModelDoctorList;
|
||||
|
||||
public SearchSpecialistMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Inicialización de variables y propiedades van aquí.
|
||||
this.medicalSpecialtiesList = this.getRemoteManagerCommon().listMedicalSpecialtiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
this.medicalSpecialty = null;
|
||||
this.lastUIQueryMS = "";
|
||||
|
||||
this.lazyDataModelDoctorList = new LazyDataModel<SpecialistDoctorTO>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public List<SpecialistDoctorTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||
if (medicalSpecialty == null) {
|
||||
this.setRowCount(0);
|
||||
return null;
|
||||
} else {
|
||||
Long totalRowCount = getRemoteManagerMedicalTest().getSpecialistDoctorByMedicalSpecialtyCount(medicalSpecialty.getId());
|
||||
this.setRowCount(totalRowCount.intValue());
|
||||
|
||||
return getRemoteManagerMedicalTest().findSpecialistDoctorByMedicalSpecialty(medicalSpecialty.getId(), (first / pageSize), pageSize);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public LazyDataModel<SpecialistDoctorTO> getLazyDataModelDoctorList() {
|
||||
return lazyDataModelDoctorList;
|
||||
}
|
||||
|
||||
public List<MedicalSpecialtyTO> completeMedicalSpecialty(String query) {
|
||||
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
||||
this.lastUIQueryMS = query;
|
||||
// Recuperamos las 200 primeras coincidencias
|
||||
this.medicalSpecialtiesList = this.getRemoteManagerCommon().listMedicalSpecialtiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.medicalSpecialtiesList;
|
||||
}
|
||||
|
||||
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||
return medicalSpecialtiesList;
|
||||
}
|
||||
|
||||
public void setMedicalSpecialtiesList(List<MedicalSpecialtyTO> value) {
|
||||
this.medicalSpecialtiesList = value;
|
||||
}
|
||||
|
||||
public MedicalSpecialtyTO getMedicalSpecialty() {
|
||||
return medicalSpecialty;
|
||||
}
|
||||
|
||||
public void setMedicalSpecialty(MedicalSpecialtyTO medicalSpecialty) {
|
||||
this.medicalSpecialty = medicalSpecialty;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
/***
|
||||
* ManageBean que gestiona la vista para el cambio de médico de familia para un paciente
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
@@ -36,50 +37,77 @@ public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializ
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicializa el managed Bean
|
||||
*
|
||||
* Si el usuario logeado es nulo devuelve un error indicando que la sesión actual no es válida.
|
||||
*
|
||||
* Recupera el id del usuario actual desde la sesión. Dado que solo los pacientes pueden seleccionar un médico de familia, si el usuario es de otro tipo se muestra un mensaje
|
||||
* de error.
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Recuperamos el usuario logeado actual
|
||||
LoggedUserTO usr = null;
|
||||
this.lastUIQuery = "";
|
||||
try {
|
||||
usr = SessionUtils.getloggedOnUser();
|
||||
usr = SessionUtils.getloggedOnUser();
|
||||
|
||||
if (usr == null)
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||
else {
|
||||
this.id = Integer.valueOf(usr.getId());
|
||||
if (usr == null)
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida", "Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||
else {
|
||||
this.id = Integer.valueOf(usr.getId());
|
||||
|
||||
if (usr.getUserType() == UserType.PATIENT) {
|
||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
if (usr.getUserType() == UserType.PATIENT) {
|
||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
|
||||
PatientTO pat = this.getRemoteManagerCommon().findPatientById(this.id);
|
||||
this.setCurrentFamilyDoctor(pat.getFamilyDoctor());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
PatientTO pat = this.getRemoteManagerCommon().findPatientById(this.id);
|
||||
this.currentFamilyDoctor = pat.getFamilyDoctor();
|
||||
} else
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil no válido", "Su tipo de usuario no permite que pueda tener acceso a esta página.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve la lista de médicos de familia para el combo de selección.
|
||||
*
|
||||
* @return Lista de médicos de familia.
|
||||
*/
|
||||
public List<FamilyDoctorTO> getFamilyDoctorList() {
|
||||
return familyDoctorList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que permite relizar búsqueda de tipo "typeAhead" en la lista de selección de médico.
|
||||
*
|
||||
* Recibe como parámetro el testo tecleado por el usuario
|
||||
*
|
||||
* @param query Texto tecleado por el usuario
|
||||
* @return Retorna la lista de médicos de familia coincidentes con el termino buscado.
|
||||
*/
|
||||
public List<FamilyDoctorTO> completeFamilyDoctor(String query) {
|
||||
if (query != null && query.equals(this.lastUIQuery) == false) {
|
||||
this.lastUIQuery = query;
|
||||
// Recuperamos las 200 primeras coincidencias
|
||||
// Recuperamos las primeras ~30 coincidencias, según constante
|
||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.familyDoctorList;
|
||||
}
|
||||
|
||||
// Id del usuario actual, obtenido de la sessión del usuario logeado.
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que realiza la persistencia del cambio de médico de familia. a través de la invocación al método EJB correspondiente.
|
||||
*
|
||||
* Se realizan 2 comprobaciones adicionales:
|
||||
*
|
||||
* 1. Se ha seleccionado un nuevo médico de familia
|
||||
*
|
||||
* 2. El médico de familia nuevo es diferente al actual
|
||||
*
|
||||
*/
|
||||
public void saveData() {
|
||||
int error = 0;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
/***
|
||||
* ManagedBean que gestiona la vista para el cambio del centro de atención primaria para los médicos de familia
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
@@ -36,38 +37,46 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicializa el managed Bean.
|
||||
*
|
||||
* Si el usuario atual no se puede recupear de la sesión o si no es un perfil de tipo médicos de familia se muestra un mensaje de error.
|
||||
*
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Recuperamos el usuario logeado actual
|
||||
LoggedUserTO usr = null;
|
||||
this.lastUIQuery = "";
|
||||
|
||||
try {
|
||||
usr = SessionUtils.getloggedOnUser();
|
||||
|
||||
if (usr == null)
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||
else {
|
||||
this.id = Integer.valueOf(usr.getId());
|
||||
usr = SessionUtils.getloggedOnUser();
|
||||
|
||||
if (usr.getUserType() == UserType.FAMILY_DOCTOR) {
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
if (usr == null)
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida", "Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||
else {
|
||||
this.id = Integer.valueOf(usr.getId());
|
||||
|
||||
FamilyDoctorTO fd = this.getRemoteManagerCommon().findFamilyDoctorById(this.id);
|
||||
this.setCurrentCenter(fd.getPrimaryHealthCareCenter());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
if (usr.getUserType() == UserType.FAMILY_DOCTOR) {
|
||||
// Recupera la lista de CAPs inicial desde el EJB.
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
|
||||
FamilyDoctorTO fd = this.getRemoteManagerCommon().findFamilyDoctorById(this.id);
|
||||
this.setCurrentCenter(fd.getPrimaryHealthCareCenter());
|
||||
} else
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil no válido", "Su tipo de usuario no permite que pueda tener acceso a esta página.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
||||
return primaryHealthCareCentersList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Método que implementa la búsqueda de un CAP a través del termino tecleado por el usuario en la lista de selección
|
||||
*
|
||||
* @param query Termino tecleado por el usuario
|
||||
* @return Lista de CAPs que coinciden con el termino búscado por el usuario.
|
||||
*/
|
||||
public List<PrimaryHealthCareCenterTO> completePrimaryHealCareCenter(String query) {
|
||||
if (query != null && query.equals(this.lastUIQuery) == false) {
|
||||
this.lastUIQuery = query;
|
||||
@@ -75,22 +84,30 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.primaryHealthCareCentersList;
|
||||
}
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que realiza el guardado de los cambios a través de la invocación del método del EJB correspondiente.
|
||||
*
|
||||
* El método realiza dos verificaciones previas: Que se haya seleccionado un CAP y que este sea diferente del asignado actualmente.
|
||||
*
|
||||
*/
|
||||
public void saveData() {
|
||||
int error = 0;
|
||||
|
||||
if (this.getNewCenter() == null) {
|
||||
this.addFacesMessage("frmChangePHCC:newCenter", FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un nuevvo centro de atención primaria.");
|
||||
this.addFacesMessage("frmChangePHCC:newCenter", FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado",
|
||||
"Por favor, especifique un nuevvo centro de atención primaria.");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (this.getNewCenter().getName().equals(this.getCurrentCenter().getName())) {
|
||||
this.addFacesMessage("frmChangePHCC:newCenter", FacesMessage.SEVERITY_WARN, "El centro de atención primeria debe ser diferente", "Por favor, seleccione un centro de atención primaria diferente al cual está actualmente asignado.");
|
||||
this.addFacesMessage("frmChangePHCC:newCenter", FacesMessage.SEVERITY_WARN, "El centro de atención primeria debe ser diferente",
|
||||
"Por favor, seleccione un centro de atención primaria diferente al cual está actualmente asignado.");
|
||||
error++;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.ValidationUtils;
|
||||
|
||||
/**
|
||||
* ManagedBEan que gestiona el registro de usuarios: Usuarios de tipo "Paciente"
|
||||
* Usuarios de tipo "Médico de Familia" usuarios de tipo "Médico especialista"
|
||||
* ManagedBEan que gestiona el registro de usuarios: Usuarios de tipo "Paciente" Usuarios de tipo "Médico de Familia" usuarios de tipo "Médico especialista"
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
@@ -35,7 +34,6 @@ import managedbean.common.ValidationUtils;
|
||||
public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private int id;
|
||||
private String cipCode;
|
||||
private String nif;
|
||||
private String name;
|
||||
@@ -52,13 +50,18 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
private UserType userType;
|
||||
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||
private MedicalSpecialtyTO medicalSpecialty;
|
||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||
private List<MedicalSpecialtyTO> medicalSpecialtiesList;
|
||||
private List<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
||||
|
||||
public RegisterUserMBean() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicializa el managedBean actual.
|
||||
*
|
||||
* Carga los tipos de usuario disponibles. Carga la lista de CAPs. Carga la lista de especialidades médicas.
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.availableUserTypes = new ArrayList<UserType>();
|
||||
@@ -71,7 +74,7 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -79,37 +82,46 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
return availableUserTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gestiona el evento de cambio de tipo de usuario. El usuario que está intentando registrarse en el sistema ha cambiado el tipo de perfil (usuario) con el cual desea
|
||||
* registrarse.
|
||||
*
|
||||
*/
|
||||
public void onUserTypeChange() {
|
||||
switch (this.userType) {
|
||||
case SPECIALIST_DOCTOR:
|
||||
try {
|
||||
PrimeFaces.current().ajax().addCallbackParam("specs", true);
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
// 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.
|
||||
PrimeFaces.current().ajax().addCallbackParam("specs", true);
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
try {
|
||||
PrimeFaces.current().ajax().addCallbackParam("caps", true);
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
// 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.
|
||||
PrimeFaces.current().ajax().addCallbackParam("caps", true);
|
||||
break;
|
||||
case ADMINISTRATOR:
|
||||
case PATIENT:
|
||||
// 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 ocultará la lista de selección de CAP o Especialidad médica
|
||||
PrimeFaces.current().ajax().addCallbackParam("pats", true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||
return medicalSpecialitiesList;
|
||||
return medicalSpecialtiesList;
|
||||
}
|
||||
|
||||
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
||||
return primaryHealthCareCentersList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que implementa la búsqueda de un CAP a través del termino tecleado por el usuario en la lista de selección
|
||||
*
|
||||
* @param query Termino tecleado por el usuario
|
||||
* @return Lista de CAPs que coinciden con el termino búscado por el usuario.
|
||||
*/
|
||||
public List<PrimaryHealthCareCenterTO> completePrimaryHealCareCenter(String query) {
|
||||
if (query != null && query.equals(this.lastUIQueryPH) == false) {
|
||||
this.lastUIQueryPH = query;
|
||||
@@ -119,23 +131,28 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
return this.primaryHealthCareCentersList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que implementa la búsqueda de una especialidad a través del termino tecleado por el usuario en la lista de selección
|
||||
*
|
||||
* @param query Termino tecleado por el usuario
|
||||
* @return Lista de especialidades que coinciden con el termino búscado por el usuario.
|
||||
*/
|
||||
public List<MedicalSpecialtyTO> completeMedicalSpecialty(String query) {
|
||||
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
||||
this.lastUIQueryMS = query;
|
||||
// Recuperamos las 200 primeras coincidencias
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
this.medicalSpecialtiesList = this.getRemoteManagerCommon().listMedicalSpecialtiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.medicalSpecialitiesList;
|
||||
return this.medicalSpecialtiesList;
|
||||
}
|
||||
|
||||
public void hadleNIFValueChange() {
|
||||
boolean isDupe = false;
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*
|
||||
* Un Médico puede estar registrado como paciente con el mismo NIF, pero como médico de familia y especialista al mismo tiempo.
|
||||
*/
|
||||
public boolean checkNIFDuplicated(String nifValue, UserType userType) {
|
||||
return ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), userType, nifValue, null);
|
||||
}
|
||||
|
||||
public boolean isPatient() {
|
||||
@@ -194,11 +211,29 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
this.nif = nif;
|
||||
}
|
||||
|
||||
public void addNewUser() {
|
||||
/**
|
||||
* Método que realiza la persistencia de los datos en la base de datos a través de la invocación de los métodos del EJB correspondiente.
|
||||
*
|
||||
* Se realizan comprobaciones adicionales para asegurar que:
|
||||
*
|
||||
* Si el tipo de usuario que se está registrando es un méidco de familia, obliga a seleccionar un CAP para el usuario.
|
||||
*
|
||||
* Si el tipo de usuario que está registrando es un médico especialista, obliga a seleccionar una especialidad médica al usuario.
|
||||
*
|
||||
* Si el tipo de usuario que está registrando es un paciente, no obliga a seleccionar un médicos de familia (puede ser nulo) será necesario que el usuario lo seleccione a
|
||||
* posteriori, una vez logeado en el sistema, a través de la opción de menú correspondiente.
|
||||
*
|
||||
* No se permite el registro de administradores a través de la página de registro pública.
|
||||
*
|
||||
*/
|
||||
public void addNewUser() throws Exception {
|
||||
int error = 0;
|
||||
|
||||
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
||||
|
||||
if (this.isFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||
this.addFacesMessage("frmRegisterUser:selPHC", FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria.");
|
||||
this.addFacesMessage("frmRegisterUser:selPHC", FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado",
|
||||
"Por favor, especifique un centro de atención primaria.");
|
||||
error++;
|
||||
}
|
||||
if (this.isSpecialistDoctor() && this.medicalSpecialty == null) {
|
||||
@@ -209,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.");
|
||||
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");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (error == 0) {
|
||||
try {
|
||||
switch (this.userType) {
|
||||
case PATIENT:
|
||||
PatientTO pat = this.getRemoteManagerProfile().registerPatient(id, nif, name, surname, password, email);
|
||||
this.cipCode = pat.getPersonalIdentificationCode();
|
||||
switch (this.userType) {
|
||||
case PATIENT:
|
||||
PatientTO pat = this.getRemoteManagerProfile().registerPatient(nif, name, surname, password, email);
|
||||
this.cipCode = pat.getPersonalIdentificationCode();
|
||||
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
FamilyDoctorTO fd = this.getRemoteManagerProfile().registerFamilyDoctor(id, nif, name, surname, password, email, this.primaryHealthCareCenter);
|
||||
this.cipCode = fd.getProfessionalNumber();
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
FamilyDoctorTO fd = this.getRemoteManagerProfile().registerFamilyDoctor(nif, name, surname, password, email, this.primaryHealthCareCenter);
|
||||
this.cipCode = fd.getProfessionalNumber();
|
||||
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
SpecialistDoctorTO sd = this.getRemoteManagerProfile().registerSpecialistDoctor(id, nif, name, surname, password, email, this.medicalSpecialty);
|
||||
this.cipCode = sd.getProfessionalNumber();
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
SpecialistDoctorTO sd = this.getRemoteManagerProfile().registerSpecialistDoctor(nif, name, surname, password, email, this.medicalSpecialty);
|
||||
this.cipCode = sd.getProfessionalNumber();
|
||||
|
||||
break;
|
||||
case ADMINISTRATOR:
|
||||
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);
|
||||
break;
|
||||
case ADMINISTRATOR:
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@ import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
import javax.resource.NotSupportedException;
|
||||
|
||||
import org.primefaces.PrimeFaces;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.LoggedUserTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
@@ -26,8 +24,7 @@ import managedbean.common.SessionUtils;
|
||||
import managedbean.common.ValidationUtils;
|
||||
|
||||
/**
|
||||
* ManagedBEan que gestiona el registro de usuarios: Usuarios de tipo "Paciente"
|
||||
* Usuarios de tipo "Médico de Familia" usuarios de tipo "Médico especialista"
|
||||
* ManagedBEan que gestiona el registro de usuarios: Usuarios de tipo "Paciente" Usuarios de tipo "Médico de Familia" usuarios de tipo "Médico especialista"
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
@@ -55,7 +52,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
private UserType userType;
|
||||
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||
private MedicalSpecialtyTO medicalSpecialty;
|
||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||
private List<MedicalSpecialtyTO> medicalSpecialtiesList;
|
||||
private List<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
||||
private FamilyDoctorTO familyDoctor;
|
||||
private List<FamilyDoctorTO> familyDoctorList;
|
||||
@@ -64,6 +61,12 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicializa el Bean:
|
||||
*
|
||||
* Carga la lsita de tipos de usuario (perfiles) Recupera los datos del usuario logeado actualmente, y los asigna a las propiedades del managedBean.
|
||||
*
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.userTypes = new ArrayList<UserType>();
|
||||
@@ -75,40 +78,39 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
|
||||
// Recuperamos el usuario logeado actual
|
||||
LoggedUserTO usr = null;
|
||||
try {
|
||||
usr = SessionUtils.getloggedOnUser();
|
||||
usr = SessionUtils.getloggedOnUser();
|
||||
|
||||
if (usr == null)
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||
else {
|
||||
this.userType = usr.getUserType();
|
||||
this.id = Integer.valueOf(usr.getId());
|
||||
if (usr == null)
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida", "Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||
else {
|
||||
this.userType = usr.getUserType();
|
||||
this.id = Integer.valueOf(usr.getId());
|
||||
|
||||
switch (usr.getUserType()) {
|
||||
case PATIENT:
|
||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
this.setPatientData(this.getRemoteManagerCommon().findPatientById(this.id));
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
this.setSpecialistDoctorData(this.getRemoteManagerCommon().findSpecialistDoctorById(this.id));
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
this.setFamilyDoctorData(this.getRemoteManagerCommon().findFamilyDoctorById(this.id));
|
||||
break;
|
||||
case ADMINISTRATOR:
|
||||
// TODO: Recuperar usuario administrador para editar su perfil ¿?
|
||||
// this.getRemoteManagerProfile().retrievePatient(usr.getId());
|
||||
break;
|
||||
}
|
||||
switch (usr.getUserType()) {
|
||||
case PATIENT:
|
||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
this.setPatientData(this.getRemoteManagerCommon().findPatientById(this.id));
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
this.medicalSpecialtiesList = this.getRemoteManagerCommon().listMedicalSpecialtiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
this.setSpecialistDoctorData(this.getRemoteManagerCommon().findSpecialistDoctorById(this.id));
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
this.setFamilyDoctorData(this.getRemoteManagerCommon().findFamilyDoctorById(this.id));
|
||||
break;
|
||||
case ADMINISTRATOR:
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Establece los valores de las propiedades del managedBean a partir de los datos de un Transfer Object de un paciente
|
||||
*
|
||||
* @param pat Paciente que está editando su perfil, y cuyos datos deben mostrarse en la vista.
|
||||
*/
|
||||
private void setPatientData(PatientTO pat) {
|
||||
this.id = pat.getId();
|
||||
this.cipCode = pat.getPersonalIdentificationCode();
|
||||
@@ -120,6 +122,11 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
this.familyDoctor = pat.getFamilyDoctor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Establece los valores de las propiedades del managedBean a partir de los datos de un Transfer Object de un médico de familia
|
||||
*
|
||||
* @param fd FamilyDoctor que está editando su perfil, y cuyos datos deben mostrarse en la vista.
|
||||
*/
|
||||
private void setFamilyDoctorData(FamilyDoctorTO fd) {
|
||||
this.id = fd.getId();
|
||||
this.cipCode = fd.getProfessionalNumber();
|
||||
@@ -131,6 +138,11 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
this.primaryHealthCareCenter = fd.getPrimaryHealthCareCenter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Establece los valores de las propiedades del managedBean a partir de los datos de un Transfer Object de un médico especialista
|
||||
*
|
||||
* @param sd SpecialistDoctor que está editando su perfil, y cuyos datos deben mostrarse en la vista.
|
||||
*/
|
||||
private void setSpecialistDoctorData(SpecialistDoctorTO sd) {
|
||||
this.id = sd.getId();
|
||||
this.cipCode = sd.getProfessionalNumber();
|
||||
@@ -147,45 +159,62 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
}
|
||||
|
||||
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||
return medicalSpecialitiesList;
|
||||
return medicalSpecialtiesList;
|
||||
}
|
||||
|
||||
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
||||
return primaryHealthCareCentersList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que implementa la búsqueda de un CAP a través del termino tecleado por el usuario en la lista de selección
|
||||
*
|
||||
* @param query Termino tecleado por el usuario
|
||||
* @return Lista de CAPs que coinciden con el termino búscado por el usuario.
|
||||
*/
|
||||
public List<PrimaryHealthCareCenterTO> completePrimaryHealCareCenter(String query) {
|
||||
if (query != null && query.equals(this.lastUIQueryPH) == false) {
|
||||
this.lastUIQueryPH = query;
|
||||
// Recuperamos las 200 primeras coincidencias
|
||||
// Recuperamos las XXX primeras coincidencias
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.primaryHealthCareCentersList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que implementa la búsqueda de una especialidad a través del termino tecleado por el usuario en la lista de selección
|
||||
*
|
||||
* @param query Termino tecleado por el usuario
|
||||
* @return Lista de especialidades que coinciden con el termino búscado por el usuario.
|
||||
*/
|
||||
public List<MedicalSpecialtyTO> completeMedicalSpecialty(String query) {
|
||||
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
||||
this.lastUIQueryMS = query;
|
||||
// Recuperamos las 200 primeras coincidencias
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
// Recuperamos las XXX primeras coincidencias
|
||||
this.medicalSpecialtiesList = this.getRemoteManagerCommon().listMedicalSpecialtiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.medicalSpecialitiesList;
|
||||
return this.medicalSpecialtiesList;
|
||||
}
|
||||
|
||||
public void hadleNIFValueChange() {
|
||||
boolean isDupe = false;
|
||||
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);
|
||||
/**
|
||||
* 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).
|
||||
*
|
||||
* Un Médico puede estar registrado como paciente con el mismo NIF, pero como médico de familia y especialista al mismo tiempo.
|
||||
*/
|
||||
public boolean checkNIFDuplicated(String nifValue, UserType userType, Integer userId) {
|
||||
return ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), userType, nifValue, userId);
|
||||
}
|
||||
|
||||
|
||||
public List<FamilyDoctorTO> getFamilyDoctorList() {
|
||||
return familyDoctorList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Método que implementa la búsqueda de un médico de familia a través del termino tecleado por el usuario en la lista de selección
|
||||
*
|
||||
* @param query Termino tecleado por el usuario
|
||||
* @return Lista de médicos de familia que coinciden con el termino búscado por el usuario.
|
||||
*/
|
||||
public List<FamilyDoctorTO> completeFamilyDoctor(String query) {
|
||||
if (query != null && query.equals(this.lastUIQueryFD) == false) {
|
||||
this.lastUIQueryFD = query;
|
||||
@@ -255,64 +284,86 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* Después de guardar los datos, se actualizan los datos guardados en la sesión actual para reflejar un posible cambio de nombre y/o apellidos.
|
||||
*/
|
||||
public void saveData() {
|
||||
int error = 0;
|
||||
|
||||
|
||||
// Si no hay tipo de usuario, es que algo raro ha pasado (sesión caducada?). salimos.
|
||||
if (this.userType == null)
|
||||
return;
|
||||
|
||||
boolean changePassword = (this.oldPassword != null && this.oldPassword.equals("") == false) || (this.password != null && this.password.equals("") == false);
|
||||
|
||||
if (this.isUserTypeFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria.");
|
||||
error++;
|
||||
}
|
||||
if (this.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.");
|
||||
try {
|
||||
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
||||
|
||||
boolean changePassword = (this.oldPassword != null && this.oldPassword.equals("") == false) || (this.password != null && this.password.equals("") == false);
|
||||
|
||||
if (this.userType == UserType.ADMINISTRATOR) {
|
||||
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 (error == 0) {
|
||||
try {
|
||||
if (this.isUserTypeFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria.");
|
||||
error++;
|
||||
}
|
||||
if (this.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;
|
||||
switch (this.userType) {
|
||||
case PATIENT:
|
||||
PatientTO pat = this.getRemoteManagerProfile().updatePatientData(id, nif, name, surname, password, email);
|
||||
this.setPatientData(pat);
|
||||
usr = new LoggedUserTO(pat.getId().toString(), pat.getName(), pat.getPassword(), this.userType, pat.getDisplayName());
|
||||
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
FamilyDoctorTO fd = this.getRemoteManagerProfile().updateFamilyDoctorData(id, nif, name, surname, password, email, this.primaryHealthCareCenter);
|
||||
this.setFamilyDoctorData(fd);
|
||||
usr = new LoggedUserTO(fd.getId().toString(), fd.getName(), fd.getPassword(), this.userType, fd.getDisplayName());
|
||||
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
SpecialistDoctorTO sd = this.getRemoteManagerProfile().updateSpecialistDoctorData(id, nif, name, surname, password, email, this.medicalSpecialty);
|
||||
this.setSpecialistDoctorData(sd);
|
||||
usr = new LoggedUserTO(sd.getId().toString(), sd.getName(), sd.getPassword(), this.userType, sd.getDisplayName());
|
||||
|
||||
break;
|
||||
case ADMINISTRATOR:
|
||||
throw new NotSupportedException("No se soporta la edición de perfiles de tipo administrador.");
|
||||
break;
|
||||
}
|
||||
|
||||
if (changePassword == true) {
|
||||
@@ -321,10 +372,13 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
||||
this.oldPassword = "";
|
||||
}
|
||||
|
||||
// Actualizamos la sessión del usuario actual por si ha cambiado el nombre de usuario.
|
||||
SessionUtils.createOrUpdateSession(usr);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package managedbean.systemAdmin;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.primefaces.model.LazyDataModel;
|
||||
import org.primefaces.model.SortOrder;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import common.Constants;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
@Named("listDoctors")
|
||||
@ViewScoped
|
||||
public class ListDoctorsByCenterMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<PrimaryHealthCareCenterTO> primaryHealthCareCenterList;
|
||||
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||
private String lastUIQueryPH;
|
||||
private LazyDataModel<FamilyDoctorTO> lazyDataModelDoctorList;
|
||||
|
||||
public ListDoctorsByCenterMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.primaryHealthCareCenterList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
this.primaryHealthCareCenter = null;
|
||||
this.lastUIQueryPH = "";
|
||||
|
||||
this.lazyDataModelDoctorList = new LazyDataModel<FamilyDoctorTO>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public List<FamilyDoctorTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||
if (primaryHealthCareCenter == null) {
|
||||
this.setRowCount(0);
|
||||
return null;
|
||||
} else {
|
||||
Long totalRowCount = getRemoteManagerSystemAdmin().getFamilyDoctorsByCAPCount(primaryHealthCareCenter.getId());
|
||||
this.setRowCount(totalRowCount.intValue());
|
||||
|
||||
return getRemoteManagerSystemAdmin().listAllFamilyDoctorsByCAPPaged(primaryHealthCareCenter.getId(), (first / pageSize), pageSize);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public LazyDataModel<FamilyDoctorTO> getLazyDataModelDoctorList() {
|
||||
return lazyDataModelDoctorList;
|
||||
}
|
||||
|
||||
public List<PrimaryHealthCareCenterTO> completePrimaryHealCareCenter(String query) {
|
||||
if (query != null && query.equals(this.lastUIQueryPH) == false) {
|
||||
this.lastUIQueryPH = query;
|
||||
this.primaryHealthCareCenterList = this.getRemoteManagerCommon().listCAPsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.primaryHealthCareCenterList;
|
||||
}
|
||||
|
||||
public List<PrimaryHealthCareCenterTO> getPrimaryHealthCareCenterList() {
|
||||
return primaryHealthCareCenterList;
|
||||
}
|
||||
|
||||
public void setPrimaryHealthCareCenterList(List<PrimaryHealthCareCenterTO> value) {
|
||||
this.primaryHealthCareCenterList = value;
|
||||
}
|
||||
|
||||
public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() {
|
||||
return primaryHealthCareCenter;
|
||||
}
|
||||
|
||||
public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterTO value) {
|
||||
this.primaryHealthCareCenter = value;
|
||||
}
|
||||
|
||||
public Long getPatientsByDoctor(int familyDoctorId) {
|
||||
return getRemoteManagerSystemAdmin().getPatientCount(familyDoctorId);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package managedbean.systemAdmin;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.inject.Named;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.primefaces.PrimeFaces;
|
||||
|
||||
@@ -45,26 +46,26 @@ public class LoginMBean extends ManagedBeanBase {
|
||||
|
||||
if (usr != null) {
|
||||
loggedIn = true;
|
||||
SessionUtils.CreateSession(usr);
|
||||
SessionUtils.createOrUpdateSession(usr);
|
||||
|
||||
this.addFacesMessageKeep(FacesMessage.SEVERITY_INFO, "Login correcto", "Bienvenido " + usr.getName());
|
||||
viewRedirect = "/home?faces-redirect=true";
|
||||
} else
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "El usuario o la contraseña son incorrectos");
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Login Error", "El usuario o la contraseña son incorrectos");
|
||||
} catch (Exception ex) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_FATAL, "Error fatal", ex.getMessage());
|
||||
}
|
||||
|
||||
} else
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "El usuario o la contraseña son incorrectos");
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Login Error", "El usuario o la contraseña son incorrectos");
|
||||
|
||||
PrimeFaces.current().ajax().addCallbackParam("loggedIn", loggedIn);
|
||||
return viewRedirect;
|
||||
}
|
||||
|
||||
|
||||
// logout event, invalidate session
|
||||
public String logout() {
|
||||
this.addFacesMessageKeep(FacesMessage.SEVERITY_INFO, "Sessión cerrada", "Ha cerrado correctament su ssesión. Hasta la vista");
|
||||
this.addFacesMessageKeep(FacesMessage.SEVERITY_INFO, "Sesión cerrada", "Ha cerrado correctamente su sesión. Hasta la vista");
|
||||
|
||||
SessionUtils.DestroySession();
|
||||
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
package managedbean.systemAdmin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.primefaces.event.RowEditEvent;
|
||||
import org.primefaces.model.LazyDataModel;
|
||||
import org.primefaces.model.SortOrder;
|
||||
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
@Named("ManageHealthCareCenters")
|
||||
@ViewScoped
|
||||
public class ManageHealthCareCentersMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String location;
|
||||
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||
private LazyDataModel<PrimaryHealthCareCenterTO> lazyDataModelCAPsList;
|
||||
|
||||
public ManageHealthCareCentersMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.lazyDataModelCAPsList = new LazyDataModel<PrimaryHealthCareCenterTO>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public List<PrimaryHealthCareCenterTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||
Long totalRowCount = getRemoteManagerSystemAdmin().getCAPCount();
|
||||
this.setRowCount(totalRowCount.intValue());
|
||||
|
||||
return getRemoteManagerCommon().listCAPsPaged((first / pageSize), pageSize);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public LazyDataModel<PrimaryHealthCareCenterTO> getlazyDataModelCAPsList() {
|
||||
return lazyDataModelCAPsList;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
private void showPrimaryHealthCareCenterData(PrimaryHealthCareCenterTO cap) {
|
||||
this.primaryHealthCareCenter = cap;
|
||||
|
||||
if (cap == null) {
|
||||
this.id = null;
|
||||
this.name = "";
|
||||
this.location = "";
|
||||
} else {
|
||||
this.id = cap.getId();
|
||||
this.name = cap.getName();
|
||||
this.location = cap.getLocation();
|
||||
}
|
||||
}
|
||||
|
||||
public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() {
|
||||
return primaryHealthCareCenter;
|
||||
}
|
||||
|
||||
public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterTO value) {
|
||||
this.primaryHealthCareCenter = value;
|
||||
}
|
||||
|
||||
public void onRowEdit(RowEditEvent event) {
|
||||
int error = 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.");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (newLocation == null || newLocation.trim().length() == 0) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Localización no rellena", "Por favor, escriba una localización.");
|
||||
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) {
|
||||
try {
|
||||
this.getRemoteManagerSystemAdmin().updateHealthCareCenter(((PrimaryHealthCareCenterTO) event.getObject()).getId(),
|
||||
((PrimaryHealthCareCenterTO) event.getObject()).getName(), ((PrimaryHealthCareCenterTO) event.getObject()).getLocation());
|
||||
|
||||
this.showPrimaryHealthCareCenterData(null);
|
||||
|
||||
FacesMessage msg = new FacesMessage("CAP editado", ((PrimaryHealthCareCenterTO) event.getObject()).getName());
|
||||
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onRowCancel(RowEditEvent event) {
|
||||
FacesMessage msg = new FacesMessage("Edición cancelada", ((PrimaryHealthCareCenterTO) event.getObject()).getName());
|
||||
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||
}
|
||||
|
||||
public void deleteDataById(Integer id) throws IOException {
|
||||
int error = 0;
|
||||
try {
|
||||
if (this.getRemoteManagerSystemAdmin().getFamilyDoctorsByCAPCount(id) > 0) {
|
||||
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++;
|
||||
}
|
||||
|
||||
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) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void insertData() {
|
||||
int error = 0;
|
||||
|
||||
if (name == null || name.trim().length() == 0) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre para el centro.");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (location == null || location.trim().length() == 0) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Localización no rellena", "Por favor, escriba una localización.");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (this.getRemoteManagerSystemAdmin().findHealthCareCenterByName(name) != null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "CAP ya existente", "El CAP ya se encuentra en la base de datos");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (error == 0) {
|
||||
try {
|
||||
this.getRemoteManagerSystemAdmin().insertHealthCareCenter(name, location);
|
||||
this.showPrimaryHealthCareCenterData(null);
|
||||
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos del Centro de Atención Primaria se han guardado correctamente.");
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +1,56 @@
|
||||
package managedbean.systemAdmin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
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.faces.view.ViewScoped;
|
||||
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 common.Constants;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@Named("ManageSpecialities")
|
||||
@RequestScoped
|
||||
@ViewScoped
|
||||
public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String description;
|
||||
private MedicalSpecialtyTO medicalSpecialty;
|
||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||
private LazyDataModel<MedicalSpecialtyTO> lazyDataModelSpecialtiesList;
|
||||
|
||||
public ManageSpecialitiesMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
if (this.medicalSpecialty == null) {
|
||||
this.medicalSpecialty = new MedicalSpecialtyTO();
|
||||
}
|
||||
// Recuperamos el usuario logeado actual
|
||||
LoggedUserTO usr = null;
|
||||
try {
|
||||
usr = SessionUtils.getloggedOnUser();
|
||||
this.lazyDataModelSpecialtiesList = new LazyDataModel<MedicalSpecialtyTO>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
if (usr == null)
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||
else {
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
@Override
|
||||
public List<MedicalSpecialtyTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||
Long totalRowCount = getRemoteManagerSystemAdmin().getSpecialtiesCount();
|
||||
this.setRowCount(totalRowCount.intValue());
|
||||
|
||||
return getRemoteManagerCommon().listMedicalSpecialtiesPaged((first / pageSize), pageSize);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public LazyDataModel<MedicalSpecialtyTO> getlazyDataModelSpecialtiesList() {
|
||||
return lazyDataModelSpecialtiesList;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -57,7 +60,7 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -65,7 +68,7 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
@@ -74,14 +77,18 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
private void setSpecialtyData(MedicalSpecialtyTO ms) {
|
||||
this.id = ms.getId();
|
||||
this.name = ms.getName();
|
||||
this.description = ms.getDescription();
|
||||
}
|
||||
|
||||
public List<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||
return medicalSpecialitiesList;
|
||||
private void showSpecialtyData(MedicalSpecialtyTO ms) {
|
||||
this.medicalSpecialty = ms;
|
||||
|
||||
if (ms == null) {
|
||||
this.id = null;
|
||||
this.name = "";
|
||||
this.description = "";
|
||||
} else {
|
||||
this.id = ms.getId();
|
||||
this.name = ms.getName();
|
||||
this.description = ms.getDescription();
|
||||
}
|
||||
}
|
||||
|
||||
public MedicalSpecialtyTO getMedicalSpecialty() {
|
||||
@@ -92,51 +99,67 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
||||
this.medicalSpecialty = value;
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
public void onRowEdit(RowEditEvent event) {
|
||||
int error = 0;
|
||||
|
||||
if (this.medicalSpecialty.getName() == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre de especialidad.");
|
||||
String newName = ((MedicalSpecialtyTO) event.getObject()).getName();
|
||||
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++;
|
||||
}
|
||||
if (this.medicalSpecialty.getDescription() == null) {
|
||||
|
||||
if (newDescription == null || newDescription.trim().length() == 0) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Descripción no rellena", "Por favor, escriba una descripción.");
|
||||
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) {
|
||||
try {
|
||||
MedicalSpecialtyTO ms = this.getRemoteManagerSystemAdmin().updateSpecialtyData(this.medicalSpecialty.getId(), this.medicalSpecialty.getName(), this.medicalSpecialty.getDescription());
|
||||
this.setSpecialtyData(ms);
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos de la especialidad se han guardado correctamente.");
|
||||
this.getRemoteManagerSystemAdmin().updateSpecialty(((MedicalSpecialtyTO) event.getObject()).getId(),
|
||||
((MedicalSpecialtyTO) event.getObject()).getName(), ((MedicalSpecialtyTO) event.getObject()).getDescription());
|
||||
|
||||
this.showSpecialtyData(null);
|
||||
|
||||
FacesMessage msg = new FacesMessage("Especialidad editada", ((MedicalSpecialtyTO) event.getObject()).getName());
|
||||
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||
} catch (Exception 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;
|
||||
|
||||
if (this.medicalSpecialty.getName() == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre de especialidad.");
|
||||
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().deleteSpecialtyData(this.medicalSpecialty.getId(), this.medicalSpecialty.getName(), this.medicalSpecialty.getDescription());
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los especialidad se ha borrado", "Los datos de la especialidad se han borrado correctamente.");
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
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 (error == 0) {
|
||||
this.getRemoteManagerSystemAdmin().deleteSpecialty(id);
|
||||
this.showSpecialtyData(null);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void insertData() {
|
||||
int error = 0;
|
||||
|
||||
@@ -149,10 +172,16 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
||||
error++;
|
||||
}
|
||||
|
||||
if (this.getRemoteManagerSystemAdmin().findSpecialtyByName(name) != null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Especialidad ya existente", "La especialidad ya se encuentra en la base de datos");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (error == 0) {
|
||||
try {
|
||||
MedicalSpecialtyTO ms = this.getRemoteManagerSystemAdmin().insertSpecialtyData(name, description);
|
||||
this.setSpecialtyData(ms);
|
||||
this.getRemoteManagerSystemAdmin().insertSpecialty(name, description);
|
||||
this.showSpecialtyData(null);
|
||||
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos de la especialidad se han guardado correctamente.");
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.el.ValueExpression;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.context.FacesContext;
|
||||
@@ -13,6 +14,8 @@ import javax.faces.validator.ValidatorException;
|
||||
|
||||
import org.primefaces.validate.ClientValidator;
|
||||
|
||||
import managedbean.systemAdmin.AddAdminMBean;
|
||||
|
||||
@FacesValidator("emailValidator")
|
||||
public class EmailValidator implements Validator<String>, ClientValidator {
|
||||
|
||||
@@ -21,16 +24,32 @@ public class EmailValidator implements Validator<String>, ClientValidator {
|
||||
|
||||
public void validate(FacesContext context, UIComponent comp, String value) throws ValidatorException {
|
||||
String strValue = "";
|
||||
|
||||
|
||||
if (value != null)
|
||||
strValue = String.valueOf(value);
|
||||
|
||||
strValue = String.valueOf(value).toLowerCase();
|
||||
|
||||
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"));
|
||||
|
||||
Matcher matcher = EMAIL_COMPILED_PATTERN.matcher((String) value);
|
||||
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"));
|
||||
|
||||
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() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package managedbean.validators;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.el.ValueExpression;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.context.FacesContext;
|
||||
@@ -9,24 +10,52 @@ import javax.faces.validator.FacesValidator;
|
||||
import javax.faces.validator.Validator;
|
||||
import javax.faces.validator.ValidatorException;
|
||||
|
||||
import org.primefaces.PrimeFaces;
|
||||
import org.primefaces.validate.ClientValidator;
|
||||
|
||||
import managedbean.common.ValidationUtils;
|
||||
import managedbean.profile.RegisterUserMBean;
|
||||
import managedbean.profile.UpdateProfileMBean;
|
||||
|
||||
@FacesValidator("nifValidator")
|
||||
public class NifValidator implements Validator<String>, ClientValidator {
|
||||
|
||||
public void validate(FacesContext context, UIComponent comp, String value) throws ValidatorException {
|
||||
String strValue = "";
|
||||
|
||||
|
||||
if (value != null)
|
||||
strValue = String.valueOf(value);
|
||||
|
||||
if (strValue.equals(""))
|
||||
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "El NIF no es válido", "El NIF " + value + " 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);
|
||||
|
||||
if (ValidationUtils.isValid(strValue) == false)
|
||||
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "El NIF no es válido", "El NIF " + value + " 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() {
|
||||
|
||||
145
1.sources/MyHealth/src/managedbean/visit/AddVisitMBean.java
Normal file
@@ -0,0 +1,145 @@
|
||||
package managedbean.visit;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.PatientTO;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@Named("AddVisit")
|
||||
@ViewScoped
|
||||
public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
private LocalDate date;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String result;
|
||||
private String patientDisplayName;
|
||||
private String familyDoctorDisplayName;
|
||||
private PatientTO patient;
|
||||
|
||||
public AddVisitMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// El usuario actual es un medico de familia, recuperamos su Id de la sessión actual
|
||||
Integer patientId = Integer.valueOf(SessionUtils.getUserId());
|
||||
|
||||
this.patient = this.getRemoteManagerCommon().findPatientById(patientId);
|
||||
|
||||
if (this.patient.getFamilyDoctor() != null)
|
||||
this.familyDoctorDisplayName = this.patient.getFamilyDoctor().getDisplayName();
|
||||
else
|
||||
this.familyDoctorDisplayName = null;
|
||||
|
||||
this.date = LocalDate.now();
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
// Comprobamos que la fecha fijada para la visita no sea anterior a la actual
|
||||
int error = 0;
|
||||
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)) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Fecha incorrecta", "La cita fijada es anterior al momento actual");
|
||||
error++;
|
||||
}
|
||||
if (this.date.equals(today) && this.time.isBefore(LocalTime.now())) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Fecha incorrecta", "La cita fijada es anterior al momento actual");
|
||||
error++;
|
||||
}
|
||||
if (error == 0) {
|
||||
try {
|
||||
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.observations = "";
|
||||
this.date=null;
|
||||
this.time=null;
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public LocalTime getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(LocalTime time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getObservations() {
|
||||
return observations;
|
||||
}
|
||||
|
||||
public void setObservations(String observations) {
|
||||
this.observations = observations;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getPatientDisplayName() {
|
||||
return patientDisplayName;
|
||||
}
|
||||
|
||||
public String getFamilyDoctorDisplayName() {
|
||||
return familyDoctorDisplayName;
|
||||
}
|
||||
|
||||
public void setFamilyDoctorDisplayName(String value) {
|
||||
this.familyDoctorDisplayName = value;
|
||||
}
|
||||
|
||||
public PatientTO getPatient() {
|
||||
return patient;
|
||||
}
|
||||
|
||||
public void setPatient(PatientTO patient) {
|
||||
this.patient = patient;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package managedbean.visit;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.primefaces.model.LazyDataModel;
|
||||
import org.primefaces.model.SortOrder;
|
||||
|
||||
import TO.PatientTO;
|
||||
import TO.VisitTO;
|
||||
import common.Constants;
|
||||
import common.UserType;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@Named("PatientVisitList")
|
||||
@ViewScoped
|
||||
public class PatientVisitListMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PatientTO patient;
|
||||
|
||||
private Integer patientId;
|
||||
private LazyDataModel<VisitTO> lazyDataModelVisitList;
|
||||
private LocalDate selectedDate;
|
||||
private String lastUIQuery;
|
||||
private List<PatientTO> patientList;
|
||||
|
||||
public PatientVisitListMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.lastUIQuery = "";
|
||||
|
||||
// Si el usuario es un paciente listamos las visitas de ese paciente, si es admnistrador listamos todas.
|
||||
switch (SessionUtils.getUserType()) {
|
||||
case ADMINISTRATOR:
|
||||
this.patientId = null;
|
||||
this.patient = null;
|
||||
this.selectedDate = LocalDate.now();
|
||||
|
||||
this.patientList = this.getRemoteManagerCommon().listPatientsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
break;
|
||||
case PATIENT:
|
||||
this.patientId = Integer.valueOf(SessionUtils.getUserId());
|
||||
this.patient = this.getRemoteManagerCommon().findPatientById(patientId);
|
||||
this.selectedDate = null;
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
case SPECIALIST_DOCTOR:
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Acesso denegado", "Su perfil de usuario no está autorizado acceder a esta página.");
|
||||
return;
|
||||
}
|
||||
|
||||
this.lazyDataModelVisitList = new LazyDataModel<VisitTO>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public List<VisitTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||
if (patient != null)
|
||||
patientId = patient.getId();
|
||||
else
|
||||
patientId = null;
|
||||
|
||||
Long totalRowCount = getRemoteManagerVisit().getVisitsCount(patientId, selectedDate);
|
||||
this.setRowCount(totalRowCount.intValue());
|
||||
|
||||
return getRemoteManagerVisit().listVisitsPaged(patientId, selectedDate, (first / pageSize), pageSize);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public List<PatientTO> completePatient(String query) {
|
||||
if (query != null && query.equals(this.lastUIQuery) == false) {
|
||||
this.lastUIQuery = query;
|
||||
// Recuperamos las 200 primeras coincidencias
|
||||
this.patientList = this.getRemoteManagerCommon().listPatientsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
return this.patientList;
|
||||
}
|
||||
|
||||
public List<PatientTO> getPatientList() {
|
||||
return patientList;
|
||||
}
|
||||
|
||||
public void removeVisit(Integer visitId) throws IOException {
|
||||
int error = 0;
|
||||
|
||||
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 {
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
ctx.getExternalContext().redirect(String.format("UpdateVisit.xhtml?id=%d&fromPage=%s", visitId, ctx.getViewRoot().getViewId()));
|
||||
}
|
||||
|
||||
public LazyDataModel<VisitTO> getLazyDataModelVisitList() {
|
||||
return lazyDataModelVisitList;
|
||||
}
|
||||
|
||||
public void showData() {
|
||||
}
|
||||
|
||||
public LocalDate getSelectedDate() {
|
||||
return selectedDate;
|
||||
}
|
||||
|
||||
public void setSelectedDate(LocalDate selectedDate) {
|
||||
this.selectedDate = selectedDate;
|
||||
}
|
||||
|
||||
public PatientTO getPatient() {
|
||||
return patient;
|
||||
}
|
||||
|
||||
public void setPatient(PatientTO patient) {
|
||||
this.patient = patient;
|
||||
}
|
||||
|
||||
public boolean isAdmin() {
|
||||
return SessionUtils.getUserType() == UserType.ADMINISTRATOR;
|
||||
}
|
||||
}
|
||||
234
1.sources/MyHealth/src/managedbean/visit/UpdateVisitMBean.java
Normal file
@@ -0,0 +1,234 @@
|
||||
package managedbean.visit;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.PatientTO;
|
||||
import TO.VisitTO;
|
||||
import common.UserType;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@Named("UpdateVisit")
|
||||
@ViewScoped
|
||||
public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
private LocalDate date;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String result;
|
||||
private PatientTO patient;
|
||||
private FamilyDoctorTO familyDoctor;
|
||||
private UserType userType;
|
||||
private String fromPage;
|
||||
private String infoMessage;
|
||||
|
||||
public UpdateVisitMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
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();
|
||||
Map<String, String> requestParams = context.getExternalContext().getRequestParameterMap();
|
||||
VisitTO vi = null;
|
||||
|
||||
try {
|
||||
this.fromPage = requestParams.get("fromPage");
|
||||
|
||||
// Parámetro con el "id" de la visita.
|
||||
int parId = Integer.valueOf(requestParams.get("id"));
|
||||
|
||||
vi = this.getRemoteManagerVisit().getVisit(parId);
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
|
||||
if (vi != null) {
|
||||
this.id = vi.getId();
|
||||
this.date = vi.getDate();
|
||||
this.time = vi.getTime();
|
||||
this.observations = vi.getObservations();
|
||||
this.result = vi.getResult();
|
||||
this.patient = vi.getPatient();
|
||||
this.familyDoctor = vi.getFamilyDoctor();
|
||||
|
||||
this.setInfoMessage();
|
||||
} else {
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
private void setInfoMessage() {
|
||||
switch (this.userType) {
|
||||
case ADMINISTRATOR:
|
||||
case PATIENT:
|
||||
if (this.result != null && this.result.trim().equals("") == false)
|
||||
this.infoMessage = "La cita ya tiene un resultado y no es editable.";
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
// El médico de familia solo puede actualizar el resultado.
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
int error = 0;
|
||||
|
||||
try {
|
||||
switch (this.userType) {
|
||||
case ADMINISTRATOR:
|
||||
case PATIENT:
|
||||
// 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
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
if (this.date.isBefore(today)) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Fecha incorrecta", "La cita fijada es anterior al momento actual");
|
||||
error++;
|
||||
}
|
||||
if (this.date.equals(today) && this.time.isBefore(LocalTime.now())) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Fecha incorrecta", "La cita fijada es anterior al momento actual");
|
||||
error++;
|
||||
}
|
||||
if (error == 0) {
|
||||
this.getRemoteManagerVisit().updateVisit(this.id, this.date, this.time);
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Visita actualizada", "La fecha y hora de la visita se ha actualizado correctamente.");
|
||||
}
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
// El médico de familia solo puede actualizar el resultado.
|
||||
if (this.date.isAfter(LocalDate.now())) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Fecha incorrecta", "La cita fijada es posterior a la fecha actual y no se puede actualizar el resultado.");
|
||||
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;
|
||||
case SPECIALIST_DOCTOR:
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Acesso denegado", "Su perfil de usuario no está autorizado acceder a esta página.");
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public LocalTime getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(LocalTime time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getObservations() {
|
||||
return observations;
|
||||
}
|
||||
|
||||
public void setObservations(String observations) {
|
||||
this.observations = observations;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public PatientTO getPatient() {
|
||||
return patient;
|
||||
}
|
||||
|
||||
public void setPatient(PatientTO patient) {
|
||||
this.patient = patient;
|
||||
}
|
||||
|
||||
public FamilyDoctorTO getFamilyDoctor() {
|
||||
return familyDoctor;
|
||||
}
|
||||
|
||||
public void setFamilyDoctor(FamilyDoctorTO familyDoctor) {
|
||||
this.familyDoctor = familyDoctor;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
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() {
|
||||
return fromPage;
|
||||
}
|
||||
|
||||
public void setFromPage(String fromPage) {
|
||||
this.fromPage = fromPage;
|
||||
}
|
||||
|
||||
public String getInfoMessage() {
|
||||
return infoMessage;
|
||||
}
|
||||
}
|
||||
84
1.sources/MyHealth/src/managedbean/visit/VisitListMBean.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package managedbean.visit;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.primefaces.model.LazyDataModel;
|
||||
import org.primefaces.model.SortOrder;
|
||||
|
||||
import TO.VisitTO;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@Named("VisitList")
|
||||
@ViewScoped
|
||||
public class VisitListMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int familyDoctorId;
|
||||
private String familyDoctorDisplayName;
|
||||
private LazyDataModel<VisitTO> lazyDataModelVisitList;
|
||||
private LocalDate selectedDate;
|
||||
|
||||
public VisitListMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// El usuario actual es un medico de familia, recuperamos su Id de la sessión actual
|
||||
this.familyDoctorId = Integer.valueOf(SessionUtils.getUserId());
|
||||
this.familyDoctorDisplayName = SessionUtils.getUserDisplayName();
|
||||
|
||||
this.selectedDate = LocalDate.now();
|
||||
|
||||
this.lazyDataModelVisitList = new LazyDataModel<VisitTO>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public List<VisitTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||
Long totalRowCount = getRemoteManagerVisit().getScheduledVisitsCount(familyDoctorId, selectedDate);
|
||||
this.setRowCount(totalRowCount.intValue());
|
||||
|
||||
return getRemoteManagerVisit().listAllScheduledVisitsPaged(familyDoctorId, selectedDate, (first / pageSize), pageSize);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public LazyDataModel<VisitTO> getLazyDataModelVisitList() {
|
||||
return lazyDataModelVisitList;
|
||||
}
|
||||
|
||||
public void showData() {
|
||||
}
|
||||
|
||||
public void showVisit(Integer visitId) throws IOException {
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
ctx.getExternalContext().redirect(String.format("VisitView.xhtml?id=%d&fromPage=%s", visitId, ctx.getViewRoot().getViewId()));
|
||||
}
|
||||
|
||||
public void editVisit(Integer visitId) throws IOException {
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
ctx.getExternalContext().redirect(String.format("UpdateVisit.xhtml?id=%d&fromPage=%s", visitId, ctx.getViewRoot().getViewId()));
|
||||
}
|
||||
|
||||
public LocalDate getSelectedDate() {
|
||||
return selectedDate;
|
||||
}
|
||||
|
||||
public void setSelectedDate(LocalDate selectedDate) {
|
||||
this.selectedDate = selectedDate;
|
||||
}
|
||||
|
||||
public String getFamilyDoctorDisplayName() {
|
||||
return familyDoctorDisplayName;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,141 @@
|
||||
package managedbean.visit;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
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.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
import TO.PatientTO;
|
||||
import TO.VisitTO;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
@Named("VisitMBean")
|
||||
@RequestScoped
|
||||
@Named("VisitView")
|
||||
@ViewScoped
|
||||
public class VisitMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
private LocalDate date;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String result;
|
||||
private PatientTO patient;
|
||||
private FamilyDoctorTO familyDoctor;
|
||||
private String fromPage;
|
||||
|
||||
public VisitMBean() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Inicialización de variables y propiedades van aquí.
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
|
||||
// Como realizar llamadas al EJB Remoto
|
||||
// this.getRemoteManagerSystemAdmin().MetodoEJB
|
||||
Map<String, String> requestParams = context.getExternalContext().getRequestParameterMap();
|
||||
|
||||
VisitTO vi = null;
|
||||
|
||||
try {
|
||||
this.fromPage = requestParams.get("fromPage");
|
||||
|
||||
// Parámetro con el "id" de la visita.
|
||||
int parId = Integer.valueOf(requestParams.get("id"));
|
||||
|
||||
vi = this.getRemoteManagerVisit().getVisit(parId);
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
|
||||
if (vi != null) {
|
||||
this.id = vi.getId();
|
||||
this.date = vi.getDate();
|
||||
this.time = vi.getTime();
|
||||
this.observations = vi.getObservations();
|
||||
this.result = vi.getResult();
|
||||
this.patient = vi.getPatient();
|
||||
this.familyDoctor = vi.getFamilyDoctor();
|
||||
} else {
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
public void editVisit(Integer visitId) throws IOException {
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
ctx.getExternalContext().redirect(String.format("UpdateVisit.xhtml?id=%d&fromPage=%s", visitId, this.fromPage));
|
||||
}
|
||||
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public LocalTime getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(LocalTime time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getObservations() {
|
||||
return observations;
|
||||
}
|
||||
|
||||
public void setObservations(String observations) {
|
||||
this.observations = observations;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public PatientTO getPatient() {
|
||||
return patient;
|
||||
}
|
||||
|
||||
public void setPatient(PatientTO patient) {
|
||||
this.patient = patient;
|
||||
}
|
||||
|
||||
public FamilyDoctorTO getFamilyDoctor() {
|
||||
return familyDoctor;
|
||||
}
|
||||
|
||||
public void setFamilyDoctor(FamilyDoctorTO familyDoctor) {
|
||||
this.familyDoctor = familyDoctor;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFromPage() {
|
||||
return fromPage;
|
||||
}
|
||||
|
||||
public void setFromPage(String fromPage) {
|
||||
this.fromPage = fromPage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
5
1.sources/MyHealth/start.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
ant
|
||||
|
||||
read -p "Di hola pringao!" asd
|
||||
@@ -70,13 +70,13 @@ if exists (SELECT 1 FROM pg_sequences WHERE schemaname='myhealth' and sequencena
|
||||
drop sequence myhealth.codigoidentificacionpaciente;
|
||||
end if;
|
||||
|
||||
CREATE SEQUENCE myhealth.ProfesionalNumber
|
||||
CREATE SEQUENCE myhealth.profesionalnumber
|
||||
INCREMENT 1
|
||||
START 1000
|
||||
MINVALUE 1000
|
||||
CACHE 1;
|
||||
|
||||
CREATE SEQUENCE myhealth.CodigoIdentificacionPaciente
|
||||
CREATE SEQUENCE myhealth.codigoidentificacionpaciente
|
||||
INCREMENT 1
|
||||
START 1000
|
||||
MINVALUE 1000
|
||||
@@ -170,11 +170,11 @@ CREATE TABLE myhealth.visit
|
||||
(
|
||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||
date date NOT NULL,
|
||||
"time" abstime NOT NULL,
|
||||
"time" time NOT NULL,
|
||||
observations TEXT COLLATE pg_catalog."default",
|
||||
result TEXT COLLATE pg_catalog."default",
|
||||
patientid INTEGER REFERENCES myhealth.patient(id),
|
||||
familydoctorid INTEGER REFERENCES myhealth.familydoctor(id),
|
||||
patientid INTEGER REFERENCES myhealth.patient(id) NOT NULL,
|
||||
familydoctorid INTEGER REFERENCES myhealth.familydoctor(id) NOT NULL,
|
||||
CONSTRAINT visit_pkey PRIMARY KEY (id)
|
||||
)
|
||||
TABLESPACE pg_default;
|
||||
@@ -197,11 +197,11 @@ TABLESPACE pg_default;
|
||||
CREATE TABLE myhealth.medicaltest
|
||||
(
|
||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||
date date NOT NULL,
|
||||
"time" abstime NOT NULL,
|
||||
date DATE NOT NULL,
|
||||
"time" TIME NOT NULL,
|
||||
observations TEXT COLLATE pg_catalog."default",
|
||||
highresimage TEXT,
|
||||
type VARCHAR(30) NOT NULL,
|
||||
type VARCHAR(50) NOT NULL,
|
||||
patientid INTEGER REFERENCES myhealth.patient(id) NOT NULL,
|
||||
specialistdoctorid INTEGER REFERENCES myhealth.specialistdoctor(id) NOT NULL,
|
||||
CONSTRAINT medicaltest_pkey PRIMARY KEY (id)
|
||||
@@ -209,26 +209,30 @@ CREATE TABLE myhealth.medicaltest
|
||||
TABLESPACE pg_default;
|
||||
|
||||
-- Permisos
|
||||
ALTER TABLE myhealth.administrator OWNER to "USER";
|
||||
ALTER TABLE myhealth.primaryhealthcarecenter OWNER to "USER";
|
||||
ALTER TABLE myhealth.familydoctor OWNER to "USER";
|
||||
ALTER TABLE myhealth.medicalspecialty OWNER to "USER";
|
||||
ALTER TABLE myhealth.patient OWNER to "USER";
|
||||
ALTER TABLE myhealth.specialistdoctor OWNER to "USER";
|
||||
ALTER TABLE myhealth.visit OWNER to "USER";
|
||||
ALTER TABLE myhealth.question OWNER to "USER";
|
||||
ALTER TABLE myhealth.medicaltest OWNER to "USER";
|
||||
ALTER TABLE myhealth.administrator OWNER to "USER";
|
||||
ALTER TABLE myhealth.primaryhealthcarecenter OWNER to "USER";
|
||||
ALTER TABLE myhealth.familydoctor OWNER to "USER";
|
||||
ALTER TABLE myhealth.medicalspecialty OWNER to "USER";
|
||||
ALTER TABLE myhealth.patient OWNER to "USER";
|
||||
ALTER TABLE myhealth.specialistdoctor OWNER to "USER";
|
||||
ALTER TABLE myhealth.visit OWNER to "USER";
|
||||
ALTER TABLE myhealth.question OWNER to "USER";
|
||||
ALTER TABLE myhealth.medicaltest OWNER to "USER";
|
||||
ALTER SEQUENCE myhealth.profesionalnumber OWNER to "USER";
|
||||
ALTER SEQUENCE myhealth.codigoidentificacionpaciente OWNER to "USER";
|
||||
|
||||
-- Permisos para la máquina de PRE (usuario: usrmyhealth)
|
||||
GRANT ALL ON myhealth.administrator to usrmyhealth;
|
||||
GRANT ALL ON myhealth.primaryhealthcarecenter to usrmyhealth;
|
||||
GRANT ALL ON myhealth.familydoctor to usrmyhealth;
|
||||
GRANT ALL ON myhealth.medicalspecialty to usrmyhealth;
|
||||
GRANT ALL ON myhealth.patient to usrmyhealth;
|
||||
GRANT ALL ON myhealth.specialistdoctor to usrmyhealth;
|
||||
GRANT ALL ON myhealth.visit to usrmyhealth;
|
||||
GRANT ALL ON myhealth.question to usrmyhealth;
|
||||
GRANT ALL ON myhealth.medicaltest to usrmyhealth;
|
||||
GRANT ALL ON myhealth.administrator to usrmyhealth;
|
||||
GRANT ALL ON myhealth.primaryhealthcarecenter to usrmyhealth;
|
||||
GRANT ALL ON myhealth.familydoctor to usrmyhealth;
|
||||
GRANT ALL ON myhealth.medicalspecialty to usrmyhealth;
|
||||
GRANT ALL ON myhealth.patient to usrmyhealth;
|
||||
GRANT ALL ON myhealth.specialistdoctor to usrmyhealth;
|
||||
GRANT ALL ON myhealth.visit to usrmyhealth;
|
||||
GRANT ALL ON myhealth.question to usrmyhealth;
|
||||
GRANT ALL ON myhealth.medicaltest to usrmyhealth;
|
||||
GRANT ALL ON myhealth.profesionalnumber to usrmyhealth;
|
||||
GRANT ALL ON myhealth.codigoidentificacionpaciente to usrmyhealth;
|
||||
|
||||
END;
|
||||
$$
|
||||
3
2.database/executeall.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
psql -U postgres -f 01.CreateTables.sql
|
||||
psql -U postgres -f 02.Datos_prueba.sql
|
||||
@@ -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?
|
||||
28
install.md
@@ -1,6 +1,8 @@
|
||||
## Instrucciones de despliegue e instalación
|
||||
### 1. Crear esquema de base de datos y tablas:
|
||||
Se debe crear un esquema nuevo en PostgreSQL y conceder permisos al usuario USER. Esto puede realizarse ejecutando el script incluido con la solución llamado:
|
||||
Se utilizará la base de datos por defecto de postgres llamada "postgres", si se tuiliza otra deberá reflejarse en paso 3 a la hora de configurar el datasource.
|
||||
También se asume que el servidor de postgres está ubicado en localhost (en la misma máquina donde se ejecutan los EJBs)
|
||||
Se debe crear un esquema nuevo en PostgreSQL, el esquema debe llamarse "myhealth", se deben conceder permisos al usuario USER. Estas accione (crear el esquema y el usuario) las realiza el script incluido con la solución llamado:
|
||||
* 01.CreateTables.sql
|
||||
|
||||
### 2. Inserción de datos iniciales:
|
||||
@@ -22,7 +24,29 @@ El usuario y contraseña de base de datos que se han utilizado en el datasource
|
||||
</security>
|
||||
</datasource>
|
||||
|
||||
### 4. Ejecutar la compilación y despliegue del proyecto
|
||||
### 4. Configuración del driver de postgresql en JBOSS
|
||||
Este proyecto utiliza el mismo driver que el utilizado en el caso practico del laboratorio. Si el entorno no está configurado, deberá configurarse el driver Postgresql en JBOSS. Para ello se debe añadir en el fichero JBOSS_HOME\standalone\configuration\standalone.xlm la siguiente configuración en el nodo <drivers>:
|
||||
|
||||
<driver name="postgresql" module="org.postgresql">
|
||||
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
|
||||
</driver>
|
||||
|
||||
Además, es necesario configurar la libreria (jar) de postgres en JBOSS. La configuración es la misma que para el caso practico. Crear el archivo modules.xml en el directorio /opt/wildfly/modules/system/layers/base/org/postgresql/main
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="urn:jboss:module:1.0" name="org.postgresql">
|
||||
<resources>
|
||||
<resource-root path="postgresql-9.4.1209.jar"/>
|
||||
</resources>
|
||||
<dependencies>
|
||||
<module name="javax.api"/>
|
||||
<module name="javax.transaction.api"/>
|
||||
</dependencies>
|
||||
</module>
|
||||
|
||||
También se debe copiar el fichero postgresql-9.4.1209.jar en la misma ruta: /opt/wildfly/modules/system/layers/base/org/postgresql/main
|
||||
|
||||
### 5. Ejecutar la compilación y despliegue del proyecto
|
||||
Acceder al directorio con el código fuente ([git-folder]/1.sources/MyHealth), y donde está ubicado el archivo de compilación de ant build.xml, ejecutar `ant` en este directorio, el proyecto debería compilarse y desplegarse automáticamente en el servidor JBOSS local.
|
||||
|
||||
## Instrucciones de despliegue alternativo con docker
|
||||
|
||||