Search in sources :

Example 1 with EmrApiProperties

use of org.openmrs.module.emrapi.EmrApiProperties 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 EmrApiProperties

use of org.openmrs.module.emrapi.EmrApiProperties 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 EmrApiProperties

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

the class EncounterDiagnosesElementTest method testGenerateHtml.

@Test
public void testGenerateHtml() throws Exception {
    EmrApiProperties emrApiProperties = mock(EmrApiProperties.class);
    FormEntryContext context = mock(FormEntryContext.class);
    when(context.getMode()).thenReturn(FormEntryContext.Mode.VIEW);
    EncounterDiagnosesElement element = new EncounterDiagnosesElement() {

        @Override
        List<Diagnosis> getExistingDiagnoses(FormEntryContext context, DiagnosisMetadata diagnosisMetadata) {
            return Arrays.asList(new Diagnosis(new CodedOrFreeTextAnswer("Some disease")));
        }
    };
    element.setEmrApiProperties(emrApiProperties);
    String html = element.generateHtml(context);
    assertTrue(html.indexOf("Translated") >= 0);
}
Also used : DiagnosisMetadata(org.openmrs.module.emrapi.diagnosis.DiagnosisMetadata) EmrApiProperties(org.openmrs.module.emrapi.EmrApiProperties) FormEntryContext(org.openmrs.module.htmlformentry.FormEntryContext) Diagnosis(org.openmrs.module.emrapi.diagnosis.Diagnosis) CodedOrFreeTextAnswer(org.openmrs.module.emrapi.diagnosis.CodedOrFreeTextAnswer) Matchers.anyString(org.mockito.Matchers.anyString) BaseContextMockTest(org.openmrs.test.BaseContextMockTest) Test(org.junit.Test)

Example 4 with EmrApiProperties

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

the class DailyRegistrationsDataSetManagerTest method setUp.

@Before
public void setUp() throws Exception {
    EmrApiProperties eap = emrApiProperties;
    PatientIdentifierType zlemrId = patientService.getPatientIdentifierTypeByUuid(ZlConfigConstants.PATIENTIDENTIFIERTYPE_ZLEMRID_UUID);
    Location registrationDesk = locationService.getLocation("Biwo Resepsyon");
    Location outpatient = locationService.getLocation("Klinik Ekstèn");
    Location mirebalaisHospital = locationService.getLocation("Hôpital Universitaire de Mirebalais - Prensipal");
    EncounterType registration = getRegistrationEncounterType();
    EncounterType checkIn = getCheckInEncounterType();
    EncounterType vitals = getVitalsEncounterType();
    EncounterType consult = getConsultationEncounterType();
    // never registered or seen
    testData.patient().name("Mary", "Rodriguez").gender("F").birthdate("1946-05-26", false).dateCreated("2013-10-01").identifier(zlemrId, "Y2ARM5", mirebalaisHospital).save();
    // registered at Clinic Registration, checked in at Outpatient Clinic, had vitals and consultation
    p1 = testData.patient().name("Alice", "Smith").gender("F").birthdate("1975-01-02", false).dateCreated("2013-10-01").identifier(zlemrId, "Y2ATDN", mirebalaisHospital).save();
    Visit v1 = testData.visit().patient(p1).visitType(eap.getAtFacilityVisitType()).started("2013-10-01 09:30:00").stopped("2013-10-01 16:45:00").location(mirebalaisHospital).save();
    testData.encounter().visit(v1).encounterType(registration).location(registrationDesk).encounterDatetime("2013-10-01 09:30:00").save();
    Encounter p2CheckIn = testData.encounter().visit(v1).encounterType(checkIn).location(outpatient).encounterDatetime("2013-10-01 09:45:00").save();
    testData.obs().encounter(p2CheckIn).concept("Type of HUM visit", "PIH").value("CLINICAL", "PIH").save();
    testData.encounter().visit(v1).encounterType(vitals).location(outpatient).encounterDatetime("2013-10-01 10:00:00").save();
    testData.encounter().visit(v1).encounterType(consult).location(outpatient).encounterDatetime("2013-10-01 10:15:00").save();
    // registered long ago, checked in at Outpatient Clinic, had vitals but no consultation
    Patient p2 = testData.patient().name("Gamma", "Helm").gender("M").birthdate("1985-01-01", false).dateCreated("2013-01-01").identifier(zlemrId, "Y2AVWK", mirebalaisHospital).save();
    testData.encounter().patient(p2).encounterType(registration).location(registrationDesk).encounterDatetime("2013-01-01 09:30:00").save();
    Visit v2 = testData.visit().patient(p2).visitType(eap.getAtFacilityVisitType()).started("2013-10-01 10:30:00").stopped("2013-10-01 16:45:00").location(mirebalaisHospital).save();
    Encounter p3checkIn = testData.encounter().visit(v2).encounterType(checkIn).location((outpatient)).encounterDatetime("2013-10-01 10:45:00").save();
    testData.obs().encounter(p3checkIn).concept("Type of HUM visit", "PIH").value("Pharmacy only", "PIH").save();
    testData.encounter().visit(v2).encounterType(vitals).location(outpatient).encounterDatetime("2013-10-01 11:00:00").save();
}
Also used : Visit(org.openmrs.Visit) EmrApiProperties(org.openmrs.module.emrapi.EmrApiProperties) Encounter(org.openmrs.Encounter) Patient(org.openmrs.Patient) EncounterType(org.openmrs.EncounterType) PatientIdentifierType(org.openmrs.PatientIdentifierType) Location(org.openmrs.Location) Before(org.junit.Before)

Example 5 with EmrApiProperties

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

the class DailyClinicalEncountersDataSetManagerTest method setUp.

@Before
public void setUp() throws Exception {
    EmrApiProperties eap = emrApiProperties;
    PatientIdentifierType zlemrId = patientService.getPatientIdentifierTypeByUuid(ZlConfigConstants.PATIENTIDENTIFIERTYPE_ZLEMRID_UUID);
    Location registrationDesk = locationService.getLocation("Biwo Resepsyon");
    Location outpatient = locationService.getLocation("Klinik Ekstèn");
    Location mirebalaisHospital = locationService.getLocation("Hôpital Universitaire de Mirebalais - Prensipal");
    EncounterType registration = getRegistrationEncounterType();
    EncounterType checkIn = getCheckInEncounterType();
    EncounterType vitals = getVitalsEncounterType();
    EncounterType consult = getConsultationEncounterType();
    // never registered or seen
    testData.patient().name("Mary", "Rodriguez").gender("F").birthdate("1946-05-26", false).dateCreated("2013-10-01").identifier(zlemrId, "Y2ARM5", mirebalaisHospital).save();
    // registered at Clinic Registration, checked in at Outpatient Clinic, had vitals and consultation
    p2 = testData.patient().name("Alice", "Smith").gender("F").birthdate("1975-01-02", false).dateCreated("2013-10-01").identifier(zlemrId, "Y2ATDN", mirebalaisHospital).save();
    Visit v1 = testData.visit().patient(p2).visitType(eap.getAtFacilityVisitType()).started("2013-10-01 09:30:00").stopped("2013-10-01 16:45:00").location(mirebalaisHospital).save();
    testData.encounter().visit(v1).encounterType(registration).location(registrationDesk).encounterDatetime("2013-10-01 09:30:00").save();
    Encounter p2CheckIn = testData.encounter().visit(v1).encounterType(checkIn).location(outpatient).encounterDatetime("2013-10-01 09:45:00").save();
    testData.obs().encounter(p2CheckIn).concept("Type of HUM visit", "PIH").value("CLINICAL", "PIH").save();
    testData.encounter().visit(v1).encounterType(vitals).location(outpatient).encounterDatetime("2013-10-01 10:00:00").save();
    testData.encounter().visit(v1).encounterType(consult).location(outpatient).encounterDatetime("2013-10-01 10:15:00").save();
    // registered long ago, checked in at Outpatient Clinic, had vitals but no consultation
    p3 = testData.patient().name("Gamma", "Helm").gender("M").birthdate("1985-01-01", false).dateCreated("2013-01-01").identifier(zlemrId, "Y2AVWK", mirebalaisHospital).save();
    testData.encounter().patient(p3).encounterType(registration).location(registrationDesk).encounterDatetime("2013-01-01 09:30:00").save();
    Visit v2 = testData.visit().patient(p3).visitType(eap.getAtFacilityVisitType()).started("2013-10-01 10:30:00").stopped("2013-10-01 16:45:00").location(mirebalaisHospital).save();
    Encounter p3checkIn = testData.encounter().visit(v2).encounterType(checkIn).location((outpatient)).encounterDatetime("2013-10-01 10:45:00").save();
    testData.obs().encounter(p3checkIn).concept("Type of HUM visit", "PIH").value("Pharmacy only", "PIH").save();
    testData.encounter().visit(v2).encounterType(vitals).location(outpatient).encounterDatetime("2013-10-01 11:00:00").save();
    // registered at Clinic Registration, checked in at Outpatient Clinic, skipped vitals but had consultation
    p4 = testData.patient().name("Johnson", "Vlissides").gender("M").birthdate("1965-01-02", false).dateCreated("2013-10-01").identifier(zlemrId, "2H5GGF", mirebalaisHospital).save();
    Visit v3 = testData.visit().patient(p4).visitType(eap.getAtFacilityVisitType()).started("2013-10-01 09:30:00").stopped("2013-10-01 16:45:00").location(mirebalaisHospital).save();
    testData.encounter().visit(v3).encounterType(registration).location(registrationDesk).encounterDatetime("2013-10-01 09:30:00").save();
    Encounter p4CheckIn = testData.encounter().visit(v3).encounterType(checkIn).location(outpatient).encounterDatetime("2013-10-01 09:45:00").save();
    testData.obs().encounter(p4CheckIn).concept("Type of HUM visit", "PIH").value("CLINICAL", "PIH").save();
    testData.encounter().visit(v3).encounterType(consult).location(outpatient).encounterDatetime("2013-10-01 10:15:00").save();
}
Also used : Visit(org.openmrs.Visit) EmrApiProperties(org.openmrs.module.emrapi.EmrApiProperties) Encounter(org.openmrs.Encounter) EncounterType(org.openmrs.EncounterType) PatientIdentifierType(org.openmrs.PatientIdentifierType) Location(org.openmrs.Location) Before(org.junit.Before)

Aggregations

EmrApiProperties (org.openmrs.module.emrapi.EmrApiProperties)6 Before (org.junit.Before)4 Encounter (org.openmrs.Encounter)3 PatientIdentifierType (org.openmrs.PatientIdentifierType)3 EncounterType (org.openmrs.EncounterType)2 Location (org.openmrs.Location)2 Visit (org.openmrs.Visit)2 ConceptService (org.openmrs.api.ConceptService)2 DispositionService (org.openmrs.module.emrapi.disposition.DispositionService)2 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1 Patient (org.openmrs.Patient)1 LocationService (org.openmrs.api.LocationService)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 CodedOrFreeTextAnswer (org.openmrs.module.emrapi.diagnosis.CodedOrFreeTextAnswer)1