/** * Patients who were enrolled on the given programs (excluding transfers) between ${onOrAfter} and * ${onOrBefore} * * @param programs the programs * @return the cohort definition */ public CohortDefinition enrolledExcludingTransfers(Program... programs) { CompositionCohortDefinition cd = new CompositionCohortDefinition(); cd.setName("enrolled excluding transfers in program between dates"); cd.addParameter(new Parameter("onOrAfter", "After Date", Date.class)); cd.addParameter(new Parameter("onOrBefore", "Before Date", Date.class)); cd.addSearch( "enrolled", ReportUtils.map( enrolled(programs), "enrolledOnOrAfter=${onOrAfter},enrolledOnOrBefore=${onOrBefore}")); cd.addSearch("transferIn", ReportUtils.map(transferredIn(), "onOrBefore=${onOrBefore}")); cd.addSearch( "completeProgram", ReportUtils.map(compltedProgram(), "completedOnOrBefore=${onOrBefore}")); cd.setCompositionString("enrolled AND NOT (transferIn OR completeProgram)"); return cd; }
/** * Patients who were enrolled on the given programs (excluding transfers) on ${onOrBefore} * * @param programs the programs * @return the cohort definition */ public CohortDefinition enrolledExcludingTransfersOnDate(Program... programs) { CompositionCohortDefinition cd = new CompositionCohortDefinition(); cd.setName("enrolled excluding transfers in program on date in this facility"); cd.addParameter(new Parameter("onOrBefore", "Before Date", Date.class)); cd.addSearch( "enrolled", ReportUtils.map(enrolled(programs), "enrolledOnOrBefore=${onOrBefore}")); cd.addSearch("transferIn", ReportUtils.map(transferredIn(), "onOrBefore=${onOrBefore}")); cd.setCompositionString("enrolled AND NOT transferIn"); return cd; }
/** * Patients who are female and at least 18 years old on ${effectiveDate} * * @return the cohort definition */ public CohortDefinition femalesAgedAtLeast18() { CompositionCohortDefinition cd = new CompositionCohortDefinition(); cd.setName("females aged at least 18"); cd.addParameter(new Parameter("effectiveDate", "Effective Date", Date.class)); cd.addSearch("females", ReportUtils.map(females())); cd.addSearch( "agedAtLeast18", ReportUtils.map(agedAtLeast(18), "effectiveDate=${effectiveDate}")); cd.setCompositionString("females AND agedAtLeast18"); return cd; }