Compare commits
1 Commits
dev
...
unique_ind
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2da2a222e6 |
@@ -14,7 +14,7 @@ ci_build:
|
|||||||
script:
|
script:
|
||||||
- cd 1.sources/MyHealth
|
- cd 1.sources/MyHealth
|
||||||
- ant clean
|
- ant clean
|
||||||
- ant ear
|
- ant all
|
||||||
|
|
||||||
ci_test:
|
ci_test:
|
||||||
stage: test
|
stage: test
|
||||||
@@ -25,12 +25,9 @@ ci_test:
|
|||||||
deploy_pre:
|
deploy_pre:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
script:
|
script:
|
||||||
- echo "Eliminamos archivo ear anterior..."
|
|
||||||
- rm -f $JBOSS_HOME/standalone/deployments/MyHealth.*
|
|
||||||
- echo "Despliegue al servidor de PRE"
|
- echo "Despliegue al servidor de PRE"
|
||||||
- cd 1.sources/MyHealth
|
- cd 1.sources/MyHealth
|
||||||
- ant deployear
|
- ant deployear
|
||||||
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
name: pre
|
name: pre
|
||||||
@@ -41,8 +38,6 @@ deploy_pre:
|
|||||||
deploy_pro:
|
deploy_pro:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
script:
|
script:
|
||||||
- echo "Eliminamos archivo ear anterior..."
|
|
||||||
- rm -f $JBOSS_HOME/standalone/deployments/MyHealth.*
|
|
||||||
- echo "Despliegue al servidor de PRO"
|
- echo "Despliegue al servidor de PRO"
|
||||||
- cd 1.sources/MyHealth
|
- cd 1.sources/MyHealth
|
||||||
- ant deployear
|
- ant deployear
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<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="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/primefaces-7.0.jar" sourcepath="C:/Users/mark/.m2/repository/org/primefaces/primefaces/7.0/primefaces-7.0-sources.jar"/>
|
||||||
<classpathentry kind="lib" path="docroot/WEB-INF/lib/omnifaces-3.4.1.jar" />
|
<classpathentry kind="lib" path="docroot/WEB-INF/lib/omnifaces-3.4.1.jar" sourcepath="C:/Users/mark/.m2/repository/org/omnifaces/omnifaces/3.4.1/omnifaces-3.4.1-sources.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
<property environment="env" />
|
<property environment="env" />
|
||||||
<property name="jboss.home" value="${env.JBOSS_HOME}" />
|
<property name="jboss.home" value="${env.JBOSS_HOME}" />
|
||||||
<property name="source" value="." />
|
<property name="source" value="." />
|
||||||
<property name="java.encoding" value="UTF-8" />
|
|
||||||
<property name="sourcesrc" value="${source}/src" />
|
<property name="sourcesrc" value="${source}/src" />
|
||||||
<property name="build" value="${source}/build" />
|
<property name="build" value="${source}/build" />
|
||||||
<property name="buildjar" value="${build}/jar" />
|
<property name="buildjar" value="${build}/jar" />
|
||||||
@@ -28,7 +27,7 @@
|
|||||||
</fileset>
|
</fileset>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<target name="all" depends="clean, init, deployear" />
|
<target name="all" depends="clean, init, ear" />
|
||||||
|
|
||||||
<target name="init" description="inicialitzacions is relevant: the structure created
|
<target name="init" description="inicialitzacions is relevant: the structure created
|
||||||
copy files and directories there. xml ">
|
copy files and directories there. xml ">
|
||||||
@@ -49,8 +48,7 @@
|
|||||||
<target name="compileEjb" depends="init">
|
<target name="compileEjb" depends="init">
|
||||||
<copy file="${sourcesrc}/META-INF/persistence.xml" todir="${buildjar}/META-INF" />
|
<copy file="${sourcesrc}/META-INF/persistence.xml" todir="${buildjar}/META-INF" />
|
||||||
<copy file="${sourcesrc}/log4j.properties" todir="${buildjar}" />
|
<copy file="${sourcesrc}/log4j.properties" todir="${buildjar}" />
|
||||||
<javac encoding="${java.encoding}" srcdir="${sourcesrc}" destdir="${buildjar}" includes="ejb/**/*.java, jpa/**/*.java, TO/**/*.java, common/**/*.java" classpathref="jboss.classpath"
|
<javac srcdir="${sourcesrc}" destdir="${buildjar}" includes="ejb/**/*.java, jpa/**/*.java, TO/**/*.java" classpathref="jboss.classpath" includeantruntime="true" />
|
||||||
includeantruntime="true" />
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Update the EJB jar file and create if not exist -->
|
<!-- Update the EJB jar file and create if not exist -->
|
||||||
@@ -63,7 +61,7 @@
|
|||||||
<copy todir="${buildwar}">
|
<copy todir="${buildwar}">
|
||||||
<fileset dir="${docroot}" />
|
<fileset dir="${docroot}" />
|
||||||
</copy>
|
</copy>
|
||||||
<javac encoding="${java.encoding}" srcdir="${sourcesrc}" destdir="${buildwar}/WEB-INF/classes" includes="managedbean/**/*.java" includeantruntime="true">
|
<javac srcdir="${sourcesrc}" destdir="${buildwar}/WEB-INF/classes" includes="managedbean/**/*.java" includeantruntime="true">
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="jboss.classpath" />
|
<path refid="jboss.classpath" />
|
||||||
<path refid="lib.dir" />
|
<path refid="lib.dir" />
|
||||||
@@ -72,7 +70,6 @@
|
|||||||
<delete verbose="true" dir="${buildwar}/WEB-INF/classes/ejb" />
|
<delete verbose="true" dir="${buildwar}/WEB-INF/classes/ejb" />
|
||||||
<delete verbose="true" dir="${buildwar}/WEB-INF/classes/jpa" />
|
<delete verbose="true" dir="${buildwar}/WEB-INF/classes/jpa" />
|
||||||
<delete verbose="true" dir="${buildwar}/WEB-INF/classes/TO" />
|
<delete verbose="true" dir="${buildwar}/WEB-INF/classes/TO" />
|
||||||
<delete verbose="true" dir="${buildwar}/WEB-INF/classes/common" />
|
|
||||||
</target>
|
</target>
|
||||||
<!-- <war destfile="${build.dir}/CrunchifyRESTJerseyExample.war" webxml="WebContent/WEB-INF/web.xml"> -->
|
<!-- <war destfile="${build.dir}/CrunchifyRESTJerseyExample.war" webxml="WebContent/WEB-INF/web.xml"> -->
|
||||||
<!-- <classes dir="${build.dir}" /> -->
|
<!-- <classes dir="${build.dir}" /> -->
|
||||||
@@ -82,8 +79,7 @@
|
|||||||
|
|
||||||
<!-- Update the WAR file and create if not exist -->
|
<!-- Update the WAR file and create if not exist -->
|
||||||
<target name="deployWar" depends="compileWar">
|
<target name="deployWar" depends="compileWar">
|
||||||
<jar jarfile="${dist}/MyHealth.war" basedir="${buildwar}" excludes="/WEB-INF/classes/ejb/*.*, /WEB-INF/classes/jpa/*.*, /WEB-INF/classes/TO/*.*, /WEB-INF/classes/common/*.*"
|
<jar jarfile="${dist}/MyHealth.war" basedir="${buildwar}" excludes="/WEB-INF/classes/ejb/*.*, /WEB-INF/classes/jpa/*.*, /WEB-INF/classes/TO/*.*" update="yes" />
|
||||||
update="yes" />
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Update the application ear file and created if not exist -->
|
<!-- Update the application ear file and created if not exist -->
|
||||||
|
|||||||
@@ -2,7 +2,4 @@
|
|||||||
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd" version="2.3">
|
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd" version="2.3">
|
||||||
|
|
||||||
<factory>
|
|
||||||
<exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory>
|
|
||||||
</factory>
|
|
||||||
</faces-config>
|
</faces-config>
|
||||||
|
|||||||
@@ -18,10 +18,7 @@
|
|||||||
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
|
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
|
||||||
<param-value>true</param-value>
|
<param-value>true</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
<context-param>
|
|
||||||
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
|
|
||||||
<param-value>client</param-value>
|
|
||||||
</context-param>
|
|
||||||
<context-param>
|
<context-param>
|
||||||
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
|
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
|
||||||
<param-value>.xhtml</param-value>
|
<param-value>.xhtml</param-value>
|
||||||
@@ -30,6 +27,8 @@
|
|||||||
<param-name>primefaces.FONT_AWESOME</param-name>
|
<param-name>primefaces.FONT_AWESOME</param-name>
|
||||||
<param-value>true</param-value>
|
<param-value>true</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
|
|
||||||
|
|
||||||
<context-param>
|
<context-param>
|
||||||
<param-name>primefaces.THEME</param-name>
|
<param-name>primefaces.THEME</param-name>
|
||||||
<param-value>#{sessionPreferences.currentTheme}</param-value>
|
<param-value>#{sessionPreferences.currentTheme}</param-value>
|
||||||
@@ -43,59 +42,36 @@
|
|||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
<!-- Map these files with JSF -->
|
<!-- Map these files with JSF -->
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>/faces/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>*.jsf</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>*.faces</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>Faces Servlet</servlet-name>
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
<url-pattern>*.xhtml</url-pattern>
|
<url-pattern>*.xhtml</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<!-- Filters -->
|
|
||||||
<filter>
|
|
||||||
<filter-name>facesExceptionFilter</filter-name>
|
|
||||||
<filter-class>org.omnifaces.filter.FacesExceptionFilter</filter-class>
|
|
||||||
</filter>
|
|
||||||
|
|
||||||
<!-- Filter mappings -->
|
|
||||||
<filter-mapping>
|
|
||||||
<filter-name>facesExceptionFilter</filter-name>
|
|
||||||
<url-pattern>/*</url-pattern>
|
|
||||||
</filter-mapping>
|
|
||||||
|
|
||||||
<!-- Error pages mapping -->
|
|
||||||
<error-page>
|
|
||||||
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
|
|
||||||
<location>/error.xhtml?type=expired</location>
|
|
||||||
</error-page>
|
|
||||||
<error-page>
|
|
||||||
<exception-type>java.sql.SQLException</exception-type>
|
|
||||||
<exception-type>org.hibernate.exception.GenericJDBCException</exception-type>
|
|
||||||
<exception-type>java.net.ConnectException</exception-type>
|
|
||||||
<exception-type>javax.persistence.PersistenceException</exception-type>
|
|
||||||
<location>/error.xhtml?type=sql</location>
|
|
||||||
</error-page>
|
|
||||||
<error-page>
|
|
||||||
<exception-type>javax.persistence.PersistenceException</exception-type>
|
|
||||||
<location>/error.xhtml?type=runtime</location>
|
|
||||||
</error-page>
|
|
||||||
<error-page>
|
|
||||||
<exception-type>java.net.ConnectException</exception-type>
|
|
||||||
<location>/error.xhtml?type=sql</location>
|
|
||||||
</error-page>
|
|
||||||
<error-page>
|
<error-page>
|
||||||
<error-code>500</error-code>
|
<error-code>500</error-code>
|
||||||
<location>/error.xhtml</location>
|
<location>/error.xhtml</location>
|
||||||
</error-page>
|
</error-page>
|
||||||
<error-page>
|
|
||||||
<error-code>401</error-code>
|
|
||||||
<location>/error.xhtml?type=expired</location>
|
|
||||||
</error-page>
|
|
||||||
|
|
||||||
<session-config>
|
<session-config>
|
||||||
<session-timeout>30</session-timeout>
|
<session-timeout>30</session-timeout>
|
||||||
|
|
||||||
</session-config>
|
</session-config>
|
||||||
|
|
||||||
<!-- The Welcome File List -->
|
<!-- The Welcome File List -->
|
||||||
<welcome-file-list>
|
<welcome-file-list>
|
||||||
<welcome-file>/home.xhtml</welcome-file>
|
<welcome-file>home.xhtml</welcome-file>
|
||||||
</welcome-file-list>
|
</welcome-file-list>
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
|
||||||
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
|
||||||
|
|
||||||
<ui:composition template="./header.xhtml">
|
<ui:composition template="./header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
@@ -10,36 +9,24 @@
|
|||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-2 ui-md-2" />
|
<div class="ui-g-2 ui-md-2" />
|
||||||
<div class="ui-g-8 ui-md-8">
|
<div class="ui-g-8 ui-md-8">
|
||||||
<p:panel id="ErrorPanel">
|
<p:panel id="ErrorPanel" header="Se ha producido un error inesperado">
|
||||||
<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" />
|
|
||||||
</f:facet>
|
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-12">La acción que estaba realizando a causado un error inesperado en el sistema. A continuación podrá ver un descripción detallada del error para que
|
||||||
|
pueda comunicarlo al equipo de soporte.</div>
|
||||||
|
|
||||||
|
<div class="ui-g-12" style="font-weight: bold;">
|
||||||
|
Descripción del error
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-12">
|
||||||
<p:outputLabel rendered="#{param.type == 'sql'}"
|
<h:messages fatalClass="ErrorMessage" showDetail="true" showSummary="true" globalOnly="true" />
|
||||||
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'}"
|
|
||||||
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'}"
|
|
||||||
value="Se ha producido un error en el servidor durante la ejecución de la última acción. Por favor, intentelo de nuevo o contacte con el equipo de soporte." />
|
|
||||||
<p:outputLabel rendered="#{param.type == '' or param.type == null}"
|
|
||||||
value="La acción que estaba realizando a causado un error inesperado en el sistema. A continuación podrá ver un descripción detallada del error para que pueda comunicarlo al equipo de soporte." />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-5" />
|
||||||
<p:messages id="errorMessage" showDetail="true" closable="false" autoupdate="true" showSummary="true" showIcon="true" />
|
<div class="ui-g-2">
|
||||||
</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" />
|
<p:button value="Ir a la página principal" outcome="home" icon="pi pi-home" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4" />
|
<div class="ui-g-5" />
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
<h:head>
|
<h:head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
@@ -14,35 +14,34 @@
|
|||||||
function handleLoginRequest(xhr, status, args) {
|
function handleLoginRequest(xhr, status, args) {
|
||||||
if(args.validationFailed || !args.loggedIn) {
|
if(args.validationFailed || !args.loggedIn) {
|
||||||
PF('dlgLogin').jq.effect("shake", {times:5}, 100);
|
PF('dlgLogin').jq.effect("shake", {times:5}, 100);
|
||||||
PF('btnLogin').enable();
|
//PF('Login').attr("disabled", false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PF('btnLogin').enable();
|
|
||||||
PF('dlgLogin').hide();
|
PF('dlgLogin').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startLogin() {
|
function startLogin() {
|
||||||
PF('btnLogin').disable();
|
//PF('Login').attr("disabled", true);
|
||||||
}
|
|
||||||
|
|
||||||
function onAjaxError() {
|
|
||||||
alert('Ajax error');
|
|
||||||
}
|
}
|
||||||
</h:outputScript>
|
</h:outputScript>
|
||||||
<h:body>
|
<h:body>
|
||||||
<p:growl id="messages" globalOnly="true" sticky="false" showDetail="true" life="15000" />
|
|
||||||
<div id="layout">
|
<div id="layout">
|
||||||
<div id="top" class="top">
|
<div id="top" class="top">
|
||||||
|
<!-- <h1 class="Titulo">myHealth Site</h1> -->
|
||||||
<h:graphicImage library="images" name="logo-small.png" />
|
<h:graphicImage library="images" name="logo-small.png" />
|
||||||
</div>
|
</div>
|
||||||
<div id="menuDiv" style="margin-bottom: 10px;">
|
<hr />
|
||||||
<p:ajaxStatus style="width:32px; height:32px; position:fixed; right:32px; bottom:32px" onerror="onAjaxError()">
|
<div id="menuDiv">
|
||||||
|
<p:growl id="messages" sticky="false" showDetail="true" life="15000" />
|
||||||
|
<p:ajaxStatus style="width:32px; height:32px; position:fixed; right:32px; bottom:32px">
|
||||||
<f:facet name="start">
|
<f:facet name="start">
|
||||||
<i id="loginSpin" class="pi pi-spin pi-spinner" style="font-size: 3em"></i>
|
<i id="loginSpin" class="pi pi-spin pi-spinner" style="font-size: 3em"></i>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
|
|
||||||
<f:facet name="error">Error!</f:facet>
|
<f:facet name="complete">
|
||||||
|
<h:outputText value="" />
|
||||||
|
</f:facet>
|
||||||
</p:ajaxStatus>
|
</p:ajaxStatus>
|
||||||
|
|
||||||
<h:form id="frmLogin">
|
<h:form id="frmLogin">
|
||||||
@@ -50,15 +49,15 @@
|
|||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-12">
|
||||||
<h:outputLabel for="username" value="Usuario:" />
|
<h:outputLabel for="username" value="Usuario:" />
|
||||||
<p:inputText id="username" value="#{loginView.username}" placeholder="Escriba su código CIP o NP" />
|
<p:inputText id="username" value="#{loginView.username}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-12">
|
||||||
|
|
||||||
<h:outputLabel for="password" value="Contraseña:" />
|
<h:outputLabel for="password" value="Contraseña:" />
|
||||||
<p:password id="password" value="#{loginView.password}" placeholder="Contraseña" />
|
<p:password id="password" value="#{loginView.password}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6">
|
<div class="ui-g-6">
|
||||||
<p:commandButton widgetVar="btnLogin" value="Login" update="messages" icon="pi pi-sign-in" action="#{loginView.login}" onstart="startLogin()"
|
<p:commandButton value="Login" update="frmMenu, messages" icon="pi pi-sign-in" action="#{loginView.login}" onstart="startLogin()"
|
||||||
oncomplete="handleLoginRequest(xhr, status, args)" />
|
oncomplete="handleLoginRequest(xhr, status, args)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6">
|
<div class="ui-g-6">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
xmlns:p="http://primefaces.org/ui">
|
||||||
<f:metadata>
|
<f:metadata>
|
||||||
<f:viewParam name="refresh" value="#{home.refresh}" />
|
<f:viewParam name="refresh" value="#{home.refresh}" />
|
||||||
</f:metadata>
|
</f:metadata>
|
||||||
@@ -10,53 +10,36 @@
|
|||||||
<ui:composition template="./header.xhtml">
|
<ui:composition template="./header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form>
|
<h:form>
|
||||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
|
||||||
<p:panel header="Pagina principal">
|
<p:panel header="Pagina principal">
|
||||||
<div class="ui-g ui-fluid">
|
<p:panelGrid>
|
||||||
<div class="ui-g-2 ui-md-2">
|
<p:outputLabel for="selectorTema" value="Cambio de tema" />
|
||||||
<p:outputLabel for="selectorTema" value="Cambio de tema" />
|
<p:themeSwitcher id="selectorTema" style="width:165px" value="#{sessionPreferences.currentTheme}">
|
||||||
</div>
|
<f:selectItem itemLabel="Seleccione un tema" itemValue="" noSelectionOption="true" />
|
||||||
<div class="ui-g-6 ui-md-6">
|
<f:selectItems value="#{home.themes}" var="theme" itemLabel="#{theme.displayName}" itemValue="#{theme.name}" />
|
||||||
<p:themeSwitcher id="selectorTema" style="width:300px" value="#{sessionPreferences.currentTheme}">
|
<p:ajax listener="#{sessionPreferences.updateCurrentTheme}" />
|
||||||
<f:selectItem itemLabel="Seleccione un tema" itemValue="" noSelectionOption="true" />
|
</p:themeSwitcher>
|
||||||
<f:selectItems value="#{home.themes}" var="theme" itemLabel="#{theme.displayName}" itemValue="#{theme.name}" />
|
</p:panelGrid>
|
||||||
<p:ajax listener="#{sessionPreferences.updateCurrentTheme}" />
|
<h:panelGrid columns="2">
|
||||||
</p:themeSwitcher>
|
<h:outputLabel value="Fecha" />
|
||||||
</div>
|
<p:calendar pattern="dd/MM/yyyy" />
|
||||||
<div class="ui-g-4 ui-md-1" />
|
<h:outputLabel value="Rich Text Editor" />
|
||||||
|
<p:editor />
|
||||||
<div class="ui-g-4 ui-md-4" />
|
</h:panelGrid>
|
||||||
<div class="ui-g-4 ui-md-4 ">
|
<h:panelGroup>
|
||||||
<p:commandButton value="Usar tema en este sesión" update="mesgs" action="#{sessionPreferences.updateCurrentTheme}" icon="pi pi-save" />
|
<h:panelGrid columns="2">
|
||||||
</div>
|
|
||||||
<div class="ui-g-4 ui-md-4" />
|
|
||||||
|
|
||||||
<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:" />
|
<h:outputLabel value="Logeado como:" />
|
||||||
<p:inputText readonly="true" value="#{home.userName}" />
|
<p:inputText readonly="true" value="#{home.userName}" />
|
||||||
</div>
|
</h:panelGrid>
|
||||||
</div>
|
</h:panelGroup>
|
||||||
|
</p:panel>
|
||||||
|
<p:panel>
|
||||||
|
<h:panelGroup>
|
||||||
|
<h:panelGrid columns="1">
|
||||||
|
<p:commandButton value="Usar tema en este sesión" update="mesgs" action="#{sessionPreferences.updateCurrentTheme}" icon="pi pi-save" />
|
||||||
|
</h:panelGrid>
|
||||||
|
</h:panelGroup>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
</h:form>
|
</h:form>
|
||||||
</ui:define>
|
</ui:define>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
<h:head>
|
<h:head>
|
||||||
<title>login</title>
|
<title>login</title>
|
||||||
|
|||||||
@@ -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="#{BeanName.actionMethod}" icon="pi pi-check" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-2 ui-md-2">
|
|
||||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-4 ui-md-4" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</p:panel>
|
|
||||||
</h:form>
|
|
||||||
</ui:define>
|
|
||||||
</ui:composition>
|
|
||||||
</html>
|
|
||||||
51
1.sources/MyHealth/docroot/menubar.xhtml
Normal file
51
1.sources/MyHealth/docroot/menubar.xhtml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<h:form>
|
||||||
|
<p:growl id="messages" />
|
||||||
|
|
||||||
|
<p:menubar>
|
||||||
|
<p:submenu label="File" icon="pi pi-file">
|
||||||
|
<p:submenu label="New" icon="pi pi-briefcase">
|
||||||
|
<p:menuitem value="Project" url="#" />
|
||||||
|
<p:menuitem value="Other" url="#" />
|
||||||
|
</p:submenu>
|
||||||
|
<p:menuitem value="Open" url="#" />
|
||||||
|
<p:separator />
|
||||||
|
<p:menuitem value="Quit" url="#" />
|
||||||
|
</p:submenu>
|
||||||
|
|
||||||
|
<p:submenu label="Edit" icon="pi pi-pencil">
|
||||||
|
<p:menuitem value="Undo" url="#" icon="pi pi-angle-double-left" />
|
||||||
|
<p:menuitem value="Redo" url="#" icon="pi pi-angle-double-right" />
|
||||||
|
</p:submenu>
|
||||||
|
|
||||||
|
<p:submenu label="Help" icon="pi pi-question">
|
||||||
|
<p:menuitem value="Contents" url="#" />
|
||||||
|
<p:submenu label="Search" icon="pi pi-search">
|
||||||
|
<p:submenu label="Text">
|
||||||
|
<p:menuitem value="Workspace" url="#" />
|
||||||
|
</p:submenu>
|
||||||
|
<p:menuitem value="File" url="#" />
|
||||||
|
</p:submenu>
|
||||||
|
</p:submenu>
|
||||||
|
|
||||||
|
<p:submenu label="Actions" icon="pi pi-cog">
|
||||||
|
<p:submenu label="Ajax" icon="pi pi-refresh">
|
||||||
|
<p:menuitem value="Save" action="#{menuView.save}" icon="pi pi-save"
|
||||||
|
update="messages" />
|
||||||
|
<p:menuitem value="Update" action="#{menuView.update}"
|
||||||
|
icon="pi pi-refresh" update="messages" />
|
||||||
|
</p:submenu>
|
||||||
|
<p:submenu label="Non-Ajax" icon="pi pi-clone">
|
||||||
|
<p:menuitem value="Delete" action="#{menuView.delete}"
|
||||||
|
icon="pi pi-times" update="messages" ajax="false" />
|
||||||
|
</p:submenu>
|
||||||
|
</p:submenu>
|
||||||
|
|
||||||
|
<p:menuitem value="Quit" url="http://www.primefaces.org"
|
||||||
|
icon="pi pi-times" />
|
||||||
|
|
||||||
|
<f:facet name="options">
|
||||||
|
<p:inputText style="margin:1px 10px 1px 1px;" placeholder="Search" />
|
||||||
|
<p:commandButton type="button" value="Logout" icon="pi pi-home" />
|
||||||
|
</f:facet>
|
||||||
|
</p:menubar>
|
||||||
|
</h:form>
|
||||||
39
1.sources/MyHealth/docroot/profile/AddFamilyDoctor.xhtml
Normal file
39
1.sources/MyHealth/docroot/profile/AddFamilyDoctor.xhtml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmRegisterUser">
|
||||||
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
|
||||||
|
<p:panel id="DatosPersonales" header="Añadir un nuevo médico de familia">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:outputLabel value="Campo1:" for="campo1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:inputText id="campo1" value="123 asdf 123" required="true" requiredMessage="Por favor, indque el campo 1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:message for="campo1" display="text" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Guardar" update="mesgs" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
38
1.sources/MyHealth/docroot/profile/AddPatient.xhtml
Normal file
38
1.sources/MyHealth/docroot/profile/AddPatient.xhtml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmRegisterUser">
|
||||||
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
|
||||||
|
<p:panel id="DatosPersonales" header="Añadir un nuevo paciente">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:outputLabel value="Campo1:" for="campo1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:inputText id="campo1" value="123 asdf 123" required="true" requiredMessage="Por favor, indque el campo 1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:message for="campo1" display="text" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Guardar" update="mesgs" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
37
1.sources/MyHealth/docroot/profile/AddSpecialistDoctor.xhtml
Normal file
37
1.sources/MyHealth/docroot/profile/AddSpecialistDoctor.xhtml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmRegisterUser">
|
||||||
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
|
||||||
|
<p:panel id="DatosPersonales" header="Añadir un nuevo médico especialista">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:outputLabel value="Campo1:" for="campo1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:inputText id="campo1" value="123 asdf 123" required="true" requiredMessage="Por favor, indque el campo 1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:message for="campo1" display="text" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Guardar" update="mesgs" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define> </ui:composition>
|
||||||
|
</html>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<ui:composition template="../header.xhtml">
|
<ui:composition template="../header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="frmChangeFD">
|
<h:form id="frmChangeFD">
|
||||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
<p:panel id="badProfile" rendered="#{not home.patient}">
|
<p:panel id="badProfile" rendered="#{not home.patient}">
|
||||||
<div class="ui-g-3 ui-md-3" />
|
<div class="ui-g-3 ui-md-3" />
|
||||||
<div class="ui-g-6 ui-md-6">
|
<div class="ui-g-6 ui-md-6">
|
||||||
@@ -44,11 +44,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:autoComplete id="newFamilyDocAC" dropdown="true" required="true" value="#{ChangeFD.newFamilyDoctor}" completeMethod="#{ChangeFD.completeFamilyDoctor}" var="fd"
|
<p:autoComplete id="newFamilyDocAC" dropdown="true" required="true" value="#{ChangeFD.newFamilyDoctor}" completeMethod="#{ChangeFD.completeFamilyDoctor}" var="fd"
|
||||||
itemLabel="#{fd.displayName}" itemValue="#{fd}" forceSelection="true" requiredMessage="Por favor, selecciona un médico de familia"
|
itemLabel="#{fd.displayName}" itemValue="#{fd}" forceSelection="true" requiredMessage="Por favor, selecciona un médico de familia">
|
||||||
placeholder="Seleccione su nuevo médico de familia o teclee para buscar...">
|
|
||||||
<o:converter converterId="omnifaces.ListConverter" list="#{ChangeFD.familyDoctorList}" />
|
<o:converter converterId="omnifaces.ListConverter" list="#{ChangeFD.familyDoctorList}" />
|
||||||
<p:column headerText="Num. Prof.">
|
<p:column headerText="Num. Prof.">
|
||||||
<h:outputText value="#{fd.professionalNumber}" />
|
<h:outputText value="#{fd.id}" />
|
||||||
</p:column>
|
</p:column>
|
||||||
<p:column headerText="Nombre">
|
<p:column headerText="Nombre">
|
||||||
<h:outputText value="#{fd.name}" />
|
<h:outputText value="#{fd.name}" />
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<ui:composition template="../header.xhtml">
|
<ui:composition template="../header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="frmChangePHCC">
|
<h:form id="frmChangePHCC">
|
||||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
<p:panel id="badProfile" rendered="#{not home.familyDoctor}">
|
<p:panel id="badProfile" rendered="#{not home.familyDoctor}">
|
||||||
<div class="ui-g-3 ui-md-3" />
|
<div class="ui-g-3 ui-md-3" />
|
||||||
<div class="ui-g-6 ui-md-6">
|
<div class="ui-g-6 ui-md-6">
|
||||||
@@ -44,16 +44,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:autoComplete id="newCenter" dropdown="true" required="true" value="#{ChangeCAP.newCenter}" completeMethod="#{ChangeCAP.completePrimaryHealCareCenter}" var="phc"
|
<p:autoComplete id="newCenter" dropdown="true" required="true" value="#{ChangeCAP.newCenter}" completeMethod="#{ChangeCAP.completePrimaryHealCareCenter}" var="phc"
|
||||||
itemLabel="#{phc.displayName}" itemValue="#{phc}" forceSelection="true" requiredMessage="Por favor, selecciona un nuevo centro de antención primaria"
|
itemLabel="#{phc.displayName}" itemValue="#{phc}" forceSelection="true" requiredMessage="Por favor, selecciona un nuevo centro de antención primaria">
|
||||||
placeholder="Seleccione una CAP o teclee para buscar...">
|
|
||||||
<o:converter converterId="omnifaces.ListConverter" list="#{ChangeCAP.phcList}" />
|
<o:converter converterId="omnifaces.ListConverter" list="#{ChangeCAP.phcList}" />
|
||||||
<p:column headerText="Nombre">
|
<p:column headerText="Nombre"><h:outputText value="#{phc.name}" /></p:column>
|
||||||
<h:outputText value="#{phc.name}" />
|
<p:column headerText="Localización"><h:outputText value="#{phc.location}" /></p:column>
|
||||||
</p:column>
|
</p:autoComplete>
|
||||||
<p:column headerText="Localización">
|
|
||||||
<h:outputText value="#{phc.location}" />
|
|
||||||
</p:column>
|
|
||||||
</p:autoComplete>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:message for="newCenter" />
|
<p:message for="newCenter" />
|
||||||
|
|||||||
@@ -46,35 +46,34 @@
|
|||||||
<h:form id="frmRegisterUser" rendered="#{not RegisterUser.registered}">
|
<h:form id="frmRegisterUser" rendered="#{not RegisterUser.registered}">
|
||||||
<h:outputScript>
|
<h:outputScript>
|
||||||
function handleRequest(xhr, status, args) {
|
function handleRequest(xhr, status, args) {
|
||||||
var nif = PF('nifButton');
|
/*
|
||||||
if ( args.NIFisDupe == false ) {
|
if(args.specs) {
|
||||||
nif.jq.children(".ui-icon").removeClass("pi pi-times");
|
$('#panCentros').slideUp();
|
||||||
nif.jq.removeClass('red-button');
|
$('#panEspecialidades').slideDown();
|
||||||
|
}
|
||||||
nif.jq.children(".ui-icon").addClass("pi pi-check");
|
else if (args.caps) {
|
||||||
nif.jq.addClass('green-button');
|
$('#panEspecialidades').slideUp();
|
||||||
}
|
$('#panCentros').slideDown();
|
||||||
else if (nif.jq.hasClass('red-button') == false) {
|
} else if (args.pats) {
|
||||||
nif.jq.children(".ui-icon").removeClass("pi pi-check");
|
$('#panCentros').slideUp();
|
||||||
nif.jq.removeClass('green-button');
|
$('#panEspecialidades').slideUp();
|
||||||
|
}
|
||||||
nif.jq.children(".ui-icon").addClass("pi pi-times");
|
*/
|
||||||
nif.jq.addClass('red-button');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</h:outputScript>
|
</h:outputScript>
|
||||||
<p:growl id="mesgs" globalOnly="true" showDetail="true" closable="true" autoupdate="true" />
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
<p:panel id="tipoUsuario" header="Especifique el tipo de usuario que desea registrarse">
|
<p:panel id="tipoUsuario" header="Especifique el tipo de usuario que desea registrarse">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
<p:outputLabel value="Tipo de usuario:" for="selUsertype" />
|
<p:outputLabel value="Tipo de usuario:" for="selUsertype" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-10 ui-md-10">
|
<div class="ui-g-6 ui-md-6">
|
||||||
<p:selectOneButton id="selUsertype" value="#{RegisterUser.userType}" required="true" unselectable="false" requiredMessage="Debe especificar un tipo de usuario">
|
<p:selectOneButton id="selUsertype" value="#{RegisterUser.userType}" required="true" unselectable="false" requiredMessage="Debe especificar un tipo de usuario">
|
||||||
<f:selectItems value="#{RegisterUser.availableUserTypes}" var="item" itemLabel="#{item.userTypename}" />
|
<f:selectItems value="#{RegisterUser.availableUserTypes}" var="item" itemLabel="#{item.userTypename}" />
|
||||||
<p:ajax listener="#{RegisterUser.onUserTypeChange}" update="panCombos" />
|
<p:ajax listener="#{RegisterUser.onUserTypeChange}" update="panCombos" oncomplete="handleRequest(xhr, status, args)" />
|
||||||
</p:selectOneButton>
|
</p:selectOneButton>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4" />
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
<br />
|
<br />
|
||||||
@@ -84,15 +83,10 @@
|
|||||||
<p:outputLabel value="NIF:" for="nif" />
|
<p:outputLabel value="NIF:" for="nif" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<div class="ui-inputgroup">
|
<p:inputText id="nif" value="#{RegisterUser.nif}" validator="nifValidator" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF" />
|
||||||
<p:inputText id="nif" value="#{RegisterUser.nif}" validator="nifValidator" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF">
|
|
||||||
<p:ajax event="blur" update="nifmsg" listener="#{RegisterUser.hadleNIFValueChange}" oncomplete="handleRequest(xhr, status, args)" />
|
|
||||||
</p:inputText>
|
|
||||||
<p:commandButton widgetVar="nifButton" icon="pi pi-times" styleClass="red-button" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6 ui-md-6">
|
<div class="ui-g-6 ui-md-6">
|
||||||
<p:message id="nifmsg" for="nif" />
|
<p:message for="nif" display="text" showDetail="true" showSummary="true" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
@@ -120,12 +114,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:inputText id="email" value="#{RegisterUser.email}" required="true" maxlength="120" validator="emailValidator"
|
<p:inputText id="email" value="#{RegisterUser.email}" required="true" maxlength="120" validator="emailValidator"
|
||||||
validatorMessage="La dirección de correo electrónico #{RegisterUser.email} no es válida" requiredMessage="Por favor, especifique su correo electrónico">
|
validatorMessage="La dirección #{RegisterUser.email} no es válida" requiredMessage="Por favor, especifique su correo electrónico">
|
||||||
<f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
|
<f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
|
||||||
</p:inputText>
|
</p:inputText>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6 ui-md-6">
|
<div class="ui-g-6 ui-md-6">
|
||||||
<p:message for="email" />
|
<p:message for="email" display="text" showDetail="true" showSummary="true" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
<p:outputLabel value="Contraseña" for="password" />
|
<p:outputLabel value="Contraseña" for="password" />
|
||||||
@@ -154,9 +148,8 @@
|
|||||||
<p:outputLabel value="Centro:" for="selPHC" />
|
<p:outputLabel value="Centro:" for="selPHC" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:autoComplete id="selPHC" dropdown="true" required="true" value="#{RegisterUser.primaryHealthCareCenter}" completeMethod="#{RegisterUser.completePrimaryHealCareCenter}"
|
<p:autoComplete id="selPHC" dropdown="true" value="#{RegisterUser.primaryHealthCareCenter}" completeMethod="#{RegisterUser.completePrimaryHealCareCenter}" var="phc"
|
||||||
var="phc" itemLabel="#{phc.displayName}" itemValue="#{phc}" forceSelection="true" requiredMessage="Por favor, selecciona un nuevo centro de antención primaria"
|
itemLabel="#{phc.displayName}" itemValue="#{phc}" forceSelection="true" requiredMessage="Por favor, selecciona un nuevo centro de antención primaria">
|
||||||
placeholder="Seleccione una CAP o teclee para buscar...">
|
|
||||||
<o:converter converterId="omnifaces.ListConverter" list="#{RegisterUser.phcList}" />
|
<o:converter converterId="omnifaces.ListConverter" list="#{RegisterUser.phcList}" />
|
||||||
<p:column headerText="Nombre">
|
<p:column headerText="Nombre">
|
||||||
<h:outputText value="#{phc.name}" />
|
<h:outputText value="#{phc.name}" />
|
||||||
@@ -176,9 +169,8 @@
|
|||||||
<p:outputLabel value="Especialidad médica:" for="selMS" />
|
<p:outputLabel value="Especialidad médica:" for="selMS" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:autoComplete id="selMS" dropdown="true" required="true" value="#{RegisterUser.medicalSpecialty}" completeMethod="#{RegisterUser.completeMedicalSpecialty}" var="ms"
|
<p:autoComplete id="selMS" dropdown="true" value="#{RegisterUser.medicalSpecialty}" completeMethod="#{RegisterUser.completeMedicalSpecialty}" var="ms"
|
||||||
itemLabel="#{ms.displayName}" itemValue="#{ms}" forceSelection="true" requiredMessage="Por favor, selecciona una especialidad médica"
|
itemLabel="#{ms.displayName}" itemValue="#{ms}" forceSelection="true" requiredMessage="Por favor, selecciona una especialidad médica">
|
||||||
placeholder="Seleccione una especialidad médica o teclee para buscar...">
|
|
||||||
<o:converter converterId="omnifaces.ListConverter" list="#{RegisterUser.medicalSpecialtiesList}" />
|
<o:converter converterId="omnifaces.ListConverter" list="#{RegisterUser.medicalSpecialtiesList}" />
|
||||||
<p:column headerText="Nombre">
|
<p:column headerText="Nombre">
|
||||||
<h:outputText value="#{ms.name}" />
|
<h:outputText value="#{ms.name}" />
|
||||||
|
|||||||
38
1.sources/MyHealth/docroot/profile/ShowFamilyDoctor.xhtml
Normal file
38
1.sources/MyHealth/docroot/profile/ShowFamilyDoctor.xhtml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmRegisterUser">
|
||||||
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
|
||||||
|
<p:panel id="DatosPersonales" header="Consultar datos de médico de familia">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:outputLabel value="Campo1:" for="campo1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:inputText id="campo1" value="123 asdf 123" required="true" requiredMessage="Por favor, indque el campo 1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:message for="campo1" display="text" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Guardar" update="mesgs" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
38
1.sources/MyHealth/docroot/profile/ShowPaciente.xhtml
Normal file
38
1.sources/MyHealth/docroot/profile/ShowPaciente.xhtml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmRegisterUser">
|
||||||
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
|
||||||
|
<p:panel id="DatosPersonales" header="Consultar datos de paciente">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:outputLabel value="Campo1:" for="campo1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:inputText id="campo1" value="123 asdf 123" required="true" requiredMessage="Por favor, indque el campo 1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:message for="campo1" display="text" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Guardar" update="mesgs" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmRegisterUser">
|
||||||
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
|
||||||
|
<p:panel id="DatosPersonales" header="Consultar datos de especialista">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:outputLabel value="Campo1:" for="campo1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:inputText id="campo1" value="123 asdf 123" required="true" requiredMessage="Por favor, indque el campo 1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:message for="campo1" display="text" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Guardar" update="mesgs" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
39
1.sources/MyHealth/docroot/profile/UpdateFamilyDoctor.xhtml
Normal file
39
1.sources/MyHealth/docroot/profile/UpdateFamilyDoctor.xhtml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmRegisterUser">
|
||||||
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
|
||||||
|
<p:panel id="DatosPersonales" header="Actualizar médico de familia">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:outputLabel value="Campo1:" for="campo1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:inputText id="campo1" value="123 asdf 123" required="true" requiredMessage="Por favor, indque el campo 1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:message for="campo1" display="text" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Guardar" update="mesgs" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
39
1.sources/MyHealth/docroot/profile/UpdatePatient.xhtml
Normal file
39
1.sources/MyHealth/docroot/profile/UpdatePatient.xhtml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmRegisterUser">
|
||||||
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
|
||||||
|
<p:panel id="DatosPersonales" header="Actualizar paciente">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:outputLabel value="Campo1:" for="campo1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:inputText id="campo1" value="123 asdf 123" required="true" requiredMessage="Por favor, indque el campo 1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:message for="campo1" display="text" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Guardar" update="mesgs" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
@@ -7,38 +7,20 @@
|
|||||||
<ui:composition template="../header.xhtml">
|
<ui:composition template="../header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="frmUpdateProfile">
|
<h:form id="frmUpdateProfile">
|
||||||
<h:outputScript>
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
function handleRequest(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');
|
|
||||||
|
|
||||||
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');
|
|
||||||
|
|
||||||
nif.jq.children(".ui-icon").addClass("pi pi-times");
|
|
||||||
nif.jq.addClass('red-button');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</h:outputScript>
|
|
||||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
|
||||||
|
|
||||||
<p:panel id="tipoUsuario" header="Tipo de usuario registrado">
|
<p:panel id="tipoUsuario" header="Tipo de usuario registrado">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
<p:outputLabel value="Tipo de usuario:" for="selUsertype" />
|
<p:outputLabel value="Tipo de usuario:" for="selUsertype" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-10 ui-md-10">
|
<div class="ui-g-6 ui-md-6">
|
||||||
<p:selectOneButton id="selUsertype" value="#{UpdateProfile.userType}" disabled="true" required="true" unselectable="false"
|
<p:selectOneButton id="selUsertype" value="#{UpdateProfile.userType}" disabled="true" required="true" unselectable="false"
|
||||||
requiredMessage="Debe especificar un tipo de usuario">
|
requiredMessage="Debe especificar un tipo de usuario">
|
||||||
<f:selectItems value="#{UpdateProfile.userTypes}" var="item" itemLabel="#{item.userTypename}" itemValue="#{item.name}" />
|
<f:selectItems value="#{UpdateProfile.userTypes}" var="item" itemLabel="#{item.userTypename}" itemValue="#{item.name}" />
|
||||||
</p:selectOneButton>
|
</p:selectOneButton>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
<br />
|
<br />
|
||||||
@@ -49,7 +31,7 @@
|
|||||||
<p:outputLabel value="Número de Profesional:" rendered="#{UpdateProfile.userTypeDoctor}" for="cipCode" />
|
<p:outputLabel value="Número de Profesional:" rendered="#{UpdateProfile.userTypeDoctor}" for="cipCode" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:inputText id="cipCode" value="#{UpdateProfile.cipCode}" readonly="true" required="true" requiredMessage="Es necesario un código de identificación" />
|
<p:inputText id="cipCode" value="#{UpdateProfile.cipCode}" disabled="true" required="true" requiredMessage="Es necesario un código de identificación" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6 ui-md-6">
|
<div class="ui-g-6 ui-md-6">
|
||||||
<p:message for="cipCode" display="text" />
|
<p:message for="cipCode" display="text" />
|
||||||
@@ -59,15 +41,10 @@
|
|||||||
<p:outputLabel value="NIF:" for="nif" />
|
<p:outputLabel value="NIF:" for="nif" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<div class="ui-inputgroup">
|
<p:inputText id="nif" value="#{UpdateProfile.nif}" validator="nifValidator" required="true" maxlength="50" requiredMessage="Por favor, indque su NIF" />
|
||||||
<p:inputText id="nif" value="#{UpdateProfile.nif}" validator="nifValidator" maxlength="20" required="true" requiredMessage="Por favor, indque su NIF">
|
|
||||||
<p:ajax event="blur" update="nifmsg" listener="#{UpdateProfile.hadleNIFValueChange}" oncomplete="handleRequest(xhr, status, args)" />
|
|
||||||
</p:inputText>
|
|
||||||
<p:commandButton widgetVar="nifButton" icon="pi pi-check" styleClass="green-button" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6 ui-md-6">
|
<div class="ui-g-6 ui-md-6">
|
||||||
<p:message id="nifmsg" for="nif" display="text" />
|
<p:message for="nif" display="text" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
@@ -94,8 +71,8 @@
|
|||||||
<p:outputLabel value="Correo electrónico:" for="email" />
|
<p:outputLabel value="Correo electrónico:" for="email" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:inputText id="email" value="#{UpdateProfile.email}" required="true" maxlength="120" validator="emailValidator"
|
<p:inputText id="email" value="#{UpdateProfile.email}" required="true" maxlength="120" validator="emailValidator" validatorMessage="La dirección #{RegisterUser.email} no es válida"
|
||||||
validatorMessage="La dirección #{RegisterUser.email} no es válida" requiredMessage="Por favor, especifique su correo electrónico">
|
requiredMessage="Por favor, especifique su correo electrónico">
|
||||||
<f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
|
<f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
|
||||||
</p:inputText>
|
</p:inputText>
|
||||||
</div>
|
</div>
|
||||||
@@ -115,7 +92,7 @@
|
|||||||
<p:outputLabel value="Nueva contraseña" for="password" />
|
<p:outputLabel value="Nueva contraseña" for="password" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:password id="password" value="#{UpdateProfile.password}" match="passwordRepeat" required="false" maxlength="100" requiredMessage="Por favor, especifique una contraseña"
|
<p:password id="password" value="#{UpdateProfile.password}" match="passwordRepeat" required="false" 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"
|
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" />
|
validatorMessage="La contraseña y su verificación deben ser iguales" />
|
||||||
</div>
|
</div>
|
||||||
@@ -126,7 +103,7 @@
|
|||||||
<p:outputLabel value="Verificación de contraseña:" for="passwordRepeat" />
|
<p:outputLabel value="Verificación de contraseña:" for="passwordRepeat" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4">
|
<div class="ui-g-4">
|
||||||
<p:password id="passwordRepeat" value="#{UpdateProfile.password}" required="false" maxlength="100" requiredMessage="Por favor, escriba la verificación de su contraseña" />
|
<p:password id="passwordRepeat" value="#{UpdateProfile.password}" required="false" maxlength="100" requiredMessage="Por favor, escriba la verificación de su contraseña" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6">
|
<div class="ui-g-6">
|
||||||
<p:message for="passwordRepeat" />
|
<p:message for="passwordRepeat" />
|
||||||
@@ -179,12 +156,11 @@
|
|||||||
<p:outputLabel value="Médico de familia:" for="FamilyDoc" />
|
<p:outputLabel value="Médico de familia:" for="FamilyDoc" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:autoComplete id="FamilyDoc" readonly="true" dropdown="true" required="true" value="#{UpdateProfile.familyDoctor}" completeMethod="#{UpdateProfile.completeFamilyDoctor}"
|
<p:autoComplete id="FamilyDoc" disabled="true" dropdown="true" required="true" value="#{UpdateProfile.familyDoctor}" completeMethod="#{UpdateProfile.completeFamilyDoctor}"
|
||||||
var="fd" itemLabel="#{fd.displayName}" itemValue="#{fd}" forceSelection="true" requiredMessage="Por favor, selecciona un médico de familia"
|
var="fd" itemLabel="#{fd.displayName}" itemValue="#{fd}" forceSelection="true" requiredMessage="Por favor, selecciona un médico de familia">
|
||||||
placeholder="Seleccione su médico de familia a través de la opción de cambiar médico de familia...">
|
|
||||||
<o:converter converterId="omnifaces.ListConverter" list="#{UpdateProfile.familyDoctorList}" />
|
<o:converter converterId="omnifaces.ListConverter" list="#{UpdateProfile.familyDoctorList}" />
|
||||||
<p:column headerText="Num. Prof.">
|
<p:column headerText="Num. Prof.">
|
||||||
<h:outputText value="#{fd.professionalNumber}" />
|
<h:outputText value="#{fd.id}" />
|
||||||
</p:column>
|
</p:column>
|
||||||
<p:column headerText="Nombre">
|
<p:column headerText="Nombre">
|
||||||
<h:outputText value="#{fd.name}" />
|
<h:outputText value="#{fd.name}" />
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmRegisterUser">
|
||||||
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
|
||||||
|
<p:panel id="DatosPersonales" header="Consultar médico especialista">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:outputLabel value="Campo1:" for="campo1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:inputText id="campo1" value="123 asdf 123" required="true" requiredMessage="Por favor, indque el campo 1" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:message for="campo1" display="text" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Guardar" update="mesgs" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
@@ -9,31 +9,4 @@ BODY {
|
|||||||
.nopadding {
|
.nopadding {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
}
|
|
||||||
|
|
||||||
ul.ui-menu-child {
|
|
||||||
white-space: nowrap;
|
|
||||||
width: auto !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.green-button.ui-button.ui-state-default {
|
|
||||||
background-color: #5cb85c;
|
|
||||||
border-color: #5cb85c;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.green-button.ui-button.ui-state-default:enabled:hover, .green-button.ui-button.ui-state-default:focus {
|
|
||||||
background-color: #4cae4c;
|
|
||||||
border-color: #5cb85c;
|
|
||||||
}
|
|
||||||
|
|
||||||
.red-button.ui-button.ui-state-default {
|
|
||||||
background-color: #d9534f;
|
|
||||||
border-color: #d9534f;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.red-button.ui-button.ui-state-default:enabled:hover, .red-button.ui-button.ui-state-default:focus {
|
|
||||||
background-color: #d43f3a;
|
|
||||||
border-color: #d9534f;
|
|
||||||
}
|
}
|
||||||
@@ -2,64 +2,58 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
<ui:composition template="../header.xhtml">
|
<ui:composition template="../header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="frmManageSpecialties">
|
<h:form id="TestForm">
|
||||||
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
<p:panel id="PanelMS" header="Modificación y borrado de especialidades">
|
<p:panel id="PanelUnderConstruction" header="Pagina en construcción de Administrador">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-2 ui-md-2">
|
|
||||||
<p:outputLabel for="ms"/>
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:selectOneMenu id="ms" value="#{ManageSpecialities.medicalSpecialty}" converter="omnifaces.SelectItemsIndexConverter"
|
<p:outputLabel for="campo" value="Etiqueta para campo de formulario:" />
|
||||||
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>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<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" />
|
<p:inputText id="campo" value="Valor del campo del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-1 ui-md-1 ">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:commandButton validateClient="true" value="Guardar" update="mesgs" action="#{ManageSpecialities.saveData}" icon="pi pi-save" />
|
<p:message for="campo" display="text" />
|
||||||
</div>
|
</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>
|
|
||||||
</div>
|
|
||||||
</p:panel>
|
|
||||||
|
|
||||||
<p:panel id="PanelNewMS" header="Alta de especialidades">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<div class="ui-g ui-fluid">
|
<p:outputLabel for="campo2" value="Etiqueta para campo 2 de formulario:" />
|
||||||
<div class="ui-g-1 ui-md-1" >
|
|
||||||
<p:outputLabel value="Nombre: " for="nameNew"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:inputText id="nameNew" value="#{ManageSpecialities.name}" readonly="false" required="ManageSpecialities.medicalSpecialty.name eq null" requiredMessage="Es necesario un nombre" />
|
<p:inputText id="campo2" value="Valor del campo 2 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-1 ui-md-1">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:outputLabel value="Descripción: " for="descriptionNew" />
|
<p:message for="campo" display="text" />
|
||||||
</div>
|
</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" />
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:outputLabel for="campo3" value="Etiqueta para campo 3 de formulario:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2 ui-md-2 ">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:commandButton validateClient="true" value="Crear" update="mesgs" action="#{ManageSpecialities.insertData}" icon="pi pi-check" />
|
<p:inputText id="campo3" value="Valor del campo 3 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="ui-g-4 ui-md-4">
|
||||||
</p:panel>
|
<p:message for="campo" display="text" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-4" />
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Guardar" update="TestForm" action="#{BeanName.actionMethod}" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
</h:form>
|
</h:form>
|
||||||
</ui:define>
|
</ui:define>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class FamilyDoctorTO implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
return String.format("[%s] %s %s", this.professionalNumber, this.name, this.surname);
|
return String.format("[%d] %s %s", this.id, this.name, this.surname);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() {
|
public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() {
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ public class LoggedUserTO implements Serializable {
|
|||||||
return userType;
|
return userType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserType(UserType value) {
|
public void setUserType(UserType userType) {
|
||||||
this.userType = value;
|
this.userType = userType;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "medicalSpecialty")
|
@XmlRootElement(name = "medicalspeciality")
|
||||||
public class MedicalSpecialtyTO implements Serializable {
|
public class MedicalSpecialtyTO implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package TO;
|
package TO;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Roberto Orden Erena <rorden@uoc.edu>
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "MedicalTest")
|
@XmlRootElement(name = "MedicalTest")
|
||||||
@@ -15,93 +14,10 @@ public class MedicalTestTO implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private int id;
|
|
||||||
private Date date;
|
public MedicalTestTO() {
|
||||||
private long time;
|
super();
|
||||||
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,
|
|
||||||
PatientTO patiend, SpecialistDoctorTO specialistDoctor) {
|
|
||||||
this.setId(id);
|
|
||||||
this.setDate(date);
|
|
||||||
this.setTime(time);
|
|
||||||
this.setObservations(observations);
|
|
||||||
this.setHighresimage(highresimage);
|
|
||||||
this.setType(type);
|
|
||||||
this.setPatient(patiend);
|
|
||||||
this.setSpecialistDoctor(specialistDoctor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDate() {
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDate(Date date) {
|
|
||||||
this.date = date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTime() {
|
|
||||||
return time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTime(long time) {
|
|
||||||
this.time = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getObservations() {
|
|
||||||
return observations;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setObservations(String observations) {
|
|
||||||
this.observations = observations;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHighresimage() {
|
|
||||||
return highresimage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHighresimage(String highresimage) {
|
|
||||||
this.highresimage = highresimage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MedicalTestType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(MedicalTestType type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PatientTO getPatient() {
|
|
||||||
return patient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPatient(PatientTO patient) {
|
|
||||||
this.patient = patient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SpecialistDoctorTO getSpecialistDoctor() {
|
|
||||||
return specialistDoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpecialistDoctor(SpecialistDoctorTO specialistDoctor) {
|
|
||||||
this.specialistDoctor = specialistDoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,10 +90,6 @@ public class PatientTO implements Serializable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDisplayName() {
|
|
||||||
return String.format("[%s] %s %s", this.personalIdentificationCode, this.name, this.surname);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FamilyDoctorTO getFamilyDoctor() {
|
public FamilyDoctorTO getFamilyDoctor() {
|
||||||
return familyDoctor;
|
return familyDoctor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
package TO;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import common.QuestionStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Roberto Orden Erena <rorden@uoc.edu>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@XmlRootElement(name = "Question")
|
|
||||||
public class QuestionTO implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private int id;
|
|
||||||
private String title;
|
|
||||||
private String message;
|
|
||||||
private QuestionStatus status;
|
|
||||||
private String response;
|
|
||||||
private PatientTO patient;
|
|
||||||
private FamilyDoctorTO fdoctor;
|
|
||||||
|
|
||||||
|
|
||||||
public QuestionTO() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public QuestionTO(int id, String title, String message, QuestionStatus status, PatientTO patient,
|
|
||||||
FamilyDoctorTO fdoctor, String response) {
|
|
||||||
super();
|
|
||||||
this.id = id;
|
|
||||||
this.title = title;
|
|
||||||
this.message = message;
|
|
||||||
this.status = status;
|
|
||||||
this.patient = patient;
|
|
||||||
this.fdoctor = fdoctor;
|
|
||||||
this.response = response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QuestionStatus getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(QuestionStatus status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PatientTO getPatient() {
|
|
||||||
return patient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPatient(PatientTO patient) {
|
|
||||||
this.patient = patient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FamilyDoctorTO getDoctor() {
|
|
||||||
return fdoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDoctor(FamilyDoctorTO fdoctor) {
|
|
||||||
this.fdoctor = fdoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResponse() {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResponse(String response) {
|
|
||||||
this.response = response;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -85,10 +85,6 @@ public class SpecialistDoctorTO implements Serializable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDisplayName() {
|
|
||||||
return String.format("[%s] %s %s", this.professionalNumber, this.name, this.surname);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MedicalSpecialtyTO getMedicalSpecialty() {
|
public MedicalSpecialtyTO getMedicalSpecialty() {
|
||||||
return medicalSpecialty;
|
return medicalSpecialty;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,4 @@ public class Constants {
|
|||||||
public static final int MAX_ITEMS_AUTOCOMPLETE_SEARCH = 200;
|
public static final int MAX_ITEMS_AUTOCOMPLETE_SEARCH = 200;
|
||||||
public static final String PROFESSIONAL_NUMBER_PREFIX = "PRO#";
|
public static final String PROFESSIONAL_NUMBER_PREFIX = "PRO#";
|
||||||
public static final String PERSONAL_IDENTIFICATION_CODE_PREFIX = "PAT#";
|
public static final String PERSONAL_IDENTIFICATION_CODE_PREFIX = "PAT#";
|
||||||
|
|
||||||
public static final int DEFAULT_TABLE_GRID_PAGE_SIZE = 20;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package common;
|
package common;
|
||||||
|
|
||||||
import java.text.Normalizer;
|
import java.text.Normalizer;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -12,18 +11,9 @@ public class Utils {
|
|||||||
public static String stripAccents(String input) {
|
public static String stripAccents(String input) {
|
||||||
return input == null ? null : Normalizer.normalize(input, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
|
return input == null ? null : Normalizer.normalize(input, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String normalizeTerm(String input) {
|
public static String normalizeTerm(String input) {
|
||||||
// return stripAccents(input).toLowerCase();
|
//return stripAccents(input).toLowerCase();
|
||||||
return input.toLowerCase();
|
return input.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Throwable getExceptionRootCause(Throwable throwable) {
|
|
||||||
Objects.requireNonNull(throwable);
|
|
||||||
Throwable rootCause = throwable;
|
|
||||||
while (rootCause.getCause() != null && rootCause.getCause() != rootCause) {
|
|
||||||
rootCause = rootCause.getCause();
|
|
||||||
}
|
|
||||||
return rootCause;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,27 +6,23 @@ import java.util.List;
|
|||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
import javax.persistence.Query;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
|
import org.jboss.security.auth.spi.Users.User;
|
||||||
|
|
||||||
import TO.FamilyDoctorTO;
|
import TO.FamilyDoctorTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
import TO.PatientTO;
|
import TO.PatientTO;
|
||||||
import TO.PrimaryHealthCareCenterTO;
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
import TO.QuestionTO;
|
|
||||||
import TO.SpecialistDoctorTO;
|
import TO.SpecialistDoctorTO;
|
||||||
import common.Utils;
|
import common.Utils;
|
||||||
import jpa.FamilyDoctorJPA;
|
import jpa.FamilyDoctorJPA;
|
||||||
import jpa.MedicalSpecialtyJPA;
|
import jpa.MedicalSpecialtyJPA;
|
||||||
import jpa.PatientJPA;
|
import jpa.PatientJPA;
|
||||||
import jpa.PrimaryHealthCareCenterJPA;
|
import jpa.PrimaryHealthCareCenterJPA;
|
||||||
import jpa.QuestionJPA;
|
|
||||||
import jpa.SpecialistDoctorJPA;
|
import jpa.SpecialistDoctorJPA;
|
||||||
|
|
||||||
/***
|
|
||||||
*
|
|
||||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||||
// Persistence Unit Context
|
// Persistence Unit Context
|
||||||
@@ -34,9 +30,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
private EntityManager entman;
|
private EntityManager entman;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Metodo que devuelve todas las especialidades medicas registradas en el sistema
|
* Metodo que devuelve todas las especialidades medicas
|
||||||
*
|
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
|
||||||
*/
|
*/
|
||||||
public List<MedicalSpecialtyTO> listAllMedicalSpecialities() {
|
public List<MedicalSpecialtyTO> listAllMedicalSpecialities() {
|
||||||
return this.listMedicalSpecialitiesPaged(0, 0);
|
return this.listMedicalSpecialitiesPaged(0, 0);
|
||||||
@@ -45,26 +39,14 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
/**
|
/**
|
||||||
* Metodo que devuelve las especialidades médicas de forma paginada
|
* 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).
|
|
||||||
*
|
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
|
||||||
*/
|
*/
|
||||||
public List<MedicalSpecialtyTO> listMedicalSpecialitiesPaged(int pageNumber, int pageSize) {
|
public List<MedicalSpecialtyTO> listMedicalSpecialitiesPaged(int pageNumber, int pageSize) {
|
||||||
return listMedicalSpecialitiesFiltered(null, pageNumber, pageSize);
|
return listMedicalSpecialitiesFiltered(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.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
|
||||||
*/
|
|
||||||
public List<MedicalSpecialtyTO> listMedicalSpecialitiesFiltered(String searchTerm, int pageNumber, int pageSize) {
|
public List<MedicalSpecialtyTO> listMedicalSpecialitiesFiltered(String searchTerm, int pageNumber, int pageSize) {
|
||||||
String strQuery = "SELECT ms from MedicalSpecialtyJPA ms %s order by ms.name, ms.description";
|
String strQuery = "SELECT ms from MedicalSpecialtyJPA ms %s order by ms.name, ms.description";
|
||||||
String strFilter = "";
|
String strFilter = "";
|
||||||
@@ -97,36 +79,14 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
return allSpecialities;
|
return allSpecialities;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Método que devuelve todos los CAPs registrados en el sistema
|
|
||||||
*
|
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
|
||||||
*/
|
|
||||||
public List<PrimaryHealthCareCenterTO> listAllCAPs() {
|
public List<PrimaryHealthCareCenterTO> listAllCAPs() {
|
||||||
return this.listCAPsPaged(0, 0);
|
return this.listCAPsPaged(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
|
||||||
*/
|
|
||||||
public List<PrimaryHealthCareCenterTO> listCAPsPaged(int pageNumber, int pageSize) {
|
public List<PrimaryHealthCareCenterTO> listCAPsPaged(int pageNumber, int pageSize) {
|
||||||
return this.listCAPsFiltered(null, pageNumber, pageSize);
|
return this.listCAPsFiltered(null, pageNumber, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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).
|
|
||||||
*/
|
|
||||||
public List<PrimaryHealthCareCenterTO> listCAPsFiltered(String searchTerm, int pageNumber, int pageSize) {
|
public List<PrimaryHealthCareCenterTO> listCAPsFiltered(String searchTerm, int pageNumber, int pageSize) {
|
||||||
String strQuery = "SELECT phc from PrimaryHealthCareCenterJPA phc %s order by phc.name, phc.location";
|
String strQuery = "SELECT phc from PrimaryHealthCareCenterJPA phc %s order by phc.name, phc.location";
|
||||||
String strFilter = "";
|
String strFilter = "";
|
||||||
@@ -159,35 +119,14 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
return allCAPs;
|
return allCAPs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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).
|
|
||||||
*/
|
|
||||||
public List<FamilyDoctorTO> listAllFamilyDoctors() {
|
public List<FamilyDoctorTO> listAllFamilyDoctors() {
|
||||||
return this.listFamilyDoctorsPaged(0, 0);
|
return this.listFamilyDoctorsPaged(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* @return Devuelve una Lista de FamilyDoctorTO (Transfer Objects).
|
|
||||||
*/
|
|
||||||
public List<FamilyDoctorTO> listFamilyDoctorsPaged(int pageNumber, int pageSize) {
|
public List<FamilyDoctorTO> listFamilyDoctorsPaged(int pageNumber, int pageSize) {
|
||||||
return this.listFamilyDoctorsFiltered(null, pageNumber, pageSize);
|
return this.listFamilyDoctorsFiltered(null, pageNumber, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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).
|
|
||||||
*/
|
|
||||||
public List<FamilyDoctorTO> listFamilyDoctorsFiltered(String searchTerm, int pageNumber, int pageSize) {
|
public List<FamilyDoctorTO> listFamilyDoctorsFiltered(String searchTerm, int pageNumber, int pageSize) {
|
||||||
String strQuery = "SELECT fd FROM FamilyDoctorJPA fd %s order by fd.name, fd.surname";
|
String strQuery = "SELECT fd FROM FamilyDoctorJPA fd %s order by fd.name, fd.surname";
|
||||||
String strFilter = "";
|
String strFilter = "";
|
||||||
@@ -220,263 +159,117 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
return allFDTOs;
|
return allFDTOs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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)
|
|
||||||
*/
|
|
||||||
public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms) {
|
public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms) {
|
||||||
MedicalSpecialtyTO msTO = null;
|
MedicalSpecialtyTO msTO = null;
|
||||||
|
|
||||||
if (ms != null) {
|
if (ms != null) {
|
||||||
msTO = new MedicalSpecialtyTO(ms.getId(), ms.getName(), ms.getDescription());
|
msTO = new MedicalSpecialtyTO(ms.getId(), ms.getName(), ms.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
return msTO;
|
return msTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Método que convierte un objecto de tipo PrimaryHealthCareCenterJPA (JPA) a su equivalente PrimaryHealthCareCenterTO (Tranfer Object)
|
|
||||||
*
|
|
||||||
* @return PrimaryHealthCareCenterTO (Transfer Object de un CAP)
|
|
||||||
*/
|
|
||||||
public PrimaryHealthCareCenterTO getPOJOforPrimaryHealthCareCenterJPA(PrimaryHealthCareCenterJPA phc) {
|
public PrimaryHealthCareCenterTO getPOJOforPrimaryHealthCareCenterJPA(PrimaryHealthCareCenterJPA phc) {
|
||||||
PrimaryHealthCareCenterTO phcTO = null;
|
PrimaryHealthCareCenterTO phcTO = null;
|
||||||
|
|
||||||
if (phc != null) {
|
if (phc != null) {
|
||||||
phcTO = new PrimaryHealthCareCenterTO(phc.getId(), phc.getName(), phc.getLocation());
|
phcTO = new PrimaryHealthCareCenterTO(phc.getId(), phc.getName(), phc.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
return phcTO;
|
return phcTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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).
|
|
||||||
*
|
|
||||||
* @return SpecialistDoctorTO (Transfer Object de un médico especialista)
|
|
||||||
*/
|
|
||||||
public SpecialistDoctorTO getPOJOforSpecialistDoctorJPA(SpecialistDoctorJPA sd, int nestedProps) {
|
public SpecialistDoctorTO getPOJOforSpecialistDoctorJPA(SpecialistDoctorJPA sd, int nestedProps) {
|
||||||
SpecialistDoctorTO sdTO = null;
|
SpecialistDoctorTO sdTO = null;
|
||||||
|
|
||||||
if (sd != null) {
|
if (sd != null) {
|
||||||
MedicalSpecialtyJPA ms = null;
|
MedicalSpecialtyJPA ms = null;
|
||||||
if (nestedProps > 0)
|
if (nestedProps > 0)
|
||||||
ms = sd.getMedicalSpecialty();
|
ms = sd.getMedicalSpecialty();
|
||||||
|
|
||||||
nestedProps--;
|
nestedProps--;
|
||||||
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(),
|
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), this.getPOJOforMedicalSpecialtyJPA(ms));
|
||||||
this.getPOJOforMedicalSpecialtyJPA(ms));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdTO;
|
return sdTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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).
|
|
||||||
*
|
|
||||||
* @return FamilyDoctorTO (Transfer Object de un médico especialista)
|
|
||||||
*/
|
|
||||||
public FamilyDoctorTO getPOJOforFamilyDoctorJPA(FamilyDoctorJPA fd, int nestedProps) {
|
public FamilyDoctorTO getPOJOforFamilyDoctorJPA(FamilyDoctorJPA fd, int nestedProps) {
|
||||||
FamilyDoctorTO fdTO = null;
|
FamilyDoctorTO fdTO = null;
|
||||||
|
|
||||||
if (fd != null) {
|
if (fd != null) {
|
||||||
PrimaryHealthCareCenterJPA phc = null;
|
PrimaryHealthCareCenterJPA phc = null;
|
||||||
if (nestedProps > 0)
|
if (nestedProps > 0)
|
||||||
phc = fd.getPrimaryHealthCareCenter();
|
phc = fd.getPrimaryHealthCareCenter();
|
||||||
|
|
||||||
nestedProps--;
|
nestedProps--;
|
||||||
fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(),
|
fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), this.getPOJOforPrimaryHealthCareCenterJPA(phc));
|
||||||
this.getPOJOforPrimaryHealthCareCenterJPA(phc));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fdTO;
|
return fdTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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).
|
|
||||||
*
|
|
||||||
* @return PatientTO (Transfer Object de un médico especialista)
|
|
||||||
*/
|
|
||||||
public PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps) {
|
public PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps) {
|
||||||
PatientTO paTO = null;
|
PatientTO paTO = null;
|
||||||
|
|
||||||
if (pat != null) {
|
if (pat != null) {
|
||||||
FamilyDoctorJPA fd = null;
|
FamilyDoctorJPA fd = null;
|
||||||
if (nestedProps > 0)
|
if (nestedProps > 0)
|
||||||
fd = pat.getFamilyDoctor();
|
fd = pat.getFamilyDoctor();
|
||||||
|
|
||||||
nestedProps--;
|
nestedProps--;
|
||||||
paTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(),
|
paTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), this.getPOJOforFamilyDoctorJPA(fd, nestedProps));
|
||||||
this.getPOJOforFamilyDoctorJPA(fd, nestedProps));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return paTO;
|
return paTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public PatientTO findPatientById(int patientId) {
|
public PatientTO findPatientById(int patientId) {
|
||||||
// Recuperamos propiedades anidadas 1 nivel!
|
// Recuperamos propiedades anidadas 1 nivel!
|
||||||
return this.getPOJOforPatientJPA(entman.find(PatientJPA.class, patientId), 1);
|
return this.getPOJOforPatientJPA(entman.find(PatientJPA.class, patientId), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
public PatientJPA findPatientByCode(String code) {
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
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);
|
query.setParameter("code", code);
|
||||||
|
|
||||||
List<PatientJPA> results = query.getResultList();
|
List<PatientJPA> results = query.getResultList();
|
||||||
if (results.size() > 0)
|
if (results.size() > 0)
|
||||||
return this.getPOJOforPatientJPA(results.get(0), 1);
|
return results.get(0);
|
||||||
else
|
else
|
||||||
return null;
|
return null; }
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public PatientTO findPatientByNif(String searchedNIF) {
|
|
||||||
TypedQuery<PatientJPA> query = entman.createQuery("from PatientJPA pat where pat.nif=:nif", PatientJPA.class);
|
|
||||||
query.setMaxResults(1);
|
|
||||||
query.setParameter("nif", searchedNIF);
|
|
||||||
|
|
||||||
List<PatientJPA> results = query.getResultList();
|
|
||||||
if (results.size() > 0)
|
|
||||||
return this.getPOJOforPatientJPA(results.get(0), 1);
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId) {
|
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId) {
|
||||||
return this.getPOJOforFamilyDoctorJPA(entman.find(FamilyDoctorJPA.class, ProfessionalNumberId), 1);
|
return this.getPOJOforFamilyDoctorJPA(entman.find(FamilyDoctorJPA.class, ProfessionalNumberId), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public FamilyDoctorJPA findFamilyDoctorByCode(String code) {
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public FamilyDoctorTO findFamilyDoctorByCode(String code) {
|
|
||||||
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.professionalNumber=:code", FamilyDoctorJPA.class);
|
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.professionalNumber=:code", FamilyDoctorJPA.class);
|
||||||
|
|
||||||
query.setParameter("code", code);
|
query.setParameter("code", code);
|
||||||
|
|
||||||
List<FamilyDoctorJPA> results = query.getResultList();
|
List<FamilyDoctorJPA> results = query.getResultList();
|
||||||
if (results.size() > 0)
|
if (results.size() > 0)
|
||||||
return this.getPOJOforFamilyDoctorJPA(results.get(0), 1);
|
return results.get(0);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public FamilyDoctorTO findFamilyDoctorByNif(String searchedNIF) {
|
|
||||||
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.nif=:nif", FamilyDoctorJPA.class);
|
|
||||||
query.setMaxResults(1);
|
|
||||||
query.setParameter("nif", searchedNIF);
|
|
||||||
|
|
||||||
List<FamilyDoctorJPA> results = query.getResultList();
|
|
||||||
if (results.size() > 0)
|
|
||||||
return this.getPOJOforFamilyDoctorJPA(results.get(0), 1);
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId) {
|
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId) {
|
||||||
return this.getPOJOforSpecialistDoctorJPA(entman.find(SpecialistDoctorJPA.class, ProfessionalNumberId), 1);
|
return this.getPOJOforSpecialistDoctorJPA(entman.find(SpecialistDoctorJPA.class, ProfessionalNumberId), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public SpecialistDoctorJPA findSpecialistDoctorByCode(String code) {
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public SpecialistDoctorTO findSpecialistDoctorByCode(String code) {
|
|
||||||
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.professionalNumber=:code", SpecialistDoctorJPA.class);
|
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.professionalNumber=:code", SpecialistDoctorJPA.class);
|
||||||
|
|
||||||
query.setParameter("code", code);
|
query.setParameter("code", code);
|
||||||
|
|
||||||
List<SpecialistDoctorJPA> results = query.getResultList();
|
List<SpecialistDoctorJPA> results = query.getResultList();
|
||||||
if (results.size() > 0)
|
if (results.size() > 0)
|
||||||
return this.getPOJOforSpecialistDoctorJPA(results.get(0), 1);
|
return results.get(0);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public SpecialistDoctorTO findSpecialistDoctorByNif(String searchedNIF) {
|
|
||||||
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.nif=:nif", SpecialistDoctorJPA.class);
|
|
||||||
query.setMaxResults(1);
|
|
||||||
query.setParameter("nif", searchedNIF);
|
|
||||||
|
|
||||||
List<SpecialistDoctorJPA> results = query.getResultList();
|
|
||||||
if (results.size() > 0)
|
|
||||||
return this.getPOJOforSpecialistDoctorJPA(results.get(0), 1);
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public QuestionTO getPOJOforQuestionJPA(QuestionJPA qs, int nestedProps) {
|
|
||||||
QuestionTO qsTO = null;
|
|
||||||
|
|
||||||
if (qs != null) {
|
|
||||||
FamilyDoctorJPA fd = null;
|
|
||||||
PatientJPA pat = null;
|
|
||||||
if (nestedProps > 0) {
|
|
||||||
fd = qs.getFamilyDoctor();
|
|
||||||
pat = qs.getPatient();
|
|
||||||
}
|
|
||||||
|
|
||||||
nestedProps--;
|
|
||||||
qsTO = new QuestionTO(qs.getId(), qs.getTitle(), qs.getMessage(), qs.getStatus(), this.getPOJOforPatientJPA(pat, nestedProps),
|
|
||||||
this.getPOJOforFamilyDoctorJPA(fd, nestedProps), qs.getResponse());
|
|
||||||
}
|
|
||||||
|
|
||||||
return qsTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package ejb.common;
|
package ejb.common;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.Local;
|
import javax.ejb.Local;
|
||||||
@@ -8,13 +9,11 @@ import TO.FamilyDoctorTO;
|
|||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
import TO.PatientTO;
|
import TO.PatientTO;
|
||||||
import TO.PrimaryHealthCareCenterTO;
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
import TO.QuestionTO;
|
|
||||||
import TO.SpecialistDoctorTO;
|
import TO.SpecialistDoctorTO;
|
||||||
import jpa.FamilyDoctorJPA;
|
import jpa.FamilyDoctorJPA;
|
||||||
import jpa.MedicalSpecialtyJPA;
|
import jpa.MedicalSpecialtyJPA;
|
||||||
import jpa.PatientJPA;
|
import jpa.PatientJPA;
|
||||||
import jpa.PrimaryHealthCareCenterJPA;
|
import jpa.PrimaryHealthCareCenterJPA;
|
||||||
import jpa.QuestionJPA;
|
|
||||||
import jpa.SpecialistDoctorJPA;
|
import jpa.SpecialistDoctorJPA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,21 +44,15 @@ public interface CommonFacadeLocal {
|
|||||||
|
|
||||||
public PatientTO findPatientById(int patientId);
|
public PatientTO findPatientById(int patientId);
|
||||||
|
|
||||||
public PatientTO findPatientByCode(String code);
|
public PatientJPA findPatientByCode(String code);
|
||||||
|
|
||||||
public PatientTO findPatientByNif(String searchValue);
|
|
||||||
|
|
||||||
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId);
|
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId);
|
||||||
|
|
||||||
public FamilyDoctorTO findFamilyDoctorByCode(String code);
|
public FamilyDoctorJPA findFamilyDoctorByCode(String code);
|
||||||
|
|
||||||
public FamilyDoctorTO findFamilyDoctorByNif(String searchValue);
|
|
||||||
|
|
||||||
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId);
|
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId);
|
||||||
|
|
||||||
public SpecialistDoctorTO findSpecialistDoctorByCode(String code);
|
public SpecialistDoctorJPA findSpecialistDoctorByCode(String code);
|
||||||
|
|
||||||
public SpecialistDoctorTO findSpecialistDoctorByNif(String searchValue);
|
|
||||||
|
|
||||||
public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms);
|
public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms);
|
||||||
|
|
||||||
@@ -71,5 +64,4 @@ public interface CommonFacadeLocal {
|
|||||||
|
|
||||||
public PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps);
|
public PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps);
|
||||||
|
|
||||||
public QuestionTO getPOJOforQuestionJPA(QuestionJPA qs, int nestedProps);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,20 +42,14 @@ public interface CommonFacadeRemote {
|
|||||||
|
|
||||||
public PatientTO findPatientById(int patientId);
|
public PatientTO findPatientById(int patientId);
|
||||||
|
|
||||||
public PatientTO findPatientByCode(String code);
|
public PatientJPA findPatientByCode(String code);
|
||||||
|
|
||||||
public PatientTO findPatientByNif(String searchValue);
|
|
||||||
|
|
||||||
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId);
|
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId);
|
||||||
|
|
||||||
public FamilyDoctorTO findFamilyDoctorByCode(String code);
|
public FamilyDoctorJPA findFamilyDoctorByCode(String code);
|
||||||
|
|
||||||
public FamilyDoctorTO findFamilyDoctorByNif(String searchValue);
|
|
||||||
|
|
||||||
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId);
|
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId);
|
||||||
|
|
||||||
public SpecialistDoctorTO findSpecialistDoctorByCode(String code);
|
public SpecialistDoctorJPA findSpecialistDoctorByCode(String code);
|
||||||
|
|
||||||
public SpecialistDoctorTO findSpecialistDoctorByNif(String searchValue);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,189 +1,26 @@
|
|||||||
package ejb.medicalTest;
|
package ejb.medicalTest;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
import javax.persistence.TypedQuery;
|
|
||||||
|
|
||||||
import TO.LoggedUserTO;
|
|
||||||
import TO.MedicalSpecialtyTO;
|
|
||||||
import TO.MedicalTestTO.MedicalTestType;
|
|
||||||
import TO.QuestionTO;
|
|
||||||
import common.QuestionStatus;
|
|
||||||
import common.UserType;
|
|
||||||
import ejb.common.CommonFacadeLocal;
|
|
||||||
import jpa.FamilyDoctorJPA;
|
|
||||||
import jpa.PatientJPA;
|
|
||||||
import jpa.QuestionJPA;
|
|
||||||
import managedbean.common.SessionUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los
|
* 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
|
* métodos de la capa de negocio que implementan la logica de negocio y la
|
||||||
* interacción con la capa de persistencia.
|
* interacción con la capa de persistencia.
|
||||||
*
|
*
|
||||||
* Tanto los pacientes como los médicos deben acceder a la vista de pruebas
|
* @author mark
|
||||||
* médicas.
|
|
||||||
*
|
|
||||||
* @author rorden
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Stateless
|
@Stateless
|
||||||
public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
||||||
|
|
||||||
// Persistence Unit Context
|
// Persistence Unit Context
|
||||||
@PersistenceContext(unitName = "MyHealth")
|
@PersistenceContext(unitName = "MyHealth")
|
||||||
EntityManager entman;
|
private EntityManager entman;
|
||||||
|
|
||||||
@EJB
|
public void ejbMethod(String parameter) {
|
||||||
CommonFacadeLocal commonServices;
|
|
||||||
|
|
||||||
// *********************************************************************
|
|
||||||
// QUESTION_RESPONSE
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Realizar una pregunta al médico por un paciente
|
|
||||||
*
|
|
||||||
* @param professionalNumber
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* El médico responde a una pregunta
|
|
||||||
*
|
|
||||||
* @param question
|
|
||||||
* @param response
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void answerQuestion(String question, String response) {
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
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>();
|
|
||||||
|
|
||||||
for (QuestionJPA item : allJPA) {
|
|
||||||
pendingQuestions.add(commonServices.getPOJOforQuestionJPA(item, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
return pendingQuestions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recuperar una pregunta por su String
|
|
||||||
*
|
|
||||||
* @param question
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void getQuestion(String question) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// *********************************************************************
|
|
||||||
// MEDICAL_TEST
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Añadir pruebas médicas a una cita
|
|
||||||
*
|
|
||||||
* Sólo médicos especialistas pueden gestionar pruebas médicas en el sistema.
|
|
||||||
*
|
|
||||||
* @param idMedicalTest
|
|
||||||
* @param date
|
|
||||||
* @param time
|
|
||||||
* @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) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recuperar una prueba médica por ID
|
|
||||||
*
|
|
||||||
* Pueden ser consultas por médicos de familia
|
|
||||||
*
|
|
||||||
* @param idMedicalTest
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void getMedicalTest(int idMedicalTest) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Añadir una imagen a una prueba médica
|
|
||||||
*
|
|
||||||
* @param idMedicalTest
|
|
||||||
* @param image
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void addImage(int idMedicalTest, String image) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Actualizar/Pisar una imagen a una prueba médica
|
|
||||||
*
|
|
||||||
* @param idMedicalTest
|
|
||||||
* @param image
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void updateImage(int idMedicalTest, String image) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Eliminar una imagen a una prueba médica
|
|
||||||
*
|
|
||||||
* @param idMedicalTest
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void removeImage(int idMedicalTest) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Listar médicos con una especialidad concreta
|
|
||||||
*
|
|
||||||
* @param speciality
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void findSpecialistDoctorByMedicalSpeciality(MedicalSpecialtyTO speciality) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,113 +1,18 @@
|
|||||||
package ejb.medicalTest;
|
package ejb.medicalTest;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
|
|
||||||
import TO.MedicalSpecialtyTO;
|
|
||||||
import TO.MedicalTestTO.MedicalTestType;
|
|
||||||
import TO.QuestionTO;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para
|
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para
|
||||||
* los clientes del EJB
|
* los clientes del EJB
|
||||||
*
|
*
|
||||||
* @author rorden
|
* @author mark
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Remote
|
@Remote
|
||||||
public interface MedicalTestFacadeRemote {
|
public interface MedicalTestFacadeRemote {
|
||||||
|
|
||||||
// *********************************************************************
|
|
||||||
// QUESTION RESPONSE
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Realizar una pregunta al médico por un paciente
|
* Definimos la interfaz remota
|
||||||
*
|
|
||||||
* @param professionalNumber
|
|
||||||
* @param title
|
|
||||||
* @param message
|
|
||||||
*/
|
*/
|
||||||
public void askQuestion(int professionalNumber, String title, String message);
|
public void ejbMethod(String parameter);
|
||||||
|
|
||||||
/**
|
|
||||||
* El médico responde a una pregunta
|
|
||||||
*
|
|
||||||
* @param question
|
|
||||||
* @param response
|
|
||||||
*/
|
|
||||||
public void answerQuestion(String question, String response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recuperar las preguntas sin respuesta para un médico
|
|
||||||
*
|
|
||||||
* De utilidad para paciente y médico de familia. No para médico especialista.
|
|
||||||
*
|
|
||||||
* @param familydoctorid
|
|
||||||
*/
|
|
||||||
public List<QuestionTO> listAllPendingQuestions(int familyDoctorId);
|
|
||||||
|
|
||||||
public Long getPendingQuestionsCount(int familyDoctorId);
|
|
||||||
|
|
||||||
public List<QuestionTO> listPendingQuestionsPaged(int familyDoctorId, int pageNumber, int pageSize);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recuperar una pregunta por su String
|
|
||||||
*
|
|
||||||
* @param question
|
|
||||||
*/
|
|
||||||
public void getQuestion(String question);
|
|
||||||
|
|
||||||
// ********************************************************************* MEDICAL
|
|
||||||
// TEST
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Añadir una prueba médica a un paciente
|
|
||||||
*
|
|
||||||
* @param idMedicalTest
|
|
||||||
* @param date
|
|
||||||
* @param time
|
|
||||||
* @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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recuperar una prueba médica por ID
|
|
||||||
*
|
|
||||||
* @param idMedicalTest
|
|
||||||
*/
|
|
||||||
public void getMedicalTest(int idPatient);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Añadir una imagen a una prueba médica
|
|
||||||
*
|
|
||||||
* @param idMedicalTest
|
|
||||||
* @param image
|
|
||||||
*/
|
|
||||||
public void addImage(int idMedicalTest, String image);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Actualizar/Pisar una imagen a una prueba médica
|
|
||||||
*
|
|
||||||
* @param idMedicalTest
|
|
||||||
* @param image
|
|
||||||
*/
|
|
||||||
public void updateImage(int idMedicalTest, String image);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Eliminar una imagen a una prueba médica
|
|
||||||
*
|
|
||||||
* @param idMedicalTest
|
|
||||||
*/
|
|
||||||
public void removeImage(int idMedicalTest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Listar médicos con una especialidad concreta
|
|
||||||
*
|
|
||||||
* @param speciality
|
|
||||||
*/
|
|
||||||
public void findSpecialistDoctorByMedicalSpeciality(MedicalSpecialtyTO speciality);
|
|
||||||
}
|
}
|
||||||
@@ -32,42 +32,19 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
@PersistenceContext(unitName = "MyHealth")
|
@PersistenceContext(unitName = "MyHealth")
|
||||||
private EntityManager entman;
|
private EntityManager entman;
|
||||||
|
|
||||||
//Propiedad que permite el acceso local a los métodos del EJB de servicios comunes (para recuperar entidades, etc).
|
|
||||||
@EJB
|
@EJB
|
||||||
CommonFacadeLocal commonServices;
|
CommonFacadeLocal commonServices;
|
||||||
|
|
||||||
/**
|
|
||||||
* Método que genera un nuevo número de profesional, basando en la secuencia de base de datos. Los números de profesional son únicos y comunes para médicos de familia y médicos
|
|
||||||
* especialistas.
|
|
||||||
*
|
|
||||||
* Si un número de profesional no se utiliza no se vuelve a reutilizar, por lo que pueden existir huecos en la númeración.
|
|
||||||
*
|
|
||||||
* @return String con el número número de profesional generado.
|
|
||||||
*/
|
|
||||||
private String getNextProfessionalNumber() {
|
private String getNextProfessionalNumber() {
|
||||||
Query q = entman.createNativeQuery("select nextval('myhealth.profesionalnumber')");
|
Query q = entman.createNativeQuery("select nextval('myhealth.profesionalnumber')");
|
||||||
return Constants.PROFESSIONAL_NUMBER_PREFIX.concat(String.valueOf(q.getSingleResult()));
|
return Constants.PROFESSIONAL_NUMBER_PREFIX.concat(String.valueOf(q.getSingleResult()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Método que genera un nuevo Código de Identificación de Paciente (CIP) basado en una secuencia de base de datos. Los códigos CIP son únicos, y si un CIP no se utiliza tras
|
|
||||||
* haber sido generado, no se vuelve a reutilizar.
|
|
||||||
*
|
|
||||||
* @return String con el CIP gnerado
|
|
||||||
*/
|
|
||||||
private String getNextPersonalIdentificationCode() {
|
private String getNextPersonalIdentificationCode() {
|
||||||
Query q = entman.createNativeQuery("select nextval('myhealth.codigoidentificacionpaciente')");
|
Query q = entman.createNativeQuery("select nextval('myhealth.profesionalnumber')");
|
||||||
return Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX.concat(String.valueOf(q.getSingleResult()));
|
return Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX.concat(String.valueOf(q.getSingleResult()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Cambia el médico de familia asignado a un paciente. Recibe como parametros el identificador del paciente y el identificador del nuevo médico de familia
|
|
||||||
*
|
|
||||||
* Si el identificador de paciente no corresponde a ningún paciente registrado se lanza una excepción. Si el identificador del médico de familia no corresponde a ningún médico
|
|
||||||
* de familia se lanza una excepción.
|
|
||||||
*
|
|
||||||
* @return PatientTO (Transfer Object del paciente al que se la ha cambiado el médico de familia).
|
|
||||||
*/
|
|
||||||
public PatientTO changeFamilyDoctor(int patientId, int newDoctor) throws Exception {
|
public PatientTO changeFamilyDoctor(int patientId, int newDoctor) throws Exception {
|
||||||
PatientJPA pat = entman.find(PatientJPA.class, patientId);
|
PatientJPA pat = entman.find(PatientJPA.class, patientId);
|
||||||
if (pat == null) {
|
if (pat == null) {
|
||||||
@@ -86,37 +63,15 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
return this.commonServices.getPOJOforPatientJPA(pat, 1);
|
return this.commonServices.getPOJOforPatientJPA(pat, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Registra un nuevo paciente en el sistema Recibe como parametros el nif del paciente, el nombre, los apellidos, la contraseña y la dirección de correo electronico.
|
|
||||||
*
|
|
||||||
* El método genera un nuevo CIP (código de identificación de paciente) y lo asigna al nuevo paciente. El médico se familia queda está establecido a null, y deberá ser
|
|
||||||
* seleccionado por el paciente una vez registrado en el sistema.
|
|
||||||
*
|
|
||||||
* La contraseña recibida se encrypta con el algoritmo MD5.
|
|
||||||
*
|
|
||||||
* @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(int id, String nif, String name, String surname, String password, String email) {
|
||||||
|
PatientTO paTO = null;
|
||||||
|
|
||||||
PatientJPA pat = new PatientJPA(this.getNextPersonalIdentificationCode(), nif, name, surname, HashUtils.hashMD5(password), email, null);
|
PatientJPA pat = new PatientJPA(this.getNextPersonalIdentificationCode(), nif, name, surname, HashUtils.hashMD5(password), email, null);
|
||||||
entman.persist(pat);
|
entman.persist(pat);
|
||||||
|
|
||||||
return this.commonServices.getPOJOforPatientJPA(pat, 1);
|
return this.commonServices.getPOJOforPatientJPA(pat, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Registra un nuevo médico especialista en el sistema.
|
|
||||||
*
|
|
||||||
* Recibe como parametros el nif, el nombre, los apellidos, la contraseña, la dirección de correo electronico y la especialidad.
|
|
||||||
*
|
|
||||||
* El método genera un nuevo NIP (Número de Identificación de Profesional) y lo asigna al nuevo médico.
|
|
||||||
*
|
|
||||||
* La contraseña recibida se encrypta con el algoritmo MD5.
|
|
||||||
*
|
|
||||||
* El médoto comprueba que la especialidad médica recibida exista en el sistema en el momento de asignarla al nuevo médico, si la especialidad especificada no se encuentra se
|
|
||||||
* lanza una excepción.
|
|
||||||
*
|
|
||||||
* @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(int id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, specialty.getId());
|
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, specialty.getId());
|
||||||
@@ -130,20 +85,9 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
return this.commonServices.getPOJOforSpecialistDoctorJPA(sd, 1);
|
return this.commonServices.getPOJOforSpecialistDoctorJPA(sd, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Registra un nuevo médico de familia en el sistema.
|
|
||||||
*
|
|
||||||
* Recibe como parametros el nif, el nombre, los apellidos, la contraseña, la dirección de correo electronico y el CAP (Centro Médico de Primaria).
|
|
||||||
*
|
|
||||||
* El método genera un nuevo NIP (Número de Identificación de Profesional) y lo asigna al nuevo médico.
|
|
||||||
*
|
|
||||||
* La contraseña recibida se encrypta con el algoritmo MD5.
|
|
||||||
*
|
|
||||||
* El médoto comprueba que el CAP recibido exista en el sistema en el momento de asignarlo al nuevo médico, si el CAP no se encuentra se lanza una excepción.
|
|
||||||
*
|
|
||||||
* @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(int id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO cap) throws Exception {
|
||||||
|
FamilyDoctorTO fdTO = null;
|
||||||
|
|
||||||
PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, cap.getId());
|
PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, cap.getId());
|
||||||
if (phcC == null) {
|
if (phcC == null) {
|
||||||
throw new Exception("No se encuentra el centro de atención primaria con identificador: " + cap.getName());
|
throw new Exception("No se encuentra el centro de atención primaria con identificador: " + cap.getName());
|
||||||
@@ -155,18 +99,6 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
return commonServices.getPOJOforFamilyDoctorJPA(fd, 1);
|
return commonServices.getPOJOforFamilyDoctorJPA(fd, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Actualiza los datos personales de un paciente
|
|
||||||
*
|
|
||||||
* Recibe como parametros el id del paciente a actualizar, el nif, el nombre, los apellidos, *la contraseña, la dirección de correo electronico (El medico de familia asignado
|
|
||||||
* no se modifica).
|
|
||||||
*
|
|
||||||
* El id de paciente recibido se busca en el sistema para realizar la actualización de datos, sino se encuentra se lanza una excepción.
|
|
||||||
*
|
|
||||||
* La contraseña recibida solo se actualiza si se recibe el parámetro (no es nulo ni cadena vacía). La contraseña recibida se encrypta con el algoritmo MD5
|
|
||||||
*
|
|
||||||
* @return PatientTO Transfer Object correspondiente al paciente actualizado..
|
|
||||||
*/
|
|
||||||
public PatientTO updatePatientData(int id, String nif, String name, String surname, String password, String email) throws Exception {
|
public PatientTO updatePatientData(int id, String nif, String name, String surname, String password, String email) throws Exception {
|
||||||
PatientJPA pat = entman.find(PatientJPA.class, id);
|
PatientJPA pat = entman.find(PatientJPA.class, id);
|
||||||
|
|
||||||
@@ -187,20 +119,6 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
return this.commonServices.getPOJOforPatientJPA(pat, 1);
|
return this.commonServices.getPOJOforPatientJPA(pat, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Actualiza los datos personales de un médico especialista
|
|
||||||
*
|
|
||||||
* Recibe como parametros el id del médico a actualizar, nif, el nombre, los apellidos, *la contraseña, la dirección de correo electronico y la especialidad médcia que se debe
|
|
||||||
* asignar.
|
|
||||||
*
|
|
||||||
* El id del médico recibido se busca en el sistema para realizar la actualización de datos, sino se encuentra se lanza una excepción.
|
|
||||||
*
|
|
||||||
* La contraseña recibida solo se actualiza si se recibe el parámetro (no es nulo ni cadena vacía). La contraseña recibida se encrypta con el algoritmo MD5
|
|
||||||
*
|
|
||||||
* El método comprueba que la especialidad recibida existe en el sistema, en caso contrario lanza una excepción.
|
|
||||||
*
|
|
||||||
* @return SpecialistDoctorTO Transfer Object correspondiente al médico especialista que se ha actualizado.
|
|
||||||
*/
|
|
||||||
public SpecialistDoctorTO updateSpecialistDoctorData(int id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty)
|
public SpecialistDoctorTO updateSpecialistDoctorData(int id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
SpecialistDoctorJPA sd = entman.find(SpecialistDoctorJPA.class, id);
|
SpecialistDoctorJPA sd = entman.find(SpecialistDoctorJPA.class, id);
|
||||||
@@ -227,20 +145,6 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
return this.commonServices.getPOJOforSpecialistDoctorJPA(sd, 1);
|
return this.commonServices.getPOJOforSpecialistDoctorJPA(sd, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Actualiza los datos personales de un médico de familia
|
|
||||||
*
|
|
||||||
* Recibe como parametros el id del médico a actualizar, nif, el nombre, los apellidos, *la contraseña, la dirección de correo electronico, y el CAP al cual está asignado el
|
|
||||||
* médico de familia.
|
|
||||||
*
|
|
||||||
* El id del médico recibido se busca en el sistema para realizar la actualización de datos, sino se encuentra se lanza una excepción.
|
|
||||||
*
|
|
||||||
* La contraseña recibida solo se actualiza si se recibe el parámetro (no es nulo ni cadena vacía). La contraseña recibida se encrypta con el algoritmo MD5
|
|
||||||
*
|
|
||||||
* El método comprueba que el CAP recibida existe en el sistema, en caso contrario lanza una excepción.
|
|
||||||
*
|
|
||||||
* @return FamilyDoctorTO Transfer Object correspondiente al médico de familia que se ha actualizado.
|
|
||||||
*/
|
|
||||||
public FamilyDoctorTO updateFamilyDoctorData(int id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO phcTO) throws Exception {
|
public FamilyDoctorTO updateFamilyDoctorData(int id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO phcTO) throws Exception {
|
||||||
FamilyDoctorJPA fd = entman.find(FamilyDoctorJPA.class, id);
|
FamilyDoctorJPA fd = entman.find(FamilyDoctorJPA.class, id);
|
||||||
if (fd == null) {
|
if (fd == null) {
|
||||||
@@ -266,17 +170,6 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
return this.commonServices.getPOJOforFamilyDoctorJPA(fd, 1);
|
return this.commonServices.getPOJOforFamilyDoctorJPA(fd, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
|
||||||
* Cambia el CAP (Centro de Atención Primaria) asignado a un médico de familia.
|
|
||||||
*
|
|
||||||
* Recibe como parametros el identificador del médico y el identificador del nuevo CAP a asginar.
|
|
||||||
*
|
|
||||||
* Si el identificador del médico no corresponde a ningún médico de familia registrado se lanza una excepción.
|
|
||||||
*
|
|
||||||
* Si el identificador del CAP no corresponde a ningún CAP registrado en el sistema se lanza una excpeción.
|
|
||||||
*
|
|
||||||
* @return FamilyDoctorTO (Transfer Object del médico de familia al que se la ha cambiado el CAP).
|
|
||||||
*/
|
|
||||||
public FamilyDoctorTO changePrimaryHealthCareCenter(int professionalId, PrimaryHealthCareCenterTO newCenter) throws Exception {
|
public FamilyDoctorTO changePrimaryHealthCareCenter(int professionalId, PrimaryHealthCareCenterTO newCenter) throws Exception {
|
||||||
FamilyDoctorTO fdTO = null;
|
FamilyDoctorTO fdTO = null;
|
||||||
|
|
||||||
|
|||||||
@@ -5,17 +5,15 @@ import javax.ejb.Stateless;
|
|||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
|
||||||
import TO.FamilyDoctorTO;
|
|
||||||
import TO.LoggedUserTO;
|
import TO.LoggedUserTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
|
||||||
import TO.PatientTO;
|
|
||||||
import TO.SpecialistDoctorTO;
|
|
||||||
import common.Constants;
|
import common.Constants;
|
||||||
import common.HashUtils;
|
import common.HashUtils;
|
||||||
import common.UserType;
|
import common.UserType;
|
||||||
import ejb.common.CommonFacadeLocal;
|
import ejb.common.CommonFacadeLocal;
|
||||||
import jpa.AdministratorJPA;
|
import jpa.AdministratorJPA;
|
||||||
import jpa.MedicalSpecialtyJPA;
|
import jpa.FamilyDoctorJPA;
|
||||||
|
import jpa.PatientJPA;
|
||||||
|
import jpa.SpecialistDoctorJPA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -31,7 +29,7 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
|
|
||||||
@EJB
|
@EJB
|
||||||
CommonFacadeLocal commonServices;
|
CommonFacadeLocal commonServices;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Si la autenticación no es correcgta devuelve null, sino devuelve un POJO con
|
* Si la autenticación no es correcgta devuelve null, sino devuelve un POJO con
|
||||||
* datos del usuario logeado.
|
* datos del usuario logeado.
|
||||||
@@ -63,20 +61,20 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
if (userCode.startsWith(Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX)) {
|
if (userCode.startsWith(Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX)) {
|
||||||
// Si el identificador de usuario es de tipo paciente, intentamos realizar el
|
// Si el identificador de usuario es de tipo paciente, intentamos realizar el
|
||||||
// login.
|
// login.
|
||||||
PatientTO pat = this.commonServices.findPatientByCode(userCode);
|
PatientJPA pat = this.commonServices.findPatientByCode(userCode);
|
||||||
if (pat != null) {
|
if (pat != null) {
|
||||||
usr = new LoggedUserTO(String.valueOf(pat.getId()), pat.getName(), pat.getPassword(), UserType.PATIENT);
|
usr = new LoggedUserTO(String.valueOf(pat.getId()), pat.getName(), pat.getPassword(), UserType.PATIENT);
|
||||||
}
|
}
|
||||||
} else if (userCode.startsWith(Constants.PROFESSIONAL_NUMBER_PREFIX)) {
|
} else if (userCode.startsWith(Constants.PROFESSIONAL_NUMBER_PREFIX)) {
|
||||||
// Si el identificador de usuario es de tipo profesional, intentamos realizar el
|
// Si el identificador de usuario es de tipo profesional, intentamos realizar el
|
||||||
// login, primero como médico de familia, después como especialista
|
// login, primero como médico de familia, después como especialista
|
||||||
FamilyDoctorTO fd = this.commonServices.findFamilyDoctorByCode(userCode);
|
FamilyDoctorJPA fd = this.commonServices.findFamilyDoctorByCode(userCode);
|
||||||
|
|
||||||
if (fd != null) {
|
if (fd != null) {
|
||||||
usr = new LoggedUserTO(String.valueOf(fd.getId()), fd.getName(), fd.getPassword(), UserType.FAMILY_DOCTOR);
|
usr = new LoggedUserTO(String.valueOf(fd.getId()), fd.getName(), fd.getPassword(), UserType.FAMILY_DOCTOR);
|
||||||
} else {
|
} else {
|
||||||
// No era un código de médico de familia, intenamos logearlo como especialista
|
// No era un código de médico de familia, intenamos logearlo como especialista
|
||||||
SpecialistDoctorTO sd = this.commonServices.findSpecialistDoctorByCode(userCode);
|
SpecialistDoctorJPA sd = this.commonServices.findSpecialistDoctorByCode(userCode);
|
||||||
|
|
||||||
if (sd != null) {
|
if (sd != null) {
|
||||||
usr = new LoggedUserTO(String.valueOf(sd.getId()), sd.getName(), sd.getPassword(), UserType.SPECIALIST_DOCTOR);
|
usr = new LoggedUserTO(String.valueOf(sd.getId()), sd.getName(), sd.getPassword(), UserType.SPECIALIST_DOCTOR);
|
||||||
@@ -109,40 +107,4 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
|
|
||||||
return usr;
|
return usr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public MedicalSpecialtyTO updateSpecialtyData(int id, String name, String description) throws Exception {
|
|
||||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
|
||||||
|
|
||||||
if (ms == null) {
|
|
||||||
throw new Exception("No se pueden actualizar los datos de la especialidad porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
ms.setName(name);
|
|
||||||
ms.setDescription(description);
|
|
||||||
|
|
||||||
entman.persist(ms);
|
|
||||||
|
|
||||||
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteSpecialtyData(int id, String name, String description) throws Exception {
|
|
||||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
|
||||||
|
|
||||||
if (ms == null) {
|
|
||||||
throw new Exception("No se puede borrar la especialidad porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
entman.remove(ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MedicalSpecialtyTO insertSpecialtyData(String name, String description) throws Exception {
|
|
||||||
|
|
||||||
MedicalSpecialtyJPA ms = new MedicalSpecialtyJPA(name, description);
|
|
||||||
entman.persist(ms);
|
|
||||||
|
|
||||||
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package ejb.systemAdmin;
|
package ejb.systemAdmin;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
|
|
||||||
import TO.LoggedUserTO;
|
import TO.LoggedUserTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -16,11 +19,6 @@ public interface SystemAdminFacadeRemote {
|
|||||||
* Definimos la interfaz remota
|
* Definimos la interfaz remota
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public LoggedUserTO login(String id, String pwd);
|
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;
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package jpa;
|
package jpa;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
@@ -28,7 +28,7 @@ public class FamilyDoctorJPA implements Serializable {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(updatable = false)
|
@Column(updatable = false)
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
@Column(nullable = false, unique = true)
|
@Column(nullable = false, unique = true)
|
||||||
private String professionalNumber;
|
private String professionalNumber;
|
||||||
@@ -39,9 +39,9 @@ public class FamilyDoctorJPA implements Serializable {
|
|||||||
private String email;
|
private String email;
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
@JoinColumn(name = "FamilyDoctorId")
|
@JoinColumn(name = "FamilyDoctorId")
|
||||||
private List<PatientJPA> patients;
|
private Collection<PatientJPA> patients;
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "PrimaryHealthCareCenterId")
|
@JoinColumn (name="PrimaryHealthCareCenterId")
|
||||||
private PrimaryHealthCareCenterJPA primaryHealthCareCenter;
|
private PrimaryHealthCareCenterJPA primaryHealthCareCenter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,22 +111,20 @@ public class FamilyDoctorJPA implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Metodos para get/set de relaciones (pacientes)
|
* Metodos para get/set de relaciones (pacientes)
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<PatientJPA> getPatients() {
|
public Collection<PatientJPA> getPatients() {
|
||||||
return patients;
|
return patients;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPatients(List<PatientJPA> patients) {
|
public void setPatients(Collection<PatientJPA> patients) {
|
||||||
this.patients = patients;
|
this.patients = patients;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrimaryHealthCareCenterJPA getPrimaryHealthCareCenter() {
|
public PrimaryHealthCareCenterJPA getPrimaryHealthCareCenter() {
|
||||||
return primaryHealthCareCenter;
|
return primaryHealthCareCenter;
|
||||||
}
|
}
|
||||||
|
public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterJPA center) {
|
||||||
public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterJPA center) {
|
|
||||||
this.primaryHealthCareCenter = center;
|
this.primaryHealthCareCenter = center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,134 +0,0 @@
|
|||||||
package jpa;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.EnumType;
|
|
||||||
import javax.persistence.Enumerated;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import common.TestType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Los nombres de los decortadores relacionados con la BBDD pueden estar en
|
|
||||||
* camelCase, snakeCase o como se quiera, puesto que en persistence.xml se tiene
|
|
||||||
* dicho que se convierta a minúsculas.
|
|
||||||
*
|
|
||||||
* Lo uso en minúsculas para mejorar la trazabilidad de los campos.
|
|
||||||
*
|
|
||||||
* @author Roberto Orden Erena <rorden@uoc.edu>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "myhealth.medicaltest")
|
|
||||||
public class MedicalTestJPA implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private int id;
|
|
||||||
private Date date;
|
|
||||||
private long 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;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "patientid")
|
|
||||||
private PatientJPA patient;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "specialistdoctorid")
|
|
||||||
private SpecialistDoctorJPA specialistDoctor;
|
|
||||||
|
|
||||||
public MedicalTestJPA() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MedicalTestJPA(int id, Date date, long time, String observations, String highresimage, TestType type, PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
|
|
||||||
this.id = id;
|
|
||||||
this.date = date;
|
|
||||||
this.time = time;
|
|
||||||
this.observations = observations;
|
|
||||||
this.highresimage = highresimage;
|
|
||||||
this.type = type;
|
|
||||||
this.patient = patient;
|
|
||||||
this.specialistDoctor = specialistDoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDate() {
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDate(Date date) {
|
|
||||||
this.date = date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTime() {
|
|
||||||
return time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTime(long time) {
|
|
||||||
this.time = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getObservations() {
|
|
||||||
return observations;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setObservations(String observations) {
|
|
||||||
this.observations = observations;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHighresimage() {
|
|
||||||
return highresimage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHighresimage(String highresimage) {
|
|
||||||
this.highresimage = highresimage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TestType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(TestType type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PatientJPA getPatient() {
|
|
||||||
return patient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPatient(PatientJPA patient) {
|
|
||||||
this.patient = patient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SpecialistDoctorJPA getSpecialistDoctor() {
|
|
||||||
return specialistDoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpecialistDoctor(SpecialistDoctorJPA specialistDoctor) {
|
|
||||||
this.specialistDoctor = specialistDoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
package jpa;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.EnumType;
|
|
||||||
import javax.persistence.Enumerated;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import common.QuestionStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
|
||||||
* @author Roberto Orden Erena <rorden@uoc.edu>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "MyHealth.Question")
|
|
||||||
public class QuestionJPA implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private int id;
|
|
||||||
private String title;
|
|
||||||
private String message;
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private QuestionStatus status;
|
|
||||||
private String response;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "patientid")
|
|
||||||
private PatientJPA patient;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "familydoctorid")
|
|
||||||
private FamilyDoctorJPA familyDoctor;
|
|
||||||
|
|
||||||
public QuestionJPA() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public QuestionJPA(int id, String title, String message, QuestionStatus status, PatientJPA patient, FamilyDoctorJPA familydoctor, String response) {
|
|
||||||
this.id = id;
|
|
||||||
this.title = title;
|
|
||||||
this.message = message;
|
|
||||||
this.status = status;
|
|
||||||
this.patient = patient;
|
|
||||||
this.familyDoctor = familydoctor;
|
|
||||||
this.response = response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PatientJPA getPatient() {
|
|
||||||
return patient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPatient(PatientJPA patient) {
|
|
||||||
this.patient = patient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QuestionStatus getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(QuestionStatus status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FamilyDoctorJPA getFamilyDoctor() {
|
|
||||||
return familyDoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFamilyDoctor(FamilyDoctorJPA familyDoc) {
|
|
||||||
this.familyDoctor = familyDoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResponse() {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResponse(String response) {
|
|
||||||
this.response = response;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -3,8 +3,6 @@ package managedbean.common;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.faces.application.FacesMessage;
|
|
||||||
import javax.persistence.PersistenceException;
|
|
||||||
import javax.servlet.Filter;
|
import javax.servlet.Filter;
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.FilterConfig;
|
import javax.servlet.FilterConfig;
|
||||||
@@ -16,11 +14,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.omnifaces.util.Exceptions;
|
|
||||||
|
|
||||||
import common.UserType;
|
|
||||||
import common.Utils;
|
|
||||||
|
|
||||||
@WebFilter(filterName = "AuthFilter", urlPatterns = { "*.xhtml" })
|
@WebFilter(filterName = "AuthFilter", urlPatterns = { "*.xhtml" })
|
||||||
public class AuthorizationFilter implements Filter {
|
public class AuthorizationFilter implements Filter {
|
||||||
|
|
||||||
@@ -32,147 +25,27 @@ public class AuthorizationFilter implements Filter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAJAXRequest(HttpServletRequest request) {
|
|
||||||
boolean check = false;
|
|
||||||
String facesRequest = request.getHeader("Faces-Request");
|
|
||||||
if (facesRequest != null && facesRequest.equals("partial/ajax")) {
|
|
||||||
check = true;
|
|
||||||
}
|
|
||||||
return check;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||||
HttpServletRequest req = null;
|
|
||||||
HttpServletResponse resp = null;
|
|
||||||
HttpSession ses = null;
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
req = (HttpServletRequest) request;
|
HttpServletRequest req = (HttpServletRequest) request;
|
||||||
|
HttpServletResponse resp = (HttpServletResponse) response;
|
||||||
|
HttpSession ses = req.getSession(false);
|
||||||
|
|
||||||
String reqURI = req.getRequestURI();
|
String reqURI = req.getRequestURI();
|
||||||
|
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/RegisterUser.xhtml") >= 0 || reqURI.indexOf("/home.xhtml") >= 0 || reqURI.indexOf("/public/") >= 0
|
||||||
resp = (HttpServletResponse) response;
|
|| reqURI.contains("javax.faces.resource") || SessionUtils.isLogedIn(ses) == true)
|
||||||
ses = req.getSession(false);
|
|
||||||
|
|
||||||
// Para recursos publicos permitimos el acceso exista sesión o no.
|
|
||||||
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/profile/RegisterUser.xhtml") >= 0 || reqURI.indexOf("/home.xhtml") >= 0
|
|
||||||
|| reqURI.indexOf("/error.xhtml") >= 0 || reqURI.indexOf("/public/") >= 0 || reqURI.contains("javax.faces.resource")) {
|
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
return;
|
else
|
||||||
}
|
resp.sendRedirect(req.getContextPath() + "/login.xhtml");
|
||||||
|
|
||||||
if (this.isAJAXRequest(req) == true) {
|
|
||||||
chain.doFilter(request, response);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sesión expirada
|
|
||||||
if (req.isRequestedSessionIdValid() == false && req.getRequestedSessionId() != null) {
|
|
||||||
resp.sendRedirect(req.getContextPath() + "/error.xhtml?type=expired");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si el usuario está logeado comprobamos si está autorizado a ver la página solicitada.
|
|
||||||
if (SessionUtils.isLogedIn(ses) == true) {
|
|
||||||
UserType tipoUsuario = SessionUtils.getUserType(ses);
|
|
||||||
boolean authorized = false;
|
|
||||||
|
|
||||||
switch (tipoUsuario) {
|
|
||||||
case ADMINISTRATOR:
|
|
||||||
if (reqURI.indexOf("/systemAdmin/ManageSpecialties") > 0)
|
|
||||||
authorized = true;
|
|
||||||
if (reqURI.indexOf("/systemAdmin/ManageHealthCareCenters") > 0)
|
|
||||||
authorized = true;
|
|
||||||
if (reqURI.indexOf("/systemAdmin/ListDoctorsByCenter") > 0)
|
|
||||||
authorized = true;
|
|
||||||
if (reqURI.indexOf("/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) {
|
} catch (Exception e) {
|
||||||
if (Exceptions.is(e, PersistenceException.class) == true) {
|
System.out.println(e.getMessage());
|
||||||
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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
System.out.println("Sessión destruida");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
package managedbean.common;
|
package managedbean.common;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
import javax.ejb.EJB;
|
||||||
import javax.faces.application.FacesMessage;
|
import javax.faces.application.FacesMessage;
|
||||||
import javax.faces.application.ViewExpiredException;
|
|
||||||
import javax.faces.context.ExternalContext;
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import javax.naming.Context;
|
import javax.naming.Context;
|
||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
@@ -98,50 +95,20 @@ public class ManagedBeanBase {
|
|||||||
protected void addFacesMessageKeep(FacesMessage.Severity severity, String summary, String detail) {
|
protected void addFacesMessageKeep(FacesMessage.Severity severity, String summary, String detail) {
|
||||||
FacesContext context = FacesContext.getCurrentInstance();
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
|
||||||
this.addFacesMessage(FacesContext.getCurrentInstance(), null, severity, summary, detail);
|
this.addFacesMessage(FacesContext.getCurrentInstance(), severity, summary, detail);
|
||||||
|
|
||||||
context.getExternalContext().getFlash().setKeepMessages(true);
|
context.getExternalContext().getFlash().setKeepMessages(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addFacesMessage(FacesMessage.Severity severity, String summary, String detail) {
|
protected void addFacesMessage(FacesMessage.Severity severity, String summary, String detail) {
|
||||||
this.addFacesMessage(FacesContext.getCurrentInstance(), null, severity, summary, detail);
|
this.addFacesMessage(FacesContext.getCurrentInstance(), severity, summary, detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addFacesMessage(String clientId, FacesMessage.Severity severity, String summary, String detail) {
|
protected void addFacesMessage(FacesContext context, FacesMessage.Severity severity, String summary, String detail) {
|
||||||
this.addFacesMessage(FacesContext.getCurrentInstance(), clientId, severity, summary, detail);
|
context.addMessage(null, new FacesMessage(severity, summary, detail));
|
||||||
}
|
|
||||||
|
|
||||||
protected void addFacesMessage(FacesContext context, String clientId, FacesMessage.Severity severity, String summary, String detail) {
|
|
||||||
this.addFacesMessage(context, clientId, new FacesMessage(severity, summary, detail));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addFacesMessage(FacesMessage facesMsg, String clientId) {
|
|
||||||
this.addFacesMessage(FacesContext.getCurrentInstance(), clientId, facesMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addFacesMessage(FacesContext context, String clientId, FacesMessage facesMsg) {
|
|
||||||
context.addMessage(clientId, facesMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void manageException(Exception ex) {
|
protected void manageException(Exception ex) {
|
||||||
String strType = "";
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Se ha producido un error inesperado", "Descripción del error: " + ex.getLocalizedMessage());
|
||||||
|
|
||||||
if (ex.getClass().equals(ViewExpiredException.class)) {
|
|
||||||
// Sessión expired
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
ExternalContext ctx = FacesContext.getCurrentInstance().getExternalContext();
|
|
||||||
|
|
||||||
ctx.redirect(ctx.getApplicationContextPath() + "/error.xhtml?type=" + strType);
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class MenuMBean implements Serializable {
|
|||||||
subMenu.addElement(createMenuItem("Responder pregunta", "fa fa-comments", "/medicaltest/MedicalTests", null));
|
subMenu.addElement(createMenuItem("Responder pregunta", "fa fa-comments", "/medicaltest/MedicalTests", null));
|
||||||
|
|
||||||
if (tipoUsuario == UserType.FAMILY_DOCTOR)
|
if (tipoUsuario == UserType.FAMILY_DOCTOR)
|
||||||
subMenu.addElement(createMenuItem("Ver preguntas pendientes", "fa fa-comments-o", "/medicaltest/PendingQuestions", null));
|
subMenu.addElement(createMenuItem("Ver preguntas pendientes", "fa fa-comments-o", "/medicaltest/MedicalTests", null));
|
||||||
|
|
||||||
model.addElement(subMenu);
|
model.addElement(subMenu);
|
||||||
}
|
}
|
||||||
@@ -114,9 +114,9 @@ public class MenuMBean implements Serializable {
|
|||||||
subMenu = new DefaultSubMenu("Gestionar perfil", "fa fa-gears");
|
subMenu = new DefaultSubMenu("Gestionar perfil", "fa fa-gears");
|
||||||
if (SessionUtils.isLogedIn() == false) {
|
if (SessionUtils.isLogedIn() == false) {
|
||||||
subMenu.addElement(createMenuItem("Registro de usuario", "fa fa-user-plus", "/profile/RegisterUser", null));
|
subMenu.addElement(createMenuItem("Registro de usuario", "fa fa-user-plus", "/profile/RegisterUser", null));
|
||||||
// subMenu.addElement(createMenuItem("Registro de paciente", "fa fa-user-plus", "/profile/AddPatient", null));
|
subMenu.addElement(createMenuItem("Registro de paciente", "fa fa-user-plus", "/profile/AddPatient", null));
|
||||||
// subMenu.addElement(createMenuItem("Registro de médico", "fa fa-user-md", "/profile/AddFamilyDoctor", null));
|
subMenu.addElement(createMenuItem("Registro de médico", "fa fa-user-md", "/profile/AddFamilyDoctor", null));
|
||||||
// subMenu.addElement(createMenuItem("Registro de especialista", "fa fa-user-md", "/profile/AddSpecialistDoctor", null));
|
subMenu.addElement(createMenuItem("Registro de especialista", "fa fa-user-md", "/profile/AddSpecialistDoctor", null));
|
||||||
|
|
||||||
model.addElement(subMenu);
|
model.addElement(subMenu);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
package managedbean.common;
|
package managedbean.common;
|
||||||
|
|
||||||
import javax.faces.application.FacesMessage;
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -15,7 +14,6 @@ public class SessionUtils {
|
|||||||
public static final String SESSION_VAR_USERID = "userId";
|
public static final String SESSION_VAR_USERID = "userId";
|
||||||
public static final String SESSION_VAR_USERTYPE = "userType";
|
public static final String SESSION_VAR_USERTYPE = "userType";
|
||||||
public static final String SESSION_VAR_USER = "loggedOnUser";
|
public static final String SESSION_VAR_USER = "loggedOnUser";
|
||||||
public static final String SESSION_VAR_MESSAGE = "facesMessage";
|
|
||||||
|
|
||||||
public static HttpSession getSession() {
|
public static HttpSession getSession() {
|
||||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||||
@@ -49,7 +47,7 @@ public class SessionUtils {
|
|||||||
public static boolean isLogedIn() {
|
public static boolean isLogedIn() {
|
||||||
return isLogedIn(getSession());
|
return isLogedIn(getSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLogedIn(HttpSession session) {
|
public static boolean isLogedIn(HttpSession session) {
|
||||||
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERID) != null)
|
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERID) != null)
|
||||||
return true;
|
return true;
|
||||||
@@ -72,18 +70,15 @@ public class SessionUtils {
|
|||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UserType getUserType() {
|
public static UserType getUserType() {
|
||||||
return getUserType(getSession());
|
HttpSession session = getSession();
|
||||||
}
|
|
||||||
|
|
||||||
public static UserType getUserType(HttpSession session) {
|
|
||||||
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE) != null)
|
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE) != null)
|
||||||
return UserType.class.cast(session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE));
|
return UserType.class.cast(session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE));
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoggedUserTO getloggedOnUser() {
|
public static LoggedUserTO getloggedOnUser() {
|
||||||
HttpSession session = getSession();
|
HttpSession session = getSession();
|
||||||
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USER) != null)
|
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USER) != null)
|
||||||
@@ -91,24 +86,4 @@ public class SessionUtils {
|
|||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FacesMessage getMessage() {
|
|
||||||
HttpSession session = getSession();
|
|
||||||
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_MESSAGE) != null) {
|
|
||||||
FacesMessage msg = FacesMessage.class.cast(session.getAttribute(SessionUtils.SESSION_VAR_MESSAGE));
|
|
||||||
session.removeAttribute(SessionUtils.SESSION_VAR_MESSAGE);
|
|
||||||
return msg;
|
|
||||||
} else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addMessage(FacesMessage.Severity severity, String summary, String detail) {
|
|
||||||
addMessage(getSession(), severity, summary, detail);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addMessage(HttpSession session, FacesMessage.Severity severity, String summary, String detail) {
|
|
||||||
if (session != null)
|
|
||||||
session.setAttribute(SessionUtils.SESSION_VAR_MESSAGE, new FacesMessage(severity, summary, detail));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
package managedbean.common;
|
package managedbean.common;
|
||||||
|
|
||||||
import TO.FamilyDoctorTO;
|
|
||||||
import TO.PatientTO;
|
|
||||||
import TO.SpecialistDoctorTO;
|
|
||||||
import common.UserType;
|
|
||||||
import ejb.common.CommonFacadeRemote;
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
@@ -53,54 +47,4 @@ public class ValidationUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Comprueba si un NIF existe para un tipo de usuario. * No se permite que el
|
|
||||||
* mismo NIF esté registrado como médico de familia y como especialista. * Se
|
|
||||||
* permite que el mismo NIF esté registrado como paciente y como médico (de
|
|
||||||
* familia o especialista)
|
|
||||||
*
|
|
||||||
* @param remoteSvc Servicio Remoto para recuperar datos.
|
|
||||||
* @param userType Tipo de usuario a comprobar
|
|
||||||
* @param nif NIF a comprobar.
|
|
||||||
* @param id Parámetro opcional, id del usuario actual (si encuentra el
|
|
||||||
* mismo nif y el usuario coincide no se devuelve la
|
|
||||||
* coincidencia)
|
|
||||||
* @return true si el NIF ya estaba registrado para un usuario diferente.
|
|
||||||
*/
|
|
||||||
public static boolean checkIfNifAlreadyRegistered(CommonFacadeRemote remoteSvc, UserType userType, String nif, Integer id) {
|
|
||||||
boolean nifExists = false;
|
|
||||||
|
|
||||||
if (userType == null || remoteSvc == null)
|
|
||||||
return nifExists;
|
|
||||||
|
|
||||||
switch (userType) {
|
|
||||||
case ADMINISTRATOR:
|
|
||||||
break;
|
|
||||||
case FAMILY_DOCTOR:
|
|
||||||
case SPECIALIST_DOCTOR:
|
|
||||||
FamilyDoctorTO fd = remoteSvc.findFamilyDoctorByNif(nif);
|
|
||||||
|
|
||||||
if (fd == null) {
|
|
||||||
// Si el nif no está en uso para un médico de familia, reivsamos si está en uso
|
|
||||||
// para los especialistas
|
|
||||||
SpecialistDoctorTO sd = remoteSvc.findSpecialistDoctorByNif(nif);
|
|
||||||
|
|
||||||
if (sd != null && (id == null || sd.getId() != id))
|
|
||||||
nifExists = true;
|
|
||||||
} else if (id == null || fd.getId() != id)
|
|
||||||
// Si se trata de un usuario diferente, entonces está repetido
|
|
||||||
nifExists = true;
|
|
||||||
|
|
||||||
break;
|
|
||||||
case PATIENT:
|
|
||||||
PatientTO pat = remoteSvc.findPatientByNif(nif);
|
|
||||||
|
|
||||||
// Si se trata de un usuario diferente, entonces está repetido
|
|
||||||
if (pat != null && (id == null || pat.getId() != id))
|
|
||||||
nifExists = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nifExists;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.faces.application.FacesMessage;
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
import common.UserType;
|
import common.UserType;
|
||||||
@@ -17,7 +16,7 @@ import common.UserType;
|
|||||||
*/
|
*/
|
||||||
@Named("home")
|
@Named("home")
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class homeMBean extends ManagedBeanBase implements Serializable {
|
public class homeMBean implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private boolean isLogedIn;
|
private boolean isLogedIn;
|
||||||
@@ -32,12 +31,6 @@ public class homeMBean extends ManagedBeanBase implements Serializable {
|
|||||||
userName = SessionUtils.getUserName();
|
userName = SessionUtils.getUserName();
|
||||||
userId = SessionUtils.getUserId();
|
userId = SessionUtils.getUserId();
|
||||||
userType = SessionUtils.getUserType();
|
userType = SessionUtils.getUserType();
|
||||||
|
|
||||||
FacesMessage message = SessionUtils.getMessage();
|
|
||||||
|
|
||||||
if (message != null) {
|
|
||||||
this.addFacesMessage(message, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Theme> getThemes() {
|
public List<Theme> getThemes() {
|
||||||
|
|||||||
@@ -1,27 +1,51 @@
|
|||||||
package managedbean.medicalTest;
|
package managedbean.medicalTest;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.ejb.EJB;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
import managedbean.common.ManagedBeanBase;
|
import ejb.medicalTest.MedicalTestFacadeRemote;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ManagedBEan que gestiona la edición y actualización de una especialidad
|
||||||
|
* médica.
|
||||||
|
*
|
||||||
|
* @author mark
|
||||||
|
*
|
||||||
|
*/
|
||||||
@Named("MedicalTestMBean")
|
@Named("MedicalTestMBean")
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
public class MedicalTestMBean implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public MedicalTestMBean() {
|
@EJB
|
||||||
|
private MedicalTestFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public MedicalTestMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
/**
|
||||||
public void init() {
|
* Inicializa la conexión con el EJB Remoto
|
||||||
// Inicialización de variables y propiedades van aquí.
|
*
|
||||||
|
* @throws Exception
|
||||||
// Como realizar llamadas al EJB Remoto
|
*/
|
||||||
// this.getRemoteManagerSystemAdmin().MetodoEJB
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (MedicalTestFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/MedicalTestFacadeBean!ejb.component.MedicalTestFacadeRemote");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +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 common.Constants;
|
|
||||||
import ejb.medicalTest.MedicalTestFacadeRemote;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named("AddFamilyDoctorMBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class AddFamilyDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public AddFamilyDoctorMBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
112
1.sources/MyHealth/src/managedbean/profile/AddPatientMBean.java
Normal file
112
1.sources/MyHealth/src/managedbean/profile/AddPatientMBean.java
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.faces.application.FacesMessage;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ManagedBEan que gestiona la edición y actualización de una especialidad
|
||||||
|
* médica.
|
||||||
|
*
|
||||||
|
* @author mark
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named("addPatientMBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class AddPatientMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String nif;
|
||||||
|
private String name;
|
||||||
|
private String surname;
|
||||||
|
private String password;
|
||||||
|
private String passwordRepeat;
|
||||||
|
private String email;
|
||||||
|
private String primaryHealthCareCenter;
|
||||||
|
private String medicalSpecialty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public AddPatientMBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurname(String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNif() {
|
||||||
|
return nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNif(String nif) {
|
||||||
|
this.nif = nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save() {
|
||||||
|
FacesMessage msg;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Alta realizada", "El usuario " + name + " " + surname + " se ha registrado correctamente.");
|
||||||
|
} catch (Exception e) {
|
||||||
|
msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Se ha producido un error inesperado: " + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPasswordRepeat() {
|
||||||
|
return passwordRepeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPasswordRepeat(String passwordRepeat) {
|
||||||
|
this.passwordRepeat = passwordRepeat;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named( "AddSpecialistDoctorMBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class AddSpecialistDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public AddSpecialistDoctorMBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -127,16 +127,6 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
}
|
}
|
||||||
return this.medicalSpecialitiesList;
|
return this.medicalSpecialitiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPatient() {
|
public boolean isPatient() {
|
||||||
return (this.userType == UserType.PATIENT);
|
return (this.userType == UserType.PATIENT);
|
||||||
@@ -209,10 +199,6 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, null) == true) {
|
|
||||||
this.addFacesMessage("frmRegisterUser:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
|
|
||||||
error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named( "ShowFamilyDoctorMBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class ShowFamilyDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public ShowFamilyDoctorMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named("ShowPatientMBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class ShowPatientMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public ShowPatientMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named( "ShowSpecialistDoctorMBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class ShowSpecialistDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public ShowSpecialistDoctorMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named("UpdateFamilyDoctorMBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class UpdateFamilyDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public UpdateFamilyDoctorMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named("UpdatePatientMBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class UpdatePatientMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public UpdatePatientMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -113,7 +113,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
this.id = pat.getId();
|
this.id = pat.getId();
|
||||||
this.cipCode = pat.getPersonalIdentificationCode();
|
this.cipCode = pat.getPersonalIdentificationCode();
|
||||||
this.name = pat.getName();
|
this.name = pat.getName();
|
||||||
this.surname = pat.getSurname();
|
this.surname = pat.getName();
|
||||||
this.nif = pat.getNif();
|
this.nif = pat.getNif();
|
||||||
this.email = pat.getEmail();
|
this.email = pat.getEmail();
|
||||||
this.currentPassword = pat.getPassword();
|
this.currentPassword = pat.getPassword();
|
||||||
@@ -124,7 +124,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
this.id = fd.getId();
|
this.id = fd.getId();
|
||||||
this.cipCode = fd.getProfessionalNumber();
|
this.cipCode = fd.getProfessionalNumber();
|
||||||
this.name = fd.getName();
|
this.name = fd.getName();
|
||||||
this.surname = fd.getSurname();
|
this.surname = fd.getName();
|
||||||
this.nif = fd.getNif();
|
this.nif = fd.getNif();
|
||||||
this.email = fd.getEmail();
|
this.email = fd.getEmail();
|
||||||
this.currentPassword = fd.getPassword();
|
this.currentPassword = fd.getPassword();
|
||||||
@@ -135,7 +135,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
this.id = sd.getId();
|
this.id = sd.getId();
|
||||||
this.cipCode = sd.getProfessionalNumber();
|
this.cipCode = sd.getProfessionalNumber();
|
||||||
this.name = sd.getName();
|
this.name = sd.getName();
|
||||||
this.surname = sd.getSurname();
|
this.surname = sd.getName();
|
||||||
this.nif = sd.getNif();
|
this.nif = sd.getNif();
|
||||||
this.email = sd.getEmail();
|
this.email = sd.getEmail();
|
||||||
this.currentPassword = sd.getPassword();
|
this.currentPassword = sd.getPassword();
|
||||||
@@ -172,16 +172,6 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
return this.medicalSpecialitiesList;
|
return this.medicalSpecialitiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FamilyDoctorTO> getFamilyDoctorList() {
|
public List<FamilyDoctorTO> getFamilyDoctorList() {
|
||||||
return familyDoctorList;
|
return familyDoctorList;
|
||||||
}
|
}
|
||||||
@@ -257,11 +247,6 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
|
|
||||||
public void saveData() {
|
public void saveData() {
|
||||||
int error = 0;
|
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);
|
boolean changePassword = (this.oldPassword != null && this.oldPassword.equals("") == false) || (this.password != null && this.password.equals("") == false);
|
||||||
|
|
||||||
if (this.isUserTypeFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
if (this.isUserTypeFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||||
@@ -276,10 +261,6 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, this.id) == true) {
|
|
||||||
this.addFacesMessage("frmUpdateProfile:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
|
|
||||||
error++;
|
|
||||||
}
|
|
||||||
if (changePassword == true) {
|
if (changePassword == true) {
|
||||||
// el usuario queire cambiar el password Comprobamos que el password
|
// el usuario queire cambiar el password Comprobamos que el password
|
||||||
// especificado coincide con el guardado
|
// especificado coincide con el guardado
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named("UpdateSpecialistDoctorMBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class UpdateSpecialistDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public UpdateSpecialistDoctorMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -42,11 +42,10 @@ public class LoginMBean extends ManagedBeanBase {
|
|||||||
|
|
||||||
public String login() {
|
public String login() {
|
||||||
boolean loggedIn = false;
|
boolean loggedIn = false;
|
||||||
String viewRedirect = "";
|
|
||||||
|
|
||||||
LoggedUserTO usr = null;
|
LoggedUserTO usr = null;
|
||||||
|
|
||||||
if (username != null && password != null && username.equals("") == false && password.equals("") == false) {
|
if (username != null && password != null) {
|
||||||
try {
|
try {
|
||||||
usr = this.getRemoteManagerSystemAdmin().login(username, password);
|
usr = this.getRemoteManagerSystemAdmin().login(username, password);
|
||||||
|
|
||||||
@@ -55,7 +54,8 @@ public class LoginMBean extends ManagedBeanBase {
|
|||||||
SessionUtils.CreateSession(usr);
|
SessionUtils.CreateSession(usr);
|
||||||
|
|
||||||
this.addFacesMessageKeep(FacesMessage.SEVERITY_INFO, "Login correcto", "Bienvenido " + usr.getName());
|
this.addFacesMessageKeep(FacesMessage.SEVERITY_INFO, "Login correcto", "Bienvenido " + usr.getName());
|
||||||
viewRedirect = "/home?faces-redirect=true";
|
|
||||||
|
return ("/home?faces-redirect=true");
|
||||||
} else
|
} else
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "El usuario o la contraseña son incorrectos");
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "El usuario o la contraseña son incorrectos");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@@ -66,7 +66,8 @@ public class LoginMBean extends ManagedBeanBase {
|
|||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "El usuario o la contraseña son incorrectos");
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "El usuario o la contraseña son incorrectos");
|
||||||
|
|
||||||
PrimeFaces.current().ajax().addCallbackParam("loggedIn", loggedIn);
|
PrimeFaces.current().ajax().addCallbackParam("loggedIn", loggedIn);
|
||||||
return viewRedirect;
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// logout event, invalidate session
|
// logout event, invalidate session
|
||||||
|
|||||||
@@ -1,162 +0,0 @@
|
|||||||
package managedbean.systemAdmin;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
import javax.faces.application.FacesMessage;
|
|
||||||
import javax.inject.Named;
|
|
||||||
|
|
||||||
import TO.LoggedUserTO;
|
|
||||||
import TO.MedicalSpecialtyTO;
|
|
||||||
import common.Constants;
|
|
||||||
import managedbean.common.ManagedBeanBase;
|
|
||||||
import managedbean.common.SessionUtils;
|
|
||||||
|
|
||||||
@Named("ManageSpecialities")
|
|
||||||
@RequestScoped
|
|
||||||
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;
|
|
||||||
|
|
||||||
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();
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MedicalSpecialtyTO getMedicalSpecialty() {
|
|
||||||
return medicalSpecialty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMedicalSpecialty(MedicalSpecialtyTO value) {
|
|
||||||
this.medicalSpecialty = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveData() {
|
|
||||||
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 {
|
|
||||||
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.");
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteData() {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 de especialidad.");
|
|
||||||
error++;
|
|
||||||
}
|
|
||||||
if (description == null || description.trim().length() == 0) {
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Descripción no rellena", "Por favor, escriba una descripción.");
|
|
||||||
error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error == 0) {
|
|
||||||
try {
|
|
||||||
MedicalSpecialtyTO ms = this.getRemoteManagerSystemAdmin().insertSpecialtyData(name, description);
|
|
||||||
this.setSpecialtyData(ms);
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package managedbean.systemAdmin;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.systemAdmin.SystemAdminFacadeRemote;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ManagedBEan que gestiona la edición y actualización de una especialidad
|
||||||
|
* médica.
|
||||||
|
*
|
||||||
|
* @author mark
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named("SystemAdminMBean")
|
||||||
|
@RequestScoped
|
||||||
|
public class SystemAdminMBean implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private SystemAdminFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public SystemAdminMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (SystemAdminFacadeRemote) ctx.lookup("java:app/myHealth.jar/ClassFacadeBean!ejb.component.SystemAdminFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,28 +1,50 @@
|
|||||||
package managedbean.visit;
|
package managedbean.visit;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.ejb.EJB;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
import managedbean.common.ManagedBeanBase;
|
import ejb.visit.VisitFacadeRemote;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ManagedBEan que gestiona la edición y actualización de una especialidad
|
||||||
|
* médica.
|
||||||
|
*
|
||||||
|
* @author mark
|
||||||
|
*
|
||||||
|
*/
|
||||||
@Named("VisitMBean")
|
@Named("VisitMBean")
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class VisitMBean extends ManagedBeanBase implements Serializable {
|
public class VisitMBean implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public VisitMBean() {
|
@EJB
|
||||||
|
private VisitFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public VisitMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
/**
|
||||||
public void init() {
|
* Inicializa la conexión con el EJB Remoto
|
||||||
// Inicialización de variables y propiedades van aquí.
|
*
|
||||||
|
* @throws Exception
|
||||||
// Como realizar llamadas al EJB Remoto
|
*/
|
||||||
// this.getRemoteManagerSystemAdmin().MetodoEJB
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (VisitFacadeRemote) ctx.lookup("java:app/myHealth.jar/ClassFacadeBean!ejb.component.VisitFacadeRemote");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,88 +1,40 @@
|
|||||||
DO
|
|
||||||
$$
|
|
||||||
begin
|
|
||||||
|
|
||||||
IF NOT EXISTS(SELECT schema_name FROM information_schema.schemata WHERE schema_name = 'myhealth') THEN
|
|
||||||
CREATE SCHEMA myhealth;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname='usrmyhealth') THEN
|
|
||||||
create user usrmyhealth with encrypted password 'myhealth.123';
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname='USER') THEN
|
|
||||||
create user "USER" with encrypted password 'PASSWORD';
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
GRANT ALL ON SCHEMA myhealth TO "USER";
|
|
||||||
GRANT ALL ON SCHEMA myhealth TO usrmyhealth;
|
|
||||||
|
|
||||||
if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='administrator') THEN
|
|
||||||
drop table myhealth.administrator;
|
|
||||||
end if;
|
|
||||||
if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='medicaltest') THEN
|
|
||||||
drop table myhealth.medicaltest;
|
|
||||||
end if;
|
|
||||||
if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='question') THEN
|
|
||||||
drop table myhealth.question;
|
|
||||||
end if;
|
|
||||||
if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='response') THEN
|
|
||||||
drop table myhealth.response;
|
|
||||||
end if;
|
|
||||||
if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='visit') THEN
|
|
||||||
drop table myhealth.visit;
|
|
||||||
end if;
|
|
||||||
if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='patient') THEN
|
|
||||||
drop table myhealth.patient;
|
|
||||||
end if;
|
|
||||||
if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='familydoctor') THEN
|
|
||||||
drop table myhealth.familydoctor;
|
|
||||||
end if;
|
|
||||||
if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='primaryhealthcarecenter') THEN
|
|
||||||
drop table myhealth.primaryhealthcarecenter;
|
|
||||||
end if;
|
|
||||||
|
|
||||||
if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='specialistdoctor') THEN
|
|
||||||
drop table myhealth.specialistdoctor;
|
|
||||||
end if;
|
|
||||||
if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='medicalspecialty') THEN
|
|
||||||
drop table myhealth.medicalspecialty;
|
|
||||||
end if;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
drop table myhealth.administrator;
|
DROP TABLE myhealth.Administrator;
|
||||||
drop table myhealth.familydoctor;
|
DROP TABLE myhealth.FamilyDoctor;
|
||||||
drop table myhealth.medicalspecialty;
|
DROP TABLE myhealth.MedicalSpecialty;
|
||||||
drop table myhealth.medicaltest;
|
DROP TABLE myhealth.MedicalTest;
|
||||||
drop table myhealth.patient;
|
DROP TABLE myhealth.Patient;
|
||||||
drop table myhealth.primaryhealthcarecenter;
|
DROP TABLE myhealth.PrimaryHealthCareCenter;
|
||||||
drop table myhealth.question;
|
DROP TABLE myhealth.Question;
|
||||||
drop table myhealth.response;
|
DROP TABLE myhealth.Response;
|
||||||
drop table myhealth.specialistdoctor;
|
DROP TABLE myhealth.SpecialistDoctor;
|
||||||
drop table myhealth.visit;
|
DROP TABLE myhealth.Visit;
|
||||||
|
|
||||||
|
DROP SEQUENCE myhealth.ProfesionalNumber;
|
||||||
|
DROP SEQUENCE myhealth.CodigoIdentificacionPaciente
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if exists (SELECT 1 FROM pg_sequences WHERE schemaname='myhealth' and sequencename='profesionalnumber') THEN
|
|
||||||
drop sequence myhealth.profesionalnumber;
|
|
||||||
end if;
|
|
||||||
|
|
||||||
if exists (SELECT 1 FROM pg_sequences WHERE schemaname='myhealth' and sequencename='codigoidentificacionpaciente') THEN
|
|
||||||
drop sequence myhealth.codigoidentificacionpaciente;
|
|
||||||
end if;
|
|
||||||
|
|
||||||
CREATE SEQUENCE myhealth.ProfesionalNumber
|
CREATE SEQUENCE myhealth.ProfesionalNumber
|
||||||
INCREMENT 1
|
INCREMENT 1
|
||||||
START 1000
|
START 1000
|
||||||
MINVALUE 1000
|
MINVALUE 1000
|
||||||
CACHE 1;
|
CACHE 1;
|
||||||
|
|
||||||
|
ALTER SEQUENCE myhealth.ProfesionalNumber OWNER TO "USER";
|
||||||
|
|
||||||
CREATE SEQUENCE myhealth.CodigoIdentificacionPaciente
|
CREATE SEQUENCE myhealth.CodigoIdentificacionPaciente
|
||||||
INCREMENT 1
|
INCREMENT 1
|
||||||
START 1000
|
START 1000
|
||||||
MINVALUE 1000
|
MINVALUE 1000
|
||||||
CACHE 1;
|
CACHE 1;
|
||||||
|
|
||||||
|
ALTER SEQUENCE myhealth.CodigoIdentificacionPaciente OWNER TO "USER";
|
||||||
|
|
||||||
|
|
||||||
-- Table: myhealth.administrator
|
-- Table: myhealth.administrator
|
||||||
|
|
||||||
|
-- DROP TABLE myhealth.administrator;
|
||||||
|
|
||||||
CREATE TABLE myhealth.administrator
|
CREATE TABLE myhealth.administrator
|
||||||
(
|
(
|
||||||
email VARCHAR(120) COLLATE pg_catalog."default" NOT NULL,
|
email VARCHAR(120) COLLATE pg_catalog."default" NOT NULL,
|
||||||
@@ -91,17 +43,13 @@ CREATE TABLE myhealth.administrator
|
|||||||
)
|
)
|
||||||
TABLESPACE pg_default;
|
TABLESPACE pg_default;
|
||||||
|
|
||||||
-- Table: myhealth.primaryhealthcarecenter
|
ALTER TABLE myhealth.administrator
|
||||||
CREATE TABLE myhealth.primaryhealthcarecenter
|
OWNER to "USER";
|
||||||
(
|
|
||||||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
|
||||||
name VARCHAR(150) COLLATE pg_catalog."default" NOT NULL,
|
|
||||||
location VARCHAR(512) COLLATE pg_catalog."default",
|
|
||||||
CONSTRAINT primaryhealthcarecenter_pkey PRIMARY KEY (id)
|
|
||||||
)
|
|
||||||
TABLESPACE pg_default;
|
|
||||||
|
|
||||||
-- Table: myhealth.familydoctor
|
-- Table: myhealth.familydoctor
|
||||||
|
|
||||||
|
-- DROP TABLE myhealth.familydoctor;
|
||||||
|
|
||||||
CREATE TABLE myhealth.familydoctor
|
CREATE TABLE myhealth.familydoctor
|
||||||
(
|
(
|
||||||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||||
@@ -111,7 +59,7 @@ CREATE TABLE myhealth.familydoctor
|
|||||||
name VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
name VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
||||||
surname VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
surname VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
||||||
email VARCHAR(120) COLLATE pg_catalog."default",
|
email VARCHAR(120) COLLATE pg_catalog."default",
|
||||||
primaryhealthcarecenterid integer REFERENCES myhealth.primaryhealthcarecenter(id) ,
|
primaryhealthcarecenterid integer,
|
||||||
CONSTRAINT familydoctor_pkey PRIMARY KEY (id)
|
CONSTRAINT familydoctor_pkey PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
TABLESPACE pg_default;
|
TABLESPACE pg_default;
|
||||||
@@ -119,7 +67,13 @@ TABLESPACE pg_default;
|
|||||||
CREATE UNIQUE INDEX family_doctor_professionaln_index
|
CREATE UNIQUE INDEX family_doctor_professionaln_index
|
||||||
ON myhealth.familydoctor (professionalnumber);
|
ON myhealth.familydoctor (professionalnumber);
|
||||||
|
|
||||||
|
ALTER TABLE myhealth.familydoctor
|
||||||
|
OWNER to "USER";
|
||||||
|
|
||||||
-- Table: myhealth.medicalspecialty
|
-- Table: myhealth.medicalspecialty
|
||||||
|
|
||||||
|
-- DROP TABLE myhealth.medicalspecialty;
|
||||||
|
|
||||||
CREATE TABLE myhealth.medicalspecialty
|
CREATE TABLE myhealth.medicalspecialty
|
||||||
(
|
(
|
||||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||||
@@ -128,8 +82,35 @@ CREATE TABLE myhealth.medicalspecialty
|
|||||||
CONSTRAINT medicalspecialty_pkey PRIMARY KEY (id)
|
CONSTRAINT medicalspecialty_pkey PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
TABLESPACE pg_default;
|
TABLESPACE pg_default;
|
||||||
|
|
||||||
|
ALTER TABLE myhealth.medicalspecialty
|
||||||
|
OWNER to "USER";
|
||||||
|
|
||||||
|
-- Table: myhealth.medicaltest
|
||||||
|
|
||||||
|
-- DROP TABLE myhealth.medicaltest;
|
||||||
|
|
||||||
|
CREATE TABLE myhealth.medicaltest
|
||||||
|
(
|
||||||
|
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||||
|
date date,
|
||||||
|
"time" abstime,
|
||||||
|
observations TEXT COLLATE pg_catalog."default",
|
||||||
|
highresimage TEXT,
|
||||||
|
type INTEGER,
|
||||||
|
patientid INTEGER NOT NULL,
|
||||||
|
specialistdoctorid INTEGER NOT NULL,
|
||||||
|
CONSTRAINT medicaltest_pkey PRIMARY KEY (id)
|
||||||
|
)
|
||||||
|
TABLESPACE pg_default;
|
||||||
|
|
||||||
|
ALTER TABLE myhealth.medicaltest
|
||||||
|
OWNER to "USER";
|
||||||
|
|
||||||
-- Table: myhealth.patient
|
-- Table: myhealth.patient
|
||||||
|
|
||||||
|
-- DROP TABLE myhealth.patient;
|
||||||
|
|
||||||
CREATE TABLE myhealth.patient
|
CREATE TABLE myhealth.patient
|
||||||
(
|
(
|
||||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||||
@@ -139,15 +120,68 @@ CREATE TABLE myhealth.patient
|
|||||||
name VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
name VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
||||||
surname VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
surname VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
||||||
email VARCHAR(120) COLLATE pg_catalog."default",
|
email VARCHAR(120) COLLATE pg_catalog."default",
|
||||||
familydoctorid INTEGER REFERENCES myhealth.familydoctor(id),
|
familydoctorid INTEGER,
|
||||||
CONSTRAINT patient_pkey PRIMARY KEY (id)
|
CONSTRAINT patient_pkey PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
TABLESPACE pg_default;
|
TABLESPACE pg_default;
|
||||||
|
|
||||||
CREATE UNIQUE INDEX patient_pic_index
|
ALTER TABLE myhealth.patient
|
||||||
ON myhealth.patient (personalIdentificationCode);
|
OWNER to "USER";
|
||||||
|
|
||||||
|
-- Table: myhealth.primaryhealthcarecenter
|
||||||
|
|
||||||
|
-- DROP TABLE myhealth.primaryhealthcarecenter;
|
||||||
|
|
||||||
|
CREATE TABLE myhealth.primaryhealthcarecenter
|
||||||
|
(
|
||||||
|
id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||||
|
name VARCHAR(150) COLLATE pg_catalog."default" NOT NULL,
|
||||||
|
location VARCHAR(512) COLLATE pg_catalog."default",
|
||||||
|
CONSTRAINT primaryhealthcarecenter_pkey PRIMARY KEY (id)
|
||||||
|
)
|
||||||
|
TABLESPACE pg_default;
|
||||||
|
|
||||||
|
ALTER TABLE myhealth.primaryhealthcarecenter
|
||||||
|
OWNER to "USER";
|
||||||
|
|
||||||
|
-- Table: myhealth.question
|
||||||
|
|
||||||
|
-- DROP TABLE myhealth.question;
|
||||||
|
|
||||||
|
CREATE TABLE myhealth.question
|
||||||
|
(
|
||||||
|
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||||
|
title VARCHAR(512) COLLATE pg_catalog."default" NOT NULL,
|
||||||
|
message TEXT COLLATE pg_catalog."default" NOT NULL,
|
||||||
|
status INTEGER,
|
||||||
|
patientid INTEGER NOT NULL,
|
||||||
|
CONSTRAINT question_pkey PRIMARY KEY (id)
|
||||||
|
)
|
||||||
|
TABLESPACE pg_default;
|
||||||
|
|
||||||
|
ALTER TABLE myhealth.question
|
||||||
|
OWNER to "USER";
|
||||||
|
|
||||||
|
-- Table: myhealth.response
|
||||||
|
|
||||||
|
-- DROP TABLE myhealth.response;
|
||||||
|
|
||||||
|
CREATE TABLE myhealth.response
|
||||||
|
(
|
||||||
|
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||||
|
response TEXT COLLATE pg_catalog."default",
|
||||||
|
questionid INTEGER NOT NULL,
|
||||||
|
CONSTRAINT response_pkey PRIMARY KEY (id)
|
||||||
|
)
|
||||||
|
TABLESPACE pg_default;
|
||||||
|
|
||||||
|
ALTER TABLE myhealth.response
|
||||||
|
OWNER to "USER";
|
||||||
|
|
||||||
-- Table: myhealth.specialistdoctor
|
-- Table: myhealth.specialistdoctor
|
||||||
|
|
||||||
|
-- DROP TABLE myhealth.specialistdoctor;
|
||||||
|
|
||||||
CREATE TABLE myhealth.specialistdoctor
|
CREATE TABLE myhealth.specialistdoctor
|
||||||
(
|
(
|
||||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||||
@@ -157,7 +191,7 @@ CREATE TABLE myhealth.specialistdoctor
|
|||||||
name VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
name VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
||||||
surname VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
surname VARCHAR(100) NOT NULL COLLATE pg_catalog."default",
|
||||||
email VARCHAR(120) COLLATE pg_catalog."default",
|
email VARCHAR(120) COLLATE pg_catalog."default",
|
||||||
medicalspecialtyid INTEGER REFERENCES myhealth.medicalspecialty(id),
|
medicalspecialtyid INTEGER,
|
||||||
CONSTRAINT specialistdoctor_pkey PRIMARY KEY (id)
|
CONSTRAINT specialistdoctor_pkey PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
TABLESPACE pg_default;
|
TABLESPACE pg_default;
|
||||||
@@ -165,7 +199,13 @@ TABLESPACE pg_default;
|
|||||||
CREATE UNIQUE INDEX specialistdoctor_professionaln_index
|
CREATE UNIQUE INDEX specialistdoctor_professionaln_index
|
||||||
ON myhealth.specialistdoctor (professionalnumber);
|
ON myhealth.specialistdoctor (professionalnumber);
|
||||||
|
|
||||||
|
ALTER TABLE myhealth.specialistdoctor
|
||||||
|
OWNER to "USER";
|
||||||
|
|
||||||
-- Table: myhealth.visit
|
-- Table: myhealth.visit
|
||||||
|
|
||||||
|
-- DROP TABLE myhealth.visit;
|
||||||
|
|
||||||
CREATE TABLE myhealth.visit
|
CREATE TABLE myhealth.visit
|
||||||
(
|
(
|
||||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||||
@@ -173,62 +213,12 @@ CREATE TABLE myhealth.visit
|
|||||||
"time" abstime NOT NULL,
|
"time" abstime NOT NULL,
|
||||||
observations TEXT COLLATE pg_catalog."default",
|
observations TEXT COLLATE pg_catalog."default",
|
||||||
result TEXT COLLATE pg_catalog."default",
|
result TEXT COLLATE pg_catalog."default",
|
||||||
patientid INTEGER REFERENCES myhealth.patient(id),
|
patientid INTEGER NOT NULL,
|
||||||
familydoctorid INTEGER REFERENCES myhealth.familydoctor(id),
|
familydoctorid INTEGER NOT NULL,
|
||||||
CONSTRAINT visit_pkey PRIMARY KEY (id)
|
CONSTRAINT visit_pkey PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
TABLESPACE pg_default;
|
TABLESPACE pg_default;
|
||||||
|
|
||||||
-- Table: myhealth.question
|
ALTER TABLE myhealth.visit
|
||||||
CREATE TABLE myhealth.question
|
OWNER to "USER";
|
||||||
(
|
|
||||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
|
||||||
title VARCHAR(512) COLLATE pg_catalog."default" NOT NULL,
|
|
||||||
message TEXT COLLATE pg_catalog."default" NOT NULL,
|
|
||||||
status VARCHAR(20) NOT NULL,
|
|
||||||
response TEXT COLLATE pg_catalog."default",
|
|
||||||
patientid INTEGER REFERENCES myhealth.patient(id) NOT NULL,
|
|
||||||
familydoctorid INTEGER REFERENCES myhealth.familydoctor(id) NOT NULL,
|
|
||||||
CONSTRAINT question_pkey PRIMARY KEY (id)
|
|
||||||
)
|
|
||||||
TABLESPACE pg_default;
|
|
||||||
|
|
||||||
-- Table: myhealth.medicaltest
|
|
||||||
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,
|
|
||||||
observations TEXT COLLATE pg_catalog."default",
|
|
||||||
highresimage TEXT,
|
|
||||||
type VARCHAR(30) NOT NULL,
|
|
||||||
patientid INTEGER REFERENCES myhealth.patient(id) NOT NULL,
|
|
||||||
specialistdoctorid INTEGER REFERENCES myhealth.specialistdoctor(id) NOT NULL,
|
|
||||||
CONSTRAINT medicaltest_pkey PRIMARY KEY (id)
|
|
||||||
)
|
|
||||||
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";
|
|
||||||
|
|
||||||
-- 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;
|
|
||||||
|
|
||||||
END;
|
|
||||||
$$
|
|
||||||
|
|||||||
61
2.database/02. Datos_prueba.sql
Normal file
61
2.database/02. Datos_prueba.sql
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
--Inserta usuarios administradores (contraseña Hash MD5 'admin' para todos)
|
||||||
|
insert into myhealth.administrator (email, password) values ('admin@example.com', '21232F297A57A5A743894A0E4A801FC3');
|
||||||
|
insert into myhealth.administrator (email, password) values ('marcos@example.com', '21232F297A57A5A743894A0E4A801FC3');
|
||||||
|
|
||||||
|
-- Insertar Algunos centros médicos
|
||||||
|
INSERT INTO myhealth.primaryhealthcarecenter(name, location) VALUES
|
||||||
|
('CENTRO SAUDE A DOBLADA',' CALLE RUA FAISAN S/N '),
|
||||||
|
('CENTRO SAUDE BEMBRIVE',' CARRETERA BEMBRIVE 259 '),
|
||||||
|
('CENTRO SAUDE BOLIVIA',' CALLE PIZARRO 22 '),
|
||||||
|
('CENTRO SAUDE CASCO VELLO',' PLAZA CONSTITUCION 7 '),
|
||||||
|
('CENTRO SAUDE COIA',' CALLE PONTEAREAS S/N '),
|
||||||
|
('CENTRO SAUDE COLMEIRO',' CALLE PINTOR COLMEIRO 11 '),
|
||||||
|
('CENTRO SAUDE CORUXO',' CALLE RUA JOSE RIVAS CARRASQUEIRA S/N '),
|
||||||
|
('CENTRO SAUDE LAVADORES',' TRAVESIA BARREIRO 1 36 '),
|
||||||
|
('CENTRO SAUDE LOPEZ MORA',' CALLE LOPEZ MORA 54 '),
|
||||||
|
('CENTRO SAUDE MATAMA',' CAMINO CAMIÑO BABIO-AS CARNEIRAS S/N '),
|
||||||
|
('CENTRO SAUDE NICOLAS PEÑA',' CAMINO CAMIÑO REGUEIRO S/N '),
|
||||||
|
('CENTRO SAUDE ROSALIA DE CASTRO-BEIRAMAR',' CALLE ROSALIA DE CASTRO 21 '),
|
||||||
|
('CENTRO SAUDE RUA CUBA',' CALLE CUBA 10 '),
|
||||||
|
('CENTRO SAUDE SAN PAIO DE NAVIA',' CALLE POZA CABALO S/N '),
|
||||||
|
('CENTRO SAUDE SARDOMA',' CALLE RUA CANTEIRA DE BALIN 76 '),
|
||||||
|
('CENTRO SAUDE TEIS',' CALLE ANGELA IGLESIAS REBOLLAR S/N ');
|
||||||
|
|
||||||
|
-- Inserta Especialidades médicas
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Alergologia','Especialidad médica de Alergologia');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Cirugía cardiaca','Especialidad médica de Cirugía cardiaca');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Cirugía general','Especialidad médica de Cirugía general');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Cirugía plastica','Especialidad médica de Cirugía plastica');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Cirugía de mama','Especialidad médica de Cirugía de mama');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Cirugía maxilofacial','Especialidad médica de Cirugía maxilofacial');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Cirugía vascular','Especialidad médica de Cirugía vascular');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Dermatología','Especialidad médica de Dermatología');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Endocrinología y nutrición','Especialidad médica de Endocrinología y nutrición');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Gastroenterología- digestivo','Especialidad médica de Gastroenterología- digestivo');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Neurocirugía','Especialidad médica de Neurocirugía');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Oftalmología','Especialidad médica de Oftalmología');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Otorrinolaringologia','Especialidad médica de Otorrinolaringologia');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Oncología','Especialidad médica de Oncología');
|
||||||
|
insert into MyHealth.MedicalSpecialty(name, description)
|
||||||
|
values ('Pediatría','Especialidad médica de Pediatría');
|
||||||
|
|
||||||
|
INSERT INTO myhealth.primaryhealthcarecenter(name, location)
|
||||||
|
VALUES ('Centro A', 'Descripción centro A');
|
||||||
|
INSERT INTO myhealth.primaryhealthcarecenter(name, location)
|
||||||
|
VALUES ('Centro Medico Azul', 'Descripción centro medico azul');
|
||||||
|
INSERT INTO myhealth.primaryhealthcarecenter(name, location)
|
||||||
|
VALUES ('Centro Medico 23', 'Descripción centro medico 23');
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
--Inserta usuarios administradores (contraseña Hash MD5 'admin' para todos)
|
|
||||||
insert into myhealth.administrator (email, password) values
|
|
||||||
('admin@example.com', '21232F297A57A5A743894A0E4A801FC3')
|
|
||||||
,('marcos@example.com', '21232F297A57A5A743894A0E4A801FC3');
|
|
||||||
|
|
||||||
-- Insertar Algunos centros médicos
|
|
||||||
INSERT INTO myhealth.primaryhealthcarecenter(name, location) VALUES
|
|
||||||
('Centro Saude A Doblada',' Calle Rua Faisan S/N')
|
|
||||||
,('Centro Saude Bembrive',' Carretera Bembrive 259')
|
|
||||||
,('Centro Saude Bolivia',' Calle Pizarro 22')
|
|
||||||
,('Centro Saude Casco Vello',' Plaza Constitucion 7')
|
|
||||||
,('Centro Saude Coia',' Calle Ponteareas S/N')
|
|
||||||
,('Centro Saude Colmeiro',' Calle Pintor Colmeiro 11')
|
|
||||||
,('Centro Saude Coruxo',' Calle Rua Jose Rivas Carrasqueira S/N')
|
|
||||||
,('Centro Saude Lavadores',' Travesia Barreiro 1 36')
|
|
||||||
,('Centro Saude Lopez Mora',' Calle Lopez Mora 54')
|
|
||||||
,('Centro Saude Matama',' Camino Camiño Babio-As Carneiras S/N')
|
|
||||||
,('Centro Saude Nicolas Peña',' Camino Camiño Regueiro S/N')
|
|
||||||
,('Centro Saude Rosalia De Castro-Beiramar',' Calle Rosalia De Castro 21')
|
|
||||||
,('Centro Saude Rua Cuba',' Calle Cuba 10')
|
|
||||||
,('Centro Saude San Paio De Navia',' Calle Poza Cabalo S/N')
|
|
||||||
,('Centro Saude Sardoma',' Calle Rua Canteira De Balin 76')
|
|
||||||
,('Centro Saude Teis',' Calle Angela Iglesias Rebollar S/N');
|
|
||||||
|
|
||||||
-- Inserta Especialidades médicas
|
|
||||||
insert into MyHealth.MedicalSpecialty(name, description) values
|
|
||||||
('Alergologia','Especialidad médica de Alergologia')
|
|
||||||
,('Cirugía cardiaca','Especialidad médica de Cirugía cardiaca')
|
|
||||||
,('Cirugía general','Especialidad médica de Cirugía general')
|
|
||||||
,('Cirugía plastica','Especialidad médica de Cirugía plastica')
|
|
||||||
,('Cirugía de mama','Especialidad médica de Cirugía de mama')
|
|
||||||
,('Cirugía maxilofacial','Especialidad médica de Cirugía maxilofacial')
|
|
||||||
,('Cirugía vascular','Especialidad médica de Cirugía vascular')
|
|
||||||
,('Dermatología','Especialidad médica de Dermatología')
|
|
||||||
,('Endocrinología y nutrición','Especialidad médica de Endocrinología y nutrición')
|
|
||||||
,('Gastroenterología- digestivo','Especialidad médica de Gastroenterología- digestivo')
|
|
||||||
,('Neurocirugía','Especialidad médica de Neurocirugía')
|
|
||||||
,('Oftalmología','Especialidad médica de Oftalmología')
|
|
||||||
,('Otorrinolaringologia','Especialidad médica de Otorrinolaringologia')
|
|
||||||
,('Oncología','Especialidad médica de Oncología')
|
|
||||||
,('Pediatría','Especialidad médica de Pediatría');
|
|
||||||
|
|
||||||
-- Insertar médicos de familia
|
|
||||||
INSERT INTO myhealth.familydoctor(professionalnumber, password, nif, surname, email, name, primaryhealthcarecenterid) VALUES
|
|
||||||
('PRO#100','912EC803B2CE49E4A541068D495AB570','95874388S','Moran Ortiz', 'Xian@example.ecom','Xian', 1)
|
|
||||||
,('PRO#101','912EC803B2CE49E4A541068D495AB570','59546140Z','Zambrano Rivas', 'Belen@example.ecom','Belen', 2)
|
|
||||||
,('PRO#102','912EC803B2CE49E4A541068D495AB570','16354100L','Cuevas Luque', 'Fernando@example.ecom','Fernando', 3)
|
|
||||||
,('PRO#103','912EC803B2CE49E4A541068D495AB570','32662259M','Becerra Muñiz', 'Luis@example.ecom','Luis', 4)
|
|
||||||
,('PRO#104','912EC803B2CE49E4A541068D495AB570','70600712G','Aznar Silva', 'Ana@example.ecom','Ana', 5)
|
|
||||||
,('PRO#105','912EC803B2CE49E4A541068D495AB570','08003806J','Galvez Sancho', 'Alfonso@example.ecom','Alfonso', 6)
|
|
||||||
,('PRO#106','912EC803B2CE49E4A541068D495AB570','19567288S','Criado Marti', 'Jordi@example.ecom','Jordi', 7)
|
|
||||||
,('PRO#107','912EC803B2CE49E4A541068D495AB570','95413653Q','Estevez Mena', 'Barbara@example.ecom','Barbara', 8)
|
|
||||||
,('PRO#108','912EC803B2CE49E4A541068D495AB570','90914444K','Godoy Alcaide', 'Amalia@example.ecom','Amalia', 9)
|
|
||||||
,('PRO#109','912EC803B2CE49E4A541068D495AB570','05709869G','Lucas Wang', 'Carmelo@example.ecom','Carmelo', 10);
|
|
||||||
|
|
||||||
-- Insertar médicos especialistas
|
|
||||||
INSERT INTO myhealth.specialistdoctor(professionalnumber, password, nif, surname, email, name, medicalspecialtyid) VALUES
|
|
||||||
('PRO#110','912EC803B2CE49E4A541068D495AB570','87719252N','Vazquez Cruz', 'Luciano@example.ecom','Luciano', 1)
|
|
||||||
,('PRO#111','912EC803B2CE49E4A541068D495AB570','79412306E','Alcaide Mesa', 'Gregorio@example.ecom','Gregorio', 2)
|
|
||||||
,('PRO#112','912EC803B2CE49E4A541068D495AB570','45727688P','Herranz Soria', 'Candida@example.ecom','Candida', 3)
|
|
||||||
,('PRO#113','912EC803B2CE49E4A541068D495AB570','65061962E','Galvez Vives', 'Nora@example.ecom','Nora', 4)
|
|
||||||
,('PRO#114','912EC803B2CE49E4A541068D495AB570','07359870P','Rojas Alonso', 'Anton@example.ecom','Anton', 5)
|
|
||||||
,('PRO#115','912EC803B2CE49E4A541068D495AB570','14117403A','Lorente Carmona', 'Sheila@example.ecom','Sheila', 6)
|
|
||||||
,('PRO#116','912EC803B2CE49E4A541068D495AB570','79864477J','Gonzalo Bonet', 'Nicolas@example.ecom','Nicolas', 7)
|
|
||||||
,('PRO#117','912EC803B2CE49E4A541068D495AB570','22761129F','Bonet Ariza', 'Aroa@example.ecom','Aroa', 8)
|
|
||||||
,('PRO#118','912EC803B2CE49E4A541068D495AB570','99693813Z','Soria Singh', 'Cristian@example.ecom','Cristian', 9)
|
|
||||||
,('PRO#119','912EC803B2CE49E4A541068D495AB570','04431824T','Requena Calderon', 'Ferran@example.ecom','Ferran', 10)
|
|
||||||
,('PRO#120','912EC803B2CE49E4A541068D495AB570','27476123R','Angulo Zamora', 'Ana@example.ecom','Ana', 11);
|
|
||||||
|
|
||||||
--Insertar Pacientes
|
|
||||||
INSERT INTO myhealth.patient(personalidentificationcode, password, nif, surname, email, name, familydoctorid) VALUES
|
|
||||||
('PAT#100','912EC803B2CE49E4A541068D495AB570','97758900E','Singh Vila', 'Soledad@example.ecom','Soledad', 1)
|
|
||||||
,('PAT#101','912EC803B2CE49E4A541068D495AB570','Z9518183Y','Jimenez Merino', 'Ainhoa@example.ecom','Ainhoa', 2)
|
|
||||||
,('PAT#102','912EC803B2CE49E4A541068D495AB570','97758900E','Jesus Chen Barba', 'Abel@example.ecom','Abel', 3)
|
|
||||||
,('PAT#103','912EC803B2CE49E4A541068D495AB570','95014341F','Lorenzo Tapia Navas', 'Francisco@example.ecom','Francisco', 4)
|
|
||||||
,('PAT#104','912EC803B2CE49E4A541068D495AB570','17873499S','Gimenez Gutierrez', 'Teodora@example.ecom','Teodora', 5)
|
|
||||||
,('PAT#105','912EC803B2CE49E4A541068D495AB570','07320674G','Escobar Marquez', 'Jorge@example.ecom','Jorge', 6)
|
|
||||||
,('PAT#106','912EC803B2CE49E4A541068D495AB570','63888801E','Marin Reina', 'Marti@example.ecom','Marti', 7)
|
|
||||||
,('PAT#107','912EC803B2CE49E4A541068D495AB570','36676167E','Bosch Zapata', 'Abril@example.ecom','Abril', 8)
|
|
||||||
,('PAT#108','912EC803B2CE49E4A541068D495AB570','73569670F','Bosch Zapata', 'Esperanza@example.ecom','Esperanza', 9)
|
|
||||||
,('PAT#109','912EC803B2CE49E4A541068D495AB570','53986482P','Carretero Ayala', 'Eduardo@example.ecom','Eduardo', 10);
|
|
||||||
|
|
||||||
INSERT INTO myhealth.question(title, message, status, response, patientid, familydoctorid) VALUES
|
|
||||||
('titulo de la pregunta número 1', 'Doctor, tengo dolor en la articulación numero 1', 'PENDING', null, 1, 1)
|
|
||||||
,('titulo de la pregunta número 2', 'Doctor, tengo dolor en la articulación numero 2', 'PENDING', null, 2, 1)
|
|
||||||
,('titulo de la pregunta número 3', 'Doctor, tengo dolor en la articulación numero 3', 'PENDING', null, 3, 1)
|
|
||||||
,('titulo de la pregunta número 4', 'Doctor, tengo dolor en la articulación numero 4', 'PENDING', null, 4, 1)
|
|
||||||
,('titulo de la pregunta número 5', 'Doctor, tengo dolor en la articulación numero 5', 'PENDING', null, 5, 1)
|
|
||||||
,('titulo de la pregunta número 6', 'Doctor, tengo dolor en la articulación numero 6', 'PENDING', null, 6, 1)
|
|
||||||
,('titulo de la pregunta número 7', 'Doctor, tengo dolor en la articulación numero 7', 'PENDING', null, 7, 1)
|
|
||||||
,('titulo de la pregunta número 8', 'Doctor, tengo dolor en la articulación numero 8', 'PENDING', null, 8, 1)
|
|
||||||
,('titulo de la pregunta número 9', 'Doctor, tengo dolor en la articulación numero 9', 'PENDING', null, 9, 1)
|
|
||||||
,('titulo de la pregunta número 10', 'Doctor, tengo dolor en la articulación numero 10', 'PENDING', null, 10, 1)
|
|
||||||
,('titulo de la pregunta número 11', 'Doctor, tengo dolor en la articulación numero 11', 'PENDING', null, 1, 1)
|
|
||||||
,('titulo de la pregunta número 12', 'Doctor, tengo dolor en la articulación numero 12', 'PENDING', null, 2, 1)
|
|
||||||
,('titulo de la pregunta número 13', 'Doctor, tengo dolor en la articulación numero 13', 'PENDING', null, 3, 1)
|
|
||||||
,('titulo de la pregunta número 14', 'Doctor, tengo dolor en la articulación numero 14', 'PENDING', null, 4, 1)
|
|
||||||
,('titulo de la pregunta número 15', 'Doctor, tengo dolor en la articulación numero 15', 'PENDING', null, 5, 1)
|
|
||||||
,('titulo de la pregunta número 16', 'Doctor, tengo dolor en la articulación numero 16', 'PENDING', null, 6, 1)
|
|
||||||
,('titulo de la pregunta número 17', 'Doctor, tengo dolor en la articulación numero 17', 'PENDING', null, 7, 1)
|
|
||||||
,('titulo de la pregunta número 18', 'Doctor, tengo dolor en la articulación numero 18', 'PENDING', null, 8, 1)
|
|
||||||
,('titulo de la pregunta número 19', 'Doctor, tengo dolor en la articulación numero 19', 'PENDING', null, 9, 1)
|
|
||||||
,('titulo de la pregunta número 20', 'Doctor, tengo dolor en la articulación numero 20', 'PENDING', null, 10, 1)
|
|
||||||
,('titulo de la pregunta número 21', 'Doctor, tengo dolor en la articulación numero 21', 'PENDING', null, 8, 1)
|
|
||||||
,('titulo de la pregunta número 22', 'Doctor, tengo dolor en la articulación numero 22', 'PENDING', null, 9, 1)
|
|
||||||
,('titulo de la pregunta número 23', 'Doctor, tengo dolor en la articulación numero 23', 'PENDING', null, 10, 1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BIN
2.database/model.mwb
Normal file
BIN
2.database/model.mwb
Normal file
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 119 KiB |
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>3.docs</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
# Dudas para la reunión
|
|
||||||
|
|
||||||
1. en las anotaciones de los JPA aparece el nombre del schema y la tabla con mayusculas y en el script de creación de database en minúsculas. ¿Qué formato de los dos?
|
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
## Página de inicio del proyecto My Health del Grupo 2
|
**Página de inicio del proyecto My Health del Grupo 2**
|
||||||
|
|
||||||
|
|
||||||
### Organización de directorios:
|
Organización de directorios:
|
||||||
* sources: Código fuente y proyecto eclipse
|
* sources: Código fuente y proyecto eclipse
|
||||||
* database: Scripts SQL para crear la estructura de base de datos y los datos de prueba
|
* database: Scripts SQL para crear la estructura de base de datos y los datos de prueba
|
||||||
* doc: Directorio para ubicar la documentación compartida.
|
* doc: Directorio para ubicar la documentación compartida.
|
||||||
|
|
||||||
### Instrucciones de despliegue e instalación
|
|
||||||
Las instrucciones detalladas de despliegue y configuración están descritas en el documento [install.md](install.md)
|
|
||||||
26
install.md
26
install.md
@@ -1,26 +0,0 @@
|
|||||||
## 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:
|
|
||||||
* 01.CreateTables.sql
|
|
||||||
|
|
||||||
### 2. Inserción de datos iniciales:
|
|
||||||
Se debe ejecutar el script, incluido con la solución, que crea la tabla e inserta los datos de prueba:
|
|
||||||
* 02.Datos_prueba.sql
|
|
||||||
|
|
||||||
### 3. Creación del DataSource:
|
|
||||||
Para este proyecto se utilizará el mismo datasource que para el caso práctico, si no está creado debe añadirse al fichero JBOSS_HOME\standalone\configuration\standalone.xlm.
|
|
||||||
El usuario y contraseña de base de datos que se han utilizado en el datasource es USER con contraseña PASSWORD.
|
|
||||||
|
|
||||||
<datasource jta="false" jndi-name="java:jboss/postgresDS" pool-name="postgresDS"
|
|
||||||
enabled="true" use-java-context="true" use-ccm="false" statistics-enabled="true">
|
|
||||||
<connection-url>jdbc:postgresql://localhost:5432/postgres</connection-url>
|
|
||||||
<driver-class>org.postgresql.Driver</driver-class>
|
|
||||||
<driver>postgresql</driver>
|
|
||||||
<security>
|
|
||||||
<user-name>USER</user-name>
|
|
||||||
<password>PASSWORD</password>
|
|
||||||
</security>
|
|
||||||
</datasource>
|
|
||||||
|
|
||||||
### 4. 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.
|
|
||||||
Reference in New Issue
Block a user