Merge branch 'master' of
http://pdp-pds.eimt.uoc.edu/pds19-grupo2/myhealth.git Conflicts: 1.sources/MyHealth/src/jpa/VisitJPA.java
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/WildFly 14.0 Runtime"/>
|
||||
<classpathentry kind="lib" path="docroot/WEB-INF/lib/primefaces-7.0.jar"/>
|
||||
<classpathentry kind="lib" path="docroot/WEB-INF/lib/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" sourcepath="C:/Users/mark/.m2/repository/org/omnifaces/omnifaces/3.4.1/omnifaces-3.4.1-sources.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
<property name="buildjar" value="${build}/jar" />
|
||||
<property name="buildwar" value="${build}/war" />
|
||||
<property name="dist" value="${source}/dist" />
|
||||
<property name="docroot" value="${source}/docroot" />
|
||||
<property name="jboss-config" value="default" />
|
||||
<property name="deploy" value="${jboss.home}\standalone\deployments" />
|
||||
<property name="deploy" value="${jboss.home}/standalone/deployments" />
|
||||
<property name="jboss.module.dir" value="${jboss.home}/modules" />
|
||||
|
||||
<path id="jboss.classpath">
|
||||
@@ -20,6 +21,11 @@
|
||||
<include name="**/*.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
<path id="lib.dir">
|
||||
<fileset dir="${docroot}/WEB-INF/lib">
|
||||
<include name="**/*.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
<target name="all" depends="clean, init, ear" />
|
||||
|
||||
@@ -33,6 +39,7 @@
|
||||
<mkdir dir="${buildwar}" />
|
||||
<mkdir dir="${buildjar}/META-INF" />
|
||||
<mkdir dir="${buildwar}/WEB-INF" />
|
||||
<mkdir dir="${buildwar}/WEB-INF/lib" />
|
||||
<mkdir dir="${buildwar}/WEB-INF/classes" />
|
||||
<mkdir dir="${dist}" />
|
||||
</target>
|
||||
@@ -52,13 +59,23 @@
|
||||
<!-- Compile the client application, creating the structure buildwar -->
|
||||
<target name="compileWar" depends="init">
|
||||
<copy todir="${buildwar}">
|
||||
<fileset dir="${source}/docroot" />
|
||||
<fileset dir="${docroot}" />
|
||||
</copy>
|
||||
<javac srcdir="${sourcesrc}" destdir="${buildwar}/WEB-INF/classes" includes="managedbean/*.java" classpathref="jboss.classpath" includeantruntime="true" />
|
||||
<javac srcdir="${sourcesrc}" destdir="${buildwar}/WEB-INF/classes" includes="managedbean/**/*.java" includeantruntime="true">
|
||||
<classpath>
|
||||
<path refid="jboss.classpath" />
|
||||
<path refid="lib.dir" />
|
||||
</classpath>
|
||||
</javac>
|
||||
<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/TO" />
|
||||
</target>
|
||||
<!-- <war destfile="${build.dir}/CrunchifyRESTJerseyExample.war" webxml="WebContent/WEB-INF/web.xml"> -->
|
||||
<!-- <classes dir="${build.dir}" /> -->
|
||||
<!-- <lib dir="${lib.dir}"> -->
|
||||
<!-- </lib> -->
|
||||
<!-- </war> -->
|
||||
|
||||
<!-- Update the WAR file and create if not exist -->
|
||||
<target name="deployWar" depends="compileWar">
|
||||
@@ -83,10 +100,11 @@
|
||||
<fileset dir="${dist}" includes="**/*" />
|
||||
<fileset dir="${build}" includes="**/*" />
|
||||
<fileset dir="${buildjar}" includes="**/*" />
|
||||
<fileset dir="${buildwar}" includes="**/*" />
|
||||
<fileset dir="${buildjar}/META-INF" includes="**/*" />
|
||||
<fileset dir="${buildwar}/WEB-INF" includes="**/*" />
|
||||
<fileset dir="${buildwar}/WEB-INF/lib" includes="**/*" />
|
||||
<fileset dir="${buildwar}/WEB-INF/classes" includes="**/*" />
|
||||
<fileset dir="${buildwar}/WEB-INF" includes="**/*" />
|
||||
<fileset dir="${buildwar}" includes="**/*" />
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -2,70 +2,4 @@
|
||||
<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">
|
||||
|
||||
<navigation-rule>
|
||||
<navigation-case>
|
||||
<from-outcome>home</from-outcome>
|
||||
<to-view-id>/home.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>RegisterUser</from-outcome>
|
||||
<to-view-id>/profile/RegisterUser.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>AddPatient</from-outcome>
|
||||
<to-view-id>/profile/AddPatient.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>AddFamilyDoctor</from-outcome>
|
||||
<to-view-id>/profile/AddFamilyDoctor.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>AddSpecialistDoctor</from-outcome>
|
||||
<to-view-id>/profile/AddSpecialistDoctor.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>ChangeFamilyDoctor</from-outcome>
|
||||
<to-view-id>/profile/ChangeFamilyDoctor.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>ShowPatient</from-outcome>
|
||||
<to-view-id>/profile/ShowPatient.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>ShowFamilyDoctor</from-outcome>
|
||||
<to-view-id>/profile/ShowFamilyDoctor.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>ShowSpecialistDoctor</from-outcome>
|
||||
<to-view-id>/profile/ShowSpecialistDoctor.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>UpdateSpecialistDoctor</from-outcome>
|
||||
<to-view-id>/profile/UpdateSpecialistDoctor.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>UpdateFamilyDoctor</from-outcome>
|
||||
<to-view-id>/profile/UpdateFamilyDoctor.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>UpdatePatient</from-outcome>
|
||||
<to-view-id>/profile/UpdatePatient.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>changecap</from-outcome>
|
||||
<to-view-id>/profile/ChangePrimaryHealthCareCenter.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>MedicalTests</from-outcome>
|
||||
<to-view-id>/medicaltest/MedicalTests.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>VisitView</from-outcome>
|
||||
<to-view-id>/visit/VisitView.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
<navigation-case>
|
||||
<from-outcome>ManageSpecialties</from-outcome>
|
||||
<to-view-id>/systemAdmin/ManageSpecialties.xhtml</to-view-id>
|
||||
</navigation-case>
|
||||
</navigation-rule>
|
||||
</faces-config>
|
||||
|
||||
BIN
1.sources/MyHealth/docroot/WEB-INF/lib/omnifaces-3.4.1.jar
Normal file
BIN
1.sources/MyHealth/docroot/WEB-INF/lib/omnifaces-3.4.1.jar
Normal file
Binary file not shown.
@@ -23,6 +23,12 @@
|
||||
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
|
||||
<param-value>.xhtml</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>primefaces.FONT_AWESOME</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<context-param>
|
||||
<param-name>primefaces.THEME</param-name>
|
||||
<param-value>#{sessionPreferences.currentTheme}</param-value>
|
||||
@@ -53,14 +59,10 @@
|
||||
<url-pattern>*.xhtml</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- <error-page> -->
|
||||
<!-- <error-code>404</error-code> -->
|
||||
<!-- <location>/error.xhtml</location> -->
|
||||
<!-- </error-page> -->
|
||||
<!-- <error-page> -->
|
||||
<!-- <error-code>500</error-code> -->
|
||||
<!-- <location>/error.xhtml</location> -->
|
||||
<!-- </error-page> -->
|
||||
<error-page>
|
||||
<error-code>500</error-code>
|
||||
<location>/error.xhtml</location>
|
||||
</error-page>
|
||||
|
||||
<session-config>
|
||||
<session-timeout>30</session-timeout>
|
||||
|
||||
@@ -1,25 +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">
|
||||
<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">
|
||||
|
||||
<ui:composition template="./header.xhtml">
|
||||
<ui:composition template="./header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="errorForm">
|
||||
<div align="center">
|
||||
<h1>Se ha producido un error</h1>
|
||||
<hr/>
|
||||
<div>Descripcion del error:</div>
|
||||
<div>
|
||||
<h:messages fatalClass="ErrorMessage" showDetail="true" showSummary="true" globalOnly="true">
|
||||
</h:messages>
|
||||
<h:form id="errorForm">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-2 ui-md-2" />
|
||||
<div class="ui-g-8 ui-md-8">
|
||||
<p:panel id="ErrorPanel" header="Se ha producido un error inesperado">
|
||||
<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">
|
||||
<h:messages fatalClass="ErrorMessage" showDetail="true" showSummary="true" globalOnly="true" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-5" />
|
||||
<div class="ui-g-2">
|
||||
<p:button value="Ir a la página principal" outcome="home" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-5" />
|
||||
</div>
|
||||
</p:panel>
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2" />
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home?refresh=1" />
|
||||
</p>
|
||||
</h:form>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -14,12 +14,16 @@
|
||||
function handleLoginRequest(xhr, status, args) {
|
||||
if(args.validationFailed || !args.loggedIn) {
|
||||
PF('dlgLogin').jq.effect("shake", {times:5}, 100);
|
||||
//PF('Login').attr("disabled", false);
|
||||
}
|
||||
else {
|
||||
PF('dlgLogin').hide();
|
||||
$('#loginLink').fadeOut();
|
||||
}
|
||||
}
|
||||
|
||||
function startLogin() {
|
||||
//PF('Login').attr("disabled", true);
|
||||
}
|
||||
</h:outputScript>
|
||||
<h:body>
|
||||
<div id="layout">
|
||||
@@ -29,69 +33,51 @@
|
||||
</div>
|
||||
<hr />
|
||||
<div id="menuDiv">
|
||||
<h:form>
|
||||
<p:growl id="messages" sticky="true" showDetail="true" life="3000" />
|
||||
<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">
|
||||
<i id="loginSpin" class="pi pi-spin pi-spinner" style="font-size: 3em"></i>
|
||||
</f:facet>
|
||||
|
||||
<p:menubar>
|
||||
<p:menuitem label="Home" icon="pi pi-home" outcome="home" />
|
||||
<p:submenu label="Administración del sistema" icon="pi pi-briefcase">
|
||||
<p:menuitem value="Gestionar especialidades" icon="pi pi-briefcase" action="#{menuView.goManageSpecialties}" />
|
||||
<p:menuitem value="Gestionar CAPs" action="#{menuView.goManageSpecialties}" />
|
||||
<p:separator />
|
||||
<p:menuitem value="Consultar medicos de familia por CAP" icon="pi pi-search" action="#{menuView.goManageSpecialties}" />
|
||||
<p:separator />
|
||||
<p:menuitem value="Nuevo administrador" icon="pi pi-user" action="#{menuView.goManageSpecialties}" />
|
||||
</p:submenu>
|
||||
<p:submenu label="Visitas" icon="pi pi-calendar">
|
||||
<p:menuitem value="Programar visita" icon="pi pi-briefcase" action="#{menuView.goVisit}" />
|
||||
<p:menuitem value="Ver visitas programadas" icon="pi pi-briefcase" action="#{menuView.goVisit}" />
|
||||
</p:submenu>
|
||||
<p:submenu label="Pruebas médicas" icon="pi pi-clone">
|
||||
<p:menuitem value="Gestionar pruebas médicas" icon="pi pi-briefcase" action="#{menuView.goMedicalTests}" />
|
||||
<p:menuitem value="Consultar médicos especialistas por especialidad" action="#{menuView.goMedicalTests}" />
|
||||
<p:separator />
|
||||
<p:menuitem value="Listar medicos especialistas por especialidad" icon="pi pi-search" action="#{menuView.goMedicalTests}" />
|
||||
</p:submenu>
|
||||
<p:submenu label="Preguntas" icon="pi pi-clone">
|
||||
<p:menuitem value="Añadir pregunta" action="#{menuView.goMedicalTests}" />
|
||||
<p:menuitem value="Responder prguntas pendientes" icon="pi pi-search" action="#{menuView.goMedicalTests}" />
|
||||
</p:submenu>
|
||||
<p:submenu label="Perfil" icon="pi pi-id-card">
|
||||
<p:menuitem value="Nuevo paciente" icon="pi pi-briefcase" outcome="AddPatient" />
|
||||
<p:menuitem value="Nuevo médico de familia" outcome="AddFamilyDoctor" />
|
||||
<p:menuitem value="Nuevo médico especialista" outcome="AddSpecialistDoctor" />
|
||||
<p:separator />
|
||||
<p:menuitem value="Actualizar mi perfil" icon="pi pi-search" action="#{menuView.goUpdateProfile}" />
|
||||
<p:separator />
|
||||
<p:menuitem value="Cambiar médico de familia" icon="pi pi-search" outcome="ChangeFamilyDoctor" />
|
||||
<p:separator />
|
||||
<p:menuitem value="Cambiar de CAP" icon="pi pi-search" outcome="changecap" />
|
||||
</p:submenu>
|
||||
<f:facet name="complete">
|
||||
<h:outputText value="" />
|
||||
</f:facet>
|
||||
</p:ajaxStatus>
|
||||
|
||||
<h:form id="frmLogin">
|
||||
|
||||
<p:dialog header="Acceder al sistema" width="350px" widgetVar="dlgLogin" resizable="false" modal="true" closeOnEscape="true">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-12">
|
||||
<h:outputLabel for="username" value="Usuario:" />
|
||||
<p:inputText id="username" value="#{loginView.username}" />
|
||||
</div>
|
||||
<div class="ui-g-12">
|
||||
|
||||
<h:outputLabel for="password" value="Contraseña:" />
|
||||
<p:password id="password" value="#{loginView.password}" />
|
||||
</div>
|
||||
<div class="ui-g-6">
|
||||
<p:commandButton value="Login" update="frmMenu, messages" icon="pi pi-sign-in" action="#{loginView.login}" onstart="startLogin()"
|
||||
oncomplete="handleLoginRequest(xhr, status, args)" />
|
||||
</div>
|
||||
<div class="ui-g-6">
|
||||
<p:commandButton value="Cancel" icon="pi pi-ban" onclick="PF('dlgLogin').hide();" />
|
||||
</div>
|
||||
</div>
|
||||
</p:dialog>
|
||||
</h:form>
|
||||
<h:form id="frmMenu">
|
||||
<p:menubar model="#{menuView.model}">
|
||||
<f:facet name="options">
|
||||
<ui:fragment rendered="#{home.logedIn}">
|
||||
<h:outputText value="hola, #{home.userName} " />
|
||||
<p:commandButton value="Logout" update="messages" icon="pi pi-user" action="#{loginView.logout}" />
|
||||
<p:commandButton value="Logout" icon="pi pi-sign-out" action="#{loginView.logout}" />
|
||||
</ui:fragment>
|
||||
<ui:fragment rendered="#{not home.logedIn}">
|
||||
<h:outputText value="hola, invitado " />
|
||||
<p:commandButton value="login" icon="pi pi-user" onclick="PF('dlgLogin').show();" title="login" />
|
||||
<p:button value="Registrarse" icon="pi pi-user" outcome="RegisterUser" />
|
||||
|
||||
<p:dialog header="Acceder al sistema" widgetVar="dlgLogin" resizable="false">
|
||||
<h:panelGrid columns="2" cellpadding="5">
|
||||
<h:outputLabel for="username" value="Username:" />
|
||||
<p:inputText id="username" value="#{loginView.username}" required="true" label="username" />
|
||||
|
||||
<h:outputLabel for="password" value="Password:" />
|
||||
<p:password id="password" value="#{loginView.password}" required="true" label="password" />
|
||||
|
||||
<f:facet name="footer">
|
||||
<p:commandButton value="Login" update="messages" icon="pi pi-user" action="#{loginView.login}" oncomplete="handleLoginRequest(xhr, status, args)" />
|
||||
<i class="pi pi-spin pi-spinner" style="font-size: 3em"></i>
|
||||
</f:facet>
|
||||
</h:panelGrid>
|
||||
</p:dialog>
|
||||
<p:commandButton value="login" icon="pi pi-sign-in" onclick="PF('dlgLogin').show();" title="login" />
|
||||
<p:button value="Registrarse" icon="pi pi-user-plus" outcome="/profile/RegisterUser" />
|
||||
</ui:fragment>
|
||||
</f:facet>
|
||||
</p:menubar>
|
||||
|
||||
@@ -23,23 +23,33 @@
|
||||
<ui:composition template="./header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form>
|
||||
<h:outputLink value="javascript:void(0)" onclick="PF('dlg').show();" title="login">
|
||||
<h:outputText>Login</h:outputText>
|
||||
</h:outputLink>
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:panel id="LoginPanel" header="Acceder al sistema">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-12">
|
||||
<h:outputLabel for="username" value="Usuario:" />
|
||||
<p:inputText id="username" value="#{loginView.username}" />
|
||||
</div>
|
||||
|
||||
<p:growl id="growl" sticky="true" showDetail="true" life="3000" />
|
||||
<div class="ui-g-12">
|
||||
<h:outputLabel for="password" value="Contraseña:" />
|
||||
<p:password id="password" value="#{loginView.password}" />
|
||||
</div>
|
||||
|
||||
<h:panelGrid columns="2" cellpadding="5">
|
||||
<h:outputLabel for="username" value="Username:" />
|
||||
<p:inputText id="username" value="#{loginView.username}" required="true" label="username" />
|
||||
|
||||
<h:outputLabel for="password" value="Password:" />
|
||||
<p:password id="password" value="#{loginView.password}" required="true" label="password" />
|
||||
|
||||
<f:facet name="footer">
|
||||
<p:commandButton value="Login" update="growl" action="#{loginView.login}" oncomplete="handleLoginRequest(xhr, status, args)" />
|
||||
</f:facet>
|
||||
</h:panelGrid>
|
||||
<div class="ui-g-6">
|
||||
<p:commandButton value="Login" update="frmMenu, messages" icon="pi pi-sign-in" action="#{loginView.login}" onstart="startLogin()"
|
||||
oncomplete="handleLoginRequest(xhr, status, args)" />
|
||||
</div>
|
||||
<div class="ui-g-6">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
</div>
|
||||
</div>
|
||||
</p:panel>
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4" />
|
||||
</div>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
|
||||
@@ -1,24 +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">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="errorForm">
|
||||
<div align="center">
|
||||
<h1>AddFamilyDoctor Page</h1>
|
||||
<hr/>
|
||||
<div>AddFamilyDoctor:</div>
|
||||
<div>
|
||||
AddFamilyDoctor 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>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home" />
|
||||
</p>
|
||||
</h:form>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -4,56 +4,33 @@
|
||||
<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">
|
||||
|
||||
<h:outputScript>
|
||||
function handleActionMessage(xhr, status, args) {
|
||||
if(args.validationFailed || !args.loggedIn) {
|
||||
PF('dlgLogin').jq.effect("shake", {times:5}, 100);
|
||||
}
|
||||
else {
|
||||
PF('dlgLogin').hide();
|
||||
$('#loginLink').fadeOut();
|
||||
}
|
||||
}
|
||||
</h:outputScript>
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form>
|
||||
<p:messages id="mesgs" showDetail="true" closable="true">
|
||||
<p:autoUpdate />
|
||||
</p:messages>
|
||||
<h:form id="frmRegisterUser">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
|
||||
<p:panel id="AltaPaciente" header="Registrarse en el sistema como paciente">
|
||||
<h:panelGrid columns="3">
|
||||
<p:outputLabel value="NIF:" for="nif" />
|
||||
<p:inputText id="nif" required="true" requiredMessage="Por favor, indque su NIF" />
|
||||
<p:message for="nif" />
|
||||
|
||||
<p:outputLabel value="Nombre:" for="name" />
|
||||
<p:inputText id="name" required="true" requiredMessage="Por favor, indique su nombre" />
|
||||
<p:message for="name" />
|
||||
|
||||
<p:outputLabel value="Apellidos:" for="surname" />
|
||||
<p:inputText id="surname" required="true" requiredMessage="Por favor, indique sus apellidos" />
|
||||
<p:message for="surname" />
|
||||
|
||||
<p:outputLabel value="Correo electrónico:" for="email"/>
|
||||
<p:inputText id="email" required="true" requiredMessage="Por favor, especifique su correo electrónico" />
|
||||
<p:message for="email" />
|
||||
|
||||
<p:outputLabel value="Contraseña" for="password" />
|
||||
<p:inputMask id="password" mask="*" required="true" requiredMessage="Por faovr, especifique una contraseña" maxlength="50" />
|
||||
<p:message for="password" />
|
||||
|
||||
<p:outputLabel value="Repita su contraseña:" for="passwordRepeat" />
|
||||
<p:inputMask id="passwordRepeat" mask="*" />
|
||||
<p:message for="passwordRepeat" />
|
||||
</h:panelGrid>
|
||||
<h:panelGroup>
|
||||
<h:panelGrid columns="3" >
|
||||
<p:commandButton validateClient="true" value="Registrarse" update="mesgs" action="#{addPatientMBean.save}" icon="pi pi-check" />
|
||||
<p:commandButton value="Volver" outcome="home" />
|
||||
</h:panelGrid>
|
||||
</h:panelGroup>
|
||||
<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>
|
||||
|
||||
@@ -1,24 +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">
|
||||
<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="errorForm">
|
||||
<div align="center">
|
||||
<h1>AddSpecialistDoctor Page</h1>
|
||||
<hr/>
|
||||
<div>AddSpecialistDoctor:</div>
|
||||
<div>
|
||||
AddSpecialistDoctor 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>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home" />
|
||||
</p>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define> </ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -2,23 +2,38 @@
|
||||
<!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:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="errorForm">
|
||||
<div align="center">
|
||||
<h1>ChangeFamilyDoctor Page</h1>
|
||||
<hr/>
|
||||
<div>ChangeFamilyDoctor:</div>
|
||||
<div>
|
||||
ChangeFamilyDoctor content
|
||||
<h:form id="frmRegisterUser">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
|
||||
<p:panel id="DatosPersonales" header="Cambiar 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>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home" />
|
||||
</p>
|
||||
</h:form>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -1,24 +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">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="errorForm">
|
||||
<div align="center">
|
||||
<h1>ChangePrimaryHealthCareCenter Page</h1>
|
||||
<hr/>
|
||||
<div>ChangePrimaryHealthCareCenter:</div>
|
||||
<div>
|
||||
ChangePrimaryHealthCareCenter content
|
||||
<h:form id="frmRegisterUser">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
|
||||
<p:panel id="DatosPersonales" header="Cambiar el Centro de Atención Primaria">
|
||||
<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>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home" />
|
||||
</p>
|
||||
</h:form>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -6,88 +6,184 @@
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:outputScript>
|
||||
<h:form id="frmRegisterUserResult" rendered="#{RegisterUser.registered}">
|
||||
<div class="ui-g-3 ui-md-3" />
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
|
||||
<p:panel id="DatosPersonales" header="El registro se ha realizado correctamente">
|
||||
<div class="ui-g ui-fluid">
|
||||
|
||||
<div class="ui-g-12">
|
||||
Enhorabuena
|
||||
<p:outputLabel value="#{RegisterUser.name}" />
|
||||
, se ha registrado correctamente, el sistema le ha asignado un <b> <p:outputLabel value="Código de Identificación Personal (CIP)" rendered="#{RegisterUser.patient}" />
|
||||
<p:outputLabel value="Número de Profesional" rendered="#{RegisterUser.familyDoctor or RegisterUser.specialistDoctor}" />
|
||||
</b> , por favor recuerdelo ya que deberá utilizarlo para logearse en el sistema.
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12">
|
||||
<p:outputLabel value="Su Código de Identificación Personal (CIP) es el siguiente:" rendered="#{RegisterUser.patient}" />
|
||||
<p:outputLabel value="Número de Profesional es el siguiente:" rendered="#{RegisterUser.familyDoctor or RegisterUser.specialistDoctor}" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12" style="font-size: larger; font-weight: bold; text-align: center;">
|
||||
<p:outputLabel value="#{RegisterUser.id}" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-3"></div>
|
||||
<div class="ui-g-6">
|
||||
<p:button value="Ir a la página principal" outcome="/home" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-3"></div>
|
||||
</div>
|
||||
|
||||
</p:panel>
|
||||
</div>
|
||||
<div class="ui-g-3 ui-md-3" />
|
||||
</h:form>
|
||||
|
||||
<h:form id="frmRegisterUser" rendered="#{not RegisterUser.registered}">
|
||||
<h:outputScript>
|
||||
function handleRequest(xhr, status, args) {
|
||||
if(args.specs) {
|
||||
PF('panCentros').hide();
|
||||
$('#panCentros').fadeOut();
|
||||
PF('panEspecialidad').show()
|
||||
$('#panEspecialidad').fadeIn();
|
||||
$('#panCentros').slideUp();
|
||||
$('#panEspecialidades').slideDown();
|
||||
}
|
||||
else if (args.caps) {
|
||||
PF('panEspecialidad').hide();
|
||||
$('#panEspecialidad').fadeOut();
|
||||
PF('panCentros').show()
|
||||
$('#panCentros').fadeIn();
|
||||
$('#panEspecialidades').slideUp();
|
||||
$('#panCentros').slideDown();
|
||||
} else {
|
||||
$('#panCentros').slideUp();
|
||||
$('#panEspecialidades').slideUp();
|
||||
}
|
||||
}
|
||||
</h:outputScript>
|
||||
<h:form>
|
||||
</h:outputScript>
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
|
||||
<p:panel id="tipoUsuario" header="Especifique el tipo de usuario que desea registrarse">
|
||||
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
|
||||
<p:selectOneButton id="selUsertype" value="#{registerUser.userType}" required="true" requiredMessage="Debe especificar un tipo de usuario">
|
||||
<f:selectItems value="#{registerUser.userTypes}" />
|
||||
<p:ajax listener="#{registerUser.onUserTypeChange}" update="medicalSpecialty" oncomplete="handleRequest(xhr, status, args)" />
|
||||
</p:selectOneButton>
|
||||
</h:panelGrid>
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Tipo de usuario:" for="selUsertype" />
|
||||
</div>
|
||||
<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">
|
||||
<f:selectItems value="#{RegisterUser.userTypes}" var="item" itemLabel="#{item.userTypename}" itemValue="#{item.name}" />
|
||||
<p:ajax listener="#{RegisterUser.onUserTypeChange}" update="selMS,selPHC" oncomplete="handleRequest(xhr, status, args)" />
|
||||
</p:selectOneButton>
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4"></div>
|
||||
</div>
|
||||
</p:panel>
|
||||
<p:panel id="RegisterUser" header="Datos personales para el usuario">
|
||||
<div class="ui-fluid">
|
||||
<h:panelGrid columns="3" layout="grid" columnClasses="p-col-12 p-md-3 p-xl-2, p-col-12 p-md-9 p-xl-4, p-col-12 p-md-3 p-xl-2, p-col-12 p-md-9 p-xl-4"
|
||||
contentStyleClass="ui-fluid">
|
||||
<br />
|
||||
<p:panel id="DatosPersonales" header="Especifique el tipo de usuario que desea registrarse">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="NIF:" for="nif" />
|
||||
<p:inputText id="nif" value="#{registerUser.nif}" required="true" requiredMessage="Por favor, indque su NIF" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="nif" value="#{RegisterUser.nif}" required="true" requiredMessage="Por favor, indque su NIF" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="nif" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Nombre:" for="name" />
|
||||
<p:inputText id="name" value="#{registerUser.name}" required="true" requiredMessage="Por favor, indique su nombre" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="name" value="#{RegisterUser.name}" required="true" requiredMessage="Por favor, indique su nombre" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="name" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Apellidos:" for="surname" />
|
||||
<p:inputText id="surname" value="#{registerUser.surname}" required="true" requiredMessage="Por favor, indique sus apellidos" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="surname" value="#{RegisterUser.surname}" required="true" requiredMessage="Por favor, indique sus apellidos" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="surname" />
|
||||
</div>
|
||||
|
||||
<p:outputLabel value="Especialidad médica:" for="medicalSpecialty" />
|
||||
<p:selectOneMenu id="medicalSpecialty" value="#{registerUser.medicalSpecialty}" style="width:350px">
|
||||
<f:selectItem itemLabel="Seleccione una especialidad médica..." itemValue="" noSelectionOption="true" />
|
||||
<f:selectItems value="#{registerUser.medicalSpecialties}" var="c.TO" itemDescription="#{c.description}" itemValue="#{c.name}" />
|
||||
</p:selectOneMenu>
|
||||
|
||||
|
||||
<p:message for="medicalSpecialty" />
|
||||
<p:outputLabel value="Centro:" for="primaryHealthCareCenter" />
|
||||
<p:selectOneMenu id="primaryHealthCareCenter" value="#{registerUser.medicalSpecialty}" style="width:350px">
|
||||
<f:selectItem itemLabel="Seleccione un centro de antención primario..." itemValue="" noSelectionOption="true" />
|
||||
<f:selectItems value="#{registerUser.medicalSpecialties}" var="c" itemDescription="#{c.description}" itemValue="#{c.name}" />
|
||||
</p:selectOneMenu>
|
||||
<p:message for="primaryHealthCareCenter" />
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Correo electrónico:" for="email" />
|
||||
<p:inputText id="email" value="#{registerUser.email}" required="true" requiredMessage="Por favor, especifique su correo electrónico" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="email" value="#{RegisterUser.email}" required="true" requiredMessage="Por favor, especifique su correo electrónico" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="email" />
|
||||
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Contraseña" for="password" />
|
||||
<p:password id="password" value="#{registerUser.password}" match="passwordRepeat" required="true" requiredMessage="Por favor, especifique una contraseña" maxlength="50"
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:password id="password" value="#{RegisterUser.password}" match="passwordRepeat" required="true" requiredMessage="Por favor, especifique una contraseña" maxlength="50"
|
||||
feedback="true" promptLabel="Especifique una contraseña segura" weakLabel="La contraseña es débil" goodLabel="La contraseña es buena" strongLabel="La contraseña es segura"
|
||||
validatorMessage="La contraseña y su verificación deben ser iguales" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="password" />
|
||||
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel value="Verificación de contraseña:" for="passwordRepeat" />
|
||||
<p:password id="passwordRepeat" value="#{registerUser.password}" required="true" requiredMessage="Por favor, escriba la verificación de su contraseña" maxlength="50" />
|
||||
</div>
|
||||
<div class="ui-g-4">
|
||||
<p:password id="passwordRepeat" value="#{RegisterUser.password}" required="true" requiredMessage="Por favor, escriba la verificación de su contraseña" maxlength="50" />
|
||||
</div>
|
||||
<div class="ui-g-6">
|
||||
<p:message for="passwordRepeat" />
|
||||
</div>
|
||||
|
||||
<div id="panCentros" class="ui-g-12 ui-g-nopad hide">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Centro:" for="selPHC" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:selectOneMenu id="selPHC" value="#{RegisterUser.primaryHealthCareCenter}" converter="omnifaces.SelectItemsConverter" required="#{RegisterUser.familyDoctor}"
|
||||
requiredMessage="Por favor, selecciona un centro de antención primaria">
|
||||
<f:selectItem itemLabel="Seleccione un centro de antención primario..." itemValue="" noSelectionOption="true" />
|
||||
<f:selectItems value="#{RegisterUser.phcList}" var="phc" itemLabel="#{phc.location}" itemValue="#{phc}" />
|
||||
<p:column>#{phc.name}</p:column>
|
||||
<p:column>#{phc.location}</p:column>
|
||||
</p:selectOneMenu>
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="selPHC" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="panEspecialidades" class="ui-g-12 ui-g-nopad hide">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Especialidad médica:" for="selMS" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:selectOneMenu id="selMS" value="#{RegisterUser.medicalSpecialty}" converter="omnifaces.SelectItemsConverter" required="#{RegisterUser.specialistDoctor}"
|
||||
requiredMessage="Por favor, seleccione una especialidad médica">
|
||||
<f:selectItem itemLabel="Seleccione una especialidad médica..." itemValue="" noSelectionOption="true" />
|
||||
<f:selectItems value="#{RegisterUser.medicalSpecialtiesList}" var="ms" itemLabel="#{ms.description}" itemValue="#{ms}" />
|
||||
<p:column>#{ms.name}</p:column>
|
||||
<p:column>#{ms.description}</p:column>
|
||||
</p:selectOneMenu>
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="selMS" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</h:panelGrid>
|
||||
<h:panelGrid columns="3" layout="grid" columnClasses="p-col-12 p-md-3 p-xl-2, p-col-12 p-md-9 p-xl-4, p-col-12 p-md-3 p-xl-2, p-col-12 p-md-9 p-xl-4">
|
||||
<p:commandButton type="button" validateClient="true" value="Registrarse" update="mesgs" action="#{registerUser.addNewUser}" icon="pi pi-check" />
|
||||
<p:commandButton type="button" value="Volver" outcome="home" />
|
||||
|
||||
</h:panelGrid>
|
||||
|
||||
<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" ajax="false" value="Registrarse" update="mesgs" action="#{RegisterUser.addNewUser}" icon="pi pi-check" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
|
||||
@@ -1,24 +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">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="errorForm">
|
||||
<div align="center">
|
||||
<h1>ShowFamilyDoctor Page</h1>
|
||||
<hr/>
|
||||
<div>ShowFamilyDoctor:</div>
|
||||
<div>
|
||||
ShowFamilyDoctor 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>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home" />
|
||||
</p>
|
||||
</h:form>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -1,20 +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">
|
||||
<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="errorForm">
|
||||
<div align="center">
|
||||
<h1>ShowPaciente Page</h1>
|
||||
<hr />
|
||||
<div>ShowPaciente:</div>
|
||||
<div>ShowPaciente content</div>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home" />
|
||||
</p>
|
||||
<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>
|
||||
|
||||
@@ -1,24 +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">
|
||||
<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="errorForm">
|
||||
<div align="center">
|
||||
<h1>ShowSpecialistDoctor Page</h1>
|
||||
<hr/>
|
||||
<div>ShowSpecialistDoctor:</div>
|
||||
<div>
|
||||
ShowSpecialistDoctor 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>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home?refresh=1" />
|
||||
</p>
|
||||
</h:form>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -1,24 +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">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
|
||||
<ui:composition template="../header.xhtml">
|
||||
<ui:define name="content">
|
||||
<h:form id="errorForm">
|
||||
<div align="center">
|
||||
<h1>UpdateFamilyDoctor Page</h1>
|
||||
<hr/>
|
||||
<div>UpdateFamilyDoctor:</div>
|
||||
<div>
|
||||
UpdateFamilyDoctor 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>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home?refresh=1" />
|
||||
</p>
|
||||
</h:form>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -1,24 +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">
|
||||
<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="errorForm">
|
||||
<div align="center">
|
||||
<h1>UpdatePaciente Page</h1>
|
||||
<hr/>
|
||||
<div>UpdatePaciente:</div>
|
||||
<div>
|
||||
UpdatePaciente 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>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home?refresh=1" />
|
||||
</p>
|
||||
</h:form>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
168
1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml
Normal file
168
1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml
Normal file
@@ -0,0 +1,168 @@
|
||||
<?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:outputScript>
|
||||
function handleRequest(xhr, status, args) {
|
||||
if(args.specs) {
|
||||
$('#panCentros').slideUp();
|
||||
$('#panEspecialidades').slideDown();
|
||||
}
|
||||
else if (args.caps) {
|
||||
$('#panEspecialidades').slideUp();
|
||||
$('#panCentros').slideDown();
|
||||
} else {
|
||||
$('#panCentros').slideUp();
|
||||
$('#panEspecialidades').slideUp();
|
||||
}
|
||||
}
|
||||
</h:outputScript>
|
||||
<h:form id="frmRegisterUser">
|
||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||
|
||||
<p:panel id="tipoUsuario" header="Tipo de usuario registrado">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Tipo de usuario:" for="selUsertype" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:selectOneButton id="selUsertype" value="#{RegisterUser.userType}" disabled="true" required="true" unselectable="false"
|
||||
requiredMessage="Debe especificar un tipo de usuario">
|
||||
<f:selectItems value="#{RegisterUser.userTypes}" var="item" itemLabel="#{item.userTypename}" itemValue="#{item.name}" />
|
||||
</p:selectOneButton>
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4"></div>
|
||||
</div>
|
||||
</p:panel>
|
||||
<br/>
|
||||
<p:panel id="DatosPersonales" header="Actualizar datos personales">
|
||||
<div class="ui-g ui-fluid">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<h:outputLabel value="value = 10" rendered="#{row == 10}" />
|
||||
<p:outputLabel value="Código de Identificación Personal (CIP):" rendered="#{RegisterUser.patient}" for="id" />
|
||||
<p:outputLabel value="Número de Profesional:" rendered="#{RegisterUser.familyDoctor or RegisterUser.specialistDoctor}" for="id" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="id" value="#{RegisterUser.id}" disabled="true" required="true" requiredMessage="Por favor, indque su identificador" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="id" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="NIF:" for="nif" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="nif" value="#{RegisterUser.nif}" required="true" requiredMessage="Por favor, indque su NIF" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="nif" display="text" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Nombre:" for="name" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="name" value="#{RegisterUser.name}" required="true" requiredMessage="Por favor, indique su nombre" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="name" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Apellidos:" for="surname" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="surname" value="#{RegisterUser.surname}" required="true" requiredMessage="Por favor, indique sus apellidos" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="surname" />
|
||||
</div>
|
||||
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Correo electrónico:" for="email" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:inputText id="email" value="#{RegisterUser.email}" required="true" requiredMessage="Por favor, especifique su correo electrónico" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="email" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Contraseña" for="password" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:password id="password" value="#{RegisterUser.password}" match="passwordRepeat" required="true" requiredMessage="Por favor, especifique una contraseña" maxlength="50"
|
||||
feedback="true" promptLabel="Especifique una contraseña segura" weakLabel="La contraseña es débil" goodLabel="La contraseña es buena" strongLabel="La contraseña es segura"
|
||||
validatorMessage="La contraseña y su verificación deben ser iguales" />
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="password" />
|
||||
</div>
|
||||
<div class="ui-g-2">
|
||||
<p:outputLabel value="Verificación de contraseña:" for="passwordRepeat" />
|
||||
</div>
|
||||
<div class="ui-g-4">
|
||||
<p:password id="passwordRepeat" value="#{RegisterUser.password}" required="true" requiredMessage="Por favor, escriba la verificación de su contraseña" maxlength="50" />
|
||||
</div>
|
||||
<div class="ui-g-6">
|
||||
<p:message for="passwordRepeat" />
|
||||
</div>
|
||||
|
||||
<div id="panCentros" class="ui-g-12 ui-g-nopad hide">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Centro:" for="selPHC" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:selectOneMenu id="selPHC" value="#{RegisterUser.primaryHealthCareCenter}" converter="omnifaces.SelectItemsConverter" required="#{RegisterUser.familyDoctor}"
|
||||
requiredMessage="Por favor, selecciona un centro de antención primaria">
|
||||
<f:selectItem itemLabel="Seleccione un centro de antención primario..." itemValue="" noSelectionOption="true" />
|
||||
<f:selectItems value="#{RegisterUser.phcList}" var="phc" itemLabel="#{phc.location}" itemValue="#{phc}" />
|
||||
<p:column>#{phc.name}</p:column>
|
||||
<p:column>#{phc.location}</p:column>
|
||||
</p:selectOneMenu>
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="selPHC" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="panEspecialidades" class="ui-g-12 ui-g-nopad hide">
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:outputLabel value="Especialidad médica:" for="selMS" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4">
|
||||
<p:selectOneMenu id="selMS" value="#{RegisterUser.medicalSpecialty}" converter="omnifaces.SelectItemsConverter" required="#{RegisterUser.specialistDoctor}"
|
||||
requiredMessage="Por favor, seleccione una especialidad médica">
|
||||
<f:selectItem itemLabel="Seleccione una especialidad médica..." itemValue="" noSelectionOption="true" />
|
||||
<f:selectItems value="#{RegisterUser.medicalSpecialtiesList}" var="ms" itemLabel="#{ms.description}" itemValue="#{ms}" />
|
||||
<p:column>#{ms.name}</p:column>
|
||||
<p:column>#{ms.description}</p:column>
|
||||
</p:selectOneMenu>
|
||||
</div>
|
||||
<div class="ui-g-6 ui-md-6">
|
||||
<p:message for="selMS" />
|
||||
</div>
|
||||
</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="Registrarse" update="mesgs" action="#{RegisterUser.addNewUser}" icon="pi pi-check" />
|
||||
</div>
|
||||
<div class="ui-g-2 ui-md-2">
|
||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||
</div>
|
||||
<div class="ui-g-4 ui-md-4"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
@@ -1,24 +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">
|
||||
<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="errorForm">
|
||||
<div align="center">
|
||||
<h1>UpdateSpecialistDoctor Page</h1>
|
||||
<hr/>
|
||||
<div>UpdateSpecialistDoctor:</div>
|
||||
<div>
|
||||
UpdateSpecialistDoctor 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>
|
||||
</div>
|
||||
<p align="center">
|
||||
<h:button value="Volver al inicio" outcome="home?refresh=1" />
|
||||
</p>
|
||||
</h:form>
|
||||
</p:panel>
|
||||
</h:form>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
BODY{
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
67
1.sources/MyHealth/src/TO/LoggedUserTO.java
Normal file
67
1.sources/MyHealth/src/TO/LoggedUserTO.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package TO;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import common.UserType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@XmlRootElement(name = "LoggedUser")
|
||||
public class LoggedUserTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
private String password;
|
||||
private String name;
|
||||
private UserType userType;
|
||||
|
||||
public LoggedUserTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
public LoggedUserTO(String usrId, String usrName, String usrPwd, UserType usrType) {
|
||||
id = usrId;
|
||||
name = usrName;
|
||||
password = usrPwd;
|
||||
userType = usrType;
|
||||
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public UserType getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(UserType userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,4 +41,10 @@ public class MedicalSpecialtyTO implements Serializable {
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s[name=%s]", getClass().getSimpleName(), getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,16 +15,16 @@ public class PrimaryHealthCareCenterTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private String location;
|
||||
|
||||
|
||||
public PrimaryHealthCareCenterTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
public PrimaryHealthCareCenterTO(String name, String description) {
|
||||
public PrimaryHealthCareCenterTO(String name, String location) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -35,12 +35,16 @@ public class PrimaryHealthCareCenterTO implements Serializable {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
public void setLocation(String description) {
|
||||
this.location = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s[name=%s]", getClass().getSimpleName(), getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
24
1.sources/MyHealth/src/common/HashUtils.java
Normal file
24
1.sources/MyHealth/src/common/HashUtils.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package common;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
public class HashUtils {
|
||||
|
||||
public static String hashMD5(String stringValue) {
|
||||
byte[] digest = null;
|
||||
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(stringValue.getBytes());
|
||||
digest = md.digest();
|
||||
} catch (Exception ex) {
|
||||
// TODO: Register exception to log.
|
||||
}
|
||||
|
||||
return (DatatypeConverter.printHexBinary(digest).toUpperCase());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package managedbean.common;
|
||||
package common;
|
||||
|
||||
public enum UserType {
|
||||
PATIENT("Paciente"),
|
||||
@@ -15,4 +15,8 @@ public enum UserType {
|
||||
public String getUserTypename() {
|
||||
return userTypename;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name();
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import TO.MedicalSpecialtyTO;
|
||||
import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import common.HashUtils;
|
||||
import jpa.FamilyDoctorJPA;
|
||||
import jpa.MedicalSpecialtyJPA;
|
||||
import jpa.PatientJPA;
|
||||
@@ -44,8 +45,11 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
||||
|
||||
public PatientTO registerPatient(Integer id, String nif, String name, String surname, String password, String email) {
|
||||
PatientTO paTO = null;
|
||||
|
||||
if (id == null)
|
||||
id = 1;
|
||||
|
||||
PatientJPA ms = new PatientJPA(id, nif, name, surname, password, email);
|
||||
PatientJPA ms = new PatientJPA(nif, name, surname, HashUtils.hashMD5(password), email);
|
||||
entman.persist(ms);
|
||||
paTO = new PatientTO(ms.getId(), ms.getNif(), ms.getName(), ms.getSurname(), ms.getPassword(), ms.getEmail());
|
||||
|
||||
@@ -59,25 +63,24 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
||||
|
||||
// TODO: Lanzar error si no se encuentra la especialidad.
|
||||
if (ms != null) {
|
||||
SpecialistDoctorJPA sd = new SpecialistDoctorJPA(id, nif, name, surname, password, email);
|
||||
SpecialistDoctorJPA sd = new SpecialistDoctorJPA(nif, name, surname, HashUtils.hashMD5(password), email, ms);
|
||||
entman.persist(sd);
|
||||
|
||||
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail());
|
||||
}
|
||||
|
||||
return sdTO;
|
||||
}
|
||||
|
||||
public FamilyDoctorTO registerFamilyDoctor1(Integer id, String nif, String name, String surname, String password, String email, String cap) {
|
||||
public FamilyDoctorTO registerFamilyDoctor1(Integer id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO cap) {
|
||||
FamilyDoctorTO fdTO = null;
|
||||
|
||||
PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, cap);
|
||||
PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, cap.getName());
|
||||
|
||||
// TODO: Lanzar error si no encontramos el cap!!!!!
|
||||
if (phcC != null) {
|
||||
|
||||
FamilyDoctorJPA fd = new FamilyDoctorJPA(id, nif, name, surname, password, email);
|
||||
fd.setPrimaryHealthCareCenter(phcC);
|
||||
|
||||
FamilyDoctorJPA fd = new FamilyDoctorJPA(nif, name, surname, HashUtils.hashMD5(password), email, phcC);
|
||||
entman.persist(fd);
|
||||
|
||||
fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail());
|
||||
@@ -94,7 +97,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
||||
fd.setNif(nif);
|
||||
fd.setName(name);
|
||||
fd.setSurname(surname);
|
||||
fd.setPassword(password);
|
||||
fd.setPassword(HashUtils.hashMD5(password));
|
||||
fd.setEmail(email);
|
||||
|
||||
entman.persist(fd);
|
||||
@@ -117,7 +120,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
||||
sd.setNif(nif);
|
||||
sd.setName(name);
|
||||
sd.setSurname(surname);
|
||||
sd.setPassword(password);
|
||||
sd.setPassword(HashUtils.hashMD5(password));
|
||||
sd.setEmail(email);
|
||||
sd.setMedicalSpecialty(ms);
|
||||
|
||||
@@ -137,7 +140,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
||||
fd.setNif(nif);
|
||||
fd.setName(name);
|
||||
fd.setSurname(surname);
|
||||
fd.setPassword(password);
|
||||
fd.setPassword(HashUtils.hashMD5(password));
|
||||
fd.setEmail(email);
|
||||
|
||||
// TODO: Es posible actualizar el cap? ¿No debería utilizar el método
|
||||
|
||||
@@ -20,15 +20,13 @@ public interface ProfileFacadeRemote {
|
||||
|
||||
public PatientTO registerPatient(Integer id, String nif, String name, String surname, String password, String email);
|
||||
|
||||
public SpecialistDoctorTO registerSpecialistDoctor(Integer id, String nif, String name, String surname, String password, String email,
|
||||
MedicalSpecialtyTO specialty);
|
||||
public SpecialistDoctorTO registerSpecialistDoctor(Integer id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty);
|
||||
|
||||
public FamilyDoctorTO registerFamilyDoctor1(Integer id, String nif, String name, String surname, String password, String email, String cap);
|
||||
public FamilyDoctorTO registerFamilyDoctor1(Integer id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO cap);
|
||||
|
||||
public PatientTO updatePacientData(Integer id, String nif, String name, String surname, String password, String email);
|
||||
|
||||
public SpecialistDoctorTO updateSpecialistDoctorData(Integer id, String nif, String name, String surname, String password, String email,
|
||||
MedicalSpecialtyTO specialty);
|
||||
public SpecialistDoctorTO updateSpecialistDoctorData(Integer id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty);
|
||||
|
||||
public FamilyDoctorTO updateFamilyDoctorData(Integer id, String nif, String name, String surname, String password, String email, String cap);
|
||||
|
||||
|
||||
@@ -8,15 +8,21 @@ import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import TO.LoggedUserTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import common.HashUtils;
|
||||
import common.UserType;
|
||||
import jpa.AdministratorJPA;
|
||||
import jpa.FamilyDoctorJPA;
|
||||
import jpa.MedicalSpecialtyJPA;
|
||||
import jpa.PatientJPA;
|
||||
import jpa.PrimaryHealthCareCenterJPA;
|
||||
import jpa.SpecialistDoctorJPA;
|
||||
|
||||
/**
|
||||
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los
|
||||
* métodos de la capa de negocio que implementan la logica de negocio y la
|
||||
* interacción con la capa de persistencia.
|
||||
*
|
||||
* @author mark
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Stateless
|
||||
@@ -59,4 +65,76 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
return allSpecialities;
|
||||
}
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listAllCAPs() {
|
||||
return this.listPagedAllCAPs(0, 0);
|
||||
}
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listPagedAllCAPs(int pageNumber, int pageSize) {
|
||||
Query query = entman.createQuery("from PrimaryHealthCareCenterJPA order by name");
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<PrimaryHealthCareCenterJPA> allJPA = query.getResultList();
|
||||
Collection<PrimaryHealthCareCenterTO> allCAPs = new ArrayList<PrimaryHealthCareCenterTO>();
|
||||
|
||||
for (PrimaryHealthCareCenterJPA cap : allJPA) {
|
||||
allCAPs.add(new PrimaryHealthCareCenterTO(cap.getName(), cap.getLocation()));
|
||||
}
|
||||
|
||||
return allCAPs;
|
||||
}
|
||||
|
||||
public LoggedUserTO login(String id, String pwd) {
|
||||
LoggedUserTO usr = null;
|
||||
|
||||
// First try to login as Admin
|
||||
AdministratorJPA adm = entman.find(AdministratorJPA.class, id);
|
||||
if (adm != null) {
|
||||
usr = new LoggedUserTO(adm.getEmail(), adm.getEmail(), adm.getPassword(), UserType.ADMINISTRADOR);
|
||||
} else {
|
||||
try {
|
||||
int iId = Integer.parseInt(id);
|
||||
|
||||
// Try to login Patient, FamilyDoctor or SpecialistDoctor
|
||||
// TODO: Si Patient, FamilyDoctor o Specialist Doctor tienen el mismo id, solo
|
||||
// el paciente se puede logear. ¿Deberíamos cambiar esto permitiendo seleccionar
|
||||
// el perfil a logearse?
|
||||
PatientJPA pat = entman.find(PatientJPA.class, iId);
|
||||
|
||||
if (pat != null) {
|
||||
usr = new LoggedUserTO(String.valueOf(pat.getId()), pat.getName(), pat.getPassword(), UserType.PATIENT);
|
||||
} else {
|
||||
FamilyDoctorJPA fdoc = entman.find(FamilyDoctorJPA.class, iId);
|
||||
|
||||
if (fdoc != null) {
|
||||
usr = new LoggedUserTO(String.valueOf(fdoc.getId()), fdoc.getName(), fdoc.getPassword(), UserType.FAMILY_DOCTOR);
|
||||
} else {
|
||||
SpecialistDoctorJPA sdoc = entman.find(SpecialistDoctorJPA.class, iId);
|
||||
|
||||
if (sdoc != null) {
|
||||
usr = new LoggedUserTO(String.valueOf(sdoc.getId()), sdoc.getName(), sdoc.getPassword(), UserType.SPECIALIST_DOCTOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException nf) {
|
||||
// id is not an intenger, so, login fails
|
||||
usr = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (usr != null) {
|
||||
// Comprobamos el password
|
||||
if (usr.getPassword().equals(HashUtils.hashMD5(pwd)) == false) {
|
||||
// Bad Password, devolvemos null!
|
||||
usr = null;
|
||||
}
|
||||
}
|
||||
|
||||
return usr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ import java.util.Collection;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
|
||||
import TO.LoggedUserTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
|
||||
/**
|
||||
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para
|
||||
* los clientes del EJB
|
||||
*
|
||||
* @author mark
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Remote
|
||||
@@ -19,4 +19,8 @@ public interface SystemAdminFacadeRemote {
|
||||
* Definimos la interfaz remota
|
||||
*/
|
||||
public Collection<MedicalSpecialtyTO> listAllMedicalSpecialities();
|
||||
|
||||
public Collection<PrimaryHealthCareCenterTO> listAllCAPs();
|
||||
|
||||
public LoggedUserTO login(String id, String pwd);
|
||||
}
|
||||
52
1.sources/MyHealth/src/jpa/AdministratorJPA.java
Normal file
52
1.sources/MyHealth/src/jpa/AdministratorJPA.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package jpa;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "MyHealth.Administrator")
|
||||
public class AdministratorJPA implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
private String email;
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* Class constructor methods
|
||||
*/
|
||||
public AdministratorJPA() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AdministratorJPA(String email, String password) {
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class FamilyDoctorJPA implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
private int id;
|
||||
private String nif;
|
||||
private String name;
|
||||
private String surname;
|
||||
@@ -42,22 +42,22 @@ public class FamilyDoctorJPA implements Serializable {
|
||||
super();
|
||||
}
|
||||
|
||||
public FamilyDoctorJPA(Integer id, String nif, String name, String surname, String password, String email) {
|
||||
this.id = id;
|
||||
public FamilyDoctorJPA(String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterJPA phc) {
|
||||
this.nif = nif;
|
||||
this.name = name;
|
||||
this.surname = surname;
|
||||
this.password = password;
|
||||
this.email = email;
|
||||
this.primaryHealthCareCenter = phc;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
public Integer getId() {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer value) {
|
||||
public void setId(int value) {
|
||||
this.id = value;
|
||||
}
|
||||
|
||||
@@ -123,6 +123,4 @@ public class FamilyDoctorJPA implements Serializable {
|
||||
public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterJPA center) {
|
||||
this.primaryHealthCareCenter = center;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class PatientJPA implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
private int id;
|
||||
private String nif;
|
||||
private String name;
|
||||
private String surname;
|
||||
@@ -40,8 +40,7 @@ public class PatientJPA implements Serializable {
|
||||
super();
|
||||
}
|
||||
|
||||
public PatientJPA(Integer id, String nif, String name, String surname, String password, String email) {
|
||||
this.id = id;
|
||||
public PatientJPA(String nif, String name, String surname, String password, String email) {
|
||||
this.nif = nif;
|
||||
this.name = name;
|
||||
this.surname = surname;
|
||||
@@ -49,11 +48,11 @@ public class PatientJPA implements Serializable {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer value) {
|
||||
public void setId(int value) {
|
||||
this.id = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public class PrimaryHealthCareCenterJPA implements Serializable {
|
||||
|
||||
@Id
|
||||
private String name;
|
||||
private String description;
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* Class constructor methods
|
||||
@@ -28,9 +28,9 @@ public class PrimaryHealthCareCenterJPA implements Serializable {
|
||||
super();
|
||||
}
|
||||
|
||||
public PrimaryHealthCareCenterJPA(String name, String description) {
|
||||
public PrimaryHealthCareCenterJPA(String name, String location) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -41,11 +41,11 @@ public class PrimaryHealthCareCenterJPA implements Serializable {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
public void setLocation(String description) {
|
||||
this.location = description;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SpecialistDoctorJPA implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
private int id;
|
||||
private String nif;
|
||||
private String name;
|
||||
private String surname;
|
||||
@@ -37,22 +37,22 @@ public class SpecialistDoctorJPA implements Serializable {
|
||||
super();
|
||||
}
|
||||
|
||||
public SpecialistDoctorJPA(Integer id, String nif, String name, String surname, String password, String email) {
|
||||
this.id = id;
|
||||
public SpecialistDoctorJPA(String nif, String name, String surname, String password, String email, MedicalSpecialtyJPA ms) {
|
||||
this.nif = nif;
|
||||
this.name = name;
|
||||
this.surname = surname;
|
||||
this.password = password;
|
||||
this.email = email;
|
||||
this.medicalSpecialty = ms;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
public Integer getId() {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer value) {
|
||||
public void setId(int value) {
|
||||
this.id = value;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SpecialistDoctorJPA implements Serializable {
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "MedicalSpecialtyName")
|
||||
@JoinColumn(name = "MedicalSpecialtyId")
|
||||
public MedicalSpecialtyJPA getMedicalSpecialty() {
|
||||
return medicalSpecialty;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
package jpa;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -103,3 +104,85 @@ public class VisitJPA implements Serializable {
|
||||
this.patient=pat;
|
||||
}
|
||||
}
|
||||
=======
|
||||
package jpa;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "MyHealth.Visit")
|
||||
public class VisitJPA implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
private Integer id;
|
||||
private Date date;
|
||||
private Time time;
|
||||
private String observations;
|
||||
private String result;
|
||||
|
||||
/**
|
||||
* Class constructor methods
|
||||
*/
|
||||
public VisitJPA() {
|
||||
super();
|
||||
}
|
||||
|
||||
public VisitJPA(Integer id, Date date, Time time, String observations, String result) {
|
||||
this.id = id;
|
||||
this.date=date;
|
||||
this.time = time;
|
||||
this.observations = observations;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer value) {
|
||||
this.id = value;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date value) {
|
||||
this.date = value;
|
||||
}
|
||||
|
||||
public Time getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Time value) {
|
||||
this.time = value;
|
||||
}
|
||||
|
||||
public String getObservations() {
|
||||
return observations;
|
||||
}
|
||||
|
||||
public void setObservations(String observation) {
|
||||
this.observations = observations;
|
||||
}
|
||||
|
||||
}
|
||||
>>>>>>> branch 'master' of http://pdp-pds.eimt.uoc.edu/pds19-grupo2/myhealth.git
|
||||
|
||||
@@ -26,20 +26,19 @@ public class AuthorizationFilter implements Filter {
|
||||
}
|
||||
|
||||
@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 {
|
||||
try {
|
||||
|
||||
HttpServletRequest reqt = (HttpServletRequest) request;
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
HttpServletResponse resp = (HttpServletResponse) response;
|
||||
HttpSession ses = reqt.getSession(false);
|
||||
HttpSession ses = req.getSession(false);
|
||||
|
||||
String reqURI = reqt.getRequestURI();
|
||||
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/RegisterUser.xhtml") >= 0 || (ses != null && ses.getAttribute("username") != null)
|
||||
|| reqURI.indexOf("/public/") >= 0 || reqURI.indexOf("/home.xhtml") >= 0 || reqURI.contains("javax.faces.resource"))
|
||||
String reqURI = req.getRequestURI();
|
||||
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/RegisterUser.xhtml") >= 0 || reqURI.indexOf("/home.xhtml") >= 0 || reqURI.indexOf("/public/") >= 0
|
||||
|| reqURI.contains("javax.faces.resource") || SessionUtils.isLogedIn(ses) == true)
|
||||
chain.doFilter(request, response);
|
||||
else
|
||||
resp.sendRedirect(reqt.getContextPath() + "/login.xhtml");
|
||||
resp.sendRedirect(req.getContextPath() + "/login.xhtml");
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
103
1.sources/MyHealth/src/managedbean/common/ManagedBeanBase.java
Normal file
103
1.sources/MyHealth/src/managedbean/common/ManagedBeanBase.java
Normal file
@@ -0,0 +1,103 @@
|
||||
package managedbean.common;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import ejb.medicalTest.MedicalTestFacadeRemote;
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import ejb.systemAdmin.SystemAdminFacadeRemote;
|
||||
import ejb.visit.VisitFacadeRemote;
|
||||
|
||||
/***
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
public class ManagedBeanBase {
|
||||
@EJB
|
||||
protected ProfileFacadeRemote remoteManagerProfile;
|
||||
@EJB
|
||||
protected SystemAdminFacadeRemote remoteManagerSystemAdmin;
|
||||
@EJB
|
||||
protected VisitFacadeRemote remoteManagerVisit;
|
||||
@EJB
|
||||
protected MedicalTestFacadeRemote remoteManagerMedicalTest;
|
||||
|
||||
/**
|
||||
* Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private <T> T getContext(String name, Class<T> type) {
|
||||
T retObj = null;
|
||||
|
||||
try {
|
||||
Properties props = System.getProperties();
|
||||
Context ctx = new InitialContext(props);
|
||||
retObj = type.cast(ctx.lookup(name));
|
||||
} catch (NamingException e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
return retObj;
|
||||
}
|
||||
|
||||
protected ProfileFacadeRemote getRemoteManagerProfile() {
|
||||
if (remoteManagerProfile == null) {
|
||||
remoteManagerProfile = this.getContext("java:app/MyHealth.jar/ProfileFacadeBean!ejb.profile.ProfileFacadeRemote", ProfileFacadeRemote.class);
|
||||
}
|
||||
|
||||
return remoteManagerProfile;
|
||||
}
|
||||
|
||||
protected SystemAdminFacadeRemote getRemoteManagerSystemAdmin() {
|
||||
if (remoteManagerSystemAdmin == null) {
|
||||
remoteManagerSystemAdmin = this.getContext("java:app/MyHealth.jar/SystemAdminFacadeBean!ejb.systemAdmin.SystemAdminFacadeRemote", SystemAdminFacadeRemote.class);
|
||||
}
|
||||
|
||||
return remoteManagerSystemAdmin;
|
||||
}
|
||||
|
||||
protected VisitFacadeRemote getRemoteManagerVisit() {
|
||||
if (remoteManagerVisit == null) {
|
||||
remoteManagerVisit = this.getContext("java:app/MyHealth.jar/VisitFacadeBean!ejb.systemAdmin.VisitFacadeRemote", VisitFacadeRemote.class);
|
||||
}
|
||||
|
||||
return remoteManagerVisit;
|
||||
}
|
||||
|
||||
protected MedicalTestFacadeRemote getRemoteManagerMedicalTest() {
|
||||
if (remoteManagerMedicalTest == null) {
|
||||
remoteManagerMedicalTest = this.getContext("java:app/MyHealth.jar/MedicalTestFacadeBean!ejb.systemAdmin.MedicalTestFacadeRemote", MedicalTestFacadeRemote.class);
|
||||
}
|
||||
|
||||
return remoteManagerMedicalTest;
|
||||
}
|
||||
|
||||
protected void addFacesMessageKeep(FacesMessage.Severity severity, String summary, String detail) {
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
|
||||
this.addFacesMessage(FacesContext.getCurrentInstance(), severity, summary, detail);
|
||||
|
||||
context.getExternalContext().getFlash().setKeepMessages(true);
|
||||
}
|
||||
|
||||
protected void addFacesMessage(FacesMessage.Severity severity, String summary, String detail) {
|
||||
this.addFacesMessage(FacesContext.getCurrentInstance(), severity, summary, detail);
|
||||
}
|
||||
|
||||
protected void addFacesMessage(FacesContext context, FacesMessage.Severity severity, String summary, String detail) {
|
||||
context.addMessage(null, new FacesMessage(severity, summary, detail));
|
||||
}
|
||||
|
||||
protected void manageException(Exception ex) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Se ha producido un error inesperado", "Descripción del error: " + ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package managedbean.common;
|
||||
|
||||
import java.awt.MenuItem;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -10,49 +11,115 @@ import javax.inject.Named;
|
||||
|
||||
import org.primefaces.model.menu.DefaultMenuItem;
|
||||
import org.primefaces.model.menu.DefaultMenuModel;
|
||||
import org.primefaces.model.menu.DefaultSeparator;
|
||||
import org.primefaces.model.menu.DefaultSubMenu;
|
||||
import org.primefaces.model.menu.MenuModel;
|
||||
import org.primefaces.model.menu.Submenu;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Named("menuView")
|
||||
@RequestScoped
|
||||
public class MenuMBean implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private MenuModel model;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
model = new DefaultMenuModel();
|
||||
DefaultMenuItem item;
|
||||
DefaultSubMenu subMenu;
|
||||
|
||||
// First submenu
|
||||
DefaultSubMenu firstSubmenu = new DefaultSubMenu("Dynamic submenu");
|
||||
DefaultMenuItem item = new DefaultMenuItem("External", "", "www.google.com");
|
||||
// item.setUrl("www.google.com");
|
||||
firstSubmenu.getElements().add(item);
|
||||
model.addElement(createMenuItem("Home", "pi pi-home", "/home", null));
|
||||
|
||||
model.getElements().add(firstSubmenu);
|
||||
if (SessionUtils.isLogedIn() == true) {
|
||||
|
||||
// Second submenu
|
||||
DefaultSubMenu secondSubmenu = new DefaultSubMenu("Dynamic Actions");
|
||||
// Administracion Sistema
|
||||
// TODO: mostrar este menú solo si el usuario es administrador
|
||||
if (1 == 1) {
|
||||
subMenu = new DefaultSubMenu("Administración del sistema", "pi pi-cog");
|
||||
subMenu.addElement(createMenuItem("Esp. médicas", "pi pi-calendar", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(createMenuItem("Centros At. Primaria", "pi pi-briefcase", "/systemAdmin/ManageSpecialties", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
subMenu.addElement(createMenuItem("Añadir usuario Admin", "pi pi-calendar", "/systemAdmin/ManageSpecialties", null));
|
||||
model.addElement(subMenu);
|
||||
}
|
||||
|
||||
item = new DefaultMenuItem("Save", "pi pi-save");
|
||||
item.setCommand("#{menuView.save}");
|
||||
item.setUpdate("messages");
|
||||
secondSubmenu.getElements().add(item);
|
||||
// Visitas
|
||||
// TODO: mostrar este menú solo si el usuario es paciente
|
||||
if (1 == 1) {
|
||||
subMenu = new DefaultSubMenu("Visitas", "pi pi-calendar");
|
||||
subMenu.addElement(createMenuItem("Agendar", "pi pi-calendar", "/visit/VisitView", null));
|
||||
subMenu.addElement(createMenuItem("Consultar", "pi pi-briefcase", "/visit/VisitView", null));
|
||||
model.addElement(subMenu);
|
||||
}
|
||||
|
||||
item = new DefaultMenuItem("Delete", "pi pi-times");
|
||||
item.setCommand("#{menuView.delete}");
|
||||
item.setAjax(false);
|
||||
secondSubmenu.getElements().add(item);
|
||||
// Pruebas médicas
|
||||
// TODO: mostrar este menú solo si el usuario es medico // etc...
|
||||
if (1 == 1) {
|
||||
|
||||
item = new DefaultMenuItem("Redirect", "pi pi-search");
|
||||
item.setCommand("#{menuView.redirect}");
|
||||
secondSubmenu.getElements().add(item);
|
||||
subMenu = new DefaultSubMenu("Pruebas Medicas", "pi pi-clone");
|
||||
subMenu.addElement(createMenuItem("Añadir", "pi pi-clone", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(createMenuItem("Gestionar", "pi pi-briefcase", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
subMenu.addElement(createMenuItem("Consultar médicos pro esp.", "pi pi-search", "/medicaltest/MedicalTests", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
subMenu.addElement(createMenuItem("Listar médicos", "pi pi-list", "/medicaltest/MedicalTests", null));
|
||||
model.addElement(subMenu);
|
||||
}
|
||||
|
||||
model.getElements().add(secondSubmenu);
|
||||
// Preguntas
|
||||
// TODO: mostrar este menú solo si el usuario es paciente o medico
|
||||
if (1 == 1) {
|
||||
subMenu = new DefaultSubMenu("Preguntas", "pi pi-clone");
|
||||
// TODO: Si es paciente puede preguntar
|
||||
if (true == true)
|
||||
subMenu.addElement(createMenuItem("Añadir pregunta", "pi pi-clone", "/medicaltest/MedicalTests", null));
|
||||
// TODO: Si es medico de familia puede responder
|
||||
if (true == true)
|
||||
subMenu.addElement(createMenuItem("Responder pregunta", "pi pi-question", "/medicaltest/MedicalTests", null));
|
||||
|
||||
model.addElement(subMenu);
|
||||
}
|
||||
}
|
||||
|
||||
// Perfil
|
||||
subMenu = new DefaultSubMenu("Gestionar perfil", "pi pi-id-card");
|
||||
if (SessionUtils.isLogedIn() == false) {
|
||||
subMenu.addElement(createMenuItem("Registro de usuario", "pi pi-users", "/profile/RegisterUser", null));
|
||||
subMenu.addElement(createMenuItem("Registro de paciente", "pi pi-user-plus", "/profile/AddPatient", null));
|
||||
subMenu.addElement(createMenuItem("Registro de médico", "pi pi-user-plus", "/profile/AddFamilyDoctor", null));
|
||||
subMenu.addElement(createMenuItem("Registro de especialista", "pi pi-user-plus", "/profile/AddFamilyDoctor", null));
|
||||
subMenu.addElement(createMenuItem("Registro de médico", "pi pi-user-plus", "/profile/AddSpecialistDoctor", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
} else {
|
||||
|
||||
subMenu.addElement(createMenuItem("Actualizar mi perfil", "pi pi-user-edit", "/profile/UpdateProfile", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
// TODO: mostrar este menú solo si el usuario es paciente
|
||||
if (true == true) {
|
||||
subMenu.addElement(createMenuItem("Cambiar médico de familia", "pi pi-chevron-circle-right", "/profile/ChangeFamilyDoctor", null));
|
||||
subMenu.addElement(new DefaultSeparator());
|
||||
}
|
||||
// TODO: mostrar este menú solo si el usuario es médico de familia
|
||||
if (true == true)
|
||||
subMenu.addElement(createMenuItem("Cambiar CAP", "fa fa-h-square", "/profile/ChangePrimaryHealthCareCenter", null));
|
||||
}
|
||||
model.addElement(subMenu);
|
||||
}
|
||||
|
||||
private DefaultMenuItem createMenuItem(String name, String icon, String outcome, String command) {
|
||||
DefaultMenuItem item = new DefaultMenuItem(name, icon);
|
||||
if (outcome != null)
|
||||
item.setOutcome(outcome);
|
||||
if (command != null)
|
||||
item.setCommand(command);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public MenuModel getModel() {
|
||||
|
||||
@@ -2,39 +2,70 @@
|
||||
package managedbean.common;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import TO.LoggedUserTO;
|
||||
|
||||
public class SessionUtils {
|
||||
public static final String SESSION_VAR_USERNAME = "userName";
|
||||
public static final String SESSION_VAR_USERID = "userId";
|
||||
public static final String SESSION_VAR_USERTYPE = "userType";
|
||||
public static final String SESSION_VAR_USER = "loggedInUser";
|
||||
|
||||
public static HttpSession getSession() {
|
||||
return (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
if (ctx != null)
|
||||
return (HttpSession) ctx.getExternalContext().getSession(false);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static HttpServletRequest getRequest() {
|
||||
return (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
|
||||
}
|
||||
|
||||
public static HttpSession getSession(ServletRequest request) {
|
||||
return ((HttpServletRequest) request).getSession(false);
|
||||
}
|
||||
|
||||
public static void CreateSession(LoggedUserTO usr) {
|
||||
HttpSession ses = getSession();
|
||||
ses.setAttribute(SessionUtils.SESSION_VAR_USERNAME, usr.getName());
|
||||
ses.setAttribute(SessionUtils.SESSION_VAR_USERID, usr.getId());
|
||||
ses.setAttribute(SessionUtils.SESSION_VAR_USERTYPE, usr.getUserType());
|
||||
ses.setAttribute(SessionUtils.SESSION_VAR_USER, usr);
|
||||
}
|
||||
|
||||
public static void DestroySession() {
|
||||
HttpSession ses = getSession();
|
||||
ses.invalidate();
|
||||
}
|
||||
|
||||
public static boolean isLogedIn() {
|
||||
if (getUserId() == "")
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
return isLogedIn(getSession());
|
||||
}
|
||||
|
||||
public static boolean isLogedIn(HttpSession session) {
|
||||
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERID) != null)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getUserName() {
|
||||
HttpSession session = getSession();
|
||||
if (session != null && session.getAttribute("username") != null)
|
||||
return session.getAttribute("username").toString();
|
||||
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERNAME) != null)
|
||||
return session.getAttribute(SessionUtils.SESSION_VAR_USERNAME).toString();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getUserId() {
|
||||
HttpSession session = getSession();
|
||||
if (session != null && session.getAttribute("userid") != null)
|
||||
return session.getAttribute("userid").toString();
|
||||
if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERID) != null)
|
||||
return session.getAttribute(SessionUtils.SESSION_VAR_USERID).toString();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ 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)
|
||||
@@ -12,7 +14,7 @@ import javax.inject.Named;
|
||||
*/
|
||||
@Named("AddFamilyDoctorMBean")
|
||||
@RequestScoped
|
||||
public class AddFamilyDoctorMBean extends ProfileMBeanBase implements Serializable {
|
||||
public class AddFamilyDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -21,8 +23,7 @@ public class AddFamilyDoctorMBean extends ProfileMBeanBase implements Serializab
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public AddFamilyDoctorMBean() throws Exception {
|
||||
super.initializeProfileFacadeRemote();
|
||||
public AddFamilyDoctorMBean() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ 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.
|
||||
@@ -16,7 +18,7 @@ import javax.inject.Named;
|
||||
*/
|
||||
@Named("addPatientMBean")
|
||||
@RequestScoped
|
||||
public class AddPatientMBean extends ProfileMBeanBase implements Serializable {
|
||||
public class AddPatientMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -35,8 +37,7 @@ public class AddPatientMBean extends ProfileMBeanBase implements Serializable {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public AddPatientMBean() throws Exception {
|
||||
super.initializeProfileFacadeRemote();
|
||||
public AddPatientMBean() {
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
|
||||
@@ -7,6 +7,7 @@ import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
/***
|
||||
*
|
||||
@@ -15,7 +16,7 @@ import ejb.profile.ProfileFacadeRemote;
|
||||
*/
|
||||
@Named( "AddSpecialistDoctorMBean")
|
||||
@RequestScoped
|
||||
public class AddSpecialistDoctorMBean extends ProfileMBeanBase implements Serializable {
|
||||
public class AddSpecialistDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -27,8 +28,7 @@ public class AddSpecialistDoctorMBean extends ProfileMBeanBase implements Serial
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public AddSpecialistDoctorMBean() throws Exception {
|
||||
super.initializeProfileFacadeRemote();
|
||||
public AddSpecialistDoctorMBean() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
/***
|
||||
*
|
||||
@@ -18,7 +19,7 @@ import ejb.profile.ProfileFacadeRemote;
|
||||
*/
|
||||
@Named( "ChangeFamilyDoctorMBean")
|
||||
@RequestScoped
|
||||
public class ChangeFamilyDoctorMBean extends ProfileMBeanBase implements Serializable {
|
||||
public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
/***
|
||||
*
|
||||
@@ -18,7 +19,7 @@ import ejb.profile.ProfileFacadeRemote;
|
||||
*/
|
||||
@Named( "ChangePrimaryHealthCareCenterMBean")
|
||||
@RequestScoped
|
||||
public class ChangePrimaryHealthCareCenterMBean extends ProfileMBeanBase implements Serializable {
|
||||
public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
package managedbean.profile;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.inject.Named;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
|
||||
/***
|
||||
*
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Named("profileMBean")
|
||||
public class ProfileMBeanBase {
|
||||
@EJB
|
||||
protected ProfileFacadeRemote remoteManager;
|
||||
|
||||
/**
|
||||
* Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void initializeProfileFacadeRemote() throws Exception {
|
||||
Properties props = System.getProperties();
|
||||
Context ctx = new InitialContext(props);
|
||||
remoteManager = (ProfileFacadeRemote) ctx.lookup("java:app/MyHealth.jar/ProfileFacadeBean!ejb.profile.ProfileFacadeRemote");
|
||||
}
|
||||
|
||||
protected void addFacesMessage(FacesMessage.Severity severity, String summary, String detail) {
|
||||
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, summary, detail));
|
||||
}
|
||||
|
||||
protected void manageException(Exception ex) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Se ha producido un error inesperado", "Descripción del error: " + ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,18 @@ package managedbean.profile;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.ExternalContext;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
import javax.resource.NotSupportedException;
|
||||
|
||||
import org.primefaces.PrimeFaces;
|
||||
@@ -21,57 +24,65 @@ import TO.MedicalSpecialtyTO;
|
||||
import TO.PatientTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
import TO.SpecialistDoctorTO;
|
||||
import common.UserType;
|
||||
import ejb.systemAdmin.SystemAdminFacadeRemote;
|
||||
import managedbean.common.UserType;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.ValidationUtils;
|
||||
|
||||
/**
|
||||
* ManagedBEan que gestiona la edición y actualización de una especialidad
|
||||
* médica.
|
||||
* ManagedBEan que gestiona el registro de usuarios: Usuarios de tipo "Paciente"
|
||||
* Usuarios de tipo "Médico de Familia" usuarios de tipo "Médico especialista"
|
||||
*
|
||||
* @author mark
|
||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||
*
|
||||
*/
|
||||
@Named("registerUser")
|
||||
@RequestScoped
|
||||
public class RegisterUserMBean extends ProfileMBeanBase implements Serializable {
|
||||
@Named("RegisterUser")
|
||||
@ViewScoped
|
||||
public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
private int id;
|
||||
private String nif;
|
||||
private String name;
|
||||
private String surname;
|
||||
private String password;
|
||||
private String passwordRepeat;
|
||||
private String email;
|
||||
private HashMap<String, String> userTypes;
|
||||
private boolean registered;
|
||||
|
||||
// private HashMap<String, String> userTypes;
|
||||
private List<UserType> userTypes;
|
||||
private String userType;
|
||||
private String primaryHealthCareCenter;
|
||||
private String medicalSpecialty;
|
||||
private Collection<MedicalSpecialtyTO> medicalSpecialities;
|
||||
private Collection<PrimaryHealthCareCenterTO> healthcareCenters;
|
||||
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||
private MedicalSpecialtyTO medicalSpecialty;
|
||||
private Collection<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||
private Collection<PrimaryHealthCareCenterTO> primaryHealthCareCentersList;
|
||||
|
||||
/**
|
||||
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public RegisterUserMBean() throws Exception {
|
||||
super.initializeProfileFacadeRemote();
|
||||
public RegisterUserMBean() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.userTypes = new HashMap<String, String>();
|
||||
this.userTypes.put(UserType.PATIENT.getUserTypename(), UserType.PATIENT.name());
|
||||
this.userTypes.put(UserType.FAMILY_DOCTOR.getUserTypename(), UserType.FAMILY_DOCTOR.name());
|
||||
this.userTypes.put(UserType.SPECIALIST_DOCTOR.getUserTypename(), UserType.SPECIALIST_DOCTOR.name());
|
||||
this.userType = UserType.PATIENT.getUserTypename();
|
||||
this.userTypes = new ArrayList<UserType>();
|
||||
this.userTypes.add(UserType.PATIENT);
|
||||
this.userTypes.add(UserType.FAMILY_DOCTOR);
|
||||
this.userTypes.add(UserType.SPECIALIST_DOCTOR);
|
||||
this.registered = false;
|
||||
|
||||
this.userType = UserType.PATIENT.name();
|
||||
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerSystemAdmin().listAllMedicalSpecialities();
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerSystemAdmin().listAllCAPs();
|
||||
}
|
||||
|
||||
public HashMap<String, String> getUserTypes() {
|
||||
public List<UserType> getUserTypes() {
|
||||
return userTypes;
|
||||
}
|
||||
|
||||
@@ -79,12 +90,6 @@ public class RegisterUserMBean extends ProfileMBeanBase implements Serializable
|
||||
switch (UserType.valueOf(this.userType)) {
|
||||
case SPECIALIST_DOCTOR:
|
||||
try {
|
||||
Properties props = System.getProperties();
|
||||
Context ctx = new InitialContext(props);
|
||||
SystemAdminFacadeRemote rman = (SystemAdminFacadeRemote) ctx.lookup("java:app/MyHealth.jar/SystemAdminFacadeBean!ejb.systemAdmin.SystemAdminFacadeRemote");
|
||||
|
||||
this.medicalSpecialities = rman.listAllMedicalSpecialities();
|
||||
|
||||
PrimeFaces.current().ajax().addCallbackParam("specs", true);
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
@@ -92,11 +97,6 @@ public class RegisterUserMBean extends ProfileMBeanBase implements Serializable
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
try {
|
||||
// TODO: Load Primary Healthcare Centers from remote EJB
|
||||
this.healthcareCenters = new ArrayList<PrimaryHealthCareCenterTO>();
|
||||
this.healthcareCenters.add(new PrimaryHealthCareCenterTO("Prueba", "Descripción prueba"));
|
||||
this.healthcareCenters.add(new PrimaryHealthCareCenterTO("Centro 2", "Centro 2"));
|
||||
|
||||
PrimeFaces.current().ajax().addCallbackParam("caps", true);
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
@@ -104,12 +104,32 @@ public class RegisterUserMBean extends ProfileMBeanBase implements Serializable
|
||||
break;
|
||||
case ADMINISTRADOR:
|
||||
case PATIENT:
|
||||
PrimeFaces.current().ajax().addCallbackParam("pats", true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<MedicalSpecialtyTO> getMedicalSpecialties() {
|
||||
return medicalSpecialities;
|
||||
public Collection<MedicalSpecialtyTO> getMedicalSpecialtiesList() {
|
||||
return medicalSpecialitiesList;
|
||||
}
|
||||
public Collection<PrimaryHealthCareCenterTO> getPhcList() {
|
||||
return primaryHealthCareCentersList;
|
||||
}
|
||||
|
||||
public boolean isPatient() {
|
||||
return (UserType.valueOf(this.userType) == UserType.PATIENT);
|
||||
}
|
||||
|
||||
public boolean isFamilyDoctor() {
|
||||
return (UserType.valueOf(this.userType) == UserType.FAMILY_DOCTOR);
|
||||
}
|
||||
|
||||
public boolean isSpecialistDoctor() {
|
||||
return (UserType.valueOf(this.userType) == UserType.SPECIALIST_DOCTOR);
|
||||
}
|
||||
|
||||
public boolean isDoctor() {
|
||||
return (isFamilyDoctor() || isSpecialistDoctor());
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
@@ -152,44 +172,59 @@ public class RegisterUserMBean extends ProfileMBeanBase implements Serializable
|
||||
this.nif = nif;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void addNewUser() {
|
||||
int error = 0;
|
||||
|
||||
if (this.isFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria.");
|
||||
error++;
|
||||
}
|
||||
if (this.isSpecialistDoctor() && this.medicalSpecialty == null) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Especialidad médica no seleccionada", "Por favor, especifique una especialidad médica.");
|
||||
error++;
|
||||
}
|
||||
if (ValidationUtils.isValid(nif) == false) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
|
||||
} else {
|
||||
error++;
|
||||
}
|
||||
|
||||
if (error == 0) {
|
||||
try {
|
||||
switch (UserType.valueOf(this.userType)) {
|
||||
case PATIENT:
|
||||
PatientTO pat = this.remoteManager.registerPatient(id, nif, name, surname, password, email);
|
||||
PatientTO pat = this.getRemoteManagerProfile().registerPatient(id, nif, name, surname, password, email);
|
||||
this.id = pat.getId();
|
||||
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
FamilyDoctorTO fd = this.remoteManager.registerFamilyDoctor1(id, nif, name, surname, password, email, null);
|
||||
FamilyDoctorTO fd = this.getRemoteManagerProfile().registerFamilyDoctor1(id, nif, name, surname, password, email, this.primaryHealthCareCenter);
|
||||
this.id = fd.getId();
|
||||
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
SpecialistDoctorTO sd = this.remoteManager.registerSpecialistDoctor(id, nif, name, surname, password, email, null);
|
||||
SpecialistDoctorTO sd = this.getRemoteManagerProfile().registerSpecialistDoctor(id, nif, name, surname, password, email, this.medicalSpecialty);
|
||||
this.id = sd.getId();
|
||||
|
||||
break;
|
||||
case ADMINISTRADOR:
|
||||
throw new NotSupportedException("No se soporta el registro directo de administradores.");
|
||||
}
|
||||
|
||||
this.registered = true;
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Registro realizado", "El usuario " + name + " " + surname + " se ha registrado correctamente.");
|
||||
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Alta realizada",
|
||||
"El usuario " + name + " " + surname + " se ha registrado correctamente. Por favor, comprueba su correo electrónico para verificar su cuenta.");
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||
}
|
||||
|
||||
public String getPasswordRepeat() {
|
||||
@@ -207,21 +242,25 @@ public class RegisterUserMBean extends ProfileMBeanBase implements Serializable
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public String getMedicalSpecialty() {
|
||||
|
||||
public MedicalSpecialtyTO getMedicalSpecialty() {
|
||||
return medicalSpecialty;
|
||||
}
|
||||
|
||||
public void setMedicalSpecialty(String medicalSpecialty) {
|
||||
public void setMedicalSpecialty(MedicalSpecialtyTO medicalSpecialty) {
|
||||
this.medicalSpecialty = medicalSpecialty;
|
||||
}
|
||||
|
||||
public String getPrimaryHealthCareCenter() {
|
||||
public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() {
|
||||
return primaryHealthCareCenter;
|
||||
}
|
||||
|
||||
public void setPrimaryHealthCareCenter(String primaryHealthCareCenter) {
|
||||
public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterTO primaryHealthCareCenter) {
|
||||
this.primaryHealthCareCenter = primaryHealthCareCenter;
|
||||
}
|
||||
|
||||
|
||||
public boolean isRegistered() {
|
||||
return registered;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
/***
|
||||
*
|
||||
@@ -18,7 +19,7 @@ import ejb.profile.ProfileFacadeRemote;
|
||||
*/
|
||||
@Named( "ShowFamilyDoctorMBean")
|
||||
@RequestScoped
|
||||
public class ShowFamilyDoctorMBean extends ProfileMBeanBase implements Serializable {
|
||||
public class ShowFamilyDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
/***
|
||||
*
|
||||
@@ -18,7 +19,7 @@ import ejb.profile.ProfileFacadeRemote;
|
||||
*/
|
||||
@Named("ShowPatientMBean")
|
||||
@RequestScoped
|
||||
public class ShowPatientMBean extends ProfileMBeanBase implements Serializable {
|
||||
public class ShowPatientMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
/***
|
||||
*
|
||||
@@ -18,7 +19,7 @@ import ejb.profile.ProfileFacadeRemote;
|
||||
*/
|
||||
@Named( "ShowSpecialistDoctorMBean")
|
||||
@RequestScoped
|
||||
public class ShowSpecialistDoctorMBean extends ProfileMBeanBase implements Serializable {
|
||||
public class ShowSpecialistDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
/***
|
||||
*
|
||||
@@ -18,7 +19,7 @@ import ejb.profile.ProfileFacadeRemote;
|
||||
*/
|
||||
@Named("UpdateFamilyDoctorMBean")
|
||||
@RequestScoped
|
||||
public class UpdateFamilyDoctorMBean extends ProfileMBeanBase implements Serializable {
|
||||
public class UpdateFamilyDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
/***
|
||||
*
|
||||
@@ -18,7 +19,7 @@ import ejb.profile.ProfileFacadeRemote;
|
||||
*/
|
||||
@Named("UpdatePatientMBean")
|
||||
@RequestScoped
|
||||
public class UpdatePatientMBean extends ProfileMBeanBase implements Serializable {
|
||||
public class UpdatePatientMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
/***
|
||||
*
|
||||
@@ -18,7 +19,7 @@ import ejb.profile.ProfileFacadeRemote;
|
||||
*/
|
||||
@Named("UpdateSpecialistDoctorMBean")
|
||||
@RequestScoped
|
||||
public class UpdateSpecialistDoctorMBean extends ProfileMBeanBase implements Serializable {
|
||||
public class UpdateSpecialistDoctorMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
package managedbean.systemAdmin;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.primefaces.PrimeFaces;
|
||||
|
||||
import TO.LoggedUserTO;
|
||||
import ejb.systemAdmin.SystemAdminFacadeRemote;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
import managedbean.common.SessionUtils;
|
||||
|
||||
@Named("loginView")
|
||||
@RequestScoped
|
||||
public class LoginMBean {
|
||||
|
||||
public class LoginMBean extends ManagedBeanBase {
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
@@ -35,29 +40,42 @@ public class LoginMBean {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void login() {
|
||||
FacesMessage message = null;
|
||||
public String login() {
|
||||
boolean loggedIn = false;
|
||||
|
||||
if (username != null && username.equals("admin") && password != null && password.equals("admin")) {
|
||||
loggedIn = true;
|
||||
HttpSession session = SessionUtils.getSession();
|
||||
session.setAttribute("username", username);
|
||||
session.setAttribute("userid", "1");
|
||||
message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Bienvenido", username);
|
||||
} else {
|
||||
loggedIn = false;
|
||||
message = new FacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "El usuario o la contraseña son incorrectos");
|
||||
}
|
||||
LoggedUserTO usr = null;
|
||||
|
||||
if (username != null && password != null) {
|
||||
try {
|
||||
usr = this.getRemoteManagerSystemAdmin().login(username, password);
|
||||
|
||||
if (usr != null) {
|
||||
loggedIn = true;
|
||||
SessionUtils.CreateSession(usr);
|
||||
|
||||
this.addFacesMessageKeep(FacesMessage.SEVERITY_INFO, "Login correcto", "Bienvenido " + usr.getName());
|
||||
|
||||
return ("/home?faces-redirect=true");
|
||||
} else
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "El usuario o la contraseña son incorrectos");
|
||||
} catch (Exception ex) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_FATAL, "Error fatal", ex.getMessage());
|
||||
}
|
||||
|
||||
} else
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Loggin Error", "El usuario o la contraseña son incorrectos");
|
||||
|
||||
FacesContext.getCurrentInstance().addMessage(null, message);
|
||||
PrimeFaces.current().ajax().addCallbackParam("loggedIn", loggedIn);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
// logout event, invalidate session
|
||||
public String logout() {
|
||||
HttpSession session = SessionUtils.getSession();
|
||||
session.invalidate();
|
||||
return "home?refresh=1&faces-redirect=true";
|
||||
this.addFacesMessageKeep(FacesMessage.SEVERITY_INFO, "Sessión cerrada", "Ha cerrado correctament su ssesión. Hasta la vista");
|
||||
|
||||
SessionUtils.DestroySession();
|
||||
|
||||
return "/home?faces-redirect=true";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,213 +11,199 @@ DROP TABLE myhealth.SpecialistDoctor;
|
||||
DROP TABLE myhealth.Visit;
|
||||
*/
|
||||
|
||||
-- Table: MyHealth.Administrator
|
||||
-- Table: myhealth.administrator
|
||||
|
||||
-- DROP TABLE MyHealth.Administrator;
|
||||
-- DROP TABLE myhealth.administrator;
|
||||
|
||||
CREATE TABLE MyHealth.Administrator
|
||||
CREATE TABLE myhealth.administrator
|
||||
(
|
||||
email character varying(50) COLLATE pg_catalog.default NOT NULL,
|
||||
password character varying(100) COLLATE pg_catalog.default,
|
||||
CONSTRAINT Administrator_pkey PRIMARY KEY (email)
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
email VARCHAR(120) COLLATE pg_catalog."default" NOT NULL,
|
||||
password VARCHAR(100) COLLATE pg_catalog."default" NOT NULL,
|
||||
CONSTRAINT administrator_pkey PRIMARY KEY (email)
|
||||
)
|
||||
TABLESPACE pg_default;
|
||||
|
||||
ALTER TABLE MyHealth.Administrator
|
||||
ALTER TABLE myhealth.administrator
|
||||
OWNER to "USER";
|
||||
|
||||
-- Table: MyHealth.FamilyDoctor
|
||||
-- Table: myhealth.familydoctor
|
||||
|
||||
-- DROP TABLE MyHealth.FamilyDoctor;
|
||||
-- DROP TABLE myhealth.familydoctor;
|
||||
|
||||
CREATE TABLE MyHealth.FamilyDoctor
|
||||
CREATE TABLE myhealth.familydoctor
|
||||
(
|
||||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
|
||||
password character(50) COLLATE pg_catalog.default,
|
||||
nif character(50) COLLATE pg_catalog.default,
|
||||
surname character varying(100) COLLATE pg_catalog.default,
|
||||
email character varying(120) COLLATE pg_catalog.default,
|
||||
name character varying(100) COLLATE pg_catalog.default,
|
||||
PrimaryHealthCareCenterId character varying(50) COLLATE pg_catalog.default,
|
||||
CONSTRAINT FamilyDoctor_pkey PRIMARY KEY (id)
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||
password VARCHAR(100) COLLATE pg_catalog."default" NOT NULL,
|
||||
nif CHAR(50) COLLATE pg_catalog."default",
|
||||
surname VARCHAR(100) COLLATE pg_catalog."default",
|
||||
email VARCHAR(120) COLLATE pg_catalog."default",
|
||||
name VARCHAR(100) COLLATE pg_catalog."default",
|
||||
primaryhealthcarecenterid VARCHAR(50) COLLATE pg_catalog."default",
|
||||
CONSTRAINT familydoctor_pkey PRIMARY KEY (id)
|
||||
)
|
||||
TABLESPACE pg_default;
|
||||
|
||||
ALTER TABLE MyHealth.FamilyDoctor
|
||||
ALTER TABLE myhealth.familydoctor
|
||||
OWNER to "USER";
|
||||
|
||||
-- Table: MyHealth.MedicalSpecialty
|
||||
|
||||
-- DROP TABLE MyHealth.MedicalSpecialty;
|
||||
-- Table: myhealth.medicalspecialty
|
||||
|
||||
CREATE TABLE MyHealth.MedicalSpecialty
|
||||
-- DROP TABLE myhealth.medicalspecialty;
|
||||
|
||||
CREATE TABLE myhealth.medicalspecialty
|
||||
(
|
||||
name text COLLATE pg_catalog.default NOT NULL,
|
||||
description text COLLATE pg_catalog.default,
|
||||
CONSTRAINT MedicalSpecialty_pkey PRIMARY KEY (name)
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||
name VARCHAR(50) COLLATE pg_catalog."default" NOT NULL UNIQUE,
|
||||
description VARCHAR(1000) COLLATE pg_catalog."default",
|
||||
CONSTRAINT medicalspecialty_pkey PRIMARY KEY (id)
|
||||
)
|
||||
TABLESPACE pg_default;
|
||||
|
||||
ALTER TABLE MyHealth.MedicalSpecialty
|
||||
ALTER TABLE myhealth.medicalspecialty
|
||||
OWNER to "USER";
|
||||
|
||||
-- Table: MyHealth.MedicalTest
|
||||
|
||||
-- DROP TABLE MyHealth.MedicalTest;
|
||||
-- Table: myhealth.medicaltest
|
||||
|
||||
CREATE TABLE MyHealth.MedicalTest
|
||||
-- DROP TABLE myhealth.medicaltest;
|
||||
|
||||
CREATE TABLE myhealth.medicaltest
|
||||
(
|
||||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
|
||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||
date date,
|
||||
time abstime,
|
||||
result text COLLATE pg_catalog.default,
|
||||
highResImage bytea,
|
||||
type integer,
|
||||
PatientId character varying(50) COLLATE pg_catalog.default NOT NULL,
|
||||
SpecialistDoctorId character varying(50) COLLATE pg_catalog.default NOT NULL,
|
||||
CONSTRAINT MedicalTest_pkey PRIMARY KEY (id)
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
"time" abstime,
|
||||
observations TEXT COLLATE pg_catalog."default",
|
||||
highresimage bytea,
|
||||
type INTEGER,
|
||||
patientid INTEGER NOT NULL,
|
||||
specialistdoctorid INTEGER NOT NULL,
|
||||
CONSTRAINT medicaltest_pkey PRIMARY KEY (id)
|
||||
)
|
||||
TABLESPACE pg_default;
|
||||
|
||||
ALTER TABLE MyHealth.MedicalTest
|
||||
ALTER TABLE myhealth.medicaltest
|
||||
OWNER to "USER";
|
||||
|
||||
-- Table: MyHealth.Patient
|
||||
-- Table: myhealth.patient
|
||||
|
||||
-- DROP TABLE MyHealth.Patient;
|
||||
-- DROP TABLE myhealth.patient;
|
||||
|
||||
CREATE TABLE MyHealth.Patient
|
||||
CREATE TABLE myhealth.patient
|
||||
(
|
||||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
|
||||
password character(50) COLLATE pg_catalog.default,
|
||||
nif character(50) COLLATE pg_catalog.default,
|
||||
surname character varying(100) COLLATE pg_catalog.default,
|
||||
email character varying(120) COLLATE pg_catalog.default,
|
||||
name character varying(100) COLLATE pg_catalog.default,
|
||||
FamilyDoctorId character varying(50) COLLATE pg_catalog.default,
|
||||
CONSTRAINT Patient_pkey PRIMARY KEY (id)
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||
password VARCHAR(100) COLLATE pg_catalog."default",
|
||||
nif VARCHAR(50) COLLATE pg_catalog."default",
|
||||
surname VARCHAR(100) COLLATE pg_catalog."default",
|
||||
email VARCHAR(120) COLLATE pg_catalog."default",
|
||||
name VARCHAR(100) COLLATE pg_catalog."default",
|
||||
familydoctorid INTEGER,
|
||||
CONSTRAINT patient_pkey PRIMARY KEY (id)
|
||||
)
|
||||
TABLESPACE pg_default;
|
||||
|
||||
ALTER TABLE MyHealth.Patient
|
||||
ALTER TABLE myhealth.patient
|
||||
OWNER to "USER";
|
||||
|
||||
-- Table: MyHealth.PrimaryHealthCareCenter
|
||||
|
||||
-- DROP TABLE MyHealth.PrimaryHealthCareCenter;
|
||||
-- Table: myhealth.location
|
||||
|
||||
CREATE TABLE MyHealth.PrimaryHealthCareCenter
|
||||
-- DROP TABLE myhealth.location;
|
||||
|
||||
CREATE TABLE myhealth.location
|
||||
(
|
||||
name character varying(50) COLLATE pg_catalog.default NOT NULL,
|
||||
location character varying(256) COLLATE pg_catalog.default,
|
||||
CONSTRAINT PrimaryHealthCareCenter_pkey PRIMARY KEY (name)
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||
name VARCHAR(100) COLLATE pg_catalog."default" NOT NULL,
|
||||
CONSTRAINT primarylocation_pkey PRIMARY KEY (id)
|
||||
)
|
||||
TABLESPACE pg_default;
|
||||
|
||||
ALTER TABLE MyHealth.PrimaryHealthCareCenter
|
||||
ALTER TABLE myhealth.location
|
||||
OWNER to "USER";
|
||||
|
||||
-- Table: MyHealth.Question
|
||||
|
||||
-- DROP TABLE MyHealth.Question;
|
||||
-- Table: myhealth.primaryhealthcarecenter
|
||||
|
||||
CREATE TABLE MyHealth.Question
|
||||
-- DROP TABLE myhealth.primaryhealthcarecenter;
|
||||
|
||||
CREATE TABLE myhealth.primaryhealthcarecenter
|
||||
(
|
||||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
|
||||
title character varying(512) COLLATE pg_catalog.default NOT NULL,
|
||||
message character varying(8000) COLLATE pg_catalog.default NOT NULL,
|
||||
status integer,
|
||||
PatientId character varying(50) COLLATE pg_catalog.default NOT NULL,
|
||||
CONSTRAINT Question_pkey PRIMARY KEY (id)
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
name VARCHAR(50) COLLATE pg_catalog."default" NOT NULL,
|
||||
location INTEGER,
|
||||
CONSTRAINT primaryhealthcarecenter_pkey PRIMARY KEY (name)
|
||||
)
|
||||
TABLESPACE pg_default;
|
||||
|
||||
ALTER TABLE MyHealth.Question
|
||||
ALTER TABLE myhealth.primaryhealthcarecenter
|
||||
OWNER to "USER";
|
||||
|
||||
-- Table: MyHealth.Response
|
||||
-- Table: myhealth.question
|
||||
|
||||
-- DROP TABLE MyHealth.Response;
|
||||
-- DROP TABLE myhealth.question;
|
||||
|
||||
CREATE TABLE MyHealth.Response
|
||||
CREATE TABLE myhealth.question
|
||||
(
|
||||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
|
||||
response character varying(8000) COLLATE pg_catalog.default,
|
||||
QuestionId integer NOT NULL,
|
||||
CONSTRAINT Response_pkey PRIMARY KEY (id)
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
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.Response
|
||||
ALTER TABLE myhealth.question
|
||||
OWNER to "USER";
|
||||
|
||||
-- Table: MyHealth.SpecialistDoctor
|
||||
|
||||
-- DROP TABLE MyHealth.SpecialistDoctor;
|
||||
-- Table: myhealth.response
|
||||
|
||||
CREATE TABLE MyHealth.SpecialistDoctor
|
||||
-- DROP TABLE myhealth.response;
|
||||
|
||||
CREATE TABLE myhealth.response
|
||||
(
|
||||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
|
||||
password character(50) COLLATE pg_catalog.default,
|
||||
nif character(50) COLLATE pg_catalog.default,
|
||||
surname character varying(100) COLLATE pg_catalog.default,
|
||||
email character varying(120) COLLATE pg_catalog.default,
|
||||
name character varying(100) COLLATE pg_catalog.default,
|
||||
MedicalSpecialtyId character varying(50) COLLATE pg_catalog.default,
|
||||
CONSTRAINT SpecialistDoctor_pkey PRIMARY KEY (id)
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
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.SpecialistDoctor
|
||||
ALTER TABLE myhealth.response
|
||||
OWNER to "USER";
|
||||
|
||||
-- Table: MyHealth.Visit
|
||||
|
||||
-- DROP TABLE MyHealth.Visit;
|
||||
-- Table: myhealth.specialistdoctor
|
||||
|
||||
CREATE TABLE MyHealth.Visit
|
||||
-- DROP TABLE myhealth.specialistdoctor;
|
||||
|
||||
CREATE TABLE myhealth.specialistdoctor
|
||||
(
|
||||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
|
||||
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||
password VARCHAR(100) COLLATE pg_catalog."default",
|
||||
nif VARCHAR(50) COLLATE pg_catalog."default",
|
||||
surname VARCHAR(100) COLLATE pg_catalog."default",
|
||||
email VARCHAR(120) COLLATE pg_catalog."default",
|
||||
name VARCHAR(100) COLLATE pg_catalog."default",
|
||||
medicalspecialtyid INTEGER,
|
||||
CONSTRAINT specialistdoctor_pkey PRIMARY KEY (id)
|
||||
)
|
||||
TABLESPACE pg_default;
|
||||
|
||||
ALTER TABLE myhealth.specialistdoctor
|
||||
OWNER to "USER";
|
||||
|
||||
-- Table: myhealth.visit
|
||||
|
||||
-- DROP 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 ),
|
||||
date date NOT NULL,
|
||||
time abstime NOT NULL,
|
||||
observations character varying(4000) COLLATE pg_catalog.default,
|
||||
result text COLLATE pg_catalog.default,
|
||||
PatientId character varying(50) COLLATE pg_catalog.default NOT NULL,
|
||||
FamilyDoctorId character varying(50) COLLATE pg_catalog.default NOT NULL,
|
||||
CONSTRAINT Visit_pkey PRIMARY KEY (id)
|
||||
)
|
||||
WITH (
|
||||
OIDS = FALSE
|
||||
"time" abstime NOT NULL,
|
||||
observations TEXT COLLATE pg_catalog."default",
|
||||
result TEXT COLLATE pg_catalog."default",
|
||||
patientid INTEGER NOT NULL,
|
||||
familydoctorid INTEGER NOT NULL,
|
||||
CONSTRAINT visit_pkey PRIMARY KEY (id)
|
||||
)
|
||||
TABLESPACE pg_default;
|
||||
|
||||
ALTER TABLE MyHealth.Visit
|
||||
ALTER TABLE myhealth.visit
|
||||
OWNER to "USER";
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
--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')
|
||||
|
||||
-- Inserta Especialidades médicas
|
||||
|
||||
insert into MyHealth.MedicalSpecialty(name, description)
|
||||
@@ -30,3 +34,4 @@ 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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user