Listado de médicos por CAP
This commit is contained in:
@@ -20,6 +20,7 @@ import common.HashUtils;
|
||||
import common.UserType;
|
||||
import ejb.common.CommonFacadeLocal;
|
||||
import jpa.AdministratorJPA;
|
||||
import jpa.FamilyDoctorJPA;
|
||||
import jpa.MedicalSpecialtyJPA;
|
||||
import jpa.PrimaryHealthCareCenterJPA;
|
||||
|
||||
@@ -228,4 +229,31 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
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 TO.FamilyDoctorTO;
|
||||
import TO.LoggedUserTO;
|
||||
import TO.MedicalSpecialtyTO;
|
||||
import TO.PrimaryHealthCareCenterTO;
|
||||
@@ -40,4 +41,8 @@ public interface SystemAdminFacadeRemote {
|
||||
public Long getCAPCount();
|
||||
|
||||
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("Centros At. Primaria", "fa fa-hospital-o", "/systemAdmin/ManageHealthCareCenters", null));
|
||||
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(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