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);
}
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");
}
}
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;
}
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));
}
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"));
}
Aggregations