@Test public void transferredIn() throws Exception { Concept transferInDate = Dictionary.getConcept(Dictionary.TRANSFER_IN_DATE); TestUtils.saveObs(Context.getPatientService().getPatient(6), transferInDate, TestUtils.date(2012, 6, 1), TestUtils.date(2012, 7, 1)); TestUtils.saveObs(Context.getPatientService().getPatient(6), transferInDate, TestUtils.date(2012, 7, 1), TestUtils.date(2012, 6, 1)); CohortDefinition cd = commonCohortLibrary.transferredIn(); context.addParameterValue("value2", TestUtils.date(2012, 6, 30)); System.out.println(cd); EvaluatedCohort evaluated = Context.getService(CohortDefinitionService.class).evaluate(cd, context); ReportingTestUtils.assertCohortEquals(Arrays.asList(6), evaluated); }
public CohortDefinition transferredIn() { Concept transferInDate = Dictionary.getConcept(Dictionary.TRANSFER_IN_DATE); DateObsValueBetweenCohortDefinition cd = new DateObsValueBetweenCohortDefinition(); cd.setName("transferred in between dates"); cd.setQuestion(transferInDate); cd.addParameter(new Parameter("onOrAfter", "After Date", Date.class)); cd.addParameter(new Parameter("onOrBefore", "Before Date", Date.class)); return cd; }
CommonCohortLibrary { public CohortDefinition transferredIn() { Concept transferInDate = Dictionary.getConcept(Dictionary.TRANSFER_IN_DATE); DateObsValueBetweenCohortDefinition cd = new DateObsValueBetweenCohortDefinition(); cd.setName("transferred in between dates"); cd.setQuestion(transferInDate); cd.addParameter(new Parameter("onOrAfter", "After Date", Date.class)); cd.addParameter(new Parameter("onOrBefore", "Before Date", Date.class)); return cd; } }
CommonCohortLibrary { public CohortDefinition transferredIn() { Concept transferInDate = Dictionary.getConcept(Dictionary.TRANSFER_IN_DATE); DateObsValueBetweenCohortDefinition cd = new DateObsValueBetweenCohortDefinition(); cd.setName("transferred in between dates"); cd.setQuestion(transferInDate); cd.addParameter(new Parameter("onOrAfter", "After Date", Date.class)); cd.addParameter(new Parameter("onOrBefore", "Before Date", Date.class)); return cd; }  }
CommonCohortLibrary { public CohortDefinition transferredIn() { Concept transferInDate = Dictionary.getConcept(Dictionary.TRANSFER_IN_DATE); DateObsValueBetweenCohortDefinition cd = new DateObsValueBetweenCohortDefinition(); cd.setName("transferred in between dates"); cd.setQuestion(transferInDate); cd.addParameter(new Parameter("onOrAfter", "After Date", Date.class)); cd.addParameter(new Parameter("onOrBefore", "Before Date", Date.class)); return cd; }  CohortDefinition females(); CohortDefinition males(); CohortDefinition agedAtMost(int maxAge); CohortDefinition agedAtLeast(int minAge); CohortDefinition agedAtLeastAgedAtMost(int minAge, int maxAge); CohortDefinition femalesAgedAtLeast18(); CohortDefinition hasEncounter(EncounterType... types); CohortDefinition hasObs(Concept question, Concept... answers); CohortDefinition transferredIn(); CohortDefinition transferredOut(); CohortDefinition enrolled(Program... programs); CohortDefinition enrolledExcludingTransfers(Program... programs); CohortDefinition enrolledExcludingTransfersOnDate(Program... programs); CohortDefinition pregnant(); CohortDefinition inProgram(Program program); CohortDefinition medicationDispensed(Concept... concepts); CohortDefinition compltedProgram(); CohortDefinition deceasedPatients(); CohortDefinition markedAsDeadButNotDeceased(); }
CommonCohortLibrary { public CohortDefinition transferredIn() { Concept transferInDate = Dictionary.getConcept(Dictionary.TRANSFER_IN_DATE); DateObsValueBetweenCohortDefinition cd = new DateObsValueBetweenCohortDefinition(); cd.setName("transferred in between dates"); cd.setQuestion(transferInDate); cd.addParameter(new Parameter("onOrAfter", "After Date", Date.class)); cd.addParameter(new Parameter("onOrBefore", "Before Date", Date.class)); return cd; }  CohortDefinition females(); CohortDefinition males(); CohortDefinition agedAtMost(int maxAge); CohortDefinition agedAtLeast(int minAge); CohortDefinition agedAtLeastAgedAtMost(int minAge, int maxAge); CohortDefinition femalesAgedAtLeast18(); CohortDefinition hasEncounter(EncounterType... types); CohortDefinition hasObs(Concept question, Concept... answers); CohortDefinition transferredIn(); CohortDefinition transferredOut(); CohortDefinition enrolled(Program... programs); CohortDefinition enrolledExcludingTransfers(Program... programs); CohortDefinition enrolledExcludingTransfersOnDate(Program... programs); CohortDefinition pregnant(); CohortDefinition inProgram(Program program); CohortDefinition medicationDispensed(Concept... concepts); CohortDefinition compltedProgram(); CohortDefinition deceasedPatients(); CohortDefinition markedAsDeadButNotDeceased();  }