use of org.openmrs.module.reporting.query.encounter.definition.BasicEncounterQuery in project openmrs-module-pihcore by PIH.
the class HaitiEncounterDataSetManager method constructDataSetDefinition.
@Override
public DataSetDefinition constructDataSetDefinition(DataSetDescriptor dataSetDescriptor, File baseConfigDir) {
EncounterDataSetDefinition dsd = new EncounterDataSetDefinition();
dsd.addParameter(getStartDateParameter());
dsd.addParameter(getEndDateParameter());
BasicEncounterQuery query = new BasicEncounterQuery();
query.addParameter(new Parameter("onOrAfter", "On or after", Date.class));
query.addParameter(new Parameter("onOrBefore", "On or before", Date.class));
dsd.addRowFilter(query, "onOrAfter=${startDate},onOrBefore=${endDate}");
dsd.addColumn("zlEmrId", patientData(pihPatientData.getPreferredZlEmrIdIdentifier()), null);
dsd.addColumn("patientId", builtInEncounterData.getPatientId(), null);
dsd.addColumn("age", pihEncounterData.getPatientAgeAtEncounter(), null, new AgeConverter(AgeConverter.YEARS_TO_ONE_DECIMAL_PLACE));
dsd.addColumn("gender", patientData(builtInPatientData.getGender()), null);
dsd.addColumn("visitId", builtInEncounterData.getEncounterVisit(), null, new PropertyConverter(Visit.class, "visitId"));
dsd.addColumn("visitStart", builtInEncounterData.getEncounterVisit(), null, new PropertyConverter(Visit.class, "startDatetime"));
dsd.addColumn("visitStop", builtInEncounterData.getEncounterVisit(), null, new PropertyConverter(Visit.class, "stopDatetime"));
dsd.addColumn("encounterId", builtInEncounterData.getEncounterId(), null);
dsd.addColumn("encounterType", builtInEncounterData.getEncounterTypeName(), null);
// the "encounterLocation.name" converter is very inefficent
dsd.addColumn("encounterLocation", new ConvertedEncounterDataDefinition(new EncounterLocationDataDefinition(), new PropertyConverter(String.class, "name")), null);
dsd.addColumn("encounterDatetime", builtInEncounterData.getEncounterDatetime(), null);
dsd.addColumn("disposition", pihEncounterData.getDisposition(), null, converterLibrary.getObsValueCodedNameConverterInLocale(Locale.FRENCH));
dsd.addColumn("enteredBy", pihEncounterData.getCreatorName(), null);
dsd.addColumn("allProviders", pihEncounterData.getAllProviders(), null);
dsd.addColumn("numberOfProviders", pihEncounterData.getNumberOfProviders(), null);
dsd.addColumn("administrativeClerk", pihEncounterData.getClerk(), null);
dsd.addColumn("nurse", pihEncounterData.getNurse(), null);
dsd.addColumn("consultingClinician", pihEncounterData.getConsultingClinician(), null);
dsd.addColumn("dispenser", pihEncounterData.getDispenser(), null);
dsd.addColumn("radiologyTech", pihEncounterData.getRadiologyTechnician(), null);
dsd.addColumn("orderingProvider", pihEncounterData.getOrderingProvider(), null);
dsd.addColumn("principalResultsInterpreter", pihEncounterData.getPrincipalResultsInterpreter(), null);
dsd.addColumn("attendingSurgeon", pihEncounterData.getAttendingSurgeonName(), null);
dsd.addColumn("assistingSurgeon", pihEncounterData.getAssistingSurgeon(), null);
dsd.addColumn("anesthesiologist", pihEncounterData.getAnesthesiologist(), null);
dsd.addColumn("birthdate", patientData(builtInPatientData.getBirthdate()), null);
dsd.addColumn("birthdate_estimated", patientData(builtInPatientData.getBirthdateEstimated()), null);
dsd.addColumn("admissionStatus", pihEncounterData.getAdmissionStatus(), null);
dsd.addColumn("requestedAdmissionLocation", pihEncounterData.getRequestedAdmissionLocationName(), null);
dsd.addColumn("requestedTransferLocation", pihEncounterData.getRequestedTransferLocationName(), null);
dsd.addColumn("department", patientData(pihPatientData.getPreferredAddressDepartment()), "");
dsd.addColumn("commune", patientData(pihPatientData.getPreferredAddressCommune()), "");
dsd.addColumn("section", patientData(pihPatientData.getPreferredAddressSection()), "");
dsd.addColumn("locality", patientData(pihPatientData.getPreferredAddressLocality()), "");
dsd.addColumn("street_landmark", patientData(pihPatientData.getPreferredAddressStreetLandmark()), "");
return dsd;
}
use of org.openmrs.module.reporting.query.encounter.definition.BasicEncounterQuery in project openmrs-module-pihcore by PIH.
the class PihEncounterQueryLibrary method getEncountersDuringPeriodAtLocation.
@DocumentedDefinition(value = "encountersDuringPeriodAtLocation")
public EncounterQuery getEncountersDuringPeriodAtLocation(List<EncounterType> encounterTypes) {
BasicEncounterQuery q = new BasicEncounterQuery();
q.setWhich(TimeQualifier.ANY);
q.setEncounterTypes(encounterTypes);
q.addParameter(parameter(Date.class, "onOrAfter"));
q.addParameter(parameter(Date.class, "onOrBefore"));
q.addParameter(parameter(Location.class, "locationList"));
return new MappedParametersEncounterQuery(q, ObjectUtil.toMap("onOrAfter=startDate,onOrBefore=endDate,locationList=location"));
}
Aggregations