use of org.openmrs.module.reporting.data.patient.definition.PatientDataDefinition in project openmrs-module-pihcore by PIH.
the class PihPatientDataLibrary method getRegistrationAge.
@DocumentedDefinition("registration.age")
public PatientDataDefinition getRegistrationAge() {
MappedData<PatientDataDefinition> effectiveDate = new MappedData<PatientDataDefinition>(getRegistrationDatetime(), null);
AgeAtDateOfOtherDataDefinition ageAtRegistration = new AgeAtDateOfOtherDataDefinition();
ageAtRegistration.setEffectiveDateDefinition(effectiveDate);
return new ConvertedPatientDataDefinition(new PersonToPatientDataDefinition(ageAtRegistration), new AgeConverter("{y:1}"));
}
use of org.openmrs.module.reporting.data.patient.definition.PatientDataDefinition 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);
}
Aggregations