Search in sources :

Example 11 with AppDescriptor

use of org.openmrs.module.appframework.domain.AppDescriptor in project openmrs-module-mirebalais by PIH.

the class PatientRegistrationAppTest method shouldCreateAppDescriptor.

@Test
public void shouldCreateAppDescriptor() throws Exception {
    executeDataSet("org/openmrs/module/pihcore/coreMetadata.xml");
    authenticate();
    deployService.installBundle(socioEconomicConcepts);
    AppDescriptor d = patientRegistrationApp.getAppDescriptor(new Config());
    assertThat(d.getId(), is(CustomAppLoaderConstants.Apps.PATIENT_REGISTRATION));
    assertThat(d.getDescription(), is("registrationapp.registerPatient"));
    assertThat(d.getLabel(), is("registrationapp.app.registerPatient.label"));
    assertThat(d.getIcon(), is("icon-user"));
    assertThat(d.getUrl(), is("registrationapp/findPatient.page?appId=" + CustomAppLoaderConstants.Apps.PATIENT_REGISTRATION));
    assertThat(d.getRequiredPrivilege(), is("App: registrationapp.registerPatient"));
    assertThat(d.getConfig().get("afterCreatedUrl").getTextValue(), is("mirebalais/patientRegistration/afterRegistration.page?patientId={{patientId}}&encounterId={{encounterId}}"));
    assertThat(d.getConfig().get("patientDashboardLink").getTextValue(), is("registrationapp/registrationSummary.page?appId=registrationapp.registerPatient"));
    assertThat(d.getConfig().get("registrationEncounter").get("encounterType").getTextValue(), is(EncounterTypes.PATIENT_REGISTRATION.uuid()));
    assertThat(d.getConfig().get("registrationEncounter").get("encounterRole").getTextValue(), is(EncounterRoleBundle.EncounterRoles.ADMINISTRATIVE_CLERK));
    assertTrue(d.getConfig().get("allowRetrospectiveEntry").getBooleanValue());
    assertTrue(d.getConfig().get("allowUnknownPatients").getBooleanValue());
    assertTrue(d.getConfig().get("allowManualIdentifier").getBooleanValue());
    JsonNode demographicsSection = assertSectionFound(d.getConfig(), 0, "demographics", "", 1);
    assertPersonAttributeQuestionFound(demographicsSection, 0, HaitiPersonAttributeTypes.MOTHERS_FIRST_NAME.uuid(), true);
    JsonNode contactInfoSection = assertSectionFound(d.getConfig(), 1, "contactInfo", "registrationapp.patient.contactInfo.label", 2);
    assertSingleFieldQuestion(contactInfoSection, 0, "personAddress");
    assertPersonAttributeQuestionFound(contactInfoSection, 1, HaitiPersonAttributeTypes.TELEPHONE_NUMBER.uuid(), false);
    JsonNode socialSection = assertSectionFound(d.getConfig(), 2, "social", "zl.registration.patient.social.label", 4);
    assertSingleFieldQuestion(socialSection, 0, "personAddress");
    assertObsQuestionFound(socialSection, 1, "obs.PIH:CIVIL STATUS");
    assertObsQuestionFound(socialSection, 2, "obs.PIH:Occupation");
    assertObsQuestionFound(socialSection, 3, "obs.PIH:Religion");
    assertSectionFound(d.getConfig(), 3, "contacts", "zl.registration.patient.contactPerson.label", 3);
}
Also used : AppDescriptor(org.openmrs.module.appframework.domain.AppDescriptor) Config(org.openmrs.module.pihcore.config.Config) JsonNode(org.codehaus.jackson.JsonNode) BaseModuleContextSensitiveTest(org.openmrs.test.BaseModuleContextSensitiveTest) Test(org.junit.Test)

Example 12 with AppDescriptor

use of org.openmrs.module.appframework.domain.AppDescriptor in project openmrs-module-mirebalais by PIH.

the class CustomAppLoaderFactory method enableAppointmentScheduling.

private void enableAppointmentScheduling() {
    AppDescriptor apppointmentScheduling = app(Apps.APPOINTMENT_SCHEDULING_HOME, "appointmentschedulingui.scheduleAppointment.new.title", "icon-calendar", "appointmentschedulingui/home.page", "App: appointmentschedulingui.home", null);
    apps.add(addToHomePage(apppointmentScheduling));
    apps.add(findPatientTemplateApp(Apps.SCHEDULE_APPOINTMENT, "appointmentschedulingui.scheduleAppointment.buttonTitle", "icon-calendar", "Task: appointmentschedulingui.bookAppointments", "/appointmentschedulingui/manageAppointments.page?patientId={{patientId}}&breadcrumbOverride={{breadcrumbOverride}}", arrayNode(objectNode("icon", "icon-home", "link", "/index.htm"), objectNode("label", "appointmentschedulingui.home.title", "link", "/appointmentschedulingui/home.page"), objectNode("label", "appointmentschedulingui.scheduleAppointment.buttonTitle"))));
    extensions.add(overallAction(Extensions.SCHEDULE_APPOINTMENT_OVERALL_ACTION, "appointmentschedulingui.scheduleAppointment.new.title", "icon-calendar", "link", "appointmentschedulingui/manageAppointments.page?patientId={{patient.uuid}}", "Task: appointmentschedulingui.bookAppointments", null));
    extensions.add(overallAction(Extensions.REQUEST_APPOINTMENT_OVERALL_ACTION, "appointmentschedulingui.requestAppointment.label", "icon-calendar", "link", "appointmentschedulingui/requestAppointment.page?patientId={{patient.uuid}}", "Task: appointmentschedulingui.requestAppointments", null));
    extensions.add(dashboardTab(Extensions.APPOINTMENTS_TAB, "appointmentschedulingui.appointmentsTab.label", "App: appointmentschedulingui.viewAppointments", "appointmentschedulingui", "appointmentsTab"));
    if (config.isComponentEnabled(Components.CLINICIAN_DASHBOARD)) {
        addToClinicianDashboardFirstColumn(apppointmentScheduling, "appointmentschedulingui", "miniPatientAppointments");
    }
}
Also used : AppDescriptor(org.openmrs.module.appframework.domain.AppDescriptor)

Example 13 with AppDescriptor

use of org.openmrs.module.appframework.domain.AppDescriptor in project openmrs-module-mirebalais by PIH.

the class CustomAppLoaderUtil method findPatientTemplateApp.

public static AppDescriptor findPatientTemplateApp(String id, String label, String icon, String privilege, String afterSelectedUrl, ArrayNode breadcrumbs) {
    AppDescriptor app = new AppDescriptor(id, id, label, "coreapps/findpatient/findPatient.page?app=" + id, icon, null, 0, privilege, null);
    app.setConfig(objectNode("afterSelectedUrl", afterSelectedUrl, "label", label, "heading", label, "showLastViewedPatients", false, "breadcrumbs", breadcrumbs));
    return app;
}
Also used : AppDescriptor(org.openmrs.module.appframework.domain.AppDescriptor)

Example 14 with AppDescriptor

use of org.openmrs.module.appframework.domain.AppDescriptor in project openmrs-module-coreapps by openmrs.

the class AppTest method testFindPatientAppIsLoaded.

@Test
public void testFindPatientAppIsLoaded() throws Exception {
    AppDescriptor app = AppTestUtil.getAppDescriptor("coreapps.findPatient");
    assertThat(app.getOrder(), is(2));
    assertThat(app.getInstanceOf(), is("coreapps.template.findPatient"));
    assertThat(app.getTemplate().getId(), is("coreapps.template.findPatient"));
    String expectedUrl = app.getTemplate().getConfigOptions().get(0).getDefaultValue().getTextValue();
    assertThat(app.getConfig().get("afterSelectedUrl").getTextValue(), is(expectedUrl));
    String expectedLabel = app.getTemplate().getConfigOptions().get(1).getDefaultValue().getTextValue();
    assertThat(app.getConfig().get("label").getTextValue(), is(expectedLabel));
    String expectedHeading = app.getTemplate().getConfigOptions().get(2).getDefaultValue().getTextValue();
    assertThat(app.getConfig().get("heading").getTextValue(), is(expectedHeading));
    String expectedShowPatientLink = app.getTemplate().getConfigOptions().get(5).getDefaultValue().getTextValue();
    assertThat(app.getConfig().get("registrationAppLink").getTextValue(), is(expectedShowPatientLink));
}
Also used : AppDescriptor(org.openmrs.module.appframework.domain.AppDescriptor) Test(org.junit.Test)

Example 15 with AppDescriptor

use of org.openmrs.module.appframework.domain.AppDescriptor in project openmrs-module-pihcore by PIH.

the class AppEntryRouterPageControllerTest method shouldRedirectToFindPatientPageAndSetAppSessionVariable.

@Test
public void shouldRedirectToFindPatientPageAndSetAppSessionVariable() {
    AppDescriptor app = new AppDescriptor();
    app.setId("mirebalais.liveCheckin");
    app.setUrl("coreapps/findpatient/findPatient.page?app=mirebalais.liveCheckin");
    Redirect redirect = new AppEntryRouterPageController().controller(request, null, app);
    verify(session).setAttribute(PihCoreConstants.CURRENT_APP_SESSION_VARIABLE, "mirebalais.liveCheckin");
    assertThat(redirect.getUrl(), is("coreapps/findpatient/findPatient.page?app=mirebalais.liveCheckin"));
}
Also used : AppDescriptor(org.openmrs.module.appframework.domain.AppDescriptor) Redirect(org.openmrs.ui.framework.page.Redirect) Test(org.junit.Test)

Aggregations

AppDescriptor (org.openmrs.module.appframework.domain.AppDescriptor)15 Test (org.junit.Test)10 Redirect (org.openmrs.ui.framework.page.Redirect)2 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 JsonNode (org.codehaus.jackson.JsonNode)1 Location (org.openmrs.Location)1 Patient (org.openmrs.Patient)1 AppContextModel (org.openmrs.module.appframework.context.AppContextModel)1 Extension (org.openmrs.module.appframework.domain.Extension)1 PatientContextModel (org.openmrs.module.coreapps.contextmodel.PatientContextModel)1 VisitContextModel (org.openmrs.module.coreapps.contextmodel.VisitContextModel)1 AwaitingAdmissionVisitQuery (org.openmrs.module.emrapi.adt.reporting.query.AwaitingAdmissionVisitQuery)1 PatientDomainWrapper (org.openmrs.module.emrapi.patient.PatientDomainWrapper)1 VisitDomainWrapper (org.openmrs.module.emrapi.visit.VisitDomainWrapper)1 Config (org.openmrs.module.pihcore.config.Config)1 MapElementConverter (org.openmrs.module.reporting.data.converter.MapElementConverter)1 ObjectFormatter (org.openmrs.module.reporting.data.converter.ObjectFormatter)1 PropertyConverter (org.openmrs.module.reporting.data.converter.PropertyConverter)1 PatientDataDefinition (org.openmrs.module.reporting.data.patient.definition.PatientDataDefinition)1