use of org.openmrs.module.appointmentscheduling.reporting.dataset.definition.AppointmentDataSetDefinition in project openmrs-module-mirebalais by PIH.
the class MirebalaisHospitalActivatorComponentTest method verifyDailyAppointmentsDataSetUpdated.
private void verifyDailyAppointmentsDataSetUpdated() {
AppointmentDataSetDefinition dsd = (AppointmentDataSetDefinition) dataSetDefinitionService.getDefinition(AppointmentSchedulingUIConstants.DAILY_SCHEDULED_APPOINTMENT_DATA_SET_DEFINITION_UUID, AppointmentDataSetDefinition.class);
RowPerObjectColumnDefinition identifierColumn = (RowPerObjectColumnDefinition) dsd.getColumnDefinition("identifier");
PatientToAppointmentDataDefinition patientToAppointmentDataDefinition = (PatientToAppointmentDataDefinition) identifierColumn.getDataDefinition().getParameterizable();
PatientIdentifierDataDefinition patientIdentifierDataDefinition = (PatientIdentifierDataDefinition) patientToAppointmentDataDefinition.getJoinedDefinition();
assertThat(patientIdentifierDataDefinition.getTypes().size(), is(1));
assertThat(patientIdentifierDataDefinition.getTypes().get(0), is(paperRecordProperties.getPaperRecordIdentifierType()));
}
use of org.openmrs.module.appointmentscheduling.reporting.dataset.definition.AppointmentDataSetDefinition 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);
}
Aggregations