Search in sources :

Example 46 with ClaimResponse

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

the class RdfParser method composeClaimResponseItemDetailComponent.

protected void composeClaimResponseItemDetailComponent(Complex parent, String parentType, String name, ClaimResponse.ItemDetailComponent 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.hasSequenceLinkIdElement())
        composePositiveInt(t, "ClaimResponse", "sequenceLinkId", element.getSequenceLinkIdElement(), -1);
    for (int i = 0; i < element.getAdjudication().size(); i++) composeClaimResponseDetailAdjudicationComponent(t, "ClaimResponse", "adjudication", element.getAdjudication().get(i), i);
    for (int i = 0; i < element.getSubDetail().size(); i++) composeClaimResponseSubDetailComponent(t, "ClaimResponse", "subDetail", element.getSubDetail().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 47 with ClaimResponse

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

the class RdfParser method composeClaimResponseItemsComponent.

protected void composeClaimResponseItemsComponent(Complex parent, String parentType, String name, ClaimResponse.ItemsComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "item", name, element, index);
    if (element.hasSequenceLinkIdElement())
        composePositiveInt(t, "ClaimResponse", "sequenceLinkId", element.getSequenceLinkIdElement(), -1);
    for (int i = 0; i < element.getNoteNumber().size(); i++) composePositiveInt(t, "ClaimResponse", "noteNumber", element.getNoteNumber().get(i), i);
    for (int i = 0; i < element.getAdjudication().size(); i++) composeClaimResponseItemAdjudicationComponent(t, "ClaimResponse", "adjudication", element.getAdjudication().get(i), i);
    for (int i = 0; i < element.getDetail().size(); i++) composeClaimResponseItemDetailComponent(t, "ClaimResponse", "detail", element.getDetail().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 48 with ClaimResponse

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

the class RdfParser method composeClaimResponseAdjudicationComponent.

protected void composeClaimResponseAdjudicationComponent(Complex parent, String parentType, String name, ClaimResponse.AdjudicationComponent 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())
        composeCodeableConcept(t, "ClaimResponse", "category", element.getCategory(), -1);
    if (element.hasReason())
        composeCodeableConcept(t, "ClaimResponse", "reason", element.getReason(), -1);
    if (element.hasAmount())
        composeMoney(t, "ClaimResponse", "amount", element.getAmount(), -1);
    if (element.hasValueElement())
        composeDecimal(t, "ClaimResponse", "value", element.getValueElement(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 49 with ClaimResponse

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

the class RdfParser method composeExplanationOfBenefit.

protected void composeExplanationOfBenefit(Complex parent, String parentType, String name, ExplanationOfBenefit element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "ExplanationOfBenefit", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "ExplanationOfBenefit", "identifier", element.getIdentifier().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "ExplanationOfBenefit", "status", element.getStatusElement(), -1);
    if (element.hasType())
        composeCodeableConcept(t, "ExplanationOfBenefit", "type", element.getType(), -1);
    if (element.hasSubType())
        composeCodeableConcept(t, "ExplanationOfBenefit", "subType", element.getSubType(), -1);
    if (element.hasUseElement())
        composeEnum(t, "ExplanationOfBenefit", "use", element.getUseElement(), -1);
    if (element.hasPatient())
        composeReference(t, "ExplanationOfBenefit", "patient", element.getPatient(), -1);
    if (element.hasBillablePeriod())
        composePeriod(t, "ExplanationOfBenefit", "billablePeriod", element.getBillablePeriod(), -1);
    if (element.hasCreatedElement())
        composeDateTime(t, "ExplanationOfBenefit", "created", element.getCreatedElement(), -1);
    if (element.hasEnterer())
        composeReference(t, "ExplanationOfBenefit", "enterer", element.getEnterer(), -1);
    if (element.hasInsurer())
        composeReference(t, "ExplanationOfBenefit", "insurer", element.getInsurer(), -1);
    if (element.hasProvider())
        composeReference(t, "ExplanationOfBenefit", "provider", element.getProvider(), -1);
    if (element.hasPriority())
        composeCodeableConcept(t, "ExplanationOfBenefit", "priority", element.getPriority(), -1);
    if (element.hasFundsReserveRequested())
        composeCodeableConcept(t, "ExplanationOfBenefit", "fundsReserveRequested", element.getFundsReserveRequested(), -1);
    if (element.hasFundsReserve())
        composeCodeableConcept(t, "ExplanationOfBenefit", "fundsReserve", element.getFundsReserve(), -1);
    for (int i = 0; i < element.getRelated().size(); i++) composeExplanationOfBenefitRelatedClaimComponent(t, "ExplanationOfBenefit", "related", element.getRelated().get(i), i);
    if (element.hasPrescription())
        composeReference(t, "ExplanationOfBenefit", "prescription", element.getPrescription(), -1);
    if (element.hasOriginalPrescription())
        composeReference(t, "ExplanationOfBenefit", "originalPrescription", element.getOriginalPrescription(), -1);
    if (element.hasPayee())
        composeExplanationOfBenefitPayeeComponent(t, "ExplanationOfBenefit", "payee", element.getPayee(), -1);
    if (element.hasReferral())
        composeReference(t, "ExplanationOfBenefit", "referral", element.getReferral(), -1);
    if (element.hasFacility())
        composeReference(t, "ExplanationOfBenefit", "facility", element.getFacility(), -1);
    if (element.hasClaim())
        composeReference(t, "ExplanationOfBenefit", "claim", element.getClaim(), -1);
    if (element.hasClaimResponse())
        composeReference(t, "ExplanationOfBenefit", "claimResponse", element.getClaimResponse(), -1);
    if (element.hasOutcomeElement())
        composeEnum(t, "ExplanationOfBenefit", "outcome", element.getOutcomeElement(), -1);
    if (element.hasDispositionElement())
        composeString(t, "ExplanationOfBenefit", "disposition", element.getDispositionElement(), -1);
    for (int i = 0; i < element.getPreAuthRef().size(); i++) composeString(t, "ExplanationOfBenefit", "preAuthRef", element.getPreAuthRef().get(i), i);
    for (int i = 0; i < element.getPreAuthRefPeriod().size(); i++) composePeriod(t, "ExplanationOfBenefit", "preAuthRefPeriod", element.getPreAuthRefPeriod().get(i), i);
    for (int i = 0; i < element.getCareTeam().size(); i++) composeExplanationOfBenefitCareTeamComponent(t, "ExplanationOfBenefit", "careTeam", element.getCareTeam().get(i), i);
    for (int i = 0; i < element.getSupportingInfo().size(); i++) composeExplanationOfBenefitSupportingInformationComponent(t, "ExplanationOfBenefit", "supportingInfo", element.getSupportingInfo().get(i), i);
    for (int i = 0; i < element.getDiagnosis().size(); i++) composeExplanationOfBenefitDiagnosisComponent(t, "ExplanationOfBenefit", "diagnosis", element.getDiagnosis().get(i), i);
    for (int i = 0; i < element.getProcedure().size(); i++) composeExplanationOfBenefitProcedureComponent(t, "ExplanationOfBenefit", "procedure", element.getProcedure().get(i), i);
    if (element.hasPrecedenceElement())
        composePositiveInt(t, "ExplanationOfBenefit", "precedence", element.getPrecedenceElement(), -1);
    for (int i = 0; i < element.getInsurance().size(); i++) composeExplanationOfBenefitInsuranceComponent(t, "ExplanationOfBenefit", "insurance", element.getInsurance().get(i), i);
    if (element.hasAccident())
        composeExplanationOfBenefitAccidentComponent(t, "ExplanationOfBenefit", "accident", element.getAccident(), -1);
    for (int i = 0; i < element.getItem().size(); i++) composeExplanationOfBenefitItemComponent(t, "ExplanationOfBenefit", "item", element.getItem().get(i), i);
    for (int i = 0; i < element.getAddItem().size(); i++) composeExplanationOfBenefitAddedItemComponent(t, "ExplanationOfBenefit", "addItem", element.getAddItem().get(i), i);
    for (int i = 0; i < element.getAdjudication().size(); i++) composeExplanationOfBenefitAdjudicationComponent(t, "ExplanationOfBenefit", "adjudication", element.getAdjudication().get(i), i);
    for (int i = 0; i < element.getTotal().size(); i++) composeExplanationOfBenefitTotalComponent(t, "ExplanationOfBenefit", "total", element.getTotal().get(i), i);
    if (element.hasPayment())
        composeExplanationOfBenefitPaymentComponent(t, "ExplanationOfBenefit", "payment", element.getPayment(), -1);
    if (element.hasFormCode())
        composeCodeableConcept(t, "ExplanationOfBenefit", "formCode", element.getFormCode(), -1);
    if (element.hasForm())
        composeAttachment(t, "ExplanationOfBenefit", "form", element.getForm(), -1);
    for (int i = 0; i < element.getProcessNote().size(); i++) composeExplanationOfBenefitNoteComponent(t, "ExplanationOfBenefit", "processNote", element.getProcessNote().get(i), i);
    if (element.hasBenefitPeriod())
        composePeriod(t, "ExplanationOfBenefit", "benefitPeriod", element.getBenefitPeriod(), -1);
    for (int i = 0; i < element.getBenefitBalance().size(); i++) composeExplanationOfBenefitBenefitBalanceComponent(t, "ExplanationOfBenefit", "benefitBalance", element.getBenefitBalance().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 50 with ClaimResponse

use of org.hl7.fhir.r4.model.ClaimResponse in project CRD by HL7-DaVinci.

the class CardBuilder method priorAuthCard.

public static Card priorAuthCard(CqlResultsForCard cqlResults, IBaseResource request, FhirComponentsT fhirComponents, String priorAuthId, String patientId, String payerId, String providerId, String applicationFhirPath, FhirResourceRepository fhirResourceRepository) {
    logger.info("Build Prior Auth Card");
    Card card = transform(CardTypes.PRIOR_AUTH, cqlResults, false);
    // create the ClaimResponse
    ClaimResponse claimResponse = Utilities.createClaimResponse(priorAuthId, patientId, payerId, providerId, applicationFhirPath);
    // build the FhirResource and save to the database
    FhirResource fhirResource = new FhirResource();
    fhirResource.setFhirVersion(fhirComponents.getFhirVersion().toString()).setResourceType(claimResponse.fhirType()).setData(fhirComponents.getJsonParser().encodeResourceToString(claimResponse));
    fhirResource.setId(claimResponse.getId());
    fhirResource.setName(claimResponse.getId());
    FhirResource newFhirResource = fhirResourceRepository.save(fhirResource);
    logger.info("stored: " + newFhirResource.getFhirVersion() + "/" + newFhirResource.getResourceType() + "/" + newFhirResource.getId());
    // create the reference to the ClaimResponse
    Reference claimResponseReference = new Reference();
    claimResponseReference.setReference("ClaimResponse/" + claimResponse.getId());
    // add SupportingInfo to the Request
    IBaseResource outputRequest = FhirRequestProcessor.addSupportingInfoToRequest(request, claimResponseReference);
    // add suggestion with ClaimResponse
    Suggestion suggestionWithClaimResponse = createSuggestionWithResource(outputRequest, claimResponse, fhirComponents, "Store the prior authorization in the EHR", true);
    card.addSuggestionsItem(suggestionWithClaimResponse);
    // add suggestion with annotation
    Suggestion suggestionWithAnnotation = createSuggestionWithNote(card, outputRequest, fhirComponents, "Store prior authorization as an annotation to the order", "Add authorization to record", false, CoverageGuidance.PRIOR_AUTH);
    card.addSuggestionsItem(suggestionWithAnnotation);
    card.setSelectionBehavior(Card.SelectionBehaviorEnum.AT_MOST_ONE);
    return card;
}
Also used : FhirResource(org.hl7.davinci.endpoint.database.FhirResource) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource)

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 FhirResource (org.hl7.davinci.endpoint.database.FhirResource)1 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)1 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)1