Merge branch 'master' of http://pdp-pds.eimt.uoc.edu/pds19-grupo2/myhealth.git
This commit is contained in:
@@ -1,59 +1,129 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
xmlns:p="http://primefaces.org/ui">
|
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||||
|
xmlns:f="http://java.sun.com/jsf/core"
|
||||||
|
xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
||||||
|
|
||||||
<ui:composition template="../header.xhtml">
|
<ui:composition template="../header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="TestForm">
|
|
||||||
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
|
||||||
<p:panel id="PanelUnderConstruction" header="Pagina en construcción de Pruebas médicas">
|
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-5 ui-md-5">
|
||||||
|
<h:form id="frmMT">
|
||||||
|
<p:panel id="mainPanel" header="Pruebas médicas">
|
||||||
|
<f:facet name="actions">
|
||||||
|
<h:commandLink rendered="#{mt.specialistDoctor}"
|
||||||
|
action="#{mt.addMT}" immediate="true" update="frmMT"
|
||||||
|
styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
|
||||||
|
<h:outputText styleClass="ui-icon pi pi-plus" />
|
||||||
|
</h:commandLink>
|
||||||
|
</f:facet>
|
||||||
|
<p:selectOneMenu rendered="#{mt.specialistDoctor}" id="lazy" value="#{mt.patIdSelected}"
|
||||||
|
converter="omnifaces.SelectItemsConverter">
|
||||||
|
<p:ajax event="valueChange" listener="#{mt.onSelectPatient}"
|
||||||
|
update="frmMT" />
|
||||||
|
<f:selectItem itemLabel="Todos" itemValue="-1" />
|
||||||
|
<f:selectItems value="#{mt.patients}" var="el"
|
||||||
|
itemLabel="#{el.name} #{el.surname}" itemValue="#{el.id}" />
|
||||||
|
</p:selectOneMenu>
|
||||||
|
<p:orderList id="medicalTestList" value="#{mt.medicalTests}"
|
||||||
|
var="el" itemValue="#{el}" controlsLocation="none"
|
||||||
|
responsive="true">
|
||||||
|
<p:ajax event="select" listener="#{mt.onSelectMT}"
|
||||||
|
update="frmMT,frmNEW,frmImage" />
|
||||||
|
<o:converter converterId="omnifaces.ListConverter"
|
||||||
|
list="#{mt.medicalTests}" />
|
||||||
|
<p:column>
|
||||||
|
<h:outputText value="#{el.onlyDate} - #{el.type.testTypeName}" />
|
||||||
|
<br />
|
||||||
|
<h:outputText rendered="#{mt.patIdSelected == -1}"
|
||||||
|
value="#{el.patient.name} #{el.patient.surname}"
|
||||||
|
style="font-size: 0.8em !important; font-style: italic;" />
|
||||||
|
</p:column>
|
||||||
|
</p:orderList>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-7 ui-md-7">
|
||||||
|
<h:form id="frmImage" enctype="multipart/form-data">
|
||||||
|
<p:panel rendered="#{mt.viewEdit}" id="detailPanel"
|
||||||
|
header="Detalle de prueba médica">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-4 ui-md-4">Fecha:</div>
|
||||||
|
<div class="ui-g-8 ui-md-8">
|
||||||
|
<h:outputText value="#{mt.selected.date}"></h:outputText>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">Hora:</div>
|
||||||
|
<div class="ui-g-8 ui-md-8">
|
||||||
|
<h:outputText value="#{mt.selected.time}"></h:outputText>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">Observaciones:</div>
|
||||||
|
<div class="ui-g-8 ui-md-8">
|
||||||
|
<h:outputText escape="false" value="#{mt.selected.observations}"></h:outputText>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">Tipo de prueba:</div>
|
||||||
|
<div class="ui-g-8 ui-md-8">
|
||||||
|
<h:outputText value="#{mt.selected.type.testTypeName}"></h:outputText>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">Imagen de alta resolución:</div>
|
||||||
|
<div class="ui-g-8 ui-md-8">
|
||||||
|
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-12 ui-md-12">
|
||||||
<p:outputLabel for="campo" value="Etiqueta para campo de formulario:" />
|
<p:fileUpload rendered="#{mt.specialistDoctor}" value="#{mt.imageUpload}" mode="simple" skinSimple="true" />
|
||||||
|
<p:commandButton rendered="#{mt.specialistDoctor}" value="Subir imagen" ajax="false" action="#{mt.addImage}" update="frmImage"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-12 ui-md-12">
|
||||||
<p:inputText id="campo" value="Valor del campo del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
<img src="#{mt.selected.highresimage}" style="max-width: 300px !important;"></img>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-12 ui-md-12">
|
||||||
<p:message for="campo" display="text" />
|
<p:commandButton rendered="#{mt.specialistDoctor}" action="#{mt.removeImage}"
|
||||||
|
disabled="#{mt.selected.highresimage == null}"
|
||||||
|
value="Eliminar" icon="pi pi-delete" update="frmImage"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-4 ui-md-4">
|
|
||||||
<p:outputLabel for="campo2" value="Etiqueta para campo 2 de formulario:" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-4 ui-md-4">
|
|
||||||
<p:inputText id="campo2" value="Valor del campo 2 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-4 ui-md-4">
|
|
||||||
<p:message for="campo" display="text" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ui-g-4 ui-md-4">
|
|
||||||
<p:outputLabel for="campo3" value="Etiqueta para campo 3 de formulario:" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-4 ui-md-4">
|
|
||||||
<p:inputText id="campo3" value="Valor del campo 3 del formulario" required="true" requiredMessage="Por favor, especifique un valor" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-4 ui-md-4">
|
|
||||||
<p:message for="campo" display="text" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ui-g-12 ui-g-nopad">
|
|
||||||
<div class="ui-g-4 ui-md-4" />
|
|
||||||
<div class="ui-g-2 ui-md-2 ">
|
|
||||||
<p:commandButton validateClient="true" value="Guardar" update="TestForm" action="#{BeanName.actionMethod}" icon="pi pi-check" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-2 ui-md-2">
|
|
||||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-4 ui-md-4" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
</h:form>
|
</h:form>
|
||||||
|
<h:form id="frmNEW">
|
||||||
|
<p:panel rendered="#{mt.viewCreate}" id="createPanel"
|
||||||
|
header="Detalle de prueba médica">
|
||||||
|
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-4 ui-md-4">Fecha:</div>
|
||||||
|
<div class="ui-g-8 ui-md-8">
|
||||||
|
<h:outputText value="#{mt.selected.date}"></h:outputText>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">Hora:</div>
|
||||||
|
<div class="ui-g-8 ui-md-8">
|
||||||
|
<h:outputText value="#{mt.selected.time}"></h:outputText>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">Observaciones:</div>
|
||||||
|
<div class="ui-g-8 ui-md-8">
|
||||||
|
<p:textEditor value="#{mt.selected.observations}"></p:textEditor>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">Tipo de prueba:</div>
|
||||||
|
<div class="ui-g-8 ui-md-8">
|
||||||
|
<p:selectOneMenu value="#{mt.medicalTestTypeSelected}">
|
||||||
|
<f:selectItems value="#{mt.medicalTestTypes}" var="el"
|
||||||
|
itemLabel="#{el.testTypeName}" itemValue="#{el.name}" />
|
||||||
|
</p:selectOneMenu>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:commandButton value="Guardar" action="#{mt.save}"
|
||||||
|
icon="pi pi-save" update="frmMT,frmImage,frmNEW" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</ui:define>
|
</ui:define>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
</html>
|
</html>
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmListCAPs">
|
||||||
|
<p:growl id="mesgsList" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
<p:panel id="PanelCAPList" style="margin-bottom: 10px;" header="Gestión de Centros de Atención Primaria">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<p:dataTable widgetVar="dtCAP" var="cap" value="#{ManageHealthCareCenters.lazyDataModelCAPsList}" editable="true" lazy="true" paginator="true" rows="10" paginatorPosition="bottom" paginatorAlwaysVisible="true"
|
||||||
|
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,40">
|
||||||
|
|
||||||
|
<p:ajax event="rowEdit" listener="#{ManageHealthCareCenters.onRowEdit}" update=":frmListCAPs:mesgsList" />
|
||||||
|
<p:ajax event="rowEditCancel" listener="#{ManageHealthCareCenters.onRowCancel}" update=":frmListCAPs:mesgsList" />
|
||||||
|
|
||||||
|
<p:column headerText="Nombre">
|
||||||
|
<p:cellEditor>
|
||||||
|
<f:facet name="output"><h:outputText value="#{cap.name}" /></f:facet>
|
||||||
|
<f:facet name="input"><p:inputText value="#{cap.name}" style="width:100%" label="Nombre"/></f:facet>
|
||||||
|
</p:cellEditor>
|
||||||
|
</p:column>
|
||||||
|
|
||||||
|
<p:column headerText="Localización">
|
||||||
|
<p:cellEditor>
|
||||||
|
<f:facet name="output"><h:outputText value="#{cap.location}" /></f:facet>
|
||||||
|
<f:facet name="input"><p:inputText value="#{cap.location}" style="width:100%" label="Localización"/></f:facet>
|
||||||
|
</p:cellEditor>
|
||||||
|
</p:column>
|
||||||
|
|
||||||
|
<p:column style="width:80px; text-align: center;" headerText="Editar">
|
||||||
|
<p:rowEditor />
|
||||||
|
</p:column>
|
||||||
|
|
||||||
|
<p:column style="width:80px; text-align: center;" headerText="Eliminar">
|
||||||
|
<p:commandLink onclick="if (! confirm('¿Seguro que quiere borrar el CAP?')) return false" ajax="true" action="#{ManageHealthCareCenters.deleteDataById(cap.id)}" update=":frmListCAPs:mesgsList frmListCAPs" process="frmListCAPs">
|
||||||
|
<span title="Borrar" class="fa fa-remove"/>
|
||||||
|
</p:commandLink>
|
||||||
|
</p:column>
|
||||||
|
|
||||||
|
<f:facet name="paginatorBottomLeft">
|
||||||
|
<p:commandButton type="button" icon="pi pi-refresh" onclick="PF('dtCAP').getPaginator().setPage(0);" />
|
||||||
|
</f:facet>
|
||||||
|
</p:dataTable>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
|
||||||
|
<h:form id="frmAddCAPs">
|
||||||
|
<p:growl id="mesgsAdd" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
<p:panel id="PanelNewCAP" header="Alta de Centros de Atención Primaria">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-1 ui-md-1">
|
||||||
|
<p:outputLabel value="Nombre: " for="nameNew" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:inputText id="nameNew" value="#{ManageHealthCareCenters.name}" readonly="false" required="ManageHealthCareCenters.medicalSpecialty.name eq null"
|
||||||
|
requiredMessage="Es necesario un nombre" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-1 ui-md-1">
|
||||||
|
<p:outputLabel value="Localización: " for="locationNew" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:inputText id="locationNew" value="#{ManageHealthCareCenters.location}" readonly="false" required="ManageHealthCareCenters.medicalSpecialty.location eq null"
|
||||||
|
requiredMessage="Es necesaria una localización" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Crear" update="mesgsAdd frmListCAPs frmAddCAPs" action="#{ManageHealthCareCenters.insertData}" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-1 ui-md-1 ">
|
<div class="ui-g-1 ui-md-1 ">
|
||||||
<p:commandButton validateClient="true" value="Borrar" update="frmEditSpecialties" action="#{ManageSpecialities.deleteData}" icon="fa fa-remove">
|
<p:commandButton validateClient="true" value="Borrar" update="frmEditSpecialties" action="#{ManageSpecialities.deleteData}" icon="fa fa-remove">
|
||||||
<p:confirm header="Confirme la eliminación" message="¿Esta seguro de que desea eliminar la especialidad?" icon="pi pi-exclamation-triangle" />
|
<p:confirm header="Confirme la eliminación" message="¿Está seguro de que desea eliminar la especialidad?" icon="pi pi-exclamation-triangle" />
|
||||||
</p:commandButton>
|
</p:commandButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package TO;
|
package TO;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
@@ -19,7 +23,7 @@ public class MedicalTestTO implements Serializable {
|
|||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private Date date;
|
private Date date;
|
||||||
private long time;
|
private LocalTime time;
|
||||||
private String observations;
|
private String observations;
|
||||||
private String highresimage;
|
private String highresimage;
|
||||||
private MedicalTestType type;
|
private MedicalTestType type;
|
||||||
@@ -27,7 +31,15 @@ public class MedicalTestTO implements Serializable {
|
|||||||
private SpecialistDoctorTO specialistDoctor;
|
private SpecialistDoctorTO specialistDoctor;
|
||||||
|
|
||||||
|
|
||||||
public MedicalTestTO(int id, Date date, int time, String observations, String highresimage, MedicalTestType type,
|
public MedicalTestTO() {
|
||||||
|
super();
|
||||||
|
this.date = new Date();
|
||||||
|
this.time = LocalTime.now();
|
||||||
|
this.patient = new PatientTO();
|
||||||
|
this.specialistDoctor = new SpecialistDoctorTO();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MedicalTestTO(int id, Date date, LocalTime time, String observations, String highresimage, MedicalTestType type,
|
||||||
PatientTO patiend, SpecialistDoctorTO specialistDoctor) {
|
PatientTO patiend, SpecialistDoctorTO specialistDoctor) {
|
||||||
this.setId(id);
|
this.setId(id);
|
||||||
this.setDate(date);
|
this.setDate(date);
|
||||||
@@ -55,11 +67,11 @@ public class MedicalTestTO implements Serializable {
|
|||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTime() {
|
public LocalTime getTime() {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(long time) {
|
public void setTime(LocalTime time) {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,4 +115,15 @@ public class MedicalTestTO implements Serializable {
|
|||||||
this.specialistDoctor = specialistDoctor;
|
this.specialistDoctor = specialistDoctor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return Integer.toString(this.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOnlyDate() {
|
||||||
|
DateFormat df = DateFormat.getDateInstance(DateFormat.DATE_FIELD, new Locale("es", "ES"));
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
return sdf.format(this.getDate());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import javax.persistence.TypedQuery;
|
|||||||
|
|
||||||
import TO.FamilyDoctorTO;
|
import TO.FamilyDoctorTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
|
import TO.MedicalTestTO;
|
||||||
import TO.PatientTO;
|
import TO.PatientTO;
|
||||||
import TO.PrimaryHealthCareCenterTO;
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
import TO.QuestionTO;
|
import TO.QuestionTO;
|
||||||
@@ -18,6 +19,7 @@ import TO.VisitTO;
|
|||||||
import common.Utils;
|
import common.Utils;
|
||||||
import jpa.FamilyDoctorJPA;
|
import jpa.FamilyDoctorJPA;
|
||||||
import jpa.MedicalSpecialtyJPA;
|
import jpa.MedicalSpecialtyJPA;
|
||||||
|
import jpa.MedicalTestJPA;
|
||||||
import jpa.PatientJPA;
|
import jpa.PatientJPA;
|
||||||
import jpa.PrimaryHealthCareCenterJPA;
|
import jpa.PrimaryHealthCareCenterJPA;
|
||||||
import jpa.QuestionJPA;
|
import jpa.QuestionJPA;
|
||||||
@@ -36,7 +38,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
private EntityManager entman;
|
private EntityManager entman;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Metodo que devuelve todas las especialidades medicas registradas en el sistema
|
* Metodo que devuelve todas las especialidades medicas registradas en el
|
||||||
|
* sistema
|
||||||
*
|
*
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
||||||
*/
|
*/
|
||||||
@@ -47,9 +50,11 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
/**
|
/**
|
||||||
* Metodo que devuelve las especialidades médicas de forma paginada
|
* Metodo que devuelve las especialidades médicas de forma paginada
|
||||||
*
|
*
|
||||||
* Acepta como parametro la página (comenzando en 0) y el número de elementos de cada página.
|
* Acepta como parametro la página (comenzando en 0) y el número de elementos de
|
||||||
|
* cada página.
|
||||||
*
|
*
|
||||||
* si pageSize == 0, entonces se devuelven todas las especialidades registradas (Se ignora el parámetro).
|
* si pageSize == 0, entonces se devuelven todas las especialidades registradas
|
||||||
|
* (Se ignora el parámetro).
|
||||||
*
|
*
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
||||||
*/
|
*/
|
||||||
@@ -58,12 +63,15 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que devuelve una lista de espcialidades médicas que tienen una coincidencia parcial en el nombre o en la descripción con el termino de búsqueda (searchTerm)
|
* Método que devuelve una lista de espcialidades médicas que tienen una
|
||||||
* especificado.
|
* coincidencia parcial en el nombre o en la descripción con el termino de
|
||||||
|
* búsqueda (searchTerm) especificado.
|
||||||
*
|
*
|
||||||
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza
|
||||||
|
* paginación y se devuelven todos los resultados.
|
||||||
*
|
*
|
||||||
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el parámetro y devuelven todas las especialidades existentes.
|
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el
|
||||||
|
* parámetro y devuelven todas las especialidades existentes.
|
||||||
*
|
*
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
||||||
*/
|
*/
|
||||||
@@ -79,7 +87,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
strFilter = "WHERE lower(ms.name) LIKE :searchTerm OR lower(ms.description) LIKE :searchTerm";
|
strFilter = "WHERE lower(ms.name) LIKE :searchTerm OR lower(ms.description) LIKE :searchTerm";
|
||||||
}
|
}
|
||||||
|
|
||||||
TypedQuery<MedicalSpecialtyJPA> query = entman.createQuery(String.format(strQuery, strFilter), MedicalSpecialtyJPA.class);
|
TypedQuery<MedicalSpecialtyJPA> query = entman.createQuery(String.format(strQuery, strFilter),
|
||||||
|
MedicalSpecialtyJPA.class);
|
||||||
|
|
||||||
if (searchTerm.length() > 0)
|
if (searchTerm.length() > 0)
|
||||||
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
||||||
@@ -109,9 +118,11 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que devuelve una lista de CAPs (Centros de Atención Primarios) de forma paginada
|
* Método que devuelve una lista de CAPs (Centros de Atención Primarios) de
|
||||||
|
* forma paginada
|
||||||
*
|
*
|
||||||
* Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
* Si pageSize == 0 no se realiza paginación y se devuelven todos los
|
||||||
|
* resultados.
|
||||||
*
|
*
|
||||||
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
* @return Devuelve una Lista de MedicalSpecialtyTO (Transfer Objects).
|
||||||
*/
|
*/
|
||||||
@@ -120,12 +131,15 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que devuelve una lista de CAPs (Centros de Atención Primarios) que tienen una coincidencia parcial en el nombre o en la localización con el termino de búsqueda
|
* Método que devuelve una lista de CAPs (Centros de Atención Primarios) que
|
||||||
* (searchTerm) especificado.
|
* tienen una coincidencia parcial en el nombre o en la localización con el
|
||||||
|
* termino de búsqueda (searchTerm) especificado.
|
||||||
*
|
*
|
||||||
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza
|
||||||
|
* paginación y se devuelven todos los resultados.
|
||||||
*
|
*
|
||||||
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el parámetro y devuelven todos los CAPs existentes.
|
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el
|
||||||
|
* parámetro y devuelven todos los CAPs existentes.
|
||||||
*
|
*
|
||||||
* @return Devuelve una Lista de PrimaryHealthCareCenterTO (Transfer Objects).
|
* @return Devuelve una Lista de PrimaryHealthCareCenterTO (Transfer Objects).
|
||||||
*/
|
*/
|
||||||
@@ -141,7 +155,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
strFilter = "WHERE lower(phc.name) LIKE :searchTerm OR lower(phc.location) LIKE :searchTerm";
|
strFilter = "WHERE lower(phc.name) LIKE :searchTerm OR lower(phc.location) LIKE :searchTerm";
|
||||||
}
|
}
|
||||||
|
|
||||||
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery(String.format(strQuery, strFilter), PrimaryHealthCareCenterJPA.class);
|
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery(String.format(strQuery, strFilter),
|
||||||
|
PrimaryHealthCareCenterJPA.class);
|
||||||
|
|
||||||
if (searchTerm.length() > 0)
|
if (searchTerm.length() > 0)
|
||||||
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
||||||
@@ -162,7 +177,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que devuelve una lista con todos los médicos de familia registrados en el sistema.
|
* Método que devuelve una lista con todos los médicos de familia registrados en
|
||||||
|
* el sistema.
|
||||||
*
|
*
|
||||||
* @return Devuelve una Lista de FamilyDoctorTO (Transfer Objects).
|
* @return Devuelve una Lista de FamilyDoctorTO (Transfer Objects).
|
||||||
*/
|
*/
|
||||||
@@ -171,9 +187,11 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que devuelve una lista con todos los médicos de familia registrados en el sistema de forma paginada.
|
* Método que devuelve una lista con todos los médicos de familia registrados en
|
||||||
|
* el sistema de forma paginada.
|
||||||
*
|
*
|
||||||
* Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
* Si pageSize == 0 no se realiza paginación y se devuelven todos los
|
||||||
|
* resultados.
|
||||||
*
|
*
|
||||||
* @return Devuelve una Lista de FamilyDoctorTO (Transfer Objects).
|
* @return Devuelve una Lista de FamilyDoctorTO (Transfer Objects).
|
||||||
*/
|
*/
|
||||||
@@ -182,11 +200,15 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que devuelve una lista de médicos de familia que tienen una coincidencia parcial en el nombre o en los apellidos con el termino de búsqueda (searchTerm) especificado.
|
* Método que devuelve una lista de médicos de familia que tienen una
|
||||||
|
* coincidencia parcial en el nombre o en los apellidos con el termino de
|
||||||
|
* búsqueda (searchTerm) especificado.
|
||||||
*
|
*
|
||||||
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza paginación y se devuelven todos los resultados.
|
* Además permite la paginacción de datos. Si pageSize == 0 no se realiza
|
||||||
|
* paginación y se devuelven todos los resultados.
|
||||||
*
|
*
|
||||||
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el parámetro y devuelven todos los registros existentes.
|
* Si serachTerm es nulo o cadena vacía entonces no se tiene en cuenta el
|
||||||
|
* parámetro y devuelven todos los registros existentes.
|
||||||
*
|
*
|
||||||
* @return Devuelve una Lista de FamilyDoctorTO (Transfer Objects).
|
* @return Devuelve una Lista de FamilyDoctorTO (Transfer Objects).
|
||||||
*/
|
*/
|
||||||
@@ -202,7 +224,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
strFilter = "WHERE lower(fd.name) LIKE :searchTerm OR lower(fd.surname) LIKE :searchTerm";
|
strFilter = "WHERE lower(fd.name) LIKE :searchTerm OR lower(fd.surname) LIKE :searchTerm";
|
||||||
}
|
}
|
||||||
|
|
||||||
TypedQuery<FamilyDoctorJPA> query = entman.createQuery(String.format(strQuery, strFilter), FamilyDoctorJPA.class);
|
TypedQuery<FamilyDoctorJPA> query = entman.createQuery(String.format(strQuery, strFilter),
|
||||||
|
FamilyDoctorJPA.class);
|
||||||
|
|
||||||
if (searchTerm.length() > 0)
|
if (searchTerm.length() > 0)
|
||||||
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
||||||
@@ -275,7 +298,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que convierte un objecto de tipo MedicalSpecialtyJPA (JPA) a su equivalente MedicalSpecialtyTO (Tranfer Object)
|
* Método que convierte un objecto de tipo MedicalSpecialtyJPA (JPA) a su
|
||||||
|
* equivalente MedicalSpecialtyTO (Tranfer Object)
|
||||||
*
|
*
|
||||||
* @return MedicalSpecialtyTO (Transfer Object de una especialidad médica)
|
* @return MedicalSpecialtyTO (Transfer Object de una especialidad médica)
|
||||||
*/
|
*/
|
||||||
@@ -290,7 +314,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que convierte un objecto de tipo PrimaryHealthCareCenterJPA (JPA) a su equivalente PrimaryHealthCareCenterTO (Tranfer Object)
|
* Método que convierte un objecto de tipo PrimaryHealthCareCenterJPA (JPA) a su
|
||||||
|
* equivalente PrimaryHealthCareCenterTO (Tranfer Object)
|
||||||
*
|
*
|
||||||
* @return PrimaryHealthCareCenterTO (Transfer Object de un CAP)
|
* @return PrimaryHealthCareCenterTO (Transfer Object de un CAP)
|
||||||
*/
|
*/
|
||||||
@@ -305,10 +330,14 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que convierte un objecto de tipo SpecialistDoctorJPA (JPA) a su equivalente SpecialistDoctorTO (Tranfer Object)
|
* Método que convierte un objecto de tipo SpecialistDoctorJPA (JPA) a su
|
||||||
|
* equivalente SpecialistDoctorTO (Tranfer Object)
|
||||||
*
|
*
|
||||||
* El parámetro nestedProps es un valor entero que indica a que nivel de profundidad se debe navegar a través de las propiedades relacionadas para convertirlas de JPA a TO. Un
|
* El parámetro nestedProps es un valor entero que indica a que nivel de
|
||||||
* valor 0 indica que no se convertirá ninguna propiedad que tenga un entidad JPA relacionada (tendrá valor null en el objeto TO).
|
* profundidad se debe navegar a través de las propiedades relacionadas para
|
||||||
|
* convertirlas de JPA a TO. Un valor 0 indica que no se convertirá ninguna
|
||||||
|
* propiedad que tenga un entidad JPA relacionada (tendrá valor null en el
|
||||||
|
* objeto TO).
|
||||||
*
|
*
|
||||||
* @return SpecialistDoctorTO (Transfer Object de un médico especialista)
|
* @return SpecialistDoctorTO (Transfer Object de un médico especialista)
|
||||||
*/
|
*/
|
||||||
@@ -321,18 +350,22 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
ms = sd.getMedicalSpecialty();
|
ms = sd.getMedicalSpecialty();
|
||||||
|
|
||||||
nestedProps--;
|
nestedProps--;
|
||||||
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(),
|
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(),
|
||||||
this.getPOJOforMedicalSpecialtyJPA(ms));
|
sd.getSurname(), sd.getPassword(), sd.getEmail(), this.getPOJOforMedicalSpecialtyJPA(ms));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdTO;
|
return sdTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que convierte un objecto de tipo FamilyDoctorJPA (JPA) a su equivalente FamilyDoctorTO (Tranfer Object)
|
* Método que convierte un objecto de tipo FamilyDoctorJPA (JPA) a su
|
||||||
|
* equivalente FamilyDoctorTO (Tranfer Object)
|
||||||
*
|
*
|
||||||
* El parámetro nestedProps es un valor entero que indica a que nivel de profundidad se debe navegar a través de las propiedades relacionadas para convertirlas de JPA a TO. Un
|
* El parámetro nestedProps es un valor entero que indica a que nivel de
|
||||||
* valor 0 indica que no se convertirá ninguna propiedad que tenga un entidad JPA relacionada (tendrá valor null en el objeto TO).
|
* profundidad se debe navegar a través de las propiedades relacionadas para
|
||||||
|
* convertirlas de JPA a TO. Un valor 0 indica que no se convertirá ninguna
|
||||||
|
* propiedad que tenga un entidad JPA relacionada (tendrá valor null en el
|
||||||
|
* objeto TO).
|
||||||
*
|
*
|
||||||
* @return FamilyDoctorTO (Transfer Object de un médico especialista)
|
* @return FamilyDoctorTO (Transfer Object de un médico especialista)
|
||||||
*/
|
*/
|
||||||
@@ -345,18 +378,22 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
phc = fd.getPrimaryHealthCareCenter();
|
phc = fd.getPrimaryHealthCareCenter();
|
||||||
|
|
||||||
nestedProps--;
|
nestedProps--;
|
||||||
fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(),
|
fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(),
|
||||||
this.getPOJOforPrimaryHealthCareCenterJPA(phc));
|
fd.getSurname(), fd.getPassword(), fd.getEmail(), this.getPOJOforPrimaryHealthCareCenterJPA(phc));
|
||||||
}
|
}
|
||||||
|
|
||||||
return fdTO;
|
return fdTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que convierte un objecto de tipo PatientJPA (JPA) a su equivalente PatientTO (Tranfer Object)
|
* Método que convierte un objecto de tipo PatientJPA (JPA) a su equivalente
|
||||||
|
* PatientTO (Tranfer Object)
|
||||||
*
|
*
|
||||||
* El parámetro nestedProps es un valor entero que indica a que nivel de profundidad se debe navegar a través de las propiedades relacionadas para convertirlas de JPA a TO. Un
|
* El parámetro nestedProps es un valor entero que indica a que nivel de
|
||||||
* valor 0 indica que no se convertirá ninguna propiedad que tenga un entidad JPA relacionada (tendrá valor null en el objeto TO).
|
* profundidad se debe navegar a través de las propiedades relacionadas para
|
||||||
|
* convertirlas de JPA a TO. Un valor 0 indica que no se convertirá ninguna
|
||||||
|
* propiedad que tenga un entidad JPA relacionada (tendrá valor null en el
|
||||||
|
* objeto TO).
|
||||||
*
|
*
|
||||||
* @return PatientTO (Transfer Object de un médico especialista)
|
* @return PatientTO (Transfer Object de un médico especialista)
|
||||||
*/
|
*/
|
||||||
@@ -369,7 +406,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
fd = pat.getFamilyDoctor();
|
fd = pat.getFamilyDoctor();
|
||||||
|
|
||||||
nestedProps--;
|
nestedProps--;
|
||||||
paTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(),
|
paTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(),
|
||||||
|
pat.getSurname(), pat.getPassword(), pat.getEmail(),
|
||||||
this.getPOJOforFamilyDoctorJPA(fd, nestedProps));
|
this.getPOJOforFamilyDoctorJPA(fd, nestedProps));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,9 +415,11 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que recupera un paciente a partir de su Identificador (Id) de base de datos.
|
* Método que recupera un paciente a partir de su Identificador (Id) de base de
|
||||||
|
* datos.
|
||||||
*
|
*
|
||||||
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se
|
||||||
|
* encuentra el objeto buscado
|
||||||
*/
|
*/
|
||||||
public PatientTO findPatientById(int patientId) {
|
public PatientTO findPatientById(int patientId) {
|
||||||
// Recuperamos propiedades anidadas 1 nivel!
|
// Recuperamos propiedades anidadas 1 nivel!
|
||||||
@@ -387,12 +427,15 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que recupera un paciente a partir de su CIP (Código de Identificación de Paciente)
|
* Método que recupera un paciente a partir de su CIP (Código de Identificación
|
||||||
|
* de Paciente)
|
||||||
*
|
*
|
||||||
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se
|
||||||
|
* encuentra el objeto buscado
|
||||||
*/
|
*/
|
||||||
public PatientTO findPatientByCode(String code) {
|
public PatientTO findPatientByCode(String code) {
|
||||||
TypedQuery<PatientJPA> query = entman.createQuery("from PatientJPA pat where pat.personalIdentificationCode=:code", PatientJPA.class);
|
TypedQuery<PatientJPA> query = entman
|
||||||
|
.createQuery("from PatientJPA pat where pat.personalIdentificationCode=:code", PatientJPA.class);
|
||||||
query.setMaxResults(1);
|
query.setMaxResults(1);
|
||||||
query.setParameter("code", code);
|
query.setParameter("code", code);
|
||||||
|
|
||||||
@@ -406,7 +449,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
/**
|
/**
|
||||||
* Método que recupera un paciente a partir de su NIF
|
* Método que recupera un paciente a partir de su NIF
|
||||||
*
|
*
|
||||||
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
* @return PatientTO (Transfer Object del objeto recuperado) o null si no se
|
||||||
|
* encuentra el objeto buscado
|
||||||
*/
|
*/
|
||||||
public PatientTO findPatientByNif(String searchedNIF) {
|
public PatientTO findPatientByNif(String searchedNIF) {
|
||||||
TypedQuery<PatientJPA> query = entman.createQuery("from PatientJPA pat where pat.nif=:nif", PatientJPA.class);
|
TypedQuery<PatientJPA> query = entman.createQuery("from PatientJPA pat where pat.nif=:nif", PatientJPA.class);
|
||||||
@@ -421,21 +465,26 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que recupera un médico de familia a partir de su Identificador (Id) de base de datos.
|
* Método que recupera un médico de familia a partir de su Identificador (Id) de
|
||||||
|
* base de datos.
|
||||||
*
|
*
|
||||||
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no
|
||||||
|
* se encuentra el objeto buscado
|
||||||
*/
|
*/
|
||||||
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId) {
|
public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId) {
|
||||||
return this.getPOJOforFamilyDoctorJPA(entman.find(FamilyDoctorJPA.class, ProfessionalNumberId), 1);
|
return this.getPOJOforFamilyDoctorJPA(entman.find(FamilyDoctorJPA.class, ProfessionalNumberId), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que recupera un médico de familia a partir de su NP (Número de profesional)
|
* Método que recupera un médico de familia a partir de su NP (Número de
|
||||||
|
* profesional)
|
||||||
*
|
*
|
||||||
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no
|
||||||
|
* se encuentra el objeto buscado
|
||||||
*/
|
*/
|
||||||
public FamilyDoctorTO findFamilyDoctorByCode(String code) {
|
public FamilyDoctorTO findFamilyDoctorByCode(String code) {
|
||||||
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.professionalNumber=:code", FamilyDoctorJPA.class);
|
TypedQuery<FamilyDoctorJPA> query = entman
|
||||||
|
.createQuery("from FamilyDoctorJPA d where d.professionalNumber=:code", FamilyDoctorJPA.class);
|
||||||
|
|
||||||
query.setParameter("code", code);
|
query.setParameter("code", code);
|
||||||
|
|
||||||
@@ -449,10 +498,12 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
/**
|
/**
|
||||||
* Método que recupera un médico de familia a partir de su NIF
|
* Método que recupera un médico de familia a partir de su NIF
|
||||||
*
|
*
|
||||||
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
* @return FamilyDoctorTO (Transfer Object del objeto recuperado) o null si no
|
||||||
|
* se encuentra el objeto buscado
|
||||||
*/
|
*/
|
||||||
public FamilyDoctorTO findFamilyDoctorByNif(String searchedNIF) {
|
public FamilyDoctorTO findFamilyDoctorByNif(String searchedNIF) {
|
||||||
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.nif=:nif", FamilyDoctorJPA.class);
|
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("from FamilyDoctorJPA d where d.nif=:nif",
|
||||||
|
FamilyDoctorJPA.class);
|
||||||
query.setMaxResults(1);
|
query.setMaxResults(1);
|
||||||
query.setParameter("nif", searchedNIF);
|
query.setParameter("nif", searchedNIF);
|
||||||
|
|
||||||
@@ -464,21 +515,26 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que recupera un médico especialista a partir de su Identificador (Id) de base de datos.
|
* Método que recupera un médico especialista a partir de su Identificador (Id)
|
||||||
|
* de base de datos.
|
||||||
*
|
*
|
||||||
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si
|
||||||
|
* no se encuentra el objeto buscado
|
||||||
*/
|
*/
|
||||||
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId) {
|
public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId) {
|
||||||
return this.getPOJOforSpecialistDoctorJPA(entman.find(SpecialistDoctorJPA.class, ProfessionalNumberId), 1);
|
return this.getPOJOforSpecialistDoctorJPA(entman.find(SpecialistDoctorJPA.class, ProfessionalNumberId), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que recupera un médico especialista a partir de su NP (Número de profesional)
|
* Método que recupera un médico especialista a partir de su NP (Número de
|
||||||
|
* profesional)
|
||||||
*
|
*
|
||||||
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si no se encuentra el objeto buscado
|
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si
|
||||||
|
* no se encuentra el objeto buscado
|
||||||
*/
|
*/
|
||||||
public SpecialistDoctorTO findSpecialistDoctorByCode(String code) {
|
public SpecialistDoctorTO findSpecialistDoctorByCode(String code) {
|
||||||
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.professionalNumber=:code", SpecialistDoctorJPA.class);
|
TypedQuery<SpecialistDoctorJPA> query = entman
|
||||||
|
.createQuery("from SpecialistDoctorJPA d where d.professionalNumber=:code", SpecialistDoctorJPA.class);
|
||||||
|
|
||||||
query.setParameter("code", code);
|
query.setParameter("code", code);
|
||||||
|
|
||||||
@@ -495,7 +551,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si el objeto JPA es nulo
|
* @return SpecialistDoctorTO (Transfer Object del objeto recuperado) o null si el objeto JPA es nulo
|
||||||
*/
|
*/
|
||||||
public SpecialistDoctorTO findSpecialistDoctorByNif(String searchedNIF) {
|
public SpecialistDoctorTO findSpecialistDoctorByNif(String searchedNIF) {
|
||||||
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.nif=:nif", SpecialistDoctorJPA.class);
|
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery("from SpecialistDoctorJPA d where d.nif=:nif",
|
||||||
|
SpecialistDoctorJPA.class);
|
||||||
query.setMaxResults(1);
|
query.setMaxResults(1);
|
||||||
query.setParameter("nif", searchedNIF);
|
query.setParameter("nif", searchedNIF);
|
||||||
|
|
||||||
@@ -507,7 +564,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Método que convierte un objecto de tipo QuestionJPA (JPA) a su equivalente QuestionTO (Tranfer Object)
|
* Método que convierte un objecto de tipo QuestionJPA (JPA) a su equivalente
|
||||||
|
* QuestionTO (Tranfer Object)
|
||||||
*
|
*
|
||||||
* El parámetro nestedProps es un valor entero que indica a que nivel de profundidad se debe navegar a través de las propiedades relacionadas para convertirlas de JPA a TO. Un
|
* El parámetro nestedProps es un valor entero que indica a que nivel de profundidad se debe navegar a través de las propiedades relacionadas para convertirlas de JPA a TO. Un
|
||||||
* valor 0 indica que no se convertirá ninguna propiedad que tenga un entidad JPA relacionada (tendrá valor null en el objeto TO).
|
* valor 0 indica que no se convertirá ninguna propiedad que tenga un entidad JPA relacionada (tendrá valor null en el objeto TO).
|
||||||
@@ -526,8 +584,9 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nestedProps--;
|
nestedProps--;
|
||||||
qsTO = new QuestionTO(qs.getId(), qs.getTitle(), qs.getMessage(), qs.getStatus(), this.getPOJOforPatientJPA(pat, nestedProps),
|
qsTO = new QuestionTO(qs.getId(), qs.getTitle(), qs.getMessage(), qs.getStatus(),
|
||||||
this.getPOJOforFamilyDoctorJPA(fd, nestedProps), qs.getResponse());
|
this.getPOJOforPatientJPA(pat, nestedProps), this.getPOJOforFamilyDoctorJPA(fd, nestedProps),
|
||||||
|
qs.getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
return qsTO;
|
return qsTO;
|
||||||
@@ -553,8 +612,27 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nestedProps--;
|
nestedProps--;
|
||||||
qsTO = new VisitTO(vi.getId(), vi.getDate(), vi.getTime(), vi.getObservations(), vi.getResult(), this.getPOJOforFamilyDoctorJPA(fd, nestedProps),
|
qsTO = new VisitTO(vi.getId(), vi.getDate(), vi.getTime(), vi.getObservations(), vi.getResult(),
|
||||||
this.getPOJOforPatientJPA(pat, nestedProps));
|
this.getPOJOforFamilyDoctorJPA(fd, nestedProps), this.getPOJOforPatientJPA(pat, nestedProps));
|
||||||
|
}
|
||||||
|
|
||||||
|
return qsTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MedicalTestTO getPOJOforMedicalTestJPA(MedicalTestJPA vi, int nestedProps) {
|
||||||
|
MedicalTestTO qsTO = null;
|
||||||
|
|
||||||
|
if (vi != null) {
|
||||||
|
SpecialistDoctorJPA fd = null;
|
||||||
|
PatientJPA pat = null;
|
||||||
|
if (nestedProps > 0) {
|
||||||
|
fd = vi.getSpecialistDoctor();
|
||||||
|
pat = vi.getPatient();
|
||||||
|
}
|
||||||
|
|
||||||
|
nestedProps--;
|
||||||
|
qsTO = new MedicalTestTO(vi.getId(), vi.getDate(), vi.getTime(), vi.getObservations(), vi.getHighresimage(), vi.getType(),
|
||||||
|
this.getPOJOforPatientJPA(pat, nestedProps), this.getPOJOforSpecialistDoctorJPA(fd, nestedProps));
|
||||||
}
|
}
|
||||||
|
|
||||||
return qsTO;
|
return qsTO;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import javax.ejb.Local;
|
|||||||
|
|
||||||
import TO.FamilyDoctorTO;
|
import TO.FamilyDoctorTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
|
import TO.MedicalTestTO;
|
||||||
import TO.PatientTO;
|
import TO.PatientTO;
|
||||||
import TO.PrimaryHealthCareCenterTO;
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
import TO.QuestionTO;
|
import TO.QuestionTO;
|
||||||
@@ -13,6 +14,7 @@ import TO.SpecialistDoctorTO;
|
|||||||
import TO.VisitTO;
|
import TO.VisitTO;
|
||||||
import jpa.FamilyDoctorJPA;
|
import jpa.FamilyDoctorJPA;
|
||||||
import jpa.MedicalSpecialtyJPA;
|
import jpa.MedicalSpecialtyJPA;
|
||||||
|
import jpa.MedicalTestJPA;
|
||||||
import jpa.PatientJPA;
|
import jpa.PatientJPA;
|
||||||
import jpa.PrimaryHealthCareCenterJPA;
|
import jpa.PrimaryHealthCareCenterJPA;
|
||||||
import jpa.QuestionJPA;
|
import jpa.QuestionJPA;
|
||||||
@@ -79,5 +81,7 @@ public interface CommonFacadeLocal {
|
|||||||
|
|
||||||
public QuestionTO getPOJOforQuestionJPA(QuestionJPA qs, int nestedProps);
|
public QuestionTO getPOJOforQuestionJPA(QuestionJPA qs, int nestedProps);
|
||||||
|
|
||||||
|
public MedicalTestTO getPOJOforMedicalTestJPA(MedicalTestJPA mt, int nestedProps);
|
||||||
|
|
||||||
public VisitTO getPOJOforVisitJPA(VisitJPA qs, int nestedProps);
|
public VisitTO getPOJOforVisitJPA(VisitJPA qs, int nestedProps);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package ejb.medicalTest;
|
package ejb.medicalTest;
|
||||||
|
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -10,20 +11,25 @@ import javax.persistence.EntityManager;
|
|||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
|
import TO.MedicalTestTO;
|
||||||
|
import TO.PatientTO;
|
||||||
import TO.QuestionTO;
|
import TO.QuestionTO;
|
||||||
import TO.SpecialistDoctorTO;
|
import TO.SpecialistDoctorTO;
|
||||||
import common.MedicalTestType;
|
import common.MedicalTestType;
|
||||||
import common.QuestionStatus;
|
import common.QuestionStatus;
|
||||||
import ejb.common.CommonFacadeLocal;
|
import ejb.common.CommonFacadeLocal;
|
||||||
|
import jpa.MedicalTestJPA;
|
||||||
import jpa.PatientJPA;
|
import jpa.PatientJPA;
|
||||||
import jpa.QuestionJPA;
|
import jpa.QuestionJPA;
|
||||||
import jpa.SpecialistDoctorJPA;
|
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
|
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los
|
||||||
* persistencia.
|
* métodos de la capa de negocio que implementan la logica de negocio y la
|
||||||
|
* interacción con la capa de persistencia.
|
||||||
*
|
*
|
||||||
* Tanto los pacientes como los médicos deben acceder a la vista de pruebas médicas.
|
* Tanto los pacientes como los médicos deben acceder a la vista de pruebas
|
||||||
|
* médicas.
|
||||||
*
|
*
|
||||||
* @author rorden
|
* @author rorden
|
||||||
*
|
*
|
||||||
@@ -47,18 +53,28 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
* @param title
|
* @param title
|
||||||
* @param message
|
* @param message
|
||||||
*/
|
*/
|
||||||
public void askQuestion(int userId, String title, String message) {
|
public String askQuestion(int userId, String title, String message) {
|
||||||
|
|
||||||
|
PatientJPA pat = entman.find(PatientJPA.class, userId);
|
||||||
|
|
||||||
|
if (pat.getFamilyDoctor() != null) {
|
||||||
|
|
||||||
QuestionJPA qjpa = new QuestionJPA();
|
QuestionJPA qjpa = new QuestionJPA();
|
||||||
qjpa.setId(0);
|
qjpa.setId(0);
|
||||||
qjpa.setTitle(title);
|
qjpa.setTitle(title);
|
||||||
qjpa.setMessage(message);
|
qjpa.setMessage(message);
|
||||||
qjpa.setStatus(QuestionStatus.PENDING);
|
qjpa.setStatus(QuestionStatus.PENDING);
|
||||||
|
|
||||||
PatientJPA pat = entman.find(PatientJPA.class, userId);
|
|
||||||
qjpa.setPatient(pat);
|
qjpa.setPatient(pat);
|
||||||
qjpa.setFamilyDoctor(pat.getFamilyDoctor());
|
qjpa.setFamilyDoctor(pat.getFamilyDoctor());
|
||||||
|
|
||||||
entman.persist(qjpa);
|
entman.persist(qjpa);
|
||||||
|
|
||||||
|
return "ok";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return "No tienes médico de familia elegido, por favor acude a la sección 'Gestionar Perfil' -> 'Cambiar médico de familia'";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +96,9 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
// TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA
|
// TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA
|
||||||
// q where q.status=:status and q.familyDoctor.id=:docId order by q.title",
|
// q where q.status=:status and q.familyDoctor.id=:docId order by q.title",
|
||||||
// QuestionJPA.class);
|
// QuestionJPA.class);
|
||||||
TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA q where q.familyDoctor.id=:docId order by q.status desc, q.title asc", QuestionJPA.class);
|
TypedQuery<QuestionJPA> query = entman.createQuery(
|
||||||
|
"SELECT q from QuestionJPA q where q.familyDoctor.id=:docId order by q.status desc, q.title asc",
|
||||||
|
QuestionJPA.class);
|
||||||
// query.setParameter("status", QuestionStatus.PENDING);
|
// query.setParameter("status", QuestionStatus.PENDING);
|
||||||
query.setParameter("docId", familyDoctorId);
|
query.setParameter("docId", familyDoctorId);
|
||||||
|
|
||||||
@@ -99,7 +117,9 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
// TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA
|
// TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA
|
||||||
// q where q.status=:status and q.familyDoctor.id=:docId order by q.title",
|
// q where q.status=:status and q.familyDoctor.id=:docId order by q.title",
|
||||||
// QuestionJPA.class);
|
// QuestionJPA.class);
|
||||||
TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA q where q.patient.id=:patientId order by q.status desc, q.title asc", QuestionJPA.class);
|
TypedQuery<QuestionJPA> query = entman.createQuery(
|
||||||
|
"SELECT q from QuestionJPA q where q.patient.id=:patientId order by q.status desc, q.title asc",
|
||||||
|
QuestionJPA.class);
|
||||||
// query.setParameter("status", QuestionStatus.PENDING);
|
// query.setParameter("status", QuestionStatus.PENDING);
|
||||||
query.setParameter("patientId", userId);
|
query.setParameter("patientId", userId);
|
||||||
|
|
||||||
@@ -120,7 +140,8 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
public QuestionTO getQuestion(int idQuestion) {
|
public QuestionTO getQuestion(int idQuestion) {
|
||||||
QuestionTO resp = new QuestionTO();
|
QuestionTO resp = new QuestionTO();
|
||||||
|
|
||||||
TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA q where q.id=:idquestion", QuestionJPA.class);
|
TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA q where q.id=:idquestion",
|
||||||
|
QuestionJPA.class);
|
||||||
|
|
||||||
query.setParameter("idquestion", idQuestion);
|
query.setParameter("idquestion", idQuestion);
|
||||||
|
|
||||||
@@ -135,15 +156,29 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
/**
|
/**
|
||||||
* Añadir pruebas médicas a una cita
|
* Añadir pruebas médicas a una cita
|
||||||
*
|
*
|
||||||
* Sólo médicos especialistas pueden gestionar pruebas médicas en el sistema.
|
* Dado que será añadida por el médico especialista en sesión no hace falta más
|
||||||
|
* información.
|
||||||
*
|
*
|
||||||
* @param idMedicalTest
|
* @param patientiID
|
||||||
* @param date
|
* @param date
|
||||||
* @param time
|
* @param time
|
||||||
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias magnéticas y TAC
|
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias
|
||||||
|
* magnéticas y TAC
|
||||||
* @param observations
|
* @param observations
|
||||||
*/
|
*/
|
||||||
public void addMedicalTest(int idMedicalTest, Date date, long time, MedicalTestType testType, String observations) {
|
public String addMedicalTest(int patientID, int doctorSpecialistID, Date date, LocalTime time,
|
||||||
|
MedicalTestType testType, String observations) {
|
||||||
|
try {
|
||||||
|
SpecialistDoctorJPA specDoctor = entman.find(SpecialistDoctorJPA.class, doctorSpecialistID);
|
||||||
|
PatientJPA pat = entman.find(PatientJPA.class, patientID);
|
||||||
|
|
||||||
|
MedicalTestJPA mt = new MedicalTestJPA(0, date, time, observations, null, testType, pat, specDoctor);
|
||||||
|
|
||||||
|
entman.persist(mt);
|
||||||
|
return "ok";
|
||||||
|
} catch (Exception ex) {
|
||||||
|
return ex.getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,7 +188,19 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
*
|
*
|
||||||
* @param idMedicalTest
|
* @param idMedicalTest
|
||||||
*/
|
*/
|
||||||
public void getMedicalTest(int idMedicalTest) {
|
public MedicalTestTO getMedicalTest(int idMedicalTest) {
|
||||||
|
MedicalTestTO resp = new MedicalTestTO();
|
||||||
|
|
||||||
|
resp = commonServices.getPOJOforMedicalTestJPA(this.getMedicalTestJPA(idMedicalTest), 1);
|
||||||
|
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MedicalTestJPA getMedicalTestJPA(int idMedicalTest) {
|
||||||
|
TypedQuery<MedicalTestJPA> query = entman
|
||||||
|
.createQuery("SELECT q from MedicalTestJPA q where q.id=:idMedicalTest", MedicalTestJPA.class);
|
||||||
|
query.setParameter("idMedicalTest", idMedicalTest);
|
||||||
|
return query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,6 +210,10 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
* @param image
|
* @param image
|
||||||
*/
|
*/
|
||||||
public void addImage(int idMedicalTest, String image) {
|
public void addImage(int idMedicalTest, String image) {
|
||||||
|
MedicalTestJPA mt = this.getMedicalTestJPA(idMedicalTest);
|
||||||
|
mt.setHighresimage(image);
|
||||||
|
|
||||||
|
entman.persist(mt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -172,6 +223,7 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
* @param image
|
* @param image
|
||||||
*/
|
*/
|
||||||
public void updateImage(int idMedicalTest, String image) {
|
public void updateImage(int idMedicalTest, String image) {
|
||||||
|
this.addImage(idMedicalTest, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,10 +232,15 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
* @param idMedicalTest
|
* @param idMedicalTest
|
||||||
*/
|
*/
|
||||||
public void removeImage(int idMedicalTest) {
|
public void removeImage(int idMedicalTest) {
|
||||||
|
MedicalTestJPA mt = this.getMedicalTestJPA(idMedicalTest);
|
||||||
|
mt.setHighresimage(null);
|
||||||
|
|
||||||
|
entman.persist(mt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getSpecialistDoctorByMedicalSpecialityCount(int specialityId) {
|
public Long getSpecialistDoctorByMedicalSpecialityCount(int specialityId) {
|
||||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from SpecialistDoctorJPA q where q.medicalSpecialty.id=:specId", Long.class);
|
TypedQuery<Long> query = entman.createQuery(
|
||||||
|
"SELECT count(1) from SpecialistDoctorJPA q where q.medicalSpecialty.id=:specId", Long.class);
|
||||||
query.setParameter("specId", specialityId);
|
query.setParameter("specId", specialityId);
|
||||||
|
|
||||||
return query.getSingleResult();
|
return query.getSingleResult();
|
||||||
@@ -194,11 +251,13 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
*
|
*
|
||||||
* @param speciality
|
* @param speciality
|
||||||
*/
|
*/
|
||||||
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(int specialityId, int pageNumber, int pageSize) {
|
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(int specialityId, int pageNumber,
|
||||||
|
int pageSize) {
|
||||||
List<SpecialistDoctorTO> pendingQuestions = new ArrayList<SpecialistDoctorTO>();
|
List<SpecialistDoctorTO> pendingQuestions = new ArrayList<SpecialistDoctorTO>();
|
||||||
|
|
||||||
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery(
|
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery(
|
||||||
"SELECT q from SpecialistDoctorJPA q where q.medicalSpecialty.id=:specId order by q.medicalSpecialty.name asc, q.surname asc", SpecialistDoctorJPA.class);
|
"SELECT q from SpecialistDoctorJPA q where q.medicalSpecialty.id=:specId order by q.medicalSpecialty.name asc, q.surname asc",
|
||||||
|
SpecialistDoctorJPA.class);
|
||||||
query.setParameter("specId", specialityId);
|
query.setParameter("specId", specialityId);
|
||||||
|
|
||||||
if (pageSize > 0) {
|
if (pageSize > 0) {
|
||||||
@@ -215,4 +274,124 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
return pendingQuestions;
|
return pendingQuestions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MedicalTestTO> loadMedicalTestForPatient(int patientID) {
|
||||||
|
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
||||||
|
|
||||||
|
TypedQuery<MedicalTestJPA> query = entman.createQuery(
|
||||||
|
"SELECT q from MedicalTestJPA q where q.patient.id=:patientId order by q.id desc",
|
||||||
|
MedicalTestJPA.class);
|
||||||
|
|
||||||
|
query.setParameter("patientId", patientID);
|
||||||
|
|
||||||
|
List<MedicalTestJPA> allJPA = query.getResultList();
|
||||||
|
|
||||||
|
for (MedicalTestJPA item : allJPA) {
|
||||||
|
medicalTests.add(commonServices.getPOJOforMedicalTestJPA(item, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return medicalTests;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID) {
|
||||||
|
return this.loadMedicalTestForFamilyDoctor(familyDoctorID, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID) {
|
||||||
|
return this.loadMedicalTestForSpecialistDoctor(specialistDoctorID, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID, int patientID) {
|
||||||
|
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
||||||
|
String extraQuery = "";
|
||||||
|
|
||||||
|
if (patientID > 0) {
|
||||||
|
extraQuery = " and q.patient.id=:patientID";
|
||||||
|
}
|
||||||
|
|
||||||
|
TypedQuery<MedicalTestJPA> query = entman
|
||||||
|
.createQuery("SELECT q from MedicalTestJPA q where q.patient.familyDoctor.id=:familyDoctorID "
|
||||||
|
+ extraQuery + " order by q.id desc", MedicalTestJPA.class);
|
||||||
|
if (patientID > 0) {
|
||||||
|
query.setParameter("patientID", patientID);
|
||||||
|
}
|
||||||
|
query.setParameter("familyDoctorID", familyDoctorID);
|
||||||
|
|
||||||
|
List<MedicalTestJPA> allJPA = query.getResultList();
|
||||||
|
|
||||||
|
for (MedicalTestJPA item : allJPA) {
|
||||||
|
medicalTests.add(commonServices.getPOJOforMedicalTestJPA(item, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return medicalTests;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID, int patientID) {
|
||||||
|
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
||||||
|
String extraQuery = "";
|
||||||
|
|
||||||
|
if (patientID > 0) {
|
||||||
|
extraQuery = " and q.patient.id=:patientID";
|
||||||
|
}
|
||||||
|
|
||||||
|
TypedQuery<MedicalTestJPA> query = entman
|
||||||
|
.createQuery("SELECT q from MedicalTestJPA q where q.specialistDoctor.id=:specialistDoctorID "
|
||||||
|
+ extraQuery + " order by q.id desc", MedicalTestJPA.class);
|
||||||
|
|
||||||
|
if (patientID > 0) {
|
||||||
|
query.setParameter("patientID", patientID);
|
||||||
|
}
|
||||||
|
query.setParameter("specialistDoctorID", specialistDoctorID);
|
||||||
|
|
||||||
|
List<MedicalTestJPA> allJPA = query.getResultList();
|
||||||
|
|
||||||
|
for (MedicalTestJPA item : allJPA) {
|
||||||
|
medicalTests.add(commonServices.getPOJOforMedicalTestJPA(item, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return medicalTests;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PatientTO> loadPatientsForSpecialistDoctor(int specialistDoctorID) {
|
||||||
|
List<PatientTO> medicalTests = new ArrayList<PatientTO>();
|
||||||
|
|
||||||
|
TypedQuery<PatientJPA> query = entman.createQuery(
|
||||||
|
"SELECT distinct q.patient from MedicalTestJPA q where q.specialistDoctor.id=:specialistDoctorID",
|
||||||
|
PatientJPA.class);
|
||||||
|
|
||||||
|
query.setParameter("specialistDoctorID", specialistDoctorID);
|
||||||
|
|
||||||
|
List<PatientJPA> allJPA = query.getResultList();
|
||||||
|
|
||||||
|
for (PatientJPA item : allJPA) {
|
||||||
|
medicalTests.add(commonServices.getPOJOforPatientJPA(item, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return medicalTests;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PatientTO> loadPatientsForFamilyDoctor(int familyDoctorID) {
|
||||||
|
List<PatientTO> medicalTests = new ArrayList<PatientTO>();
|
||||||
|
|
||||||
|
TypedQuery<PatientJPA> query = entman.createQuery(
|
||||||
|
"SELECT distinct q.patient from MedicalTestJPA q where q.patient.familyDoctor.id=:familyDoctorID",
|
||||||
|
PatientJPA.class);
|
||||||
|
|
||||||
|
query.setParameter("familyDoctorID", familyDoctorID);
|
||||||
|
|
||||||
|
List<PatientJPA> allJPA = query.getResultList();
|
||||||
|
|
||||||
|
for (PatientJPA item : allJPA) {
|
||||||
|
medicalTests.add(commonServices.getPOJOforPatientJPA(item, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return medicalTests;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
package ejb.medicalTest;
|
package ejb.medicalTest;
|
||||||
|
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
|
|
||||||
|
import TO.MedicalTestTO;
|
||||||
|
import TO.PatientTO;
|
||||||
import TO.QuestionTO;
|
import TO.QuestionTO;
|
||||||
import TO.SpecialistDoctorTO;
|
import TO.SpecialistDoctorTO;
|
||||||
import common.MedicalTestType;
|
import common.MedicalTestType;
|
||||||
@@ -28,7 +31,7 @@ public interface MedicalTestFacadeRemote {
|
|||||||
* @param title
|
* @param title
|
||||||
* @param message
|
* @param message
|
||||||
*/
|
*/
|
||||||
public void askQuestion(int userID, String title, String message);
|
public String askQuestion(int userID, String title, String message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* El médico responde a una pregunta
|
* El médico responde a una pregunta
|
||||||
@@ -62,8 +65,23 @@ public interface MedicalTestFacadeRemote {
|
|||||||
// ********************************************************************* MEDICAL
|
// ********************************************************************* MEDICAL
|
||||||
// TEST
|
// TEST
|
||||||
|
|
||||||
|
public List<MedicalTestTO> loadMedicalTestForPatient(int patientID);
|
||||||
|
|
||||||
|
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID);
|
||||||
|
|
||||||
|
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID);
|
||||||
|
|
||||||
|
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID, int patientID);
|
||||||
|
|
||||||
|
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID, int patientID);
|
||||||
|
|
||||||
|
public List<PatientTO> loadPatientsForSpecialistDoctor(int specialistDoctorID);
|
||||||
|
|
||||||
|
public List<PatientTO> loadPatientsForFamilyDoctor(int familyDoctorID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Añadir una prueba médica a un paciente
|
* Añadir una prueba médica a un paciente
|
||||||
|
* Dado que será añadida por el médico especialista en sesión no hace falta más información.
|
||||||
*
|
*
|
||||||
* @param idMedicalTest
|
* @param idMedicalTest
|
||||||
* @param date
|
* @param date
|
||||||
@@ -71,14 +89,14 @@ public interface MedicalTestFacadeRemote {
|
|||||||
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias magnéticas y TAC
|
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias magnéticas y TAC
|
||||||
* @param observations
|
* @param observations
|
||||||
*/
|
*/
|
||||||
public void addMedicalTest(int id, Date date, long time, MedicalTestType testType, String observations);
|
public String addMedicalTest(int patientID, int doctorSpecialistID, Date date, LocalTime time, MedicalTestType testType, String observations);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recuperar una prueba médica por ID
|
* Recuperar una prueba médica por ID
|
||||||
*
|
*
|
||||||
* @param idMedicalTest
|
* @param idMedicalTest
|
||||||
*/
|
*/
|
||||||
public void getMedicalTest(int idPatient);
|
public MedicalTestTO getMedicalTest(int idPatient);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Añadir una imagen a una prueba médica
|
* Añadir una imagen a una prueba médica
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package ejb.systemAdmin;
|
package ejb.systemAdmin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
import javax.ejb.EJB;
|
||||||
@@ -12,6 +13,7 @@ import TO.FamilyDoctorTO;
|
|||||||
import TO.LoggedUserTO;
|
import TO.LoggedUserTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
import TO.PatientTO;
|
import TO.PatientTO;
|
||||||
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
import TO.SpecialistDoctorTO;
|
import TO.SpecialistDoctorTO;
|
||||||
import common.Constants;
|
import common.Constants;
|
||||||
import common.HashUtils;
|
import common.HashUtils;
|
||||||
@@ -19,6 +21,7 @@ import common.UserType;
|
|||||||
import ejb.common.CommonFacadeLocal;
|
import ejb.common.CommonFacadeLocal;
|
||||||
import jpa.AdministratorJPA;
|
import jpa.AdministratorJPA;
|
||||||
import jpa.MedicalSpecialtyJPA;
|
import jpa.MedicalSpecialtyJPA;
|
||||||
|
import jpa.PrimaryHealthCareCenterJPA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -148,10 +151,81 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MedicalSpecialtyTO insertSpecialty(String name, String description) throws Exception {
|
public MedicalSpecialtyTO insertSpecialty(String name, String description) throws Exception {
|
||||||
|
|
||||||
MedicalSpecialtyJPA ms = new MedicalSpecialtyJPA(name, description);
|
MedicalSpecialtyJPA ms = new MedicalSpecialtyJPA(name, description);
|
||||||
entman.persist(ms);
|
entman.persist(ms);
|
||||||
|
|
||||||
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
|
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PrimaryHealthCareCenterTO updateHealthCareCenter(int id, String name, String location) throws Exception {
|
||||||
|
PrimaryHealthCareCenterJPA ms = entman.find(PrimaryHealthCareCenterJPA.class, id);
|
||||||
|
|
||||||
|
if (ms == null) {
|
||||||
|
throw new Exception("No se pueden actualizar los datos del CAP porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
ms.setName(name);
|
||||||
|
ms.setLocation(location);
|
||||||
|
|
||||||
|
entman.persist(ms);
|
||||||
|
|
||||||
|
return this.commonServices.getPOJOforPrimaryHealthCareCenterJPA(ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrimaryHealthCareCenterTO findHealthCareCenterByName(String searchedName) {
|
||||||
|
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery("from PrimaryHealthCareCenterJPA cap where cap.name=:name", PrimaryHealthCareCenterJPA.class);
|
||||||
|
query.setMaxResults(1);
|
||||||
|
query.setParameter("name", searchedName);
|
||||||
|
|
||||||
|
List<PrimaryHealthCareCenterJPA> results = query.getResultList();
|
||||||
|
if (results.size() > 0)
|
||||||
|
return this.commonServices.getPOJOforPrimaryHealthCareCenterJPA(results.get(0));
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteHealthCareCenter(int id) throws Exception {
|
||||||
|
PrimaryHealthCareCenterJPA cap = entman.find(PrimaryHealthCareCenterJPA.class, id);
|
||||||
|
|
||||||
|
if (cap == null) {
|
||||||
|
throw new Exception("No se puede borrar el CAP porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
entman.remove(cap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PrimaryHealthCareCenterTO insertHealthCareCenter(String name, String location) throws Exception {
|
||||||
|
PrimaryHealthCareCenterJPA cap = new PrimaryHealthCareCenterJPA(name, location);
|
||||||
|
entman.persist(cap);
|
||||||
|
|
||||||
|
return this.commonServices.getPOJOforPrimaryHealthCareCenterJPA(cap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCAPCount() {
|
||||||
|
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from PrimaryHealthCareCenterJPA", Long.class);
|
||||||
|
|
||||||
|
return query.getSingleResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PrimaryHealthCareCenterTO> listCAPsPaged(int pageNumber, int pageSize) {
|
||||||
|
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery("SELECT c from PrimaryHealthCareCenterJPA c order by c.name", PrimaryHealthCareCenterJPA.class);
|
||||||
|
|
||||||
|
if (pageSize > 0) {
|
||||||
|
query.setFirstResult(pageNumber * pageSize);
|
||||||
|
query.setMaxResults(pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PrimaryHealthCareCenterJPA> allJPA = query.getResultList();
|
||||||
|
List<PrimaryHealthCareCenterTO> caps = new ArrayList<PrimaryHealthCareCenterTO>();
|
||||||
|
|
||||||
|
for (PrimaryHealthCareCenterJPA item : allJPA) {
|
||||||
|
caps.add(commonServices.getPOJOforPrimaryHealthCareCenterJPA(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
return caps;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package ejb.systemAdmin;
|
package ejb.systemAdmin;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
|
|
||||||
import TO.LoggedUserTO;
|
import TO.LoggedUserTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -25,4 +28,16 @@ public interface SystemAdminFacadeRemote {
|
|||||||
public void deleteSpecialty(int id) throws Exception;
|
public void deleteSpecialty(int id) throws Exception;
|
||||||
|
|
||||||
public MedicalSpecialtyTO insertSpecialty(String name, String description) throws Exception;
|
public MedicalSpecialtyTO insertSpecialty(String name, String description) throws Exception;
|
||||||
|
|
||||||
|
public PrimaryHealthCareCenterTO updateHealthCareCenter(int id, String name, String location) throws Exception;
|
||||||
|
|
||||||
|
public PrimaryHealthCareCenterTO findHealthCareCenterByName(String name);
|
||||||
|
|
||||||
|
public void deleteHealthCareCenter(int id) throws Exception;
|
||||||
|
|
||||||
|
public PrimaryHealthCareCenterTO insertHealthCareCenter(String name, String location) throws Exception;
|
||||||
|
|
||||||
|
public Long getCAPCount();
|
||||||
|
|
||||||
|
public List<PrimaryHealthCareCenterTO> listCAPsPaged(int pageNumber, int pageSize);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package jpa;
|
package jpa;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
@@ -36,7 +37,7 @@ public class MedicalTestJPA implements Serializable {
|
|||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private int id;
|
private int id;
|
||||||
private Date date;
|
private Date date;
|
||||||
private long time;
|
private LocalTime time;
|
||||||
private String observations;
|
private String observations;
|
||||||
private String highresimage;
|
private String highresimage;
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
@@ -56,7 +57,7 @@ public class MedicalTestJPA implements Serializable {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MedicalTestJPA(int id, Date date, long time, String observations, String highresimage, MedicalTestType type, PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
|
public MedicalTestJPA(int id, Date date, LocalTime time, String observations, String highresimage, MedicalTestType type, PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
@@ -83,11 +84,11 @@ public class MedicalTestJPA implements Serializable {
|
|||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTime() {
|
public LocalTime getTime() {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(long time) {
|
public void setTime(LocalTime time) {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public class AuthorizationFilter implements Filter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.sendRedirect(req.getContextPath() + "/home.xhtml");
|
resp.sendRedirect(req.getContextPath() + "/login.xhtml");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (Exceptions.is(e, PersistenceException.class) == true) {
|
if (Exceptions.is(e, PersistenceException.class) == true) {
|
||||||
if (ses != null)
|
if (ses != null)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class MenuMBean implements Serializable {
|
|||||||
subMenu = new DefaultSubMenu("Administración del sistema", "fa fa-wrench");
|
subMenu = new DefaultSubMenu("Administración del sistema", "fa fa-wrench");
|
||||||
|
|
||||||
subMenu.addElement(createMenuItem("Gestionar especialidades", "fa fa-file-text-o", "/systemAdmin/ManageSpecialties", null));
|
subMenu.addElement(createMenuItem("Gestionar especialidades", "fa fa-file-text-o", "/systemAdmin/ManageSpecialties", null));
|
||||||
subMenu.addElement(createMenuItem("Centros At. Primaria", "fa fa-hospital-o", "/systemAdmin/ManageSpecialties", null));
|
subMenu.addElement(createMenuItem("Centros At. Primaria", "fa fa-hospital-o", "/systemAdmin/ManageHealthCareCenters", null));
|
||||||
subMenu.addElement(new DefaultSeparator());
|
subMenu.addElement(new DefaultSeparator());
|
||||||
subMenu.addElement(createMenuItem("Ver médicos de un CAP", "fa fa-medkit", "/systemAdmin/ManageSpecialties", null));
|
subMenu.addElement(createMenuItem("Ver médicos de un CAP", "fa fa-medkit", "/systemAdmin/ManageSpecialties", null));
|
||||||
subMenu.addElement(new DefaultSeparator());
|
subMenu.addElement(new DefaultSeparator());
|
||||||
|
|||||||
@@ -1,27 +1,245 @@
|
|||||||
package managedbean.medicalTest;
|
package managedbean.medicalTest;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.faces.application.FacesMessage;
|
||||||
|
import javax.faces.event.AjaxBehaviorEvent;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
import managedbean.common.ManagedBeanBase;
|
import org.primefaces.event.FileUploadEvent;
|
||||||
|
import org.primefaces.event.SelectEvent;
|
||||||
|
import org.primefaces.model.UploadedFile;
|
||||||
|
|
||||||
@Named("MedicalTestMBean")
|
import TO.MedicalTestTO;
|
||||||
@RequestScoped
|
import TO.PatientTO;
|
||||||
|
import common.MedicalTestType;
|
||||||
|
import common.UserType;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
import managedbean.common.SessionUtils;
|
||||||
|
|
||||||
|
@Named("mt")
|
||||||
|
@ViewScoped
|
||||||
public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private int userID;
|
||||||
|
private UserType userType;
|
||||||
|
private List<MedicalTestTO> medicalTests;
|
||||||
|
private MedicalTestTO selected;
|
||||||
|
private PatientTO patSelected;
|
||||||
|
private boolean addNewMode = false;
|
||||||
|
private UploadedFile imageUpload;
|
||||||
|
|
||||||
public MedicalTestMBean() {
|
public MedicalTestMBean() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
// Inicialización de variables y propiedades van aquí.
|
this.userType = SessionUtils.getUserType();
|
||||||
|
this.userID = Integer.valueOf(SessionUtils.getUserId());
|
||||||
|
|
||||||
// Como realizar llamadas al EJB Remoto
|
this.selected = null;
|
||||||
// this.getRemoteManagerSystemAdmin().MetodoEJB
|
this.patSelected = null;
|
||||||
|
|
||||||
|
this.loadMedicalTests();
|
||||||
|
this.getPatients();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addMedicalTest() {
|
||||||
|
getRemoteManagerMedicalTest().addMedicalTest(this.selected.getPatient().getId(), userID,
|
||||||
|
this.selected.getDate(), this.selected.getTime(), this.selected.getType(),
|
||||||
|
this.selected.getObservations());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addImage() {
|
||||||
|
if(this.imageUpload != null ) {
|
||||||
|
String content = "data:"+imageUpload.getContentType()+";base64," + Base64.getEncoder().encodeToString(imageUpload.getContents());
|
||||||
|
System.out.println("FILE Content base64: ");
|
||||||
|
System.out.println(content);
|
||||||
|
this.selected.setHighresimage(content);
|
||||||
|
getRemoteManagerMedicalTest().addImage(this.selected.getId(), content);
|
||||||
|
this.loadMedicalTests();
|
||||||
|
this.imageUpload = null;
|
||||||
|
}else {
|
||||||
|
System.out.println("IMAGEN SUBIDA ES NULA");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public UploadedFile getImageUpload() {
|
||||||
|
return imageUpload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageUpload(UploadedFile imageUpload) {
|
||||||
|
this.imageUpload = imageUpload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeImage() {
|
||||||
|
this.selected.setHighresimage(null);
|
||||||
|
getRemoteManagerMedicalTest().removeImage(this.selected.getId());
|
||||||
|
this.loadMedicalTests();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MedicalTestTO getSelected() {
|
||||||
|
return this.selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelected(MedicalTestTO selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PatientTO getPatSelected() {
|
||||||
|
return this.patSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPatSelected(PatientTO s) {
|
||||||
|
this.patSelected = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadMedicalTests() {
|
||||||
|
if (userType == UserType.PATIENT) {
|
||||||
|
// Cargar las pruebas para el paciente en sesión
|
||||||
|
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForPatient(userID);
|
||||||
|
} else if (userType == UserType.SPECIALIST_DOCTOR) {
|
||||||
|
// Cargar las pruebas que el doctor especialista ha creado
|
||||||
|
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForSpecialistDoctor(userID,
|
||||||
|
this.patIdSelected);
|
||||||
|
} else if (userType == UserType.FAMILY_DOCTOR) {
|
||||||
|
// Cargar las pruebas para los pacientes del doctor de familia en sesión
|
||||||
|
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForFamilyDoctor(userID,
|
||||||
|
this.patIdSelected);
|
||||||
|
} else {
|
||||||
|
// Nothing todo
|
||||||
|
this.medicalTests = new ArrayList<MedicalTestTO>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PatientTO> getPatients() {
|
||||||
|
if (userType == UserType.SPECIALIST_DOCTOR) {
|
||||||
|
// Cargar los pacientes a los que ha añadido pruebas médicas el médico
|
||||||
|
// especialista
|
||||||
|
return getRemoteManagerMedicalTest().loadPatientsForSpecialistDoctor(userID);
|
||||||
|
} else if (userType == UserType.FAMILY_DOCTOR) {
|
||||||
|
// Cargar los pacientes del médico de familia que tiene pruebas médicas hechas
|
||||||
|
return getRemoteManagerMedicalTest().loadPatientsForFamilyDoctor(userID);
|
||||||
|
} else {
|
||||||
|
// Nothing todo
|
||||||
|
return new ArrayList<PatientTO>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MedicalTestTO> getMedicalTests() {
|
||||||
|
return this.medicalTests;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedicalTests(List<MedicalTestTO> list) {
|
||||||
|
// Nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************** METODOS PARA LA VISTA */
|
||||||
|
private int patIdSelected = -1;
|
||||||
|
|
||||||
|
public void setPatIdSelected(Integer value) {
|
||||||
|
this.patIdSelected = value;
|
||||||
|
this.addNewMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPatIdSelected() {
|
||||||
|
return this.patIdSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSpecialistDoctor() {
|
||||||
|
return this.userType == UserType.SPECIALIST_DOCTOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPatSelector() {
|
||||||
|
return !(userType == UserType.PATIENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSelectPatient(AjaxBehaviorEvent event) {
|
||||||
|
this.selected = null;
|
||||||
|
this.loadMedicalTests();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSelectMT(SelectEvent event) {
|
||||||
|
this.selected = (MedicalTestTO) event.getObject();
|
||||||
|
this.addNewMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMT() {
|
||||||
|
if (this.patIdSelected != -1) {
|
||||||
|
this.selected = new MedicalTestTO();
|
||||||
|
this.selected.setId(-1);
|
||||||
|
this.selected.setObservations("");
|
||||||
|
this.selected.setType(MedicalTestType.BLOOD_TEST);
|
||||||
|
this.addNewMode = true;
|
||||||
|
} else {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Atención!",
|
||||||
|
"Debe elegir un paciente al que añadir la prueba médica.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAddNewMode() {
|
||||||
|
return addNewMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddNewMode(boolean addNewMode) {
|
||||||
|
this.addNewMode = addNewMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getViewCreate() {
|
||||||
|
return addNewMode && userType == UserType.SPECIALIST_DOCTOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getViewEdit() {
|
||||||
|
return !addNewMode && this.selected != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MedicalTestType> getMedicalTestTypes() {
|
||||||
|
ArrayList<MedicalTestType> list = new ArrayList<MedicalTestType>();
|
||||||
|
list.add(MedicalTestType.BLOOD_TEST);
|
||||||
|
list.add(MedicalTestType.CT_SCAN);
|
||||||
|
list.add(MedicalTestType.MAGNETIC_RESONANCE_IMAGING);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMedicalTestTypeSelected() {
|
||||||
|
return this.selected.getType().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedicalTestTypeSelected(String val) {
|
||||||
|
System.out.println("********************************");
|
||||||
|
System.out.println(val);
|
||||||
|
System.out.println("********************************");
|
||||||
|
MedicalTestType mt;
|
||||||
|
if (val.equals("BLOOD_TEST")) {
|
||||||
|
mt = MedicalTestType.BLOOD_TEST;
|
||||||
|
} else if (val.equals("CT_SCAN")) {
|
||||||
|
mt = MedicalTestType.CT_SCAN;
|
||||||
|
} else {
|
||||||
|
mt = MedicalTestType.MAGNETIC_RESONANCE_IMAGING;
|
||||||
|
}
|
||||||
|
this.selected.setType(mt);
|
||||||
|
System.out.println("********************************");
|
||||||
|
System.out.println(this.selected.getType());
|
||||||
|
System.out.println("********************************");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save() {
|
||||||
|
String res = getRemoteManagerMedicalTest().addMedicalTest(this.patIdSelected, userID, this.selected.getDate(),
|
||||||
|
this.selected.getTime(), this.selected.getType(), this.selected.getObservations());
|
||||||
|
if (res.equals("ok")) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Éxito", "Guardado correctamente");
|
||||||
|
} else {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Error", res);
|
||||||
|
}
|
||||||
|
this.loadMedicalTests();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,10 +100,15 @@ public class QuestionsMBean extends ManagedBeanBase implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addNewQuestion() {
|
public void addNewQuestion() {
|
||||||
getRemoteManagerMedicalTest().askQuestion(userID, this.selected.getTitle(), this.selected.getMessage());
|
String result = getRemoteManagerMedicalTest().askQuestion(userID, this.selected.getTitle(), this.selected.getMessage());
|
||||||
|
if(result == "ok") {
|
||||||
this.create();
|
this.create();
|
||||||
this.loadQuestions();
|
this.loadQuestions();
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Datos guardados", "La pregunta se registrado correctamente en el sistema.");
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Datos guardados", "La pregunta se registrado correctamente en el sistema.");
|
||||||
|
} else {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Error", result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShowPanelDetail() {
|
public boolean isShowPanelDetail() {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class LoginMBean extends ManagedBeanBase {
|
|||||||
|
|
||||||
// logout event, invalidate session
|
// logout event, invalidate session
|
||||||
public String logout() {
|
public String logout() {
|
||||||
this.addFacesMessageKeep(FacesMessage.SEVERITY_INFO, "Sessión cerrada", "Ha cerrado correctament su ssesión. Hasta la vista");
|
this.addFacesMessageKeep(FacesMessage.SEVERITY_INFO, "Sessión cerrada", "Ha cerrado correctament su sesión. Hasta la vista");
|
||||||
|
|
||||||
SessionUtils.DestroySession();
|
SessionUtils.DestroySession();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,173 @@
|
|||||||
|
package managedbean.systemAdmin;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.faces.application.FacesMessage;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.primefaces.event.RowEditEvent;
|
||||||
|
import org.primefaces.model.LazyDataModel;
|
||||||
|
import org.primefaces.model.SortOrder;
|
||||||
|
|
||||||
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
|
||||||
|
@Named("ManageHealthCareCenters")
|
||||||
|
@ViewScoped
|
||||||
|
public class ManageHealthCareCentersMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
private String location;
|
||||||
|
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||||
|
private LazyDataModel<PrimaryHealthCareCenterTO> lazyDataModelCAPsList;
|
||||||
|
|
||||||
|
public ManageHealthCareCentersMBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
this.lazyDataModelCAPsList = new LazyDataModel<PrimaryHealthCareCenterTO>() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PrimaryHealthCareCenterTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||||
|
Long totalRowCount = getRemoteManagerSystemAdmin().getCAPCount();
|
||||||
|
this.setRowCount(totalRowCount.intValue());
|
||||||
|
|
||||||
|
return getRemoteManagerSystemAdmin().listCAPsPaged((first / pageSize), pageSize);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public LazyDataModel<PrimaryHealthCareCenterTO> getlazyDataModelCAPsList() {
|
||||||
|
return lazyDataModelCAPsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocation(String location) {
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showPrimaryHealthCareCenterData(PrimaryHealthCareCenterTO cap) {
|
||||||
|
this.primaryHealthCareCenter = cap;
|
||||||
|
|
||||||
|
if (cap == null) {
|
||||||
|
this.id = null;
|
||||||
|
this.name = "";
|
||||||
|
this.location = "";
|
||||||
|
} else {
|
||||||
|
this.id = cap.getId();
|
||||||
|
this.name = cap.getName();
|
||||||
|
this.location = cap.getLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() {
|
||||||
|
return primaryHealthCareCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterTO value) {
|
||||||
|
this.primaryHealthCareCenter = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRowEdit(RowEditEvent event) {
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
if (((PrimaryHealthCareCenterTO) event.getObject()).getName() == null || ((PrimaryHealthCareCenterTO) event.getObject()).getName().trim().length() == 0) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre para el centro.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
if (((PrimaryHealthCareCenterTO) event.getObject()).getLocation() == null || ((PrimaryHealthCareCenterTO) event.getObject()).getLocation().trim().length() == 0) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Localización no rellena", "Por favor, escriba una localización.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error == 0) {
|
||||||
|
try {
|
||||||
|
this.getRemoteManagerSystemAdmin().updateHealthCareCenter(((PrimaryHealthCareCenterTO) event.getObject()).getId(), ((PrimaryHealthCareCenterTO) event.getObject()).getName(),
|
||||||
|
((PrimaryHealthCareCenterTO) event.getObject()).getLocation());
|
||||||
|
|
||||||
|
this.showPrimaryHealthCareCenterData(null);
|
||||||
|
|
||||||
|
FacesMessage msg = new FacesMessage("CAP editado", ((PrimaryHealthCareCenterTO) event.getObject()).getName());
|
||||||
|
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.manageException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRowCancel(RowEditEvent event) {
|
||||||
|
FacesMessage msg = new FacesMessage("Edición cancelada", ((PrimaryHealthCareCenterTO) event.getObject()).getName());
|
||||||
|
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteDataById(Integer id) throws IOException {
|
||||||
|
try {
|
||||||
|
this.getRemoteManagerSystemAdmin().deleteHealthCareCenter(id);
|
||||||
|
this.showPrimaryHealthCareCenterData(null);
|
||||||
|
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "El CAP se ha borrado", "Los datos del Centro de Atención Primaria se han borrado correctamente.");
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.manageException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertData() {
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
if (name == null || name.trim().length() == 0) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre para el centro.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
if (location == null || location.trim().length() == 0) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Localización no rellena", "Por favor, escriba una localización.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.getRemoteManagerSystemAdmin().findHealthCareCenterByName(name) != null) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "CAP ya existente", "El CAP ya se encuentra en la base de datos");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error == 0) {
|
||||||
|
try {
|
||||||
|
this.getRemoteManagerSystemAdmin().insertHealthCareCenter(name, location);
|
||||||
|
this.showPrimaryHealthCareCenterData(null);
|
||||||
|
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos del Centro de Atención Primaria se han guardado correctamente.");
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.manageException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,6 @@ import javax.inject.Named;
|
|||||||
|
|
||||||
import TO.LoggedUserTO;
|
import TO.LoggedUserTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
import common.Constants;
|
|
||||||
import managedbean.common.ManagedBeanBase;
|
import managedbean.common.ManagedBeanBase;
|
||||||
import managedbean.common.SessionUtils;
|
import managedbean.common.SessionUtils;
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void refreshFormData() {
|
private void refreshFormData() {
|
||||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listAllMedicalSpecialities();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
@@ -118,9 +117,7 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
|||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
try {
|
try {
|
||||||
MedicalSpecialtyTO ms = this.getRemoteManagerSystemAdmin().updateSpecialty(this.medicalSpecialty.getId(), this.medicalSpecialty.getName(),
|
this.getRemoteManagerSystemAdmin().updateSpecialty(this.medicalSpecialty.getId(), this.medicalSpecialty.getName(),this.medicalSpecialty.getDescription());
|
||||||
this.medicalSpecialty.getDescription());
|
|
||||||
|
|
||||||
this.showSpecialtyData(null);
|
this.showSpecialtyData(null);
|
||||||
this.refreshFormData();
|
this.refreshFormData();
|
||||||
|
|
||||||
@@ -149,7 +146,7 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
|||||||
this.showSpecialtyData(null);
|
this.showSpecialtyData(null);
|
||||||
this.refreshFormData();
|
this.refreshFormData();
|
||||||
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los especialidad se ha borrado", "Los datos de la especialidad se han borrado correctamente.");
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "La especialidad se ha borrado", "Los datos de la especialidad se han borrado correctamente.");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.manageException(e);
|
this.manageException(e);
|
||||||
}
|
}
|
||||||
@@ -175,8 +172,7 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
|||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
try {
|
try {
|
||||||
MedicalSpecialtyTO ms = this.getRemoteManagerSystemAdmin().insertSpecialty(name, description);
|
this.getRemoteManagerSystemAdmin().insertSpecialty(name, description);
|
||||||
|
|
||||||
this.showSpecialtyData(null);
|
this.showSpecialtyData(null);
|
||||||
this.refreshFormData();
|
this.refreshFormData();
|
||||||
|
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ CREATE TABLE myhealth.medicaltest
|
|||||||
"time" TIME NOT NULL,
|
"time" TIME NOT NULL,
|
||||||
observations TEXT COLLATE pg_catalog."default",
|
observations TEXT COLLATE pg_catalog."default",
|
||||||
highresimage TEXT,
|
highresimage TEXT,
|
||||||
type VARCHAR(30) NOT NULL,
|
type VARCHAR(50) NOT NULL,
|
||||||
patientid INTEGER REFERENCES myhealth.patient(id) NOT NULL,
|
patientid INTEGER REFERENCES myhealth.patient(id) NOT NULL,
|
||||||
specialistdoctorid INTEGER REFERENCES myhealth.specialistdoctor(id) NOT NULL,
|
specialistdoctorid INTEGER REFERENCES myhealth.specialistdoctor(id) NOT NULL,
|
||||||
CONSTRAINT medicaltest_pkey PRIMARY KEY (id)
|
CONSTRAINT medicaltest_pkey PRIMARY KEY (id)
|
||||||
|
|||||||
@@ -659,13 +659,13 @@ INSERT INTO myhealth.visit(date, "time", observations, result, patientid, family
|
|||||||
|
|
||||||
-- Insertar datos de prueba para medical test
|
-- Insertar datos de prueba para medical test
|
||||||
INSERT INTO myhealth.medicaltest(date, "time", observations, highresimage, type, patientid, specialistdoctorid) VALUES
|
INSERT INTO myhealth.medicaltest(date, "time", observations, highresimage, type, patientid, specialistdoctorid) VALUES
|
||||||
('2019-12-23','09:00:00','Observaciones del medical test1','somehighresimage1', 'Radiografía Tórax', 1, 1),
|
('2019-12-23','09:00:00','Observaciones del medical test1','somehighresimage1', 'MAGNETIC_RESONANCE_IMAGING', 1, 1),
|
||||||
('2019-12-24','19:20:00','Observaciones del medical test2','somehighresimage2', 'TAC Craneal', 2, 1),
|
('2019-12-24','19:20:00','Observaciones del medical test2','somehighresimage2', 'CT_SCAN', 1, 1),
|
||||||
('2019-12-25','18:35:20','Observaciones del medical test3','somehighresimage3', 'Radiografía Cadera', 3, 2),
|
('2019-12-25','18:35:20','Observaciones del medical test3','somehighresimage3', 'BLOOD_TEST', 1, 1),
|
||||||
('2019-12-26','08:15:10','Observaciones del medical test4','somehighresimage4', 'TAC Rodilla', 4, 2),
|
('2019-12-26','08:15:10','Observaciones del medical test4','somehighresimage4', 'CT_SCAN', 4, 2),
|
||||||
('2019-12-27','18:15:10','Observaciones del medical test5','somehighresimage5', 'TAC Pie Izquierdo', 5, 1),
|
('2019-12-27','18:15:10','Observaciones del medical test5','somehighresimage5', 'CT_SCAN', 5, 1),
|
||||||
('2019-12-28','22:15:40','Observaciones del medical test6','somehighresimage6', 'Radiografía Tórax', 6, 3),
|
('2019-12-28','22:15:40','Observaciones del medical test6','somehighresimage6', 'MAGNETIC_RESONANCE_IMAGING', 6, 3),
|
||||||
('2019-12-28','23:15:40','Observaciones del medical test7','somehighresimage7', 'Radiografía Tibia', 7, 1),
|
('2019-12-28','23:15:40','Observaciones del medical test7','somehighresimage7', 'MAGNETIC_RESONANCE_IMAGING', 7, 1),
|
||||||
('2019-12-29','11:12:20','Observaciones del medical test8','somehighresimage8', 'TAC Craneal', 8, 1),
|
('2019-12-29','11:12:20','Observaciones del medical test8','somehighresimage8', 'CT_SCAN', 8, 1),
|
||||||
('2019-12-30','13:17:50','Observaciones del medical test9','somehighresimage9', 'Radiografía Cadera', 2, 2),
|
('2019-12-30','13:17:50','Observaciones del medical test9','somehighresimage9', 'MAGNETIC_RESONANCE_IMAGING', 2, 2),
|
||||||
('2019-12-31','05:08:30','Observaciones del medical test10','somehighresimage10', 'Radiografía rodilla', 4, 1);
|
('2019-12-31','05:08:30','Observaciones del medical test10','somehighresimage10', 'MAGNETIC_RESONANCE_IMAGING', 4, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user