Search in sources :

Example 1 with HtmlFormEntryService

use of org.openmrs.module.htmlformentry.HtmlFormEntryService in project openmrs-module-pihcore by PIH.

the class HtmlFormSetup method setupHtmlFormEntryTagHandlers.

public static void setupHtmlFormEntryTagHandlers() throws Exception {
    HtmlFormEntryService htmlFormEntryService = Context.getService(HtmlFormEntryService.class);
    htmlFormEntryService.addHandler(PihCoreConstants.HTMLFORMENTRY_CAUSE_OF_DEATH_LIST_TAG_NAME, new CauseOfDeathListTagHandler());
    htmlFormEntryService.addHandler(PihCoreConstants.HTMLFORMENTRY_PAST_MEDICAL_HISTORY_CHECKBOX_TAG_NAME, new PastMedicalHistoryCheckboxTagHandler());
    htmlFormEntryService.addHandler(PihCoreConstants.HTMLFORMENTRY_FAMILY_HISTORY_RELATIVE_CHECKBOXES_TAG_NAME, new FamilyHistoryRelativeCheckboxesTagHandler());
}
Also used : HtmlFormEntryService(org.openmrs.module.htmlformentry.HtmlFormEntryService) PastMedicalHistoryCheckboxTagHandler(org.openmrs.module.pihcore.htmlformentry.PastMedicalHistoryCheckboxTagHandler) CauseOfDeathListTagHandler(org.openmrs.module.pihcore.htmlformentry.CauseOfDeathListTagHandler) FamilyHistoryRelativeCheckboxesTagHandler(org.openmrs.module.pihcore.htmlformentry.FamilyHistoryRelativeCheckboxesTagHandler)

Example 2 with HtmlFormEntryService

use of org.openmrs.module.htmlformentry.HtmlFormEntryService 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 HtmlFormEntryService

use of org.openmrs.module.htmlformentry.HtmlFormEntryService in project openmrs-module-coreapps by openmrs.

the class CoreAppsActivator method stopped.

/**
 * @see ModuleActivator#stopped()
 */
public void stopped() {
    try {
        HtmlFormEntryService htmlFormEntryService = Context.getService(HtmlFormEntryService.class);
        htmlFormEntryService.getHandlers().remove(CoreAppsConstants.HTMLFORMENTRY_ENCOUNTER_DIAGNOSES_TAG_NAME);
        htmlFormEntryService.getHandlers().remove(CoreAppsConstants.HTMLFORMENTRY_ENCOUNTER_DISPOSITION_TAG_NAME);
    } catch (Exception ex) {
    // pass
    }
    log.info("Core Apps Module stopped");
}
Also used : HtmlFormEntryService(org.openmrs.module.htmlformentry.HtmlFormEntryService)

Example 4 with HtmlFormEntryService

use of org.openmrs.module.htmlformentry.HtmlFormEntryService in project openmrs-module-mirebalais by PIH.

the class HtmlFormSetup method setupHtmlForms.

// 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
public static void setupHtmlForms(Config config) throws Exception {
    try {
        ResourceFactory resourceFactory = ResourceFactory.getInstance();
        FormService formService = Context.getFormService();
        HtmlFormEntryService htmlFormEntryService = Context.getService(HtmlFormEntryService.class);
        // forms installed across all implementations
        List<String> htmlforms = new ArrayList(Arrays.asList("pihcore:htmlforms/admissionNote.xml", "pihcore:htmlforms/patientRegistration.xml", "pihcore:htmlforms/patientRegistration-rs.xml", "pihcore:htmlforms/surgicalPostOpNote.xml", "pihcore:htmlforms/vitals.xml", "pihcore:htmlforms/transferNote.xml", "pihcore:htmlforms/dischargeNote.xml", "pihcore:htmlforms/outpatientConsult.xml", "pihcore:htmlforms/edNote.xml", "pihcore:htmlforms/deathCertificate.xml", "pihcore:htmlforms/oncologyConsult.xml", "pihcore:htmlforms/mentalHealth.xml", "pihcore:htmlforms/section-chief-complaint.xml", "pihcore:htmlforms/section-history.xml", "pihcore:htmlforms/section-exam.xml", "pihcore:htmlforms/section-dx.xml", "pihcore:htmlforms/section-peds-feeding.xml", "pihcore:htmlforms/section-peds-supplements.xml", "pihcore:htmlforms/section-plan.xml", "pihcore:htmlforms/section-ncd.xml", "pihcore:htmlforms/section-lab-order.xml", "pihcore:htmlforms/section-family-planning.xml", "pihcore:htmlforms/socio-econ.xml", "pihcore:htmlforms/primary-care-adult-initial.xml", "pihcore:htmlforms/primary-care-adult-followup.xml", "pihcore:htmlforms/primary-care-peds-initial.xml", "pihcore:htmlforms/primary-care-peds-followup.xml", "pihcore:htmlforms/ncd-adult-initial.xml", "pihcore:htmlforms/ncd-adult-followup.xml"));
        // add any country-specific forms
        if (config.getCountry().equals(ConfigDescriptor.Country.HAITI)) {
            htmlforms.addAll(Arrays.asList("pihcore:htmlforms/haiti/hiv/zl/hiv-intake.xml", "pihcore:htmlforms/haiti/patientRegistration-contact.xml", "pihcore:htmlforms/haiti/patientRegistration-social.xml", "pihcore:htmlforms/haiti/patientRegistration-insurance.xml", "pihcore:htmlforms/haiti/checkin.xml", "pihcore:htmlforms/haiti/liveCheckin.xml", "pihcore:htmlforms/haiti/hiv/zl/hiv-followup.xml", "pihcore:htmlforms/haiti/hiv/zl/vct.xml", "pihcore:htmlforms/haiti/hiv/zl/section-hiv-serology.xml", "pihcore:htmlforms/haiti/hiv/zl/section-symptoms.xml", "pihcore:htmlforms/haiti/hiv/zl/section-who-stages.xml", "pihcore:htmlforms/haiti/hiv/zl/section-hiv-oi.xml", "pihcore:htmlforms/haiti/hiv/zl/section-hiv-state.xml", "pihcore:htmlforms/haiti/hiv/iSantePlus/Adherence.xml", "pihcore:htmlforms/haiti/hiv/iSantePlus/SaisiePremiereVisiteAdult.xml", "pihcore:htmlforms/haiti/hiv/iSantePlus/SaisiePremiereVisitePediatrique.xml", "pihcore:htmlforms/haiti/hiv/iSantePlus/VisiteDeSuivi.xml", "pihcore:htmlforms/haiti/hiv/iSantePlus/VisiteDeSuiviPediatrique.xml"));
        } else if (config.getCountry().equals(ConfigDescriptor.Country.LIBERIA)) {
            htmlforms.addAll(Arrays.asList("pihcore:htmlforms/liberia/checkin.xml", "pihcore:htmlforms/liberia/liveCheckin.xml", "pihcore:htmlforms/liberia/patientRegistration-contact.xml", "pihcore:htmlforms/liberia/patientRegistration-social.xml"));
        } else if (config.getCountry().equals(ConfigDescriptor.Country.SIERRA_LEONE)) {
            htmlforms.addAll(Arrays.asList("pihcore:htmlforms/patientRegistration.xml", "pihcore:htmlforms/patientRegistration-rs.xml", "pihcore:htmlforms/sierra_leone/checkin.xml", "pihcore:htmlforms/sierra_leone/liveCheckin.xml", "pihcore:htmlforms/sierra_leone/patientRegistration-contact.xml", "pihcore:htmlforms/sierra_leone/patientRegistration-social.xml"));
        }
        if (htmlforms != null) {
            for (String htmlform : htmlforms) {
                HtmlFormUtil.getHtmlFormFromUiResource(resourceFactory, formService, htmlFormEntryService, htmlform);
            }
        }
    } catch (Exception e) {
        // this is a hack to get component test to pass until we find the proper way to mock this
        if (ResourceFactory.getInstance().getResourceProviders() == null) {
            log.error("Unable to load HTML forms--this error is expected when running component tests");
        } else {
            throw e;
        }
    }
}
Also used : HtmlFormEntryService(org.openmrs.module.htmlformentry.HtmlFormEntryService) FormService(org.openmrs.api.FormService) ArrayList(java.util.ArrayList) ResourceFactory(org.openmrs.ui.framework.resource.ResourceFactory)

Aggregations

HtmlFormEntryService (org.openmrs.module.htmlformentry.HtmlFormEntryService)4 ArrayList (java.util.ArrayList)1 ConceptService (org.openmrs.api.ConceptService)1 FormService (org.openmrs.api.FormService)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 EmrApiProperties (org.openmrs.module.emrapi.EmrApiProperties)1 AdtService (org.openmrs.module.emrapi.adt.AdtService)1 DispositionService (org.openmrs.module.emrapi.disposition.DispositionService)1 CauseOfDeathListTagHandler (org.openmrs.module.pihcore.htmlformentry.CauseOfDeathListTagHandler)1 FamilyHistoryRelativeCheckboxesTagHandler (org.openmrs.module.pihcore.htmlformentry.FamilyHistoryRelativeCheckboxesTagHandler)1 PastMedicalHistoryCheckboxTagHandler (org.openmrs.module.pihcore.htmlformentry.PastMedicalHistoryCheckboxTagHandler)1 BasicUiUtils (org.openmrs.ui.framework.BasicUiUtils)1 UiUtils (org.openmrs.ui.framework.UiUtils)1 ResourceFactory (org.openmrs.ui.framework.resource.ResourceFactory)1