use of org.openmrs.module.reporting.data.converter.PropertyConverter in project openmrs-module-coreapps by openmrs.
the class AwaitingAdmissionPageController method get.
public void get(PageModel model, @SpringBean AllDefinitionLibraries libraries, @SpringBean DataSetDefinitionService dsdService, @SpringBean CoreAppsProperties coreAppsProperties, @SpringBean("appFrameworkService") AppFrameworkService appFrameworkService) throws EvaluationException {
EvaluationContext context = new EvaluationContext();
List<Extension> admissionActions = appFrameworkService.getExtensionsForCurrentUser("coreapps.app.awaitingAdmissionActions");
Collections.sort(admissionActions);
model.addAttribute("admissionActions", admissionActions);
DataSet dataSet = null;
VisitDataSetDefinition dsd = new VisitDataSetDefinition();
AwaitingAdmissionVisitQuery query = new AwaitingAdmissionVisitQuery();
dsd.addRowFilter(query, null);
dsd.addColumn("visitId", libraries.getDefinition(VisitDataDefinition.class, "reporting.library.visitDataDefinition.builtIn.visitId"), "");
dsd.addColumn("patientId", libraries.getDefinition(PatientDataDefinition.class, "reporting.library.patientDataDefinition.builtIn.patientId"), "");
dsd.addColumn("patientLastName", libraries.getDefinition(PatientDataDefinition.class, "reporting.library.patientDataDefinition.builtIn.preferredName.familyName"), "");
dsd.addColumn("patientFirstName", libraries.getDefinition(PatientDataDefinition.class, "reporting.library.patientDataDefinition.builtIn.preferredName.givenName"), "");
dsd.addColumn("primaryIdentifier", libraries.getDefinition(PatientDataDefinition.class, "emrapi.patientDataDefinition.primaryIdentifier"), "", new PropertyConverter(String.class, "identifier"));
dsd.addColumn("mostRecentAdmissionRequestFromLocation", libraries.getDefinition(VisitDataDefinition.class, "emrapi.visitDataDefinition.mostRecentAdmissionRequest"), "", new MapElementConverter("fromLocation", new ObjectFormatter()));
dsd.addColumn("mostRecentAdmissionRequestToLocation", libraries.getDefinition(VisitDataDefinition.class, "emrapi.visitDataDefinition.mostRecentAdmissionRequest"), "", new MapElementConverter("toLocation", new ObjectFormatter()));
dsd.addColumn("mostRecentAdmissionRequestDatetime", libraries.getDefinition(VisitDataDefinition.class, "emrapi.visitDataDefinition.mostRecentAdmissionRequest"), "", new MapElementConverter("datetime", null));
dsd.addColumn("mostRecentAdmissionRequestProvider", libraries.getDefinition(VisitDataDefinition.class, "emrapi.visitDataDefinition.mostRecentAdmissionRequest"), "", new MapElementConverter("provider", new ObjectFormatter()));
dsd.addColumn("mostRecentAdmissionRequestDiagnoses", libraries.getDefinition(VisitDataDefinition.class, "emrapi.visitDataDefinition.mostRecentAdmissionRequest"), "", new MapElementConverter("diagnoses", new AwaitingAdmissionDiagnosisFormatter()));
// add the paper record identifier, if the definition is available (provided by the paper record module)
PatientDataDefinition paperRecordIdentifierDefinition = libraries.getDefinition(PatientDataDefinition.class, "paperrecord.patientDataDefinition.paperRecordIdentifier");
if (paperRecordIdentifierDefinition != null) {
model.addAttribute("paperRecordIdentifierDefinitionAvailable", true);
dsd.addColumn("paperRecordIdentifier", paperRecordIdentifierDefinition, "", new PropertyConverter(String.class, "identifier"));
} else {
model.addAttribute("paperRecordIdentifierDefinitionAvailable", false);
}
dsd.addSortCriteria("mostRecentAdmissionRequestDatetime", SortCriteria.SortDirection.ASC);
dataSet = dsdService.evaluate(dsd, context);
model.addAttribute("awaitingAdmissionList", DataSetUtil.simplify(dataSet));
// add location tag constants
model.addAttribute("supportsAdmissionLocationTag", EmrApiConstants.LOCATION_TAG_SUPPORTS_ADMISSION);
model.addAttribute("supportsLoginLocationTag", EmrApiConstants.LOCATION_TAG_SUPPORTS_LOGIN);
// used to determine whether or not we display a link to the patient in the results list
model.addAttribute("privilegePatientDashboard", CoreAppsConstants.PRIVILEGE_PATIENT_DASHBOARD);
AppDescriptor app = appFrameworkService.getApp(CoreAppsConstants.AWAITING_ADMISSION);
String patientPageUrl = app.getConfig().get("patientPageUrl") != null ? app.getConfig().get("patientPageUrl").getTextValue() : coreAppsProperties.getDashboardUrl();
model.addAttribute("patientPageUrl", patientPageUrl);
}
use of org.openmrs.module.reporting.data.converter.PropertyConverter 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.data.converter.PropertyConverter 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(", "));
}
use of org.openmrs.module.reporting.data.converter.PropertyConverter 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}"));
}
use of org.openmrs.module.reporting.data.converter.PropertyConverter in project openmrs-module-pihcore 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);
}
Aggregations