Search in sources :

Example 1 with ClaimResponse

use of org.hl7.fhir.r4.model.ClaimResponse in project beneficiary-fhir-data by CMSgov.

the class FissClaimResponseTransformerV2 method transformClaim.

/**
 * @param claimGroup the {@link PreAdjFissClaim} to transform
 * @return a FHIR {@link ClaimResponse} resource that represents the specified {@link
 *     PreAdjFissClaim}
 */
private static ClaimResponse transformClaim(PreAdjFissClaim claimGroup) {
    ClaimResponse claim = new ClaimResponse();
    claim.setId("f-" + claimGroup.getDcn());
    claim.setContained(List.of(getContainedPatient(claimGroup)));
    claim.setExtension(getExtension(claimGroup));
    claim.setIdentifier(getIdentifier(claimGroup));
    claim.setStatus(ClaimResponse.ClaimResponseStatus.ACTIVE);
    claim.setOutcome(STATUS_TO_OUTCOME.get(Character.toLowerCase(claimGroup.getCurrStatus())));
    claim.setType(getType());
    claim.setUse(ClaimResponse.Use.CLAIM);
    claim.setInsurer(new Reference().setIdentifier(new Identifier().setValue("CMS")));
    claim.setPatient(new Reference("#patient"));
    claim.setRequest(new Reference(String.format("Claim/f-%s", claimGroup.getDcn())));
    claim.setMeta(new Meta().setLastUpdated(Date.from(claimGroup.getLastUpdated())));
    claim.setCreated(new Date());
    return claim;
}
Also used : Meta(org.hl7.fhir.r4.model.Meta) Identifier(org.hl7.fhir.r4.model.Identifier) ClaimResponse(org.hl7.fhir.r4.model.ClaimResponse) Reference(org.hl7.fhir.r4.model.Reference) Date(java.util.Date)

Example 2 with ClaimResponse

use of org.hl7.fhir.r4.model.ClaimResponse in project beneficiary-fhir-data by CMSgov.

the class R4ClaimResponseResourceProviderIT method shouldGetCorrectFissClaimResponseResourceById.

@Test
void shouldGetCorrectFissClaimResponseResourceById() {
    IGenericClient fhirClient = ServerTestUtils.get().createFhirClientV2();
    ClaimResponse claimResult = fhirClient.read().resource(ClaimResponse.class).withId("f-123456").execute();
    String expected = testUtils.expectedResponseFor("claimResponseFissRead");
    String actual = FhirContext.forR4().newJsonParser().encodeResourceToString(claimResult);
    AssertUtils.assertJsonEquals(expected, actual, IGNORE_PATTERNS);
}
Also used : ClaimResponse(org.hl7.fhir.r4.model.ClaimResponse) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Test(org.junit.jupiter.api.Test)

Example 3 with ClaimResponse

use of org.hl7.fhir.r4.model.ClaimResponse in project beneficiary-fhir-data by CMSgov.

the class R4ClaimResponseResourceProviderIT method shouldGetCorrectMcsClaimResponseResourceById.

@Test
void shouldGetCorrectMcsClaimResponseResourceById() {
    IGenericClient fhirClient = ServerTestUtils.get().createFhirClientV2();
    ClaimResponse claimResult = fhirClient.read().resource(ClaimResponse.class).withId("m-654321").execute();
    String expected = testUtils.expectedResponseFor("claimResponseMcsRead");
    String actual = FhirContext.forR4().newJsonParser().encodeResourceToString(claimResult);
    AssertUtils.assertJsonEquals(expected, actual, IGNORE_PATTERNS);
}
Also used : ClaimResponse(org.hl7.fhir.r4.model.ClaimResponse) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Test(org.junit.jupiter.api.Test)

Example 4 with ClaimResponse

use of org.hl7.fhir.r4.model.ClaimResponse in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeClaimResponseItemAdjudicationComponent.

protected void composeClaimResponseItemAdjudicationComponent(Complex parent, String parentType, String name, ClaimResponse.ItemAdjudicationComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "adjudication", name, element, index);
    if (element.hasCategory())
        composeCoding(t, "ClaimResponse", "category", element.getCategory(), -1);
    if (element.hasReason())
        composeCoding(t, "ClaimResponse", "reason", element.getReason(), -1);
    if (element.hasAmount())
        composeQuantity(t, "ClaimResponse", "amount", element.getAmount(), -1);
    if (element.hasValueElement())
        composeDecimal(t, "ClaimResponse", "value", element.getValueElement(), -1);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 5 with ClaimResponse

use of org.hl7.fhir.r4.model.ClaimResponse in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeClaimResponseAddedItemsDetailComponent.

protected void composeClaimResponseAddedItemsDetailComponent(Complex parent, String parentType, String name, ClaimResponse.AddedItemsDetailComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "detail", name, element, index);
    if (element.hasService())
        composeCoding(t, "ClaimResponse", "service", element.getService(), -1);
    if (element.hasFee())
        composeQuantity(t, "ClaimResponse", "fee", element.getFee(), -1);
    for (int i = 0; i < element.getAdjudication().size(); i++) composeClaimResponseAddedItemDetailAdjudicationComponent(t, "ClaimResponse", "adjudication", element.getAdjudication().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Aggregations

Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)16 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)15 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)13 ClaimResponse (org.hl7.fhir.r4.model.ClaimResponse)4 Test (org.junit.jupiter.api.Test)3 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)2 Date (java.util.Date)2 Identifier (org.hl7.fhir.r4.model.Identifier)2 Meta (org.hl7.fhir.r4.model.Meta)2 Reference (org.hl7.fhir.r4.model.Reference)2 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)1