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