use of org.openmrs.module.reporting.data.converter.PropertyConverter in project openmrs-module-mirebalais by PIH.
the class AppointmentSchedulingSetup method customizeDailyAppointmentsDataSet.
public static void customizeDailyAppointmentsDataSet() {
DataSetDefinitionService dataSetDefinitionService = Context.getService(DataSetDefinitionService.class);
PaperRecordProperties paperRecordProperties = Context.getRegisteredComponents(PaperRecordProperties.class).get(0);
AppointmentDataSetDefinition dsd = (AppointmentDataSetDefinition) dataSetDefinitionService.getDefinition(AppointmentSchedulingUIConstants.DAILY_SCHEDULED_APPOINTMENT_DATA_SET_DEFINITION_UUID, AppointmentDataSetDefinition.class);
if (dsd == null || dsd.getId() == null) {
throw new RuntimeException("Daily scheduled appointment data set definition not found");
}
// swap out the identifier column to show dossier number instead of primary identifier
dsd.removeColumnDefinition("identifier");
PatientIdentifierDataDefinition dd = new PatientIdentifierDataDefinition(null, paperRecordProperties.getPaperRecordIdentifierType());
dd.setIncludeFirstNonNullOnly(true);
dsd.addColumn("identifier", dd, "", new PropertyConverter(PatientIdentifier.class, "identifier"));
dataSetDefinitionService.saveDefinition(dsd);
}
use of org.openmrs.module.reporting.data.converter.PropertyConverter in project openmrs-module-pihcore by PIH.
the class DispensingDataSetManager method constructDataSetDefinition.
@Override
public DataSetDefinition constructDataSetDefinition(DataSetDescriptor dataSetDescriptor, File baseConfigDir) {
ObsDataSetDefinition dsd = new ObsDataSetDefinition();
dsd.addParameter(getStartDateParameter());
dsd.addParameter(getEndDateParameter());
BasicObsQuery query = new BasicObsQuery();
query.addParameter(new Parameter("onOrAfter", "On or after", Date.class));
query.addParameter(new Parameter("onOrBefore", "On or before", Date.class));
query.addConcept(dispensingProperties.getDispensingConstructConcept());
dsd.addRowFilter(query, "onOrAfter=${startDate},onOrBefore=${endDate}");
dsd.addColumn("visitId", pihObsData.getVisitId(), null);
dsd.addColumn("encounterId", pihObsData.getEncounterId(), null);
dsd.addColumn("medication", constructGroupMemberObsDataDefinition(dispensingProperties.getMedicationConcept()), "", new PropertyConverter(Drug.class, "valueDrug"), new ObjectFormatter());
dsd.addColumn("dosage", constructGroupMemberObsDataDefinition(dispensingProperties.getDosageConcept()), "", new ObjectFormatter());
dsd.addColumn("dosageUnits", constructGroupMemberObsDataDefinition(dispensingProperties.getDosageUnitsConcept()), "", new ObjectFormatter());
dsd.addColumn("frequency", constructGroupMemberObsDataDefinition(dispensingProperties.getMedicationFrequencyConcept()), "", new ObjectFormatter());
dsd.addColumn("duration", constructGroupMemberObsDataDefinition(dispensingProperties.getMedicationDurationConcept()), "", new ObjectFormatter());
dsd.addColumn("durationUnits", constructGroupMemberObsDataDefinition(dispensingProperties.getMedicationDurationUnitsConcept()), "", new ObjectFormatter());
dsd.addColumn("amount", constructGroupMemberObsDataDefinition(dispensingProperties.getDispensedAmountConcept()), "", new ObjectFormatter());
dsd.addColumn("instructions", constructGroupMemberObsDataDefinition(dispensingProperties.getAdministrationInstructions()), "", new ObjectFormatter());
dsd.addColumn("patientIdentifier", constructPatientIdentifierDataDefinition(emrApiProperties.getPrimaryIdentifierType()), "", new ObjectFormatter());
dsd.addColumn("dispensedLocation", new EncounterLocationDataDefinition(), "", new ObjectFormatter());
dsd.addColumn("dispensedDatetime", new EncounterDatetimeDataDefinition(), "", new DateConverter("dd MMM yyyy hh:mm aa"));
EncounterProviderDataDefinition dispensedByDef = new EncounterProviderDataDefinition();
dispensedByDef.setEncounterRole(encounterService.getEncounterRoleByUuid(PihEmrConfigConstants.ENCOUNTERROLE_DISPENSER_UUID));
dsd.addColumn("dispensedBy", dispensedByDef, "", new ObjectFormatter());
EncounterProviderDataDefinition prescribedByDef = new EncounterProviderDataDefinition();
prescribedByDef.setEncounterRole(encounterService.getEncounterRoleByUuid(PihEmrConfigConstants.ENCOUNTERROLE_ORDERINGPROVIDER_UUID));
dsd.addColumn("prescribedBy", prescribedByDef, "", new ObjectFormatter());
ObsForEncounterDataDefinition typeOfPrescriptionDef = new ObsForEncounterDataDefinition();
typeOfPrescriptionDef.setQuestion(conceptService.getConceptByMapping("9292", "PIH"));
dsd.addColumn("typeOfPrescription", typeOfPrescriptionDef, "", new ObjectFormatter());
ObsForEncounterDataDefinition locationOfPrescriptionDef = new ObsForEncounterDataDefinition();
locationOfPrescriptionDef.setQuestion(conceptService.getConceptByMapping("9293", "PIH"));
dsd.addColumn("locationOfPrescription", locationOfPrescriptionDef, "", new ObsValueTextAsCodedConverter<>(Location.class), new ObjectFormatter());
return dsd;
}
use of org.openmrs.module.reporting.data.converter.PropertyConverter in project openmrs-module-pihcore by PIH.
the class PihEncounterDataLibrary method getAdmissionStatus.
@DocumentedDefinition
public EncounterDataDefinition getAdmissionStatus() {
ObsForEncounterDataDefinition dd = new ObsForEncounterDataDefinition();
// concept with synonyms "Type of Patient" and "Admission Status", possible answers are Ambulatory and Hospitalized
dd.setQuestion(conceptService.getConceptByMapping("3289", "PIH"));
return new ConvertedEncounterDataDefinition(dd, new PropertyConverter(Obs.class, "valueCoded"), new ObjectFormatter());
}
use of org.openmrs.module.reporting.data.converter.PropertyConverter in project openmrs-module-pihcore by PIH.
the class PihPatientDataLibrary method getAllDossierNumberIdentifiers.
@DocumentedDefinition("allDossierNumbers.identifier")
public PatientDataDefinition getAllDossierNumberIdentifiers() {
PatientIdentifierDataDefinition pdd = new PatientIdentifierDataDefinition();
pdd.setTypes(Arrays.asList(getDossierNumberType()));
CollectionConverter cc = new CollectionConverter(new PropertyConverter(PatientIdentifier.class, "identifier"), false, new ComparableComparator());
return new ConvertedPatientDataDefinition(pdd, cc);
}
Aggregations