use of org.openmrs.module.providermanagement.api.ProviderManagementService in project openmrs-module-coreapps by openmrs.
the class ProviderListPageController method get.
public void get(PageModel model, @SpringBean("providerManagementService") ProviderManagementService providerManagementService) throws PersonIsNotProviderException {
Map<Provider, List<ProviderPersonRelationship>> providers = new HashMap<Provider, List<ProviderPersonRelationship>>();
List<ProviderRole> providerRoleList = providerManagementService.getRestrictedProviderRoles(false);
if (providerRoleList != null && providerRoleList.size() > 0) {
List<Provider> providersByRoles = Context.getService(ProviderManagementService.class).getProvidersByRoles(providerRoleList);
for (Provider providerByRole : providersByRoles) {
List<ProviderPersonRelationship> supervisorsForProvider = ProviderManagementUtils.getSupervisors(providerByRole);
if (supervisorsForProvider == null) {
supervisorsForProvider = new ArrayList<ProviderPersonRelationship>();
}
providers.put(providerByRole, supervisorsForProvider);
}
}
model.addAttribute("providersList", providers);
}
Aggregations