Add support to the BasicEncounterQuery for limiting the query by form(s) and by a certain number of first or last encounters for each patient