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);
|
||||
}
|
||||
Reference in New Issue
Block a user