Search in sources :

Example 1 with DispositionService

use of org.openmrs.module.emrapi.disposition.DispositionService in project openmrs-module-coreapps by openmrs.

the class ParserEncounterIntoSimpleObjectsTest method setUp.

@Before
public void setUp() throws Exception {
    emrApiProperties = mock(EmrApiProperties.class);
    conceptService = mock(ConceptService.class);
    locationService = mock(LocationService.class);
    dispositionService = mock(DispositionService.class);
    MockMetadataTestUtil.setupMockConceptService(conceptService, emrApiProperties);
    emrConceptService = mock(EmrConceptService.class);
    diagnosisMetadata = MockMetadataTestUtil.setupDiagnosisMetadata(emrApiProperties, conceptService);
    dispositionDescriptor = MockMetadataTestUtil.setupDispositionDescriptor(conceptService);
    when(dispositionService.getDispositionDescriptor()).thenReturn(dispositionDescriptor);
    TestUiUtils testUiUtils = new TestUiUtils();
    testUiUtils.setMockFormattingConcepts(true);
    uiUtils = testUiUtils;
    encounter = new Encounter();
    parser = new ParserEncounterIntoSimpleObjects(encounter, uiUtils, emrApiProperties, locationService, dispositionService);
}
Also used : DispositionService(org.openmrs.module.emrapi.disposition.DispositionService) LocationService(org.openmrs.api.LocationService) TestUiUtils(org.openmrs.module.appui.TestUiUtils) EmrApiProperties(org.openmrs.module.emrapi.EmrApiProperties) Encounter(org.openmrs.Encounter) EmrConceptService(org.openmrs.module.emrapi.concept.EmrConceptService) ConceptService(org.openmrs.api.ConceptService) EmrConceptService(org.openmrs.module.emrapi.concept.EmrConceptService) Before(org.junit.Before)

Example 2 with DispositionService

use of org.openmrs.module.emrapi.disposition.DispositionService in project openmrs-module-coreapps by openmrs.

the class CoreAppsActivator method contextRefreshed.

/**
 * @see ModuleActivator#contextRefreshed()
 */
public void contextRefreshed() {
    ConceptService conceptService = Context.getConceptService();
    EmrApiProperties emrApiProperties = Context.getRegisteredComponent("emrApiProperties", EmrApiProperties.class);
    DispositionService dispositionService = Context.getRegisteredComponent("dispositionService", DispositionService.class);
    AdtService adtService = Context.getRegisteredComponent("adtService", AdtService.class);
    UiUtils uiUtils = Context.getRegisteredComponent("uiUtils", BasicUiUtils.class);
    if (ModuleFactory.isModuleStarted("htmlformentry")) {
        HtmlFormEntryService htmlFormEntryService = Context.getService(HtmlFormEntryService.class);
        EncounterDiagnosesTagHandler encounterDiagnosesTagHandler = CoreAppsActivator.setupEncounterDiagnosesTagHandler(conceptService, adtService, emrApiProperties, uiUtils);
        htmlFormEntryService.addHandler(CoreAppsConstants.HTMLFORMENTRY_ENCOUNTER_DIAGNOSES_TAG_NAME, encounterDiagnosesTagHandler);
        EncounterDispositionTagHandler encounterDispositionTagHandler = CoreAppsActivator.setupEncounterDispositionTagHandler(emrApiProperties, dispositionService, adtService);
        htmlFormEntryService.addHandler(CoreAppsConstants.HTMLFORMENTRY_ENCOUNTER_DISPOSITION_TAG_NAME, encounterDispositionTagHandler);
        htmlFormEntryService.addHandler(CoreAppsConstants.HTMLFORMENTRY_CODED_OR_FREE_TEXT_OBS_TAG_NAME, new CodedOrFreeTextObsTagHandler());
    }
    log.info("Core Apps Module refreshed");
}
Also used : DispositionService(org.openmrs.module.emrapi.disposition.DispositionService) AdtService(org.openmrs.module.emrapi.adt.AdtService) HtmlFormEntryService(org.openmrs.module.htmlformentry.HtmlFormEntryService) EmrApiProperties(org.openmrs.module.emrapi.EmrApiProperties) EncounterDiagnosesTagHandler(org.openmrs.module.coreapps.htmlformentry.EncounterDiagnosesTagHandler) ConceptService(org.openmrs.api.ConceptService) EncounterDispositionTagHandler(org.openmrs.module.coreapps.htmlformentry.EncounterDispositionTagHandler) CodedOrFreeTextObsTagHandler(org.openmrs.module.coreapps.htmlformentry.CodedOrFreeTextObsTagHandler) BasicUiUtils(org.openmrs.ui.framework.BasicUiUtils) UiUtils(org.openmrs.ui.framework.UiUtils)

Example 3 with DispositionService

use of org.openmrs.module.emrapi.disposition.DispositionService in project openmrs-module-pihcore by PIH.

the class RedirectToDeathNoteIfMissing method applyAction.

@Override
public void applyAction(FormEntrySession session) {
    DispositionService dispositionService = Context.getService(DispositionService.class);
    if (!Context.getRegisteredComponent("config", Config.class).isComponentEnabled(Components.DEATH_CERTIFICATE)) {
        return;
    }
    if (!Context.hasPrivilege("Task: mirebalais.enterDeathCertificate")) {
        return;
    }
    if (!dispositionIsDeath(session.getEncounter(), dispositionService)) {
        return;
    }
    if (hasDeathCertificateEncounter(session.getPatient())) {
        return;
    }
    session.setAfterSaveUrlTemplate("htmlformentryui/htmlform/enterHtmlFormWithSimpleUi.page" + "?patientId={{patient.id}}" + "&definitionUiResource=" + PihCoreUtil.getFormResource("deathCertificate.xml") + "&returnUrl=" + session.getReturnUrl());
}
Also used : DispositionService(org.openmrs.module.emrapi.disposition.DispositionService)

Example 4 with DispositionService

use of org.openmrs.module.emrapi.disposition.DispositionService in project openmrs-module-mirebalais by PIH.

the class MirebalaisHospitalActivator method started.

/**
 * @see ModuleActivator#started()
 */
public void started() {
    try {
        // currently only one of these
        Config config = Context.getRegisteredComponents(Config.class).get(0);
        AdministrationService administrationService = Context.getAdministrationService();
        ReportService reportService = Context.getService(ReportService.class);
        ReportDefinitionService reportDefinitionService = Context.getService(ReportDefinitionService.class);
        SerializedObjectDAO serializedObjectDAO = Context.getRegisteredComponents(SerializedObjectDAO.class).get(0);
        PrinterService printerService = Context.getService(PrinterService.class);
        DispositionService dispositionService = Context.getService(DispositionService.class);
        removeOldPrivileges();
        setDispositionConfig(config, dispositionService);
        // register our custom print handlers
        PrinterSetup.registerPrintHandlers(printerService);
        // set up html forms--this must happen *after* MDS packages are installed, so that forms defined in code/github
        // take precedent over any in MDS packages; therefore we still do this in the Mirebalais module, not PIH Core
        HtmlFormSetup.setupHtmlForms(config);
        // configure default dashboard in coreapps
        updateGlobalProperty(CoreAppsConstants.GP_DASHBOARD_URL, config.getDashboardUrl());
        // configure default visits page in coreapps
        updateGlobalProperty(CoreAppsConstants.GP_VISITS_PAGE_URL, config.getVisitPageUrl());
        // configure default specific visit detail page in coreapps
        updateGlobalProperty(CoreAppsConstants.GP_VISITS_PAGE_WITH_SPECIFIC_URL, config.getVisitsPageWithSpecificUrl());
        if (config.isComponentEnabled(Components.LEGACY_MPI)) {
            LegacyMasterPatientIndexSetup.setupConnectionToMasterPatientIndex(customProperties);
        }
        if (config.isComponentEnabled(Components.ARCHIVES)) {
            ArchivesSetup.setupCloseStaleCreateRequestsTask();
            ArchivesSetup.setupCloseStalePullRequestsTask();
        }
        if (config.isComponentEnabled(Components.APPOINTMENT_SCHEDULING)) {
            AppointmentSchedulingSetup.setupMarkAppointmentAsMissedOrCompletedTask();
            if (config.getCountry().equals(ConfigDescriptor.Country.HAITI)) {
                AppointmentSchedulingSetup.customizeDailyAppointmentsDataSet();
            }
        }
        if (config.isComponentEnabled(Components.RADIOLOGY) && config.getSite().equals(ConfigDescriptor.Site.MIREBALAIS)) {
            updateGlobalProperty(OpenmrsConstants.GP_ORDER_NUMBER_GENERATOR_BEAN_ID, MirebalaisConstants.RADIOLOGY_ORDER_NUMBER_GENERATOR_BEAN_ID);
        }
        if (!testMode) {
            if (config.isComponentEnabled(Components.OVERVIEW_REPORTS) || config.isComponentEnabled(Components.DATA_EXPORTS)) {
                // must happen after location tags have been configured
                ReportSetup.setupReports(reportService, reportDefinitionService, administrationService, serializedObjectDAO, config);
            }
            // do app and extension configuration
            Context.getRegisteredComponent("customAppLoaderFactory", CustomAppLoaderFactory.class).setReadyForRefresh(true);
            ModuleFactory.getStartedModuleById("appframework").getModuleActivator().contextRefreshed();
            // on first startup, these modules may not have been able to configure their global propertes correctly because
            // all metadata was not loaded; we call the started method here to complete setup
            ModuleFactory.getStartedModuleById("registrationapp").getModuleActivator().started();
        }
    } catch (Exception e) {
        Module mod = ModuleFactory.getModuleById(MirebalaisConstants.MIREBALAIS_MODULE_ID);
        ModuleFactory.stopModule(mod);
        throw new RuntimeException("failed to setup the required modules", e);
    }
    log.info("Mirebalais Hospital Module started");
}
Also used : DispositionService(org.openmrs.module.emrapi.disposition.DispositionService) ReportService(org.openmrs.module.reporting.report.service.ReportService) AdministrationService(org.openmrs.api.AdministrationService) ReportDefinitionService(org.openmrs.module.reporting.report.definition.service.ReportDefinitionService) CustomAppLoaderFactory(org.openmrs.module.mirebalais.apploader.CustomAppLoaderFactory) Config(org.openmrs.module.pihcore.config.Config) PrinterService(org.openmrs.module.printer.PrinterService) Module(org.openmrs.module.Module) SerializedObjectDAO(org.openmrs.api.db.SerializedObjectDAO)

Example 5 with DispositionService

use of org.openmrs.module.emrapi.disposition.DispositionService in project openmrs-module-pihcore by PIH.

the class ApplyDispositionAction method applyAction.

@Override
public void applyAction(FormEntrySession session) {
    DispositionService dispositionService = Context.getService(DispositionService.class);
    applyDispositionActions(session, dispositionService);
}
Also used : DispositionService(org.openmrs.module.emrapi.disposition.DispositionService)

Aggregations

DispositionService (org.openmrs.module.emrapi.disposition.DispositionService)6 Before (org.junit.Before)2 Encounter (org.openmrs.Encounter)2 ConceptService (org.openmrs.api.ConceptService)2 EmrApiProperties (org.openmrs.module.emrapi.EmrApiProperties)2 Date (java.util.Date)1 AdministrationService (org.openmrs.api.AdministrationService)1 LocationService (org.openmrs.api.LocationService)1 PersonService (org.openmrs.api.PersonService)1 SerializedObjectDAO (org.openmrs.api.db.SerializedObjectDAO)1 Module (org.openmrs.module.Module)1 TestUiUtils (org.openmrs.module.appui.TestUiUtils)1 CodedOrFreeTextObsTagHandler (org.openmrs.module.coreapps.htmlformentry.CodedOrFreeTextObsTagHandler)1 EncounterDiagnosesTagHandler (org.openmrs.module.coreapps.htmlformentry.EncounterDiagnosesTagHandler)1 EncounterDispositionTagHandler (org.openmrs.module.coreapps.htmlformentry.EncounterDispositionTagHandler)1 AdtService (org.openmrs.module.emrapi.adt.AdtService)1 EmrConceptService (org.openmrs.module.emrapi.concept.EmrConceptService)1 DispositionDescriptor (org.openmrs.module.emrapi.disposition.DispositionDescriptor)1 DispositionAction (org.openmrs.module.emrapi.disposition.actions.DispositionAction)1 FormEntrySession (org.openmrs.module.htmlformentry.FormEntrySession)1