Merge branch 'master' of http://pdp-pds.eimt.uoc.edu/pds19-grupo2/myhealth.git
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
<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:ui="http://java.sun.com/jsf/facelets"
|
|
||||||
xmlns:f="http://java.sun.com/jsf/core"
|
|
||||||
xmlns:h="http://java.sun.com/jsf/html"
|
|
||||||
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
|
||||||
|
|
||||||
<ui:composition template="../header.xhtml">
|
<ui:composition template="../header.xhtml">
|
||||||
@@ -15,33 +12,41 @@
|
|||||||
<h:form id="frmMT">
|
<h:form id="frmMT">
|
||||||
<p:panel id="mainPanel" header="Pruebas médicas">
|
<p:panel id="mainPanel" header="Pruebas médicas">
|
||||||
<f:facet name="actions">
|
<f:facet name="actions">
|
||||||
<h:commandLink rendered="#{mt.specialistDoctor}"
|
<h:commandLink rendered="#{mt.specialistDoctor}" action="#{mt.addMT}" immediate="true" update="frmMT" styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
|
||||||
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:outputText styleClass="ui-icon pi pi-plus" />
|
||||||
</h:commandLink>
|
</h:commandLink>
|
||||||
|
<h:commandLink rendered="#{mt.patSelector}" action="#{mt.clearFilteredPatient}" immediate="true" update="frmMT" styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
|
||||||
|
<h:outputText styleClass="ui-icon pi pi-times-circle" title="Quitar filtro y ver todos los registros" />
|
||||||
|
</h:commandLink>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<p:selectOneMenu rendered="#{mt.specialistDoctor}" id="lazy" value="#{mt.patIdSelected}"
|
<p:autoComplete rendered="#{mt.patSelector}" id="filterPatient" widgetVar="filterPatient" dropdown="true" value="#{mt.patientFilterSelected}" completeMethod="#{mt.completePatientFilter}" var="p"
|
||||||
converter="omnifaces.SelectItemsConverter">
|
itemLabel="#{p.displayName}" itemValue="#{p}" forceSelection="true" placeholder="Seleccione un paciente o teclee para buscar...">
|
||||||
<p:ajax event="valueChange" listener="#{mt.onSelectPatient}"
|
<o:converter converterId="omnifaces.ListConverter" list="#{mt.patientWithTestList}" />
|
||||||
update="frmMT" />
|
<f:selectItem itemLabel="Ver todos" itemValue="">
|
||||||
<f:selectItem itemLabel="Todos" itemValue="-1" />
|
<p:column headerText="Num. Prof.">
|
||||||
<f:selectItems value="#{mt.patients}" var="el"
|
<h:outputText value="Ver todos" />
|
||||||
itemLabel="#{el.name} #{el.surname}" itemValue="#{el.id}" />
|
</p:column>
|
||||||
</p:selectOneMenu>
|
</f:selectItem>
|
||||||
<p:orderList id="medicalTestList" value="#{mt.medicalTests}"
|
<p:column headerText="Num. Prof.">
|
||||||
var="el" itemValue="#{el}" controlsLocation="none"
|
<h:outputText value="#{p.personalIdentificationCode}" />
|
||||||
responsive="true">
|
</p:column>
|
||||||
<p:ajax event="select" listener="#{mt.onSelectMT}"
|
<p:column headerText="Nombre">
|
||||||
update="frmMT,frmNEW,frmImage" />
|
<h:outputText value="#{p.name}" />
|
||||||
<o:converter converterId="omnifaces.ListConverter"
|
</p:column>
|
||||||
list="#{mt.medicalTests}" />
|
<p:column headerText="Apellidos">
|
||||||
|
<h:outputText value="#{p.surname}" />
|
||||||
|
</p:column>
|
||||||
|
<p:ajax event="itemSelect" listener="#{mt.onSelectPatient}" update="medicalTestList" />
|
||||||
|
<p:ajax event="change" listener="#{mt.onChangePatient}" update="medicalTestList" />
|
||||||
|
</p:autoComplete>
|
||||||
|
|
||||||
|
<p:orderList id="medicalTestList" value="#{mt.medicalTests}" var="el" itemValue="#{el}" controlsLocation="none" responsive="true">
|
||||||
|
<p:ajax event="select" listener="#{mt.onSelectMT}" update="frmNEW,frmImage" />
|
||||||
|
<o:converter converterId="omnifaces.ListConverter" list="#{mt.medicalTests}" />
|
||||||
<p:column>
|
<p:column>
|
||||||
<h:outputText value="#{el.onlyDate} - #{el.type.testTypeName}" />
|
<h:outputText value="#{el.onlyDate} - #{el.type.testTypeName}" />
|
||||||
<br />
|
<br />
|
||||||
<h:outputText rendered="#{mt.patIdSelected == -1}"
|
<h:outputText rendered="#{mt.patientFilterSelected == null}" value="#{el.patient.displayName}" style="font-size: 0.8em !important; font-style: italic;" />
|
||||||
value="#{el.patient.name} #{el.patient.surname}"
|
|
||||||
style="font-size: 0.8em !important; font-style: italic;" />
|
|
||||||
</p:column>
|
</p:column>
|
||||||
</p:orderList>
|
</p:orderList>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
@@ -49,76 +54,109 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-7 ui-md-7">
|
<div class="ui-g-7 ui-md-7">
|
||||||
<h:form id="frmImage" enctype="multipart/form-data">
|
<h:form id="frmImage" enctype="multipart/form-data">
|
||||||
<p:panel rendered="#{mt.viewEdit}" id="detailPanel"
|
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
|
||||||
header="Detalle de prueba médica">
|
<p:commandButton value="Sí" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check" />
|
||||||
|
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times" />
|
||||||
|
</p:confirmDialog>
|
||||||
|
|
||||||
|
<p:panel rendered="#{mt.viewEdit}" id="detailPanel" header="Detalle de prueba médica">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-4 ui-md-4">Fecha:</div>
|
<div class="ui-g-3">Fecha:</div>
|
||||||
<div class="ui-g-8 ui-md-8">
|
<div class="ui-g-9">
|
||||||
<h:outputText value="#{mt.selected.date}"></h:outputText>
|
<h:outputText value="#{mt.selected.date}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">Hora:</div>
|
<div class="ui-g-3">Hora:</div>
|
||||||
<div class="ui-g-8 ui-md-8">
|
<div class="ui-g-9">
|
||||||
<h:outputText value="#{mt.selected.time}"></h:outputText>
|
<h:outputText value="#{mt.selected.time}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">Observaciones:</div>
|
<div class="ui-g-3">Observaciones:</div>
|
||||||
<div class="ui-g-8 ui-md-8">
|
<div class="ui-g-9">
|
||||||
<h:outputText escape="false" value="#{mt.selected.observations}"></h:outputText>
|
<h:outputText escape="false" value="#{mt.selected.observations}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">Tipo de prueba:</div>
|
<div class="ui-g-3">Tipo de prueba:</div>
|
||||||
<div class="ui-g-8 ui-md-8">
|
<div class="ui-g-9">
|
||||||
<h:outputText value="#{mt.selected.type.testTypeName}"></h:outputText>
|
<h:outputText value="#{mt.selected.type.testTypeName}" />
|
||||||
</div>
|
</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-12 ui-md-12">
|
<div class="ui-g-12">
|
||||||
|
<p:outputPanel rendered="#{mt.selected.type != 'BLOOD_TEST'}">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-3">Imagen de alta resolución:</div>
|
||||||
|
<div class="ui-g-5">
|
||||||
<p:fileUpload rendered="#{mt.specialistDoctor}" value="#{mt.imageUpload}" mode="simple" skinSimple="true" />
|
<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-12 ui-md-12">
|
<div class="ui-g-2">
|
||||||
<img src="#{mt.selected.highresimage}" style="max-width: 300px !important;"></img>
|
<p:commandButton rendered="#{mt.specialistDoctor}" value="Subir" icon="pi pi-upload" ajax="false" action="#{mt.addImage}" update="frmImage" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-12 ui-md-12">
|
<div class="ui-g-2">
|
||||||
<p:commandButton rendered="#{mt.specialistDoctor}" action="#{mt.removeImage}"
|
<p:commandButton rendered="#{mt.specialistDoctor}" value="Eliminar" icon="pi pi-trash" action="#{mt.removeImage}" disabled="#{mt.selected.highresimage == null}"
|
||||||
disabled="#{mt.selected.highresimage == null}"
|
update="frmImage">
|
||||||
value="Eliminar" icon="pi pi-delete" update="frmImage"/>
|
<p:confirm header="Confirme la eliminación" message="¿Está seguro de que desea eliminar la imagen?" icon="pi pi-exclamation-triangle" />
|
||||||
|
</p:commandButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-12 ui-md-12" style="align-content: center; text-align: center;">
|
||||||
|
<img src="#{mt.selected.highresimage}" style="max-width: 300px !important;" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:outputPanel>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
</h:form>
|
</h:form>
|
||||||
<h:form id="frmNEW">
|
<h:form id="frmNEW">
|
||||||
<p:panel rendered="#{mt.viewCreate}" id="createPanel"
|
<p:growl id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
header="Detalle de prueba médica">
|
|
||||||
|
|
||||||
|
<p:panel rendered="#{mt.viewCreate}" id="createPanel" header="Añadir una nueva prueba médica">
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
<div class="ui-g-4 ui-md-4">Fecha:</div>
|
<div class="ui-g-3">Paciente:</div>
|
||||||
<div class="ui-g-8 ui-md-8">
|
<div class="ui-g-9">
|
||||||
<h:outputText value="#{mt.selected.date}"></h:outputText>
|
<p:autoComplete id="addTestPatient" dropdown="true" value="#{mt.patSelected}" completeMethod="#{mt.completePatient}" var="p" itemLabel="#{p.displayName}" itemValue="#{p}"
|
||||||
|
forceSelection="true" placeholder="Seleccione un paciente o teclee para buscar..." required="true"
|
||||||
|
requiredMessage="Por favor, seleccione un paciente al cual aádir la prueba.">
|
||||||
|
<o:converter converterId="omnifaces.ListConverter" list="#{mt.patientList}" />
|
||||||
|
<p:column headerText="Num. Prof.">
|
||||||
|
<h:outputText value="#{p.personalIdentificationCode}" />
|
||||||
|
</p:column>
|
||||||
|
<p:column headerText="Nombre">
|
||||||
|
<h:outputText value="#{p.name}" />
|
||||||
|
</p:column>
|
||||||
|
<p:column headerText="Apellidos">
|
||||||
|
<h:outputText value="#{p.surname}" />
|
||||||
|
</p:column>
|
||||||
|
</p:autoComplete>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">Hora:</div>
|
|
||||||
<div class="ui-g-8 ui-md-8">
|
<div class="ui-g-3">Fecha:</div>
|
||||||
<h:outputText value="#{mt.selected.time}"></h:outputText>
|
<div class="ui-g-9">
|
||||||
|
<p:datePicker id="fecha" value="#{mt.selected.date}" pattern="dd/MM/yyyy" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
|
requiredMessage="Especifique la fecha de la prueba médica" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">Observaciones:</div>
|
|
||||||
<div class="ui-g-8 ui-md-8">
|
<div class="ui-g-3">Hora:</div>
|
||||||
<p:textEditor value="#{mt.selected.observations}"></p:textEditor>
|
<div class="ui-g-9">
|
||||||
|
<p:datePicker id="hora" value="#{mt.selected.time}" timeOnly="true" pattern="HH:mm" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
|
requiredMessage="Especifique la hora de la prueba médica">
|
||||||
|
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||||
|
</p:datePicker>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">Tipo de prueba:</div>
|
|
||||||
<div class="ui-g-8 ui-md-8">
|
<div class="ui-g-3">Observaciones:</div>
|
||||||
<p:selectOneMenu value="#{mt.medicalTestTypeSelected}">
|
<div class="ui-g-9">
|
||||||
<f:selectItems value="#{mt.medicalTestTypes}" var="el"
|
<p:textEditor value="#{mt.selected.observations}" required="true" requiredMessage="Debe indicar las observaciones de la prueba" />
|
||||||
itemLabel="#{el.testTypeName}" itemValue="#{el.name}" />
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-3">Tipo de prueba:</div>
|
||||||
|
<div class="ui-g-9">
|
||||||
|
<p:selectOneMenu id="selUsertype" value="#{mt.selected.type}" required="true" unselectable="false" requiredMessage="Debe especificar un tipo de prueba médica">
|
||||||
|
<f:selectItems value="#{mt.medicalTestTypes}" var="item" itemLabel="#{item.testTypeName}" />
|
||||||
</p:selectOneMenu>
|
</p:selectOneMenu>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4"></div>
|
<div class="ui-g-4 ui-md-5" />
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-2">
|
||||||
<p:commandButton value="Guardar" action="#{mt.save}"
|
<p:commandButton value="Guardar" action="#{mt.save}" icon="pi pi-save" update="frmMT,frmImage,frmNEW" />
|
||||||
icon="pi pi-save" update="frmMT,frmImage,frmNEW" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4"></div>
|
<div class="ui-g-4 ui-md-5" />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
</h:form>
|
</h:form>
|
||||||
|
|||||||
@@ -35,8 +35,8 @@
|
|||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
<p:column style="width:80px; text-align: center;" headerText="Eliminar">
|
<p:column style="width:80px; text-align: center;" headerText="Eliminar">
|
||||||
<p:commandLink onclick="if (! confirm('¿Seguro que quiere borrar el CAP?')) return false" ajax="true" action="#{ManageHealthCareCenters.deleteDataById(cap.id)}" update=":frmListCAPs:mesgsList frmListCAPs" process="frmListCAPs">
|
<p:commandLink class="pi pi-trash" actionListener="#{ManageHealthCareCenters.deleteDataById(cap.id)}" update=":frmListCAPs:mesgsList frmListCAPs">
|
||||||
<span title="Borrar" class="fa fa-remove"/>
|
<p:confirm header="Eliminar" message="¿Está seguro de que quiere borrar el centro?" icon="pi pi-exclamation-triangle"/>
|
||||||
</p:commandLink>
|
</p:commandLink>
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
@@ -44,6 +44,11 @@
|
|||||||
<p:commandButton type="button" icon="pi pi-refresh" onclick="PF('dtCAP').getPaginator().setPage(0);" />
|
<p:commandButton type="button" icon="pi pi-refresh" onclick="PF('dtCAP').getPaginator().setPage(0);" />
|
||||||
</f:facet>
|
</f:facet>
|
||||||
</p:dataTable>
|
</p:dataTable>
|
||||||
|
|
||||||
|
<p:confirmDialog global="true">
|
||||||
|
<p:commandButton value="Sí" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check"/>
|
||||||
|
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times"/>
|
||||||
|
</p:confirmDialog>
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
</h:form>
|
</h:form>
|
||||||
|
|||||||
@@ -86,14 +86,11 @@
|
|||||||
</p:dataTable>
|
</p:dataTable>
|
||||||
|
|
||||||
<div class="ui-g-12 ui-g-nopad">
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
<div class="ui-g-4 ui-md-4" />
|
<div class="ui-g-4 ui-md-5" />
|
||||||
<div class="ui-g-2 ui-md-2 ">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4" />
|
<div class="ui-g-4 ui-md-5" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
|
|||||||
@@ -71,15 +71,11 @@
|
|||||||
</p:dataTable>
|
</p:dataTable>
|
||||||
|
|
||||||
<div class="ui-g-12 ui-g-nopad">
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
<div class="ui-g-4 ui-md-4" />
|
<div class="ui-g-4 ui-md-5" />
|
||||||
<div class="ui-g-2 ui-md-2 ">
|
|
||||||
<p:commandButton validateClient="true" value="Consultar" update="frmVisitList" action="#{VisitList.showData}" icon="pi pi-check" />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-2 ui-md-2">
|
<div class="ui-g-2 ui-md-2">
|
||||||
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4" />
|
<div class="ui-g-4 ui-md-5" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import TO.QuestionTO;
|
|||||||
import TO.SpecialistDoctorTO;
|
import TO.SpecialistDoctorTO;
|
||||||
import common.MedicalTestType;
|
import common.MedicalTestType;
|
||||||
import common.QuestionStatus;
|
import common.QuestionStatus;
|
||||||
|
import common.Utils;
|
||||||
import ejb.common.CommonFacadeLocal;
|
import ejb.common.CommonFacadeLocal;
|
||||||
import jpa.MedicalTestJPA;
|
import jpa.MedicalTestJPA;
|
||||||
import jpa.PatientJPA;
|
import jpa.PatientJPA;
|
||||||
@@ -24,12 +25,10 @@ import jpa.QuestionJPA;
|
|||||||
import jpa.SpecialistDoctorJPA;
|
import jpa.SpecialistDoctorJPA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los
|
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los métodos de la capa de negocio que implementan la logica de negocio y la interacción con la capa de
|
||||||
* métodos de la capa de negocio que implementan la logica de negocio y la
|
* persistencia.
|
||||||
* interacción con la capa de persistencia.
|
|
||||||
*
|
*
|
||||||
* Tanto los pacientes como los médicos deben acceder a la vista de pruebas
|
* Tanto los pacientes como los médicos deben acceder a la vista de pruebas médicas.
|
||||||
* médicas.
|
|
||||||
*
|
*
|
||||||
* @author rorden
|
* @author rorden
|
||||||
*
|
*
|
||||||
@@ -96,9 +95,7 @@ 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(
|
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);
|
||||||
"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);
|
||||||
|
|
||||||
@@ -117,9 +114,7 @@ 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(
|
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);
|
||||||
"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);
|
||||||
|
|
||||||
@@ -140,8 +135,7 @@ 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",
|
TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA q where q.id=:idquestion", QuestionJPA.class);
|
||||||
QuestionJPA.class);
|
|
||||||
|
|
||||||
query.setParameter("idquestion", idQuestion);
|
query.setParameter("idquestion", idQuestion);
|
||||||
|
|
||||||
@@ -156,29 +150,23 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
/**
|
/**
|
||||||
* Añadir pruebas médicas a una cita
|
* Añadir pruebas médicas a una cita
|
||||||
*
|
*
|
||||||
* Dado que será añadida por el médico especialista en sesión no hace falta más
|
* Dado que será añadida por el médico especialista en sesión no hace falta más información.
|
||||||
* información.
|
|
||||||
*
|
*
|
||||||
* @param patientiID
|
* @param patientiID
|
||||||
* @param date
|
* @param date
|
||||||
* @param time
|
* @param time
|
||||||
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias
|
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias magnéticas y TAC
|
||||||
* magnéticas y TAC
|
|
||||||
* @param observations
|
* @param observations
|
||||||
*/
|
*/
|
||||||
public String addMedicalTest(int patientID, int doctorSpecialistID, Date date, LocalTime time,
|
public MedicalTestTO addMedicalTest(int patientID, int doctorSpecialistID, Date date, LocalTime time, MedicalTestType testType, String observations) throws Exception {
|
||||||
MedicalTestType testType, String observations) {
|
|
||||||
try {
|
|
||||||
SpecialistDoctorJPA specDoctor = entman.find(SpecialistDoctorJPA.class, doctorSpecialistID);
|
SpecialistDoctorJPA specDoctor = entman.find(SpecialistDoctorJPA.class, doctorSpecialistID);
|
||||||
PatientJPA pat = entman.find(PatientJPA.class, patientID);
|
PatientJPA pat = entman.find(PatientJPA.class, patientID);
|
||||||
|
|
||||||
MedicalTestJPA mt = new MedicalTestJPA(0, date, time, observations, null, testType, pat, specDoctor);
|
MedicalTestJPA mt = new MedicalTestJPA(date, time, observations, null, testType, pat, specDoctor);
|
||||||
|
|
||||||
entman.persist(mt);
|
entman.persist(mt);
|
||||||
return "ok";
|
|
||||||
} catch (Exception ex) {
|
return this.commonServices.getPOJOforMedicalTestJPA(mt, 1);
|
||||||
return ex.getMessage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -197,8 +185,7 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private MedicalTestJPA getMedicalTestJPA(int idMedicalTest) {
|
private MedicalTestJPA getMedicalTestJPA(int idMedicalTest) {
|
||||||
TypedQuery<MedicalTestJPA> query = entman
|
TypedQuery<MedicalTestJPA> query = entman.createQuery("SELECT q from MedicalTestJPA q where q.id=:idMedicalTest", MedicalTestJPA.class);
|
||||||
.createQuery("SELECT q from MedicalTestJPA q where q.id=:idMedicalTest", MedicalTestJPA.class);
|
|
||||||
query.setParameter("idMedicalTest", idMedicalTest);
|
query.setParameter("idMedicalTest", idMedicalTest);
|
||||||
return query.getSingleResult();
|
return query.getSingleResult();
|
||||||
}
|
}
|
||||||
@@ -239,8 +226,7 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Long getSpecialistDoctorByMedicalSpecialityCount(int specialityId) {
|
public Long getSpecialistDoctorByMedicalSpecialityCount(int specialityId) {
|
||||||
TypedQuery<Long> query = entman.createQuery(
|
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from SpecialistDoctorJPA q where q.medicalSpecialty.id=:specId", Long.class);
|
||||||
"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();
|
||||||
@@ -251,13 +237,11 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
*
|
*
|
||||||
* @param speciality
|
* @param speciality
|
||||||
*/
|
*/
|
||||||
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(int specialityId, int pageNumber,
|
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(int specialityId, int pageNumber, int pageSize) {
|
||||||
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",
|
"SELECT q from SpecialistDoctorJPA q where q.medicalSpecialty.id=:specId order by q.medicalSpecialty.name asc, q.surname asc", SpecialistDoctorJPA.class);
|
||||||
SpecialistDoctorJPA.class);
|
|
||||||
query.setParameter("specId", specialityId);
|
query.setParameter("specId", specialityId);
|
||||||
|
|
||||||
if (pageSize > 0) {
|
if (pageSize > 0) {
|
||||||
@@ -278,9 +262,7 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
public List<MedicalTestTO> loadMedicalTestForPatient(int patientID) {
|
public List<MedicalTestTO> loadMedicalTestForPatient(int patientID) {
|
||||||
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
||||||
|
|
||||||
TypedQuery<MedicalTestJPA> query = entman.createQuery(
|
TypedQuery<MedicalTestJPA> query = entman.createQuery("SELECT q from MedicalTestJPA q where q.patient.id=:patientId order by q.id desc", MedicalTestJPA.class);
|
||||||
"SELECT q from MedicalTestJPA q where q.patient.id=:patientId order by q.id desc",
|
|
||||||
MedicalTestJPA.class);
|
|
||||||
|
|
||||||
query.setParameter("patientId", patientID);
|
query.setParameter("patientId", patientID);
|
||||||
|
|
||||||
@@ -304,18 +286,17 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID, int patientID) {
|
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID, Integer patientID) {
|
||||||
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
||||||
String extraQuery = "";
|
String extraQuery = "";
|
||||||
|
|
||||||
if (patientID > 0) {
|
if (patientID != null) {
|
||||||
extraQuery = " and q.patient.id=:patientID";
|
extraQuery = " and q.patient.id=:patientID";
|
||||||
}
|
}
|
||||||
|
|
||||||
TypedQuery<MedicalTestJPA> query = entman
|
TypedQuery<MedicalTestJPA> query = entman
|
||||||
.createQuery("SELECT q from MedicalTestJPA q where q.patient.familyDoctor.id=:familyDoctorID "
|
.createQuery("SELECT q from MedicalTestJPA q where q.patient.familyDoctor.id=:familyDoctorID " + extraQuery + " order by q.id desc", MedicalTestJPA.class);
|
||||||
+ extraQuery + " order by q.id desc", MedicalTestJPA.class);
|
if (patientID != null) {
|
||||||
if (patientID > 0) {
|
|
||||||
query.setParameter("patientID", patientID);
|
query.setParameter("patientID", patientID);
|
||||||
}
|
}
|
||||||
query.setParameter("familyDoctorID", familyDoctorID);
|
query.setParameter("familyDoctorID", familyDoctorID);
|
||||||
@@ -330,19 +311,18 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID, int patientID) {
|
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID, Integer patientID) {
|
||||||
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
List<MedicalTestTO> medicalTests = new ArrayList<MedicalTestTO>();
|
||||||
String extraQuery = "";
|
String extraQuery = "";
|
||||||
|
|
||||||
if (patientID > 0) {
|
if (patientID != null) {
|
||||||
extraQuery = " and q.patient.id=:patientID";
|
extraQuery = " and q.patient.id=:patientID";
|
||||||
}
|
}
|
||||||
|
|
||||||
TypedQuery<MedicalTestJPA> query = entman
|
TypedQuery<MedicalTestJPA> query = entman
|
||||||
.createQuery("SELECT q from MedicalTestJPA q where q.specialistDoctor.id=:specialistDoctorID "
|
.createQuery("SELECT q from MedicalTestJPA q where q.specialistDoctor.id=:specialistDoctorID " + extraQuery + " order by q.id desc", MedicalTestJPA.class);
|
||||||
+ extraQuery + " order by q.id desc", MedicalTestJPA.class);
|
|
||||||
|
|
||||||
if (patientID > 0) {
|
if (patientID != null) {
|
||||||
query.setParameter("patientID", patientID);
|
query.setParameter("patientID", patientID);
|
||||||
}
|
}
|
||||||
query.setParameter("specialistDoctorID", specialistDoctorID);
|
query.setParameter("specialistDoctorID", specialistDoctorID);
|
||||||
@@ -356,42 +336,73 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
return medicalTests;
|
return medicalTests;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public List<PatientTO> loadPatientsForSpecialistDoctor(int specialistDoctorID, String searchTerm, int pageNumber, int pageSize) {
|
||||||
public List<PatientTO> loadPatientsForSpecialistDoctor(int specialistDoctorID) {
|
String strQuery = "SELECT distinct q.patient from MedicalTestJPA q where q.specialistDoctor.id=:specialistDoctorID %s order by q.patient.name, q.patient.surname";
|
||||||
List<PatientTO> medicalTests = new ArrayList<PatientTO>();
|
String strFilter = "";
|
||||||
|
if (searchTerm == null)
|
||||||
|
searchTerm = "";
|
||||||
|
else
|
||||||
|
searchTerm = Utils.normalizeTerm(searchTerm);
|
||||||
|
|
||||||
TypedQuery<PatientJPA> query = entman.createQuery(
|
if (searchTerm.length() > 0) {
|
||||||
"SELECT distinct q.patient from MedicalTestJPA q where q.specialistDoctor.id=:specialistDoctorID",
|
strFilter = "and lower(q.patient.name) LIKE :searchTerm OR lower(q.patient.surname) LIKE :searchTerm";
|
||||||
PatientJPA.class);
|
}
|
||||||
|
|
||||||
|
TypedQuery<PatientJPA> query = entman.createQuery(String.format(strQuery, strFilter), PatientJPA.class);
|
||||||
|
|
||||||
|
if (searchTerm.length() > 0)
|
||||||
|
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
||||||
|
|
||||||
query.setParameter("specialistDoctorID", specialistDoctorID);
|
query.setParameter("specialistDoctorID", specialistDoctorID);
|
||||||
|
|
||||||
|
if (pageSize > 0) {
|
||||||
|
query.setFirstResult(pageNumber * pageSize);
|
||||||
|
query.setMaxResults(pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
List<PatientJPA> allJPA = query.getResultList();
|
List<PatientJPA> allJPA = query.getResultList();
|
||||||
|
List<PatientTO> patsTO = new ArrayList<PatientTO>();
|
||||||
|
|
||||||
for (PatientJPA item : allJPA) {
|
for (PatientJPA item : allJPA) {
|
||||||
medicalTests.add(commonServices.getPOJOforPatientJPA(item, 1));
|
patsTO.add(commonServices.getPOJOforPatientJPA(item, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return medicalTests;
|
return patsTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public List<PatientTO> loadPatientsForFamilyDoctor(int familyDoctorID, String searchTerm, int pageNumber, int pageSize) {
|
||||||
public List<PatientTO> loadPatientsForFamilyDoctor(int familyDoctorID) {
|
String strQuery = "SELECT distinct q.patient from MedicalTestJPA q where q.patient.familyDoctor.id=:familyDoctorID %s order by q.patient.name, q.patient.surname";
|
||||||
List<PatientTO> medicalTests = new ArrayList<PatientTO>();
|
|
||||||
|
|
||||||
TypedQuery<PatientJPA> query = entman.createQuery(
|
String strFilter = "";
|
||||||
"SELECT distinct q.patient from MedicalTestJPA q where q.patient.familyDoctor.id=:familyDoctorID",
|
if (searchTerm == null)
|
||||||
PatientJPA.class);
|
searchTerm = "";
|
||||||
|
else
|
||||||
|
searchTerm = Utils.normalizeTerm(searchTerm);
|
||||||
|
|
||||||
|
if (searchTerm.length() > 0) {
|
||||||
|
strFilter = "and lower(q.patient.name) LIKE :searchTerm OR lower(q.patient.surname) LIKE :searchTerm";
|
||||||
|
}
|
||||||
|
|
||||||
|
TypedQuery<PatientJPA> query = entman.createQuery(String.format(strQuery, strFilter), PatientJPA.class);
|
||||||
|
|
||||||
|
if (searchTerm.length() > 0)
|
||||||
|
query.setParameter("searchTerm", "%" + searchTerm + "%");
|
||||||
|
|
||||||
query.setParameter("familyDoctorID", familyDoctorID);
|
query.setParameter("familyDoctorID", familyDoctorID);
|
||||||
|
|
||||||
|
if (pageSize > 0) {
|
||||||
|
query.setFirstResult(pageNumber * pageSize);
|
||||||
|
query.setMaxResults(pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
List<PatientJPA> allJPA = query.getResultList();
|
List<PatientJPA> allJPA = query.getResultList();
|
||||||
|
List<PatientTO> patsTO = new ArrayList<PatientTO>();
|
||||||
|
|
||||||
for (PatientJPA item : allJPA) {
|
for (PatientJPA item : allJPA) {
|
||||||
medicalTests.add(commonServices.getPOJOforPatientJPA(item, 1));
|
patsTO.add(commonServices.getPOJOforPatientJPA(item, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return medicalTests;
|
return patsTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -71,17 +71,16 @@ public interface MedicalTestFacadeRemote {
|
|||||||
|
|
||||||
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID);
|
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID);
|
||||||
|
|
||||||
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID, int patientID);
|
public List<MedicalTestTO> loadMedicalTestForFamilyDoctor(int familyDoctorID, Integer patientID);
|
||||||
|
|
||||||
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID, int patientID);
|
public List<MedicalTestTO> loadMedicalTestForSpecialistDoctor(int specialistDoctorID, Integer patientID);
|
||||||
|
|
||||||
public List<PatientTO> loadPatientsForSpecialistDoctor(int specialistDoctorID);
|
public List<PatientTO> loadPatientsForSpecialistDoctor(int specialistDoctorID, String searchTerm, int pageNumber, int pageSize);
|
||||||
|
|
||||||
public List<PatientTO> loadPatientsForFamilyDoctor(int familyDoctorID);
|
public List<PatientTO> loadPatientsForFamilyDoctor(int familyDoctorID, String searchTerm, int pageNumber, int pageSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Añadir una prueba médica a un paciente
|
* Añadir una prueba médica a un paciente Dado que será añadida por el médico especialista en sesión no hace falta más información.
|
||||||
* 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
|
||||||
@@ -89,7 +88,7 @@ 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 String addMedicalTest(int patientID, int doctorSpecialistID, Date date, LocalTime time, MedicalTestType testType, String observations);
|
public MedicalTestTO addMedicalTest(int patientID, int doctorSpecialistID, Date date, LocalTime time, MedicalTestType testType, String observations) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recuperar una prueba médica por ID
|
* Recuperar una prueba médica por ID
|
||||||
|
|||||||
@@ -57,8 +57,7 @@ public class MedicalTestJPA implements Serializable {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MedicalTestJPA(int id, Date date, LocalTime time, String observations, String highresimage, MedicalTestType type, PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
|
public MedicalTestJPA(Date date, LocalTime time, String observations, String highresimage, MedicalTestType type, PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
|
||||||
this.id = id;
|
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
this.observations = observations;
|
this.observations = observations;
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ import javax.faces.event.AjaxBehaviorEvent;
|
|||||||
import javax.faces.view.ViewScoped;
|
import javax.faces.view.ViewScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
import org.primefaces.event.FileUploadEvent;
|
|
||||||
import org.primefaces.event.SelectEvent;
|
import org.primefaces.event.SelectEvent;
|
||||||
import org.primefaces.model.UploadedFile;
|
import org.primefaces.model.UploadedFile;
|
||||||
|
|
||||||
import TO.MedicalTestTO;
|
import TO.MedicalTestTO;
|
||||||
import TO.PatientTO;
|
import TO.PatientTO;
|
||||||
|
import common.Constants;
|
||||||
import common.MedicalTestType;
|
import common.MedicalTestType;
|
||||||
import common.UserType;
|
import common.UserType;
|
||||||
import managedbean.common.ManagedBeanBase;
|
import managedbean.common.ManagedBeanBase;
|
||||||
@@ -33,8 +33,14 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
private List<MedicalTestTO> medicalTests;
|
private List<MedicalTestTO> medicalTests;
|
||||||
private MedicalTestTO selected;
|
private MedicalTestTO selected;
|
||||||
private PatientTO patSelected;
|
private PatientTO patSelected;
|
||||||
|
private PatientTO patientFilterSelected;
|
||||||
private boolean addNewMode = false;
|
private boolean addNewMode = false;
|
||||||
private UploadedFile imageUpload;
|
private UploadedFile imageUpload;
|
||||||
|
private List<PatientTO> patientList;
|
||||||
|
private List<PatientTO> patientWithTestList;
|
||||||
|
private String lastUIQuery;
|
||||||
|
private String lastUIQueryPatFilter;
|
||||||
|
private List<MedicalTestType> medicalTestTypes;
|
||||||
|
|
||||||
public MedicalTestMBean() {
|
public MedicalTestMBean() {
|
||||||
}
|
}
|
||||||
@@ -43,18 +49,32 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public void init() {
|
public void init() {
|
||||||
this.userType = SessionUtils.getUserType();
|
this.userType = SessionUtils.getUserType();
|
||||||
this.userID = Integer.valueOf(SessionUtils.getUserId());
|
this.userID = Integer.valueOf(SessionUtils.getUserId());
|
||||||
|
this.medicalTestTypes = new ArrayList<MedicalTestType>();
|
||||||
|
this.medicalTestTypes.add(MedicalTestType.BLOOD_TEST);
|
||||||
|
this.medicalTestTypes.add(MedicalTestType.CT_SCAN);
|
||||||
|
this.medicalTestTypes.add(MedicalTestType.MAGNETIC_RESONANCE_IMAGING);
|
||||||
|
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
this.patSelected = null;
|
this.patSelected = null;
|
||||||
|
this.lastUIQuery = "";
|
||||||
|
this.lastUIQueryPatFilter = "";
|
||||||
|
|
||||||
this.loadMedicalTests();
|
switch (userType) {
|
||||||
this.getPatients();
|
case ADMINISTRATOR:
|
||||||
|
case PATIENT:
|
||||||
|
this.patientList = null;
|
||||||
|
this.patientWithTestList = null;
|
||||||
|
break;
|
||||||
|
case SPECIALIST_DOCTOR:
|
||||||
|
this.patientList = this.getRemoteManagerCommon().listPatientsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForSpecialistDoctor(userID, null, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
break;
|
||||||
|
case FAMILY_DOCTOR:
|
||||||
|
this.patientList = null;
|
||||||
|
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForFamilyDoctor(userID, null, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMedicalTest() {
|
this.loadMedicalTests();
|
||||||
getRemoteManagerMedicalTest().addMedicalTest(this.selected.getPatient().getId(), userID,
|
|
||||||
this.selected.getDate(), this.selected.getTime(), this.selected.getType(),
|
|
||||||
this.selected.getObservations());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addImage() {
|
public void addImage() {
|
||||||
@@ -102,35 +122,68 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadMedicalTests() {
|
public void loadMedicalTests() {
|
||||||
if (userType == UserType.PATIENT) {
|
Integer patId = null;
|
||||||
|
if (this.patientFilterSelected != null)
|
||||||
|
patId = this.patientFilterSelected.getId();
|
||||||
|
|
||||||
|
switch (userType) {
|
||||||
|
case PATIENT:
|
||||||
// Cargar las pruebas para el paciente en sesión
|
// Cargar las pruebas para el paciente en sesión
|
||||||
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForPatient(userID);
|
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForPatient(userID);
|
||||||
} else if (userType == UserType.SPECIALIST_DOCTOR) {
|
break;
|
||||||
|
case SPECIALIST_DOCTOR:
|
||||||
// Cargar las pruebas que el doctor especialista ha creado
|
// Cargar las pruebas que el doctor especialista ha creado
|
||||||
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForSpecialistDoctor(userID,
|
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForSpecialistDoctor(userID, patId);
|
||||||
this.patIdSelected);
|
break;
|
||||||
} else if (userType == UserType.FAMILY_DOCTOR) {
|
case FAMILY_DOCTOR:
|
||||||
// Cargar las pruebas para los pacientes del doctor de familia en sesión
|
// Cargar las pruebas para los pacientes del doctor de familia en sesión
|
||||||
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForFamilyDoctor(userID,
|
this.medicalTests = getRemoteManagerMedicalTest().loadMedicalTestForFamilyDoctor(userID, patId);
|
||||||
this.patIdSelected);
|
break;
|
||||||
} else {
|
case ADMINISTRATOR:
|
||||||
// Nothing todo
|
this.medicalTests = null;
|
||||||
this.medicalTests = new ArrayList<MedicalTestTO>();
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Operación no válida para el tipo de usuario actual.");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PatientTO> getPatients() {
|
public List<PatientTO> completePatient(String query) {
|
||||||
if (userType == UserType.SPECIALIST_DOCTOR) {
|
if (query != null && query.equals(this.lastUIQuery) == false) {
|
||||||
// Cargar los pacientes a los que ha añadido pruebas médicas el médico
|
this.lastUIQuery = query;
|
||||||
// especialista
|
// Recuperamos las xxx primeras coincidencias
|
||||||
return getRemoteManagerMedicalTest().loadPatientsForSpecialistDoctor(userID);
|
this.patientList = this.getRemoteManagerCommon().listPatientsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
} 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>();
|
|
||||||
}
|
}
|
||||||
|
return this.patientList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PatientTO> completePatientFilter(String query) {
|
||||||
|
if (query != null && query.equals(this.lastUIQueryPatFilter) == false) {
|
||||||
|
this.lastUIQueryPatFilter = query;
|
||||||
|
|
||||||
|
switch (userType) {
|
||||||
|
case SPECIALIST_DOCTOR:
|
||||||
|
// Cargar los pacientes a los que ha añadido pruebas médicas el médico especialista
|
||||||
|
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForSpecialistDoctor(userID, query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
break;
|
||||||
|
case FAMILY_DOCTOR:
|
||||||
|
// Cargar los pacientes del médico de familia que tiene pruebas médicas hechas
|
||||||
|
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForFamilyDoctor(userID, query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
break;
|
||||||
|
case ADMINISTRATOR:
|
||||||
|
case PATIENT:
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Operación no válida para el tipo de usuario actual.");
|
||||||
|
this.patientWithTestList = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.patientWithTestList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PatientTO> getPatientList() {
|
||||||
|
return patientList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PatientTO> getPatientWithTestList() {
|
||||||
|
return patientWithTestList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MedicalTestTO> getMedicalTests() {
|
public List<MedicalTestTO> getMedicalTests() {
|
||||||
@@ -141,18 +194,6 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
// Nothing to do
|
// 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() {
|
public boolean isSpecialistDoctor() {
|
||||||
return this.userType == UserType.SPECIALIST_DOCTOR;
|
return this.userType == UserType.SPECIALIST_DOCTOR;
|
||||||
}
|
}
|
||||||
@@ -161,10 +202,20 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
return !(userType == UserType.PATIENT);
|
return !(userType == UserType.PATIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSelectPatient(AjaxBehaviorEvent event) {
|
public void clearFilteredPatient() {
|
||||||
|
this.selected = null;
|
||||||
|
this.patientFilterSelected = null;
|
||||||
|
this.loadMedicalTests();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onChangePatient(AjaxBehaviorEvent event) {
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
this.loadMedicalTests();
|
this.loadMedicalTests();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSelectPatient(SelectEvent event) {
|
||||||
|
this.selected = null;
|
||||||
|
this.loadMedicalTests();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSelectMT(SelectEvent event) {
|
public void onSelectMT(SelectEvent event) {
|
||||||
@@ -173,16 +224,13 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addMT() {
|
public void addMT() {
|
||||||
if (this.patIdSelected != -1) {
|
// Si hay un paciente filtrado en la busqueda de pruebas, lo seleccionamos para la prueba a añadir.
|
||||||
|
this.patSelected = this.patientFilterSelected;
|
||||||
this.selected = new MedicalTestTO();
|
this.selected = new MedicalTestTO();
|
||||||
this.selected.setId(-1);
|
this.selected.setId(-1);
|
||||||
this.selected.setObservations("");
|
this.selected.setObservations("");
|
||||||
this.selected.setType(MedicalTestType.BLOOD_TEST);
|
this.selected.setType(MedicalTestType.BLOOD_TEST);
|
||||||
this.addNewMode = true;
|
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() {
|
public boolean isAddNewMode() {
|
||||||
@@ -202,44 +250,32 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<MedicalTestType> getMedicalTestTypes() {
|
public List<MedicalTestType> getMedicalTestTypes() {
|
||||||
ArrayList<MedicalTestType> list = new ArrayList<MedicalTestType>();
|
return this.medicalTestTypes;
|
||||||
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() {
|
public void save() {
|
||||||
String res = getRemoteManagerMedicalTest().addMedicalTest(this.patIdSelected, userID, this.selected.getDate(),
|
try {
|
||||||
this.selected.getTime(), this.selected.getType(), this.selected.getObservations());
|
|
||||||
if (res.equals("ok")) {
|
MedicalTestTO mt = this.getRemoteManagerMedicalTest().addMedicalTest(this.patSelected.getId(), this.userID, this.selected.getDate(), this.selected.getTime(),
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Éxito", "Guardado correctamente");
|
this.selected.getType(), this.selected.getObservations());
|
||||||
} else {
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Error", res);
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Éxito", String.format("La prueba médica se ha guardado correctamente, el identificador asignado es: %d", mt.getId()));
|
||||||
}
|
|
||||||
|
// Volvemos al modo añadir (limpiamos el formulario).
|
||||||
|
this.addMT();
|
||||||
|
|
||||||
this.loadMedicalTests();
|
this.loadMedicalTests();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
this.manageException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PatientTO getPatientFilterSelected() {
|
||||||
|
return patientFilterSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPatientFilterSelected(PatientTO patientFilterSelected) {
|
||||||
|
this.patientFilterSelected = patientFilterSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user