use of org.openmrs.module.reporting.evaluation.parameter.Parameter in project openmrs-module-pihcore by PIH.
the class ReportingMatchers method hasParameter.
public static Matcher<Definition> hasParameter(final String withName, final Class<?> ofType, final Class<? extends Collection> ofCollectionType) {
return new BaseMatcher<Definition>() {
@Override
public boolean matches(Object o) {
Definition actual = (Definition) o;
Parameter parameter = actual.getParameter(withName);
return parameter != null && parameter.getType().equals(ofType) && ((ofCollectionType == null && parameter.getCollectionType() == null) || (ofCollectionType != null && ofCollectionType.equals(parameter.getCollectionType())));
}
// TODO fix this implementation or figure out which other matcher implementation to use
@Override
public void describeTo(Description description) {
description.appendText("should have parameter " + withName + " of type " + ofType + " and collection type " + ofCollectionType);
}
};
}
use of org.openmrs.module.reporting.evaluation.parameter.Parameter in project openmrs-module-pihcore by PIH.
the class BaseEncounterDataSetManager method constructDataSet.
public DataSetDefinition constructDataSet() {
EncounterDataSetDefinition dsd = new EncounterDataSetDefinition();
dsd.addParameter(new Parameter("startDate", "mirebalaisreports.parameter.startDate", Date.class));
dsd.addParameter(new Parameter("endDate", "mirebalaisreports.parameter.endDate", Date.class));
// Rows defined as patients who had an encounter of the configured types during the given period
dsd.addRowFilter(Mapped.mapStraightThrough(new PatientEncounterQuery(cohortQueries.getExcludeTestPatients())));
dsd.addRowFilter(Mapped.mapStraightThrough(encounterQueries.getEncountersDuringPeriodAtLocation(getEncounterTypes())));
// Define columns
addPrimaryIdentifierColumns(dsd);
addPatientNameColumns(dsd);
addBirthDateAndAgeColumns(dsd);
addGenderColumns(dsd);
addOtherIdentifierColumns(dsd);
addCoreEncounterColumns(dsd);
addCoreVisitColumns(dsd);
addAddressColumns(dsd);
addPersonAttributeColumns(dsd);
addObsColumns(dsd);
addAuditColumns(dsd);
return dsd;
}
Aggregations