Listado de médicos por CAP
This commit is contained in:
@@ -0,0 +1,66 @@
|
|||||||
|
<?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="frmListDoctors" header="Listado de médicos por Centro de Antención Primaria">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:outputLabel for="selPHC" value="Centro de atención primaria:" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6 ui-md-6">
|
||||||
|
<p:autoComplete id="selPHC" dropdown="true" value="#{listDoctors.primaryHealthCareCenter}" completeMethod="#{listDoctors.completePrimaryHealCareCenter}" var="phc"
|
||||||
|
itemLabel="#{phc.displayName}" itemValue="#{phc}" forceSelection="true" required="true" requiredMessage="Por favor, seleccione un centro de antención primaria" placeholder="Seleccione un centro o escriba para buscar...">
|
||||||
|
<o:converter converterId="omnifaces.ListConverter" list="#{listDoctors.primaryHealthCareCenterList}" />
|
||||||
|
<p:ajax event="itemSelect" update="dtDoctorList" onstart="PF('dtDoctorList').getPaginator().setPage(0);" />
|
||||||
|
<p:column headerText="Nombre">
|
||||||
|
<h:outputText value="#{phc.name}" />
|
||||||
|
</p:column>
|
||||||
|
<p:column headerText="Localización">
|
||||||
|
<h:outputText value="#{phc.location}" />
|
||||||
|
</p:column>
|
||||||
|
</p:autoComplete>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4" />
|
||||||
|
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<p:dataTable id="dtDoctorList" widgetVar="dtDoctorList" var="d" value="#{listDoctors.lazyDataModelDoctorList}" lazy="true" paginator="true" rows="10"
|
||||||
|
paginatorPosition="bottom" paginatorAlwaysVisible="true"
|
||||||
|
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,40"
|
||||||
|
emptyMessage="No existe ningún doctor para el centro seleccionado.">
|
||||||
|
|
||||||
|
<p:column headerText="Número Profesional" width="100">
|
||||||
|
<h:outputText value="#{d.professionalNumber}" />
|
||||||
|
</p:column>
|
||||||
|
|
||||||
|
<p:column headerText="Nombre" width="150">
|
||||||
|
<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 type="button" icon="pi pi-refresh" onclick="PF('dtDoctorList').getPaginator().setPage(0);" />
|
||||||
|
</f:facet>
|
||||||
|
</p:dataTable>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
@@ -20,6 +20,7 @@ import common.HashUtils;
|
|||||||
import common.UserType;
|
import common.UserType;
|
||||||
import ejb.common.CommonFacadeLocal;
|
import ejb.common.CommonFacadeLocal;
|
||||||
import jpa.AdministratorJPA;
|
import jpa.AdministratorJPA;
|
||||||
|
import jpa.FamilyDoctorJPA;
|
||||||
import jpa.MedicalSpecialtyJPA;
|
import jpa.MedicalSpecialtyJPA;
|
||||||
import jpa.PrimaryHealthCareCenterJPA;
|
import jpa.PrimaryHealthCareCenterJPA;
|
||||||
|
|
||||||
@@ -228,4 +229,31 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getFamilyDoctorsByCAPCount(int primaryHealthCareCenterId) {
|
||||||
|
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from FamilyDoctorJPA d where d.primaryHealthCareCenter.id=:capId", Long.class);
|
||||||
|
query.setParameter("capId", primaryHealthCareCenterId);
|
||||||
|
|
||||||
|
return query.getSingleResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FamilyDoctorTO> listAllFamilyDoctorsByCAPPaged(int primaryHealthCareCenterId, int pageNumber, int pageSize) {
|
||||||
|
List<FamilyDoctorTO> familyDoctorsByCAP = new ArrayList<FamilyDoctorTO>();
|
||||||
|
|
||||||
|
TypedQuery<FamilyDoctorJPA> query = entman.createQuery("SELECT d from FamilyDoctorJPA d where d.primaryHealthCareCenter.id=:capId order by d.name asc, d.surname asc",
|
||||||
|
FamilyDoctorJPA.class);
|
||||||
|
query.setParameter("capId", primaryHealthCareCenterId);
|
||||||
|
|
||||||
|
if (pageSize > 0) {
|
||||||
|
query.setFirstResult(pageNumber * pageSize);
|
||||||
|
query.setMaxResults(pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<FamilyDoctorJPA> allJPA = query.getResultList();
|
||||||
|
|
||||||
|
for (FamilyDoctorJPA item : allJPA) {
|
||||||
|
familyDoctorsByCAP.add(commonServices.getPOJOforFamilyDoctorJPA(item, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return familyDoctorsByCAP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
|
|
||||||
|
import TO.FamilyDoctorTO;
|
||||||
import TO.LoggedUserTO;
|
import TO.LoggedUserTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
import TO.PrimaryHealthCareCenterTO;
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
@@ -40,4 +41,8 @@ public interface SystemAdminFacadeRemote {
|
|||||||
public Long getCAPCount();
|
public Long getCAPCount();
|
||||||
|
|
||||||
public List<PrimaryHealthCareCenterTO> listCAPsPaged(int pageNumber, int pageSize);
|
public List<PrimaryHealthCareCenterTO> listCAPsPaged(int pageNumber, int pageSize);
|
||||||
|
|
||||||
|
public Long getFamilyDoctorsByCAPCount(int primaryHealthCareCenterId);
|
||||||
|
|
||||||
|
public List<FamilyDoctorTO> listAllFamilyDoctorsByCAPPaged(int primaryHealthCareCenterId, int pageNumber, int pageSize);
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ public class MenuMBean implements Serializable {
|
|||||||
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/ManageHealthCareCenters", 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/ListDoctorsByCenter", null));
|
||||||
subMenu.addElement(new DefaultSeparator());
|
subMenu.addElement(new DefaultSeparator());
|
||||||
subMenu.addElement(createMenuItem("Añadir usuario Admin", "fa fa-user-secret", "/systemAdmin/ManageSpecialties", null));
|
subMenu.addElement(createMenuItem("Añadir usuario Admin", "fa fa-user-secret", "/systemAdmin/ManageSpecialties", null));
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package managedbean.systemAdmin;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.primefaces.model.LazyDataModel;
|
||||||
|
import org.primefaces.model.SortOrder;
|
||||||
|
|
||||||
|
import TO.FamilyDoctorTO;
|
||||||
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
|
import common.Constants;
|
||||||
|
import managedbean.common.ManagedBeanBase;
|
||||||
|
|
||||||
|
@Named("listDoctors")
|
||||||
|
@ViewScoped
|
||||||
|
public class ListDoctorsByCenterMBean extends ManagedBeanBase implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private List<PrimaryHealthCareCenterTO> primaryHealthCareCenterList;
|
||||||
|
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||||
|
private String lastUIQueryPH;
|
||||||
|
private LazyDataModel<FamilyDoctorTO> lazyDataModelDoctorList;
|
||||||
|
|
||||||
|
public ListDoctorsByCenterMBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
this.primaryHealthCareCenterList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
this.primaryHealthCareCenter = null;
|
||||||
|
this.lastUIQueryPH = "";
|
||||||
|
|
||||||
|
this.lazyDataModelDoctorList = new LazyDataModel<FamilyDoctorTO>() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FamilyDoctorTO> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
|
||||||
|
if (primaryHealthCareCenter == null) {
|
||||||
|
this.setRowCount(0);
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
Long totalRowCount = getRemoteManagerMedicalTest().getSpecialistDoctorByMedicalSpecialityCount(primaryHealthCareCenter.getId());
|
||||||
|
this.setRowCount(totalRowCount.intValue());
|
||||||
|
|
||||||
|
return getRemoteManagerSystemAdmin().listAllFamilyDoctorsByCAPPaged(primaryHealthCareCenter.getId(), (first / pageSize), pageSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public LazyDataModel<FamilyDoctorTO> getLazyDataModelDoctorList() {
|
||||||
|
return lazyDataModelDoctorList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PrimaryHealthCareCenterTO> completePrimaryHealCareCenter(String query) {
|
||||||
|
if (query != null && query.equals(this.lastUIQueryPH) == false) {
|
||||||
|
this.lastUIQueryPH = query;
|
||||||
|
this.primaryHealthCareCenterList = this.getRemoteManagerCommon().listCAPsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
}
|
||||||
|
return this.primaryHealthCareCenterList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PrimaryHealthCareCenterTO> getPrimaryHealthCareCenterList() {
|
||||||
|
return primaryHealthCareCenterList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrimaryHealthCareCenterList(List<PrimaryHealthCareCenterTO> value) {
|
||||||
|
this.primaryHealthCareCenterList = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() {
|
||||||
|
return primaryHealthCareCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterTO value) {
|
||||||
|
this.primaryHealthCareCenter = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user