Búsqueda de especialista por especialidad
This commit is contained in:
@@ -0,0 +1,56 @@
|
|||||||
|
<?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="TestForm">
|
||||||
|
<p:messages id="mesgs" showDetail="true" closable="true"
|
||||||
|
autoupdate="true" />
|
||||||
|
<p:panel id="frmSSbD"
|
||||||
|
header="Búsqueda de médicos especialista por especialidad">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:outputLabel for="selMS" value="Especialidad:" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:autoComplete id="selMS" dropdown="true" required="true"
|
||||||
|
value="#{sspec.medicalSpeciality}"
|
||||||
|
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...">
|
||||||
|
<o:converter converterId="omnifaces.ListConverter"
|
||||||
|
list="#{RegisterUser.medicalSpecialtiesList}" />
|
||||||
|
<p:ajax event="itemSelect" listener="#{sspec.onSelect}"
|
||||||
|
update="frmSSbD" />
|
||||||
|
<p:column headerText="Nombre">
|
||||||
|
<h:outputText value="#{ms.name}" />
|
||||||
|
</p:column>
|
||||||
|
<p:column headerText="Localización">
|
||||||
|
<h:outputText value="#{ms.description}" />
|
||||||
|
</p:column>
|
||||||
|
</p:autoComplete>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
|
||||||
|
<div class="ui-g-4 ui-md-4"></div>
|
||||||
|
<div class="ui-g-8 ui-md-8">
|
||||||
|
|
||||||
|
<p:dataList value="#{sspec.listDoctors}" var="dd" type="ordered" emptyMessage="Ningún especialista para la especialidad seleccionada">
|
||||||
|
#{dd.name} #{dd.surname} <#{dd.email}>
|
||||||
|
</p:dataList>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
@@ -13,6 +13,7 @@ import javax.persistence.TypedQuery;
|
|||||||
import TO.LoggedUserTO;
|
import TO.LoggedUserTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
import TO.QuestionTO;
|
import TO.QuestionTO;
|
||||||
|
import TO.SpecialistDoctorTO;
|
||||||
import common.MedicalTestType;
|
import common.MedicalTestType;
|
||||||
import common.QuestionStatus;
|
import common.QuestionStatus;
|
||||||
import common.UserType;
|
import common.UserType;
|
||||||
@@ -20,6 +21,7 @@ import ejb.common.CommonFacadeLocal;
|
|||||||
import jpa.FamilyDoctorJPA;
|
import jpa.FamilyDoctorJPA;
|
||||||
import jpa.PatientJPA;
|
import jpa.PatientJPA;
|
||||||
import jpa.QuestionJPA;
|
import jpa.QuestionJPA;
|
||||||
|
import jpa.SpecialistDoctorJPA;
|
||||||
import managedbean.common.SessionUtils;
|
import managedbean.common.SessionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -229,7 +231,21 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
|||||||
* @param speciality
|
* @param speciality
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void findSpecialistDoctorByMedicalSpeciality(MedicalSpecialtyTO speciality) {
|
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(MedicalSpecialtyTO speciality) {
|
||||||
|
List<SpecialistDoctorTO> pendingQuestions = new ArrayList<SpecialistDoctorTO>();
|
||||||
|
|
||||||
|
TypedQuery<SpecialistDoctorJPA> query = entman.createQuery(
|
||||||
|
"SELECT q from SpecialistDoctorJPA q where q.medicalSpecialty.name=:spec order by q.medicalSpecialty.name asc, q.surname asc",
|
||||||
|
SpecialistDoctorJPA.class);
|
||||||
|
query.setParameter("spec", speciality.getName());
|
||||||
|
|
||||||
|
List<SpecialistDoctorJPA> allJPA = query.getResultList();
|
||||||
|
|
||||||
|
for (SpecialistDoctorJPA item : allJPA) {
|
||||||
|
pendingQuestions.add(commonServices.getPOJOforSpecialistDoctorJPA(item, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return pendingQuestions;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import javax.ejb.Remote;
|
|||||||
|
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
import TO.QuestionTO;
|
import TO.QuestionTO;
|
||||||
|
import TO.SpecialistDoctorTO;
|
||||||
import common.MedicalTestType;
|
import common.MedicalTestType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,5 +115,5 @@ public interface MedicalTestFacadeRemote {
|
|||||||
*
|
*
|
||||||
* @param speciality
|
* @param speciality
|
||||||
*/
|
*/
|
||||||
public void findSpecialistDoctorByMedicalSpeciality(MedicalSpecialtyTO speciality);
|
public List<SpecialistDoctorTO> findSpecialistDoctorByMedicalSpeciality(MedicalSpecialtyTO speciality);
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ public class AuthorizationFilter implements Filter {
|
|||||||
authorized = true;
|
authorized = true;
|
||||||
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
|
if (reqURI.indexOf("/medicaltest/MedicalTests") > 0)
|
||||||
authorized = true;
|
authorized = true;
|
||||||
if (reqURI.indexOf("/medicaltest/SearchSpecialistBySpecialty") > 0)
|
if (reqURI.indexOf("/medicaltest/SearchSpecialist") > 0)
|
||||||
authorized = true;
|
authorized = true;
|
||||||
if (reqURI.indexOf("/profile/UpdateProfile") > 0)
|
if (reqURI.indexOf("/profile/UpdateProfile") > 0)
|
||||||
authorized = true;
|
authorized = true;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class MenuMBean implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tipoUsuario == UserType.PATIENT)
|
if (tipoUsuario == UserType.PATIENT)
|
||||||
subMenu.addElement(createMenuItem("Buscar especialista...", "fa fa-heartbeat", "/medicaltest/MedicalTests", null));
|
subMenu.addElement(createMenuItem("Buscar especialista...", "fa fa-heartbeat", "/medicaltest/SearchSpecialist", null));
|
||||||
|
|
||||||
model.addElement(subMenu);
|
model.addElement(subMenu);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package managedbean.medicalTest;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.primefaces.event.SelectEvent;
|
||||||
|
|
||||||
|
import TO.MedicalSpecialtyTO;
|
||||||
|
import TO.SpecialistDoctorTO;
|
||||||
|
import common.Constants;
|
||||||
|
import common.UserType;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
import managedbean.common.SessionUtils;
|
||||||
|
|
||||||
|
@Named("sspec")
|
||||||
|
@ViewScoped
|
||||||
|
public class SearchSpecialistMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private int userID;
|
||||||
|
private UserType userType;
|
||||||
|
private List<SpecialistDoctorTO> listDoctors;
|
||||||
|
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||||
|
private MedicalSpecialtyTO medicalSpeciality;
|
||||||
|
private String lastUIQueryMS;
|
||||||
|
|
||||||
|
public SearchSpecialistMBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
// Inicialización de variables y propiedades van aquí.
|
||||||
|
this.userType = SessionUtils.getUserType();
|
||||||
|
this.userID = Integer.valueOf(SessionUtils.getUserId());
|
||||||
|
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0,
|
||||||
|
Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
this.medicalSpeciality = null;
|
||||||
|
this.lastUIQueryMS = "";
|
||||||
|
this.listDoctors = new ArrayList<SpecialistDoctorTO>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
System.out.println("onSelect");
|
||||||
|
this.medicalSpeciality = (MedicalSpecialtyTO) event.getObject();
|
||||||
|
System.out.println(this.medicalSpeciality);
|
||||||
|
this.listDoctors = getRemoteManagerMedicalTest()
|
||||||
|
.findSpecialistDoctorByMedicalSpeciality(this.medicalSpeciality);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MedicalSpecialtyTO> completeMedicalSpeciality(String query) {
|
||||||
|
if (query != null && query.equals(this.lastUIQueryMS) == false) {
|
||||||
|
this.lastUIQueryMS = query;
|
||||||
|
// Recuperamos las 200 primeras coincidencias
|
||||||
|
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0,
|
||||||
|
Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
}
|
||||||
|
return this.medicalSpecialitiesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TO.SpecialistDoctorTO> getListDoctors() {
|
||||||
|
return listDoctors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListDoctors(List<TO.SpecialistDoctorTO> listDoctors) {
|
||||||
|
this.listDoctors = listDoctors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MedicalSpecialtyTO> getMedicalSpecialitiesList() {
|
||||||
|
return medicalSpecialitiesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedicalSpecialitiesList(List<MedicalSpecialtyTO> medicalSpecialitiesList) {
|
||||||
|
this.medicalSpecialitiesList = medicalSpecialitiesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MedicalSpecialtyTO getMedicalSpeciality() {
|
||||||
|
return medicalSpeciality;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedicalSpeciality(MedicalSpecialtyTO medicalSpecialty) {
|
||||||
|
this.medicalSpeciality = medicalSpecialty;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user