use of org.hl7.fhir.r4.model.AllergyIntolerance in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7AllergyFHIRConversionTest method test_allergy_no_severity_no_coding_system.
@Test
void test_allergy_no_severity_no_coding_system() {
String hl7message = "MSH|^~\\&|SE050|050|PACS|050|20120912011230||ADT^A01|102|T|2.6|||AL|NE\r" + "PID|0010||PID1234^5^M11^A^MR^HOSP~1234568965^^^USA^SS||DOE^JOHN^A^||19800202|F||W|111 TEST_STREET_NAME^^TEST_CITY^NY^111-1111^USA||(905)111-1111|||S|ZZ|12^^^124|34-13-312||||TEST_BIRTH_PLACE\r" + "AL1|1|DA|00000741^OXYCODONE||HYPOTENSION\r";
AllergyIntolerance allergy = ResourceUtils.getAllergyResource(ftv, hl7message);
assertThat(allergy.hasCriticality()).isFalse();
assertThat(allergy.getCategory().get(0).getCode()).isEqualTo("medication");
assertThat(allergy.getCode().getText()).isEqualTo("OXYCODONE");
List<Coding> codings = allergy.getCode().getCoding();
Assertions.assertEquals(1, codings.size());
Coding coding = codings.get(0);
Assertions.assertEquals("00000741", coding.getCode());
Assertions.assertEquals("OXYCODONE", coding.getDisplay());
assertThat(allergy.getReaction().get(0).getManifestation()).extracting(m -> m.getText()).containsExactly("HYPOTENSION");
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7AllergyFHIRConversionTest method test_allergy_single.
@Test
void test_allergy_single() {
String hl7message = "MSH|^~\\&|SE050|050|PACS|050|20120912011230||ADT^A01|102|T|2.6|||AL|NE\r" + "PID|0010||PID1234^5^M11^A^MR^HOSP~1234568965^^^USA^SS||DOE^JOHN^A^||19800202|F||W|111 TEST_STREET_NAME^^TEST_CITY^NY^111-1111^USA||(905)111-1111|||S|ZZ|12^^^124|34-13-312||||TEST_BIRTH_PLACE\r" + "AL1|1|DA|^PENICILLIN|MI|PRODUCES HIVES~RASH|MI\r" + "AL1|2|AA|^CAT DANDER|SV";
AllergyIntolerance allergy = ResourceUtils.getAllergyResource(ftv, hl7message);
assertThat(allergy.getCriticality().toCode()).isEqualTo("low");
assertThat(allergy.getCategory().get(0).getCode()).isEqualTo("medication");
assertThat(allergy.getCode().getText()).isEqualTo("PENICILLIN");
assertThat(allergy.getReaction().get(0).getManifestation()).extracting(m -> m.getText()).containsExactlyInAnyOrder("PRODUCES HIVES", "RASH");
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceSearchQueryTest method searchForAllergies_shouldSearchForAllergiesByCategoryEnvironment.
@Test
public void searchForAllergies_shouldSearchForAllergiesByCategoryEnvironment() {
TokenAndListParam category = new TokenAndListParam();
category.addAnd(new TokenOrListParam().addOr(new TokenParam().setValue(CATEGORY_ENVIRONMENT)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.CATEGORY_SEARCH_HANDLER, category);
IBundleProvider results = search(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(((AllergyIntolerance) resultList.iterator().next()).getCategory().get(0).getValue(), equalTo(AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT));
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceSearchQueryTest method searchForAllergies_shouldSearchForAllergiesByPatientName.
@Test
public void searchForAllergies_shouldSearchForAllergiesByPatientName() {
ReferenceAndListParam referenceParam = new ReferenceAndListParam();
ReferenceParam allergyParam = new ReferenceParam();
allergyParam.setValue(PATIENT_NAME);
allergyParam.setChain(Patient.SP_NAME);
referenceParam.addValue(new ReferenceOrListParam().add(allergyParam));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, referenceParam);
IBundleProvider results = search(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(((AllergyIntolerance) resultList.iterator().next()).getIdElement().getIdPart(), equalTo(ALLERGY_UUID));
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceSearchQueryTest method searchForAllergies_shouldSearchForAllergiesByIdentifier.
@Test
public void searchForAllergies_shouldSearchForAllergiesByIdentifier() {
ReferenceAndListParam referenceParam = new ReferenceAndListParam();
ReferenceParam allergyParam = new ReferenceParam();
allergyParam.setValue(PATIENT_IDENTIFIER);
allergyParam.setChain(Patient.SP_IDENTIFIER);
referenceParam.addValue(new ReferenceOrListParam().add(allergyParam));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER, referenceParam);
IBundleProvider results = search(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(((AllergyIntolerance) resultList.iterator().next()).getPatient().getReference(), endsWith(PATIENT_UUID));
}
Aggregations