Search in sources :

Example 1 with PaperRecordProperties

use of org.openmrs.module.paperrecord.PaperRecordProperties in project openmrs-module-mirebalais by PIH.

the class PaperRecordServiceIT method setUp.

@Before
public void setUp() {
    paperRecordService = new PaperRecordServiceImpl();
    patientService = mock(PatientService.class);
    administrationService = mock(AdministrationService.class);
    paperRecordProperties = mock(PaperRecordProperties.class);
    paperRecordDAO = mock(PaperRecordDAO.class);
    ((PaperRecordServiceImpl) paperRecordService).setIdentifierSourceService(identifierSourceService);
    ((PaperRecordServiceImpl) paperRecordService).setPatientService(patientService);
    ((PaperRecordServiceImpl) paperRecordService).setPaperRecordProperties(paperRecordProperties);
    ((PaperRecordServiceImpl) paperRecordService).setPaperRecordDAO(paperRecordDAO);
    // so we handle the hack in PaperRecordServiceImpl where internal methods are fetched via Context.getService
    mockStatic(Context.class);
    when(Context.getService(PaperRecordService.class)).thenReturn(paperRecordService);
}
Also used : PaperRecordDAO(org.openmrs.module.paperrecord.db.PaperRecordDAO) AdministrationService(org.openmrs.api.AdministrationService) PatientService(org.openmrs.api.PatientService) PaperRecordProperties(org.openmrs.module.paperrecord.PaperRecordProperties) PaperRecordServiceImpl(org.openmrs.module.paperrecord.PaperRecordServiceImpl) Before(org.junit.Before)

Example 2 with PaperRecordProperties

use of org.openmrs.module.paperrecord.PaperRecordProperties 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);
}
Also used : AppointmentDataSetDefinition(org.openmrs.module.appointmentscheduling.reporting.dataset.definition.AppointmentDataSetDefinition) PatientIdentifierDataDefinition(org.openmrs.module.reporting.data.patient.definition.PatientIdentifierDataDefinition) PropertyConverter(org.openmrs.module.reporting.data.converter.PropertyConverter) DataSetDefinitionService(org.openmrs.module.reporting.dataset.definition.service.DataSetDefinitionService) PaperRecordProperties(org.openmrs.module.paperrecord.PaperRecordProperties) PatientIdentifier(org.openmrs.PatientIdentifier)

Aggregations

PaperRecordProperties (org.openmrs.module.paperrecord.PaperRecordProperties)2 Before (org.junit.Before)1 PatientIdentifier (org.openmrs.PatientIdentifier)1 AdministrationService (org.openmrs.api.AdministrationService)1 PatientService (org.openmrs.api.PatientService)1 AppointmentDataSetDefinition (org.openmrs.module.appointmentscheduling.reporting.dataset.definition.AppointmentDataSetDefinition)1 PaperRecordServiceImpl (org.openmrs.module.paperrecord.PaperRecordServiceImpl)1 PaperRecordDAO (org.openmrs.module.paperrecord.db.PaperRecordDAO)1 PropertyConverter (org.openmrs.module.reporting.data.converter.PropertyConverter)1 PatientIdentifierDataDefinition (org.openmrs.module.reporting.data.patient.definition.PatientIdentifierDataDefinition)1 DataSetDefinitionService (org.openmrs.module.reporting.dataset.definition.service.DataSetDefinitionService)1