private EncounterTypeDataGrid getEncounterTypeDataGrid(SecRole role) {

    Integer roleId = null;
    if (role != null) roleId = role.getId().intValue();

    EncounterTypeDataGrid result = new EncounterTypeDataGrid();

    for (EncounterUtil.EncounterType encounterType : EncounterUtil.EncounterType.values()) {
      result.put(encounterType, getEncounterTypeDataRow(roleId, encounterType));
    }

    if (!skipTotalRow) result.subTotal = getEncounterTypeDataRow(roleId, null);

    return (result);
  }
  /** The Role is used to determine which providers to report on. */
  public ProviderDataGrid getProviderDataGrid(Integer secRoleId) {

    long startTime = System.currentTimeMillis();

    ProviderDataGrid providerDataGrid = new ProviderDataGrid();

    SecRole secRole = secRoleDao.find(secRoleId);
    List<SecUserRole> secUserRoles = secUserRoleDao.getSecUserRolesByRoleName(secRole.getName());
    HashSet<String> providerNos = new HashSet<String>();
    for (SecUserRole secUserRole : secUserRoles) providerNos.add(secUserRole.getProviderNo());

    for (String providerNo : providerNos) {
      Provider provider = providerDao.getProvider(providerNo);
      if (provider != null) providerDataGrid.put(provider, getEncounterTypeDataGrid(provider));
      else
        logger.warn(
            "Provider doesn't exist but a secUserRole record does. providerNo=" + providerNo);
    }

    long totalTime = System.currentTimeMillis() - startTime;
    logger.debug("report generation in seconds : " + (totalTime / 1000));

    return (providerDataGrid);
  }