fixed SQL syntax
updated cohort definitions to use facility parameters
reordered queries to match indexes
Merge remote-tracking branch 'upstream/master' into REPORTS-195
REPORTS-195: More commits on remove report link