Search in sources :

Example 1 with EncounterProviderDataDefinition

use of org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition in project openmrs-module-pihcore by PIH.

the class PihEncounterDataLibrary method getAllProviders.

@DocumentedDefinition
public EncounterDataDefinition getAllProviders() {
    EncounterProviderDataDefinition dd = new EncounterProviderDataDefinition();
    dd.setSingleProvider(false);
    ChainedConverter itemConverter = new ChainedConverter(new PropertyConverter(Provider.class, "person"), new PropertyConverter(Person.class, "personName"), new ObjectFormatter("{givenName} {familyName}"));
    return new ConvertedEncounterDataDefinition(dd, new CollectionConverter(itemConverter, false, null), new ObjectFormatter(", "));
}
Also used : ChainedConverter(org.openmrs.module.reporting.data.converter.ChainedConverter) ObjectFormatter(org.openmrs.module.reporting.data.converter.ObjectFormatter) ConvertedEncounterDataDefinition(org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition) PropertyConverter(org.openmrs.module.reporting.data.converter.PropertyConverter) EncounterProviderDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition) Person(org.openmrs.Person) CollectionConverter(org.openmrs.module.reporting.data.converter.CollectionConverter) Provider(org.openmrs.Provider) DocumentedDefinition(org.openmrs.module.reporting.definition.library.DocumentedDefinition)

Example 2 with EncounterProviderDataDefinition

use of org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition in project openmrs-module-pihcore by PIH.

the class PihEncounterDataLibrary method getNumberOfProviders.

@DocumentedDefinition
public EncounterDataDefinition getNumberOfProviders() {
    EncounterProviderDataDefinition dd = new EncounterProviderDataDefinition();
    dd.setSingleProvider(false);
    return new ConvertedEncounterDataDefinition(dd, new CountConverter());
}
Also used : CountConverter(org.openmrs.module.reporting.data.converter.CountConverter) ConvertedEncounterDataDefinition(org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition) EncounterProviderDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition) DocumentedDefinition(org.openmrs.module.reporting.definition.library.DocumentedDefinition)

Example 3 with EncounterProviderDataDefinition

use of org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition in project openmrs-module-pihcore by PIH.

the class PihEncounterDataLibrary method getEncounterProvider.

@DocumentedDefinition
public EncounterDataDefinition getEncounterProvider() {
    EncounterProviderDataDefinition epdd = new EncounterProviderDataDefinition();
    epdd.setSingleProvider(true);
    return new ConvertedEncounterDataDefinition(epdd, new DataConverter[] { new ObjectFormatter() });
}
Also used : ObjectFormatter(org.openmrs.module.reporting.data.converter.ObjectFormatter) ConvertedEncounterDataDefinition(org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition) EncounterProviderDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition) DocumentedDefinition(org.openmrs.module.reporting.definition.library.DocumentedDefinition)

Example 4 with EncounterProviderDataDefinition

use of org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition in project openmrs-module-pihcore by PIH.

the class PihEncounterDataLibrary method getProvider.

private EncounterDataDefinition getProvider(String encounterRoleUuid) {
    EncounterProviderDataDefinition dd = new EncounterProviderDataDefinition();
    dd.setEncounterRole(encounterService.getEncounterRoleByUuid(encounterRoleUuid));
    return new ConvertedEncounterDataDefinition(dd, new PropertyConverter(Provider.class, "person"), new PropertyConverter(Person.class, "personName"), new ObjectFormatter("{givenName} {familyName}"));
}
Also used : ObjectFormatter(org.openmrs.module.reporting.data.converter.ObjectFormatter) ConvertedEncounterDataDefinition(org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition) PropertyConverter(org.openmrs.module.reporting.data.converter.PropertyConverter) EncounterProviderDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition) Person(org.openmrs.Person) Provider(org.openmrs.Provider)

Example 5 with EncounterProviderDataDefinition

use of org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition 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;
}
Also used : Drug(org.openmrs.Drug) EncounterLocationDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterLocationDataDefinition) ObsForEncounterDataDefinition(org.openmrs.module.reporting.data.encounter.definition.ObsForEncounterDataDefinition) EncounterDatetimeDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterDatetimeDataDefinition) DateConverter(org.openmrs.module.reporting.data.converter.DateConverter) BasicObsQuery(org.openmrs.module.reporting.query.obs.definition.BasicObsQuery) Date(java.util.Date) ObsDataSetDefinition(org.openmrs.module.reporting.dataset.definition.ObsDataSetDefinition) ObjectFormatter(org.openmrs.module.reporting.data.converter.ObjectFormatter) PropertyConverter(org.openmrs.module.reporting.data.converter.PropertyConverter) Parameter(org.openmrs.module.reporting.evaluation.parameter.Parameter) EncounterProviderDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition) Location(org.openmrs.Location)

Aggregations

EncounterProviderDataDefinition (org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition)6 ObjectFormatter (org.openmrs.module.reporting.data.converter.ObjectFormatter)4 ConvertedEncounterDataDefinition (org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition)4 DocumentedDefinition (org.openmrs.module.reporting.definition.library.DocumentedDefinition)4 PropertyConverter (org.openmrs.module.reporting.data.converter.PropertyConverter)3 Person (org.openmrs.Person)2 Provider (org.openmrs.Provider)2 Date (java.util.Date)1 Drug (org.openmrs.Drug)1 Location (org.openmrs.Location)1 ChainedConverter (org.openmrs.module.reporting.data.converter.ChainedConverter)1 CollectionConverter (org.openmrs.module.reporting.data.converter.CollectionConverter)1 CountConverter (org.openmrs.module.reporting.data.converter.CountConverter)1 DateConverter (org.openmrs.module.reporting.data.converter.DateConverter)1 EncounterDatetimeDataDefinition (org.openmrs.module.reporting.data.encounter.definition.EncounterDatetimeDataDefinition)1 EncounterLocationDataDefinition (org.openmrs.module.reporting.data.encounter.definition.EncounterLocationDataDefinition)1 ObsForEncounterDataDefinition (org.openmrs.module.reporting.data.encounter.definition.ObsForEncounterDataDefinition)1 EncounterToObsDataDefinition (org.openmrs.module.reporting.data.obs.definition.EncounterToObsDataDefinition)1 ObsDataSetDefinition (org.openmrs.module.reporting.dataset.definition.ObsDataSetDefinition)1 Parameter (org.openmrs.module.reporting.evaluation.parameter.Parameter)1