Search in sources :

Example 11 with Patient

use of org.hl7.fhir.r5.model.Patient in project beneficiary-fhir-data by CMSgov.

the class InpatientClaimTransformerV2Test method shouldHaveNchPtntStusIndCdSupInfo.

@Test
public void shouldHaveNchPtntStusIndCdSupInfo() {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("https://bluebutton.cms.gov/resources/variables/nch_ptnt_stus_ind_cd", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/claiminformationcategory", "info", "Information"), new Coding("https://bluebutton.cms.gov/resources/codesystem/information", "https://bluebutton.cms.gov/resources/variables/nch_ptnt_stus_ind_cd", "NCH Patient Status Indicator Code")), // Code
    new Coding("https://bluebutton.cms.gov/resources/variables/nch_ptnt_stus_ind_cd", "A", "Discharged"));
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) Test(org.junit.jupiter.api.Test)

Example 12 with Patient

use of org.hl7.fhir.r5.model.Patient in project beneficiary-fhir-data by CMSgov.

the class InpatientClaimTransformerV2Test method shouldHaveClmIpAdmsnTypeCdSupInfo.

@Test
public void shouldHaveClmIpAdmsnTypeCdSupInfo() {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/claiminformationcategory", "info", "Information"), new Coding("https://bluebutton.cms.gov/resources/codesystem/information", "https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd", "Claim Inpatient Admission Type Code")), // Code
    new Coding("https://bluebutton.cms.gov/resources/variables/clm_ip_admsn_type_cd", "1", "Emergency - The patient required immediate medical intervention as a result of" + " severe, life threatening, or potentially disabling conditions. Generally," + " the patient was admitted through the emergency room."));
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) Test(org.junit.jupiter.api.Test)

Example 13 with Patient

use of org.hl7.fhir.r5.model.Patient in project beneficiary-fhir-data by CMSgov.

the class BeneficiaryTransformerV2Test method shouldHaveReferenceYearExtension.

/**
 * test to verify that {@link gov.cms.bfd.server.war.r4.providers.BeneficiaryTransformerV2}
 * hanldes patient reference year extension.
 */
@Test
public void shouldHaveReferenceYearExtension() {
    Extension ex = TransformerTestUtilsV2.findExtensionByUrl("https://bluebutton.cms.gov/resources/variables/rfrnc_yr", patient.getExtension());
    DateType yearValue = null;
    try {
        Date dt = new SimpleDateFormat("yyyy-MM-dd").parse("2018-01-01");
        yearValue = new DateType(dt, TemporalPrecisionEnum.YEAR);
    } catch (Exception e) {
    }
    Extension compare = new Extension().setValue(yearValue).setUrl("https://bluebutton.cms.gov/resources/variables/rfrnc_yr");
    assertTrue(compare.equalsDeep(ex));
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) DateType(org.hl7.fhir.r4.model.DateType) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Test(org.junit.jupiter.api.Test)

Example 14 with Patient

use of org.hl7.fhir.r5.model.Patient in project beneficiary-fhir-data by CMSgov.

the class BeneficiaryTransformerV2Test method verifyDualResourceExtension.

/**
 * helper function to verify that {@link
 * gov.cms.bfd.server.war.r4.providers.BeneficiaryTransformerV2} correctly handles patient Part D
 * attributee.
 */
private void verifyDualResourceExtension(String dualId) {
    String uri = "https://bluebutton.cms.gov/resources/variables/" + dualId;
    Extension ex = TransformerTestUtilsV2.findExtensionByUrl(uri, patient.getExtension());
    assertNotNull(ex);
    Extension compare = new Extension(uri, new Coding(uri, "**", "Enrolled in Medicare A and/or B, but no Part D enrollment data for the beneficiary. (This status was indicated as 'XX' for 2006-2009)"));
    assertTrue(compare.equalsDeep(ex));
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) Coding(org.hl7.fhir.r4.model.Coding)

Example 15 with Patient

use of org.hl7.fhir.r5.model.Patient in project beneficiary-fhir-data by CMSgov.

the class BeneficiaryTransformerV2Test method shouldMatchAddressWithAddrHeader.

/**
 * Verifies that {@link gov.cms.bfd.server.war.r4.providers.BeneficiaryTransformerV2} works
 * correctly when passed a {@link Beneficiary} with includeAddressFields header values.
 */
@Test
public void shouldMatchAddressWithAddrHeader() {
    RequestHeaders reqHdr = getRHwithIncldAddrFldHdr("true");
    createPatient(reqHdr);
    assertNotNull(patient);
    List<Address> addrList = patient.getAddress();
    assertEquals(1, addrList.size());
    assertEquals(6, addrList.get(0).getLine().size());
    Address compare = new Address();
    compare.setPostalCode("12345");
    compare.setState("MO");
    compare.setCity("PODUNK");
    ArrayList<StringType> lineList = new ArrayList<>(Arrays.asList(new StringType("204 SOUTH ST"), new StringType("7560 123TH ST"), new StringType("SURREY"), new StringType("DAEJEON SI 34867"), new StringType("COLOMBIA"), new StringType("SURREY")));
    compare.setLine(lineList);
    assertTrue(compare.equalsDeep(addrList.get(0)));
}
Also used : Address(org.hl7.fhir.r4.model.Address) StringType(org.hl7.fhir.r4.model.StringType) ArrayList(java.util.ArrayList) RequestHeaders(gov.cms.bfd.server.war.commons.RequestHeaders) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.Test)576 Test (org.junit.jupiter.api.Test)442 Patient (org.hl7.fhir.r4.model.Patient)437 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)255 HashMap (java.util.HashMap)251 Patient (org.hl7.fhir.dstu3.model.Patient)249 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)228 Bundle (org.hl7.fhir.r4.model.Bundle)203 Path (javax.ws.rs.Path)188 Date (java.util.Date)171 Produces (javax.ws.rs.Produces)163 ArrayList (java.util.ArrayList)156 JsonObject (javax.json.JsonObject)141 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)140 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)138 ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)137 ReferenceAndListParam (ca.uhn.fhir.rest.param.ReferenceAndListParam)128 ReferenceOrListParam (ca.uhn.fhir.rest.param.ReferenceOrListParam)128 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)125 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)120