Mejora en visualización de especialistas por especialidad (Vista
páginada de datos).
This commit is contained in:
@@ -1,51 +1,62 @@
|
|||||||
<?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">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="TestForm">
|
<h:form id="TestForm">
|
||||||
<p:messages id="mesgs" showDetail="true" closable="true"
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
autoupdate="true" />
|
<p:panel id="frmSSbD" header="Búsqueda de médicos especialista por especialidad">
|
||||||
<p:panel id="frmSSbD"
|
|
||||||
header="Búsqueda de médicos especialista por especialidad">
|
|
||||||
<div class="ui-g ui-fluid">
|
<div class="ui-g ui-fluid">
|
||||||
|
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-2 ui-md-2">
|
||||||
<p:outputLabel for="selMS" value="Especialidad:" />
|
<p:outputLabel for="selMS" value="Especialidad:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-6 ui-md-6">
|
||||||
<p:autoComplete id="selMS" dropdown="true" required="true"
|
<p:autoComplete id="selMS" dropdown="true" required="true" value="#{sspec.medicalSpeciality}" completeMethod="#{sspec.completeMedicalSpeciality}" var="ms"
|
||||||
value="#{sspec.medicalSpeciality}"
|
itemLabel="#{ms.displayName}" itemValue="#{ms}" forceSelection="true" requiredMessage="Por favor, selecciona una especialidad médica"
|
||||||
completeMethod="#{sspec.completeMedicalSpeciality}" var="ms"
|
|
||||||
itemLabel="#{ms.displayName}" itemValue="#{ms}"
|
|
||||||
forceSelection="true"
|
|
||||||
requiredMessage="Por favor, selecciona una especialidad médica"
|
|
||||||
placeholder="Seleccione una especialidad médica o teclee para buscar...">
|
placeholder="Seleccione una especialidad médica o teclee para buscar...">
|
||||||
<o:converter converterId="omnifaces.ListConverter"
|
<o:converter converterId="omnifaces.ListConverter" list="#{RegisterUser.medicalSpecialtiesList}" />
|
||||||
list="#{RegisterUser.medicalSpecialtiesList}" />
|
<p:ajax event="itemSelect" listener="#{sspec.onSelect}" update="frmSSbD" />
|
||||||
<p:ajax event="itemSelect" listener="#{sspec.onSelect}"
|
|
||||||
update="frmSSbD" />
|
|
||||||
<p:column headerText="Nombre">
|
<p:column headerText="Nombre">
|
||||||
<h:outputText value="#{ms.name}" />
|
<h:outputText value="#{ms.name}" />
|
||||||
</p:column>
|
</p:column>
|
||||||
<p:column headerText="Localización">
|
<p:column headerText="Descripción">
|
||||||
<h:outputText value="#{ms.description}" />
|
<h:outputText value="#{ms.description}" />
|
||||||
</p:column>
|
</p:column>
|
||||||
</p:autoComplete>
|
</p:autoComplete>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4"></div>
|
<div class="ui-g-4 ui-md-4"/>
|
||||||
|
|
||||||
<div class="ui-g-4 ui-md-4"></div>
|
<div class="ui-g-12">
|
||||||
<div class="ui-g-8 ui-md-8">
|
<p:dataTable id="dtDoctorList" var="d" value="#{sspec.lazyDataModelDoctorList}" lazy="true" paginator="true" rows="10" paginatorPosition="bottom"
|
||||||
<p:dataList value="#{sspec.listDoctors}" var="dd" type="ordered" emptyMessage="Ningún especialista para la especialidad seleccionada">
|
paginatorAlwaysVisible="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
|
||||||
#{dd.name} #{dd.surname} <#{dd.email}>
|
rowsPerPageTemplate="10,20,30,40" emptyMessage="No existe ningún especialista para la especialidad seleccionada.">
|
||||||
</p:dataList>
|
|
||||||
|
<p:column headerText="Núm Profesional" width="90">
|
||||||
|
<h:outputText value="#{d.professionalNumber}" />
|
||||||
|
</p:column>
|
||||||
|
|
||||||
|
<p:column headerText="Nombre" width="60">
|
||||||
|
<h:outputText value="#{d.name}">
|
||||||
|
<f:convertDateTime type="time" pattern="HH:mm" />
|
||||||
|
</h:outputText>
|
||||||
|
</p:column>
|
||||||
|
|
||||||
|
<p:column headerText="Apellidos" width="auto">
|
||||||
|
<h:outputText value="#{d.surname}" />
|
||||||
|
</p:column>
|
||||||
|
|
||||||
|
<p:column headerText="Correo electrónico" width="auto">
|
||||||
|
<h:outputText value="#{d.email}" />
|
||||||
|
</p:column>
|
||||||
|
|
||||||
|
<f:facet name="paginatorBottomLeft">
|
||||||
|
<p:commandButton update="dtDoctorList" action="#{sspec.showData}" icon="pi pi-refresh" />
|
||||||
|
</f:facet>
|
||||||
|
</p:dataTable>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
|
|||||||
@@ -25,12 +25,10 @@ import jpa.SpecialistDoctorJPA;
|
|||||||
import managedbean.common.SessionUtils;
|
import managedbean.common.SessionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los
|
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los métodos de la capa de negocio que implementan la logica de negocio y la 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
|
||||||
*
|
*
|
||||||
@@ -54,18 +52,17 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
* @param title
|
* @param title
|
||||||
* @param message
|
* @param message
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void askQuestion(int userId, String title, String message) {
|
public void askQuestion(int userId, String title, String message) {
|
||||||
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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +72,6 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
* @param question
|
* @param question
|
||||||
* @param response
|
* @param response
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void answerQuestion(int questionId, String response) {
|
public void answerQuestion(int questionId, String response) {
|
||||||
QuestionJPA qjpa;
|
QuestionJPA qjpa;
|
||||||
qjpa = entman.find(QuestionJPA.class, questionId);
|
qjpa = entman.find(QuestionJPA.class, questionId);
|
||||||
@@ -85,14 +81,11 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
entman.persist(qjpa);
|
entman.persist(qjpa);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<QuestionTO> listAllPendingQuestions(int familyDoctorId) {
|
public List<QuestionTO> listAllPendingQuestions(int familyDoctorId) {
|
||||||
// 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);
|
||||||
|
|
||||||
@@ -111,9 +104,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);
|
||||||
|
|
||||||
@@ -131,17 +122,14 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
*
|
*
|
||||||
* @param question
|
* @param question
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public QuestionTO getQuestion(int idQuestion) {
|
public QuestionTO getQuestion(int idQuestion) {
|
||||||
QuestionTO resp = new QuestionTO();
|
QuestionTO resp = new QuestionTO();
|
||||||
|
|
||||||
TypedQuery<QuestionJPA> query = entman.createQuery(
|
TypedQuery<QuestionJPA> query = entman.createQuery("SELECT q from QuestionJPA q where q.id=:idquestion", QuestionJPA.class);
|
||||||
"SELECT q from QuestionJPA q where q.id=:idquestion",
|
|
||||||
QuestionJPA.class);
|
|
||||||
|
|
||||||
query.setParameter("idquestion", idQuestion);
|
query.setParameter("idquestion", idQuestion);
|
||||||
|
|
||||||
resp = commonServices.getPOJOforQuestionJPA(query.getSingleResult(),1);
|
resp = commonServices.getPOJOforQuestionJPA(query.getSingleResult(), 1);
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
@@ -157,11 +145,9 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
* @param idMedicalTest
|
* @param idMedicalTest
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void addMedicalTest(int idMedicalTest, Date date, long time, MedicalTestType testType, String observations) {
|
public void addMedicalTest(int idMedicalTest, Date date, long time, MedicalTestType testType, String observations) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +158,6 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
*
|
*
|
||||||
* @param idMedicalTest
|
* @param idMedicalTest
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void getMedicalTest(int idMedicalTest) {
|
public void getMedicalTest(int idMedicalTest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +167,6 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
* @param idMedicalTest
|
* @param idMedicalTest
|
||||||
* @param image
|
* @param image
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void addImage(int idMedicalTest, String image) {
|
public void addImage(int idMedicalTest, String image) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +176,6 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
* @param idMedicalTest
|
* @param idMedicalTest
|
||||||
* @param image
|
* @param image
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void updateImage(int idMedicalTest, String image) {
|
public void updateImage(int idMedicalTest, String image) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,24 +184,33 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
*
|
*
|
||||||
* @param idMedicalTest
|
* @param idMedicalTest
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void removeImage(int idMedicalTest) {
|
public void removeImage(int idMedicalTest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getSpecialistDoctorByMedicalSpecialityCount(int specialityId) {
|
||||||
|
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from SpecialistDoctorJPA q where q.medicalSpecialty.id=:specId", Long.class);
|
||||||
|
query.setParameter("specId", specialityId);
|
||||||
|
|
||||||
|
return query.getSingleResult();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listar médicos con una especialidad concreta
|
* Listar médicos con una especialidad concreta
|
||||||
*
|
*
|
||||||
* @param speciality
|
* @param speciality
|
||||||
*/
|
*/
|
||||||
@Override
|
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(int specialityId, int pageNumber, int pageSize) {
|
||||||
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(MedicalSpecialtyTO speciality) {
|
|
||||||
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.name=:spec 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("spec", speciality.getName());
|
|
||||||
|
|
||||||
|
if (pageSize > 0) {
|
||||||
|
query.setFirstResult(pageNumber * pageSize);
|
||||||
|
query.setMaxResults(pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
List<SpecialistDoctorJPA> allJPA = query.getResultList();
|
List<SpecialistDoctorJPA> allJPA = query.getResultList();
|
||||||
|
|
||||||
for (SpecialistDoctorJPA item : allJPA) {
|
for (SpecialistDoctorJPA item : allJPA) {
|
||||||
|
|||||||
@@ -5,14 +5,12 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
|
|
||||||
import TO.MedicalSpecialtyTO;
|
|
||||||
import TO.QuestionTO;
|
import TO.QuestionTO;
|
||||||
import TO.SpecialistDoctorTO;
|
import TO.SpecialistDoctorTO;
|
||||||
import common.MedicalTestType;
|
import common.MedicalTestType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para
|
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para los clientes del EJB
|
||||||
* los clientes del EJB
|
|
||||||
*
|
*
|
||||||
* @author rorden
|
* @author rorden
|
||||||
*
|
*
|
||||||
@@ -53,7 +51,7 @@ public interface MedicalTestFacadeRemote {
|
|||||||
* Recuperar las preguntas hechas por un paciente
|
* Recuperar las preguntas hechas por un paciente
|
||||||
*/
|
*/
|
||||||
public List<QuestionTO> listAllMyQuestions(int userId);
|
public List<QuestionTO> listAllMyQuestions(int userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recuperar una pregunta por su String
|
* Recuperar una pregunta por su String
|
||||||
*
|
*
|
||||||
@@ -70,8 +68,7 @@ public interface MedicalTestFacadeRemote {
|
|||||||
* @param idMedicalTest
|
* @param idMedicalTest
|
||||||
* @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 void addMedicalTest(int id, Date date, long time, MedicalTestType testType, String observations);
|
public void addMedicalTest(int id, Date date, long time, MedicalTestType testType, String observations);
|
||||||
@@ -106,10 +103,12 @@ public interface MedicalTestFacadeRemote {
|
|||||||
*/
|
*/
|
||||||
public void removeImage(int idMedicalTest);
|
public void removeImage(int idMedicalTest);
|
||||||
|
|
||||||
|
public Long getSpecialistDoctorByMedicalSpecialityCount(int specialityId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listar médicos con una especialidad concreta
|
* Listar médicos con una especialidad concreta
|
||||||
*
|
*
|
||||||
* @param speciality
|
* @param speciality
|
||||||
*/
|
*/
|
||||||
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(MedicalSpecialtyTO speciality);
|
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(int specialityId, int pageNumber, int pageSize);
|
||||||
}
|
}
|
||||||
@@ -3,15 +3,19 @@ package managedbean.medicalTest;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.faces.view.ViewScoped;
|
import javax.faces.view.ViewScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
import org.primefaces.event.SelectEvent;
|
import org.primefaces.event.SelectEvent;
|
||||||
|
import org.primefaces.model.LazyDataModel;
|
||||||
|
import org.primefaces.model.SortOrder;
|
||||||
|
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
import TO.SpecialistDoctorTO;
|
import TO.SpecialistDoctorTO;
|
||||||
|
import TO.VisitTO;
|
||||||
import common.Constants;
|
import common.Constants;
|
||||||
import common.UserType;
|
import common.UserType;
|
||||||
import managedbean.common.ManagedBeanBase;
|
import managedbean.common.ManagedBeanBase;
|
||||||
@@ -25,10 +29,10 @@ public class SearchSpecialistMBean extends ManagedBeanBase implements Serializab
|
|||||||
|
|
||||||
private int userID;
|
private int userID;
|
||||||
private UserType userType;
|
private UserType userType;
|
||||||
private List<SpecialistDoctorTO> listDoctors;
|
|
||||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||||
private MedicalSpecialtyTO medicalSpeciality;
|
private MedicalSpecialtyTO medicalSpeciality;
|
||||||
private String lastUIQueryMS;
|
private String lastUIQueryMS;
|
||||||
|
private LazyDataModel<SpecialistDoctorTO> lazyDataModelDoctorList;
|
||||||
|
|
||||||
public SearchSpecialistMBean() {
|
public SearchSpecialistMBean() {
|
||||||
}
|
}
|
||||||
@@ -38,39 +42,45 @@ public class SearchSpecialistMBean extends ManagedBeanBase implements Serializab
|
|||||||
// Inicialización de variables y propiedades van aquí.
|
// Inicialización de variables y propiedades van aquí.
|
||||||
this.userType = SessionUtils.getUserType();
|
this.userType = SessionUtils.getUserType();
|
||||||
this.userID = Integer.valueOf(SessionUtils.getUserId());
|
this.userID = Integer.valueOf(SessionUtils.getUserId());
|
||||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0,
|
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
|
||||||
this.medicalSpeciality = null;
|
this.medicalSpeciality = null;
|
||||||
this.lastUIQueryMS = "";
|
this.lastUIQueryMS = "";
|
||||||
this.listDoctors = new ArrayList<SpecialistDoctorTO>();
|
|
||||||
|
this.lazyDataModelDoctorList = new LazyDataModel<SpecialistDoctorTO>() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SpecialistDoctorTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||||
|
if (medicalSpeciality == null) {
|
||||||
|
this.setRowCount(0);
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
Long totalRowCount = getRemoteManagerMedicalTest().getSpecialistDoctorByMedicalSpecialityCount(medicalSpeciality.getId());
|
||||||
|
this.setRowCount(totalRowCount.intValue());
|
||||||
|
|
||||||
|
return getRemoteManagerMedicalTest().findSpecialistDoctorByMedicalSpeciality(medicalSpeciality.getId(), (first / pageSize), pageSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public LazyDataModel<SpecialistDoctorTO> getLazyDataModelDoctorList() {
|
||||||
|
return lazyDataModelDoctorList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
System.out.println("onSelect");
|
|
||||||
this.medicalSpeciality = (MedicalSpecialtyTO) event.getObject();
|
this.medicalSpeciality = (MedicalSpecialtyTO) event.getObject();
|
||||||
System.out.println(this.medicalSpeciality);
|
|
||||||
this.listDoctors = getRemoteManagerMedicalTest()
|
|
||||||
.findSpecialistDoctorByMedicalSpeciality(this.medicalSpeciality);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> completeMedicalSpeciality(String query) {
|
public List<MedicalSpecialtyTO> completeMedicalSpeciality(String query) {
|
||||||
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
||||||
this.lastUIQueryMS = query;
|
this.lastUIQueryMS = query;
|
||||||
// Recuperamos las 200 primeras coincidencias
|
// Recuperamos las 200 primeras coincidencias
|
||||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0,
|
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
|
||||||
}
|
}
|
||||||
return this.medicalSpecialitiesList;
|
return this.medicalSpecialitiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TO.SpecialistDoctorTO> getListDoctors() {
|
|
||||||
return listDoctors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setListDoctors(List<TO.SpecialistDoctorTO> listDoctors) {
|
|
||||||
this.listDoctors = listDoctors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> getMedicalSpecialitiesList() {
|
public List<MedicalSpecialtyTO> getMedicalSpecialitiesList() {
|
||||||
return medicalSpecialitiesList;
|
return medicalSpecialitiesList;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user