Search in sources :

Example 16 with SimpleQuantity

use of org.hl7.fhir.dstu2016may.model.SimpleQuantity in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method mapEobCommonItemCarrierDME.

/**
 * Transforms the common item level data elements between the {@link CarrierClaimLine} and {@link
 * DMEClaimLine} claim types to FHIR. The method parameter fields from {@link CarrierClaimLine}
 * and {@link DMEClaimLine} are listed below and their corresponding RIF CCW fields (denoted in
 * all CAPS below from {@link CarrierClaimColumn} and {@link DMEClaimColumn}).
 *
 * @param item the {@ ItemComponent} to modify
 * @param eob the {@ ExplanationOfBenefit} to modify
 * @param claimId CLM_ID,
 * @param serviceCount LINE_SRVC_CNT,
 * @param placeOfServiceCode LINE_PLACE_OF_SRVC_CD,
 * @param firstExpenseDate LINE_1ST_EXPNS_DT,
 * @param lastExpenseDate LINE_LAST_EXPNS_DT,
 * @param beneficiaryPaymentAmount LINE_BENE_PMT_AMT,
 * @param providerPaymentAmount LINE_PRVDR_PMT_AMT,
 * @param beneficiaryPartBDeductAmount LINE_BENE_PTB_DDCTBL_AMT,
 * @param primaryPayerCode LINE_BENE_PRMRY_PYR_CD,
 * @param primaryPayerPaidAmount LINE_BENE_PRMRY_PYR_PD_AMT,
 * @param betosCode BETOS_CD,
 * @param paymentAmount LINE_NCH_PMT_AMT,
 * @param paymentCode LINE_PMT_80_100_CD,
 * @param coinsuranceAmount LINE_COINSRNC_AMT,
 * @param submittedChargeAmount LINE_SBMTD_CHRG_AMT,
 * @param allowedChargeAmount LINE_ALOWD_CHRG_AMT,
 * @param processingIndicatorCode LINE_PRCSG_IND_CD,
 * @param serviceDeductibleCode LINE_SERVICE_DEDUCTIBLE,
 * @param diagnosisCode LINE_ICD_DGNS_CD,
 * @param diagnosisCodeVersion LINE_ICD_DGNS_VRSN_CD,
 * @param hctHgbTestTypeCode LINE_HCT_HGB_TYPE_CD
 * @param hctHgbTestResult LINE_HCT_HGB_RSLT_NUM,
 * @param cmsServiceTypeCode LINE_CMS_TYPE_SRVC_CD,
 * @param nationalDrugCode LINE_NDC_CD,
 * @param beneficiaryId BENE_ID,
 * @param referringPhysicianNpi RFR_PHYSN_NPI
 * @return the {@link ItemComponent}
 */
static ItemComponent mapEobCommonItemCarrierDME(ItemComponent item, ExplanationOfBenefit eob, String claimId, BigDecimal serviceCount, String placeOfServiceCode, Optional<LocalDate> firstExpenseDate, Optional<LocalDate> lastExpenseDate, BigDecimal beneficiaryPaymentAmount, BigDecimal providerPaymentAmount, BigDecimal beneficiaryPartBDeductAmount, Optional<Character> primaryPayerCode, BigDecimal primaryPayerPaidAmount, Optional<String> betosCode, BigDecimal paymentAmount, Optional<Character> paymentCode, BigDecimal coinsuranceAmount, BigDecimal submittedChargeAmount, BigDecimal allowedChargeAmount, Optional<String> processingIndicatorCode, Optional<Character> serviceDeductibleCode, Optional<String> diagnosisCode, Optional<Character> diagnosisCodeVersion, Optional<String> hctHgbTestTypeCode, BigDecimal hctHgbTestResult, char cmsServiceTypeCode, Optional<String> nationalDrugCode) {
    SimpleQuantity serviceCnt = new SimpleQuantity();
    serviceCnt.setValue(serviceCount);
    item.setQuantity(serviceCnt);
    item.setCategory(createCodeableConcept(eob, CcwCodebookVariable.LINE_CMS_TYPE_SRVC_CD, cmsServiceTypeCode));
    item.setLocation(createCodeableConcept(eob, CcwCodebookVariable.LINE_PLACE_OF_SRVC_CD, placeOfServiceCode));
    if (betosCode.isPresent()) {
        item.addExtension(createExtensionCoding(eob, CcwCodebookVariable.BETOS_CD, betosCode));
    }
    if (firstExpenseDate.isPresent() && lastExpenseDate.isPresent()) {
        validatePeriodDates(firstExpenseDate, lastExpenseDate);
        item.setServiced(new Period().setStart((convertToDate(firstExpenseDate.get())), TemporalPrecisionEnum.DAY).setEnd((convertToDate(lastExpenseDate.get())), TemporalPrecisionEnum.DAY));
    }
    AdjudicationComponent adjudicationForPayment = item.addAdjudication();
    adjudicationForPayment.setCategory(createAdjudicationCategory(CcwCodebookVariable.LINE_NCH_PMT_AMT)).setAmount(createMoney(paymentAmount));
    if (paymentCode.isPresent())
        adjudicationForPayment.addExtension(createExtensionCoding(eob, CcwCodebookVariable.LINE_PMT_80_100_CD, paymentCode));
    item.addAdjudication().setCategory(createAdjudicationCategory(CcwCodebookVariable.LINE_BENE_PMT_AMT)).setAmount(createMoney(beneficiaryPaymentAmount));
    item.addAdjudication().setCategory(createAdjudicationCategory(CcwCodebookVariable.LINE_PRVDR_PMT_AMT)).setAmount(createMoney(providerPaymentAmount));
    item.addAdjudication().setCategory(TransformerUtils.createAdjudicationCategory(CcwCodebookVariable.LINE_BENE_PTB_DDCTBL_AMT)).setAmount(createMoney(beneficiaryPartBDeductAmount));
    if (primaryPayerCode.isPresent()) {
        item.addExtension(createExtensionCoding(eob, CcwCodebookVariable.LINE_BENE_PRMRY_PYR_CD, primaryPayerCode));
    }
    item.addAdjudication().setCategory(createAdjudicationCategory(CcwCodebookVariable.LINE_BENE_PRMRY_PYR_PD_AMT)).setAmount(createMoney(primaryPayerPaidAmount));
    item.addAdjudication().setCategory(TransformerUtils.createAdjudicationCategory(CcwCodebookVariable.LINE_COINSRNC_AMT)).setAmount(createMoney(coinsuranceAmount));
    item.addAdjudication().setCategory(createAdjudicationCategory(CcwCodebookVariable.LINE_SBMTD_CHRG_AMT)).setAmount(createMoney(submittedChargeAmount));
    item.addAdjudication().setCategory(TransformerUtils.createAdjudicationCategory(CcwCodebookVariable.LINE_ALOWD_CHRG_AMT)).setAmount(createMoney(allowedChargeAmount));
    if (processingIndicatorCode.isPresent())
        item.addAdjudication(createAdjudicationWithReason(eob, CcwCodebookVariable.LINE_PRCSG_IND_CD, processingIndicatorCode));
    if (serviceDeductibleCode.isPresent())
        item.addExtension(createExtensionCoding(eob, CcwCodebookVariable.LINE_SERVICE_DEDUCTIBLE, serviceDeductibleCode));
    Optional<Diagnosis> lineDiagnosis = Diagnosis.from(diagnosisCode, diagnosisCodeVersion);
    if (lineDiagnosis.isPresent())
        addDiagnosisLink(eob, item, lineDiagnosis.get());
    if (hctHgbTestTypeCode.isPresent()) {
        Observation hctHgbObservation = new Observation();
        hctHgbObservation.setStatus(ObservationStatus.UNKNOWN);
        hctHgbObservation.setCode(createCodeableConcept(eob, CcwCodebookVariable.LINE_HCT_HGB_TYPE_CD, hctHgbTestTypeCode));
        hctHgbObservation.setValue(new Quantity().setValue(hctHgbTestResult));
        Extension hctHgbObservationReference = new Extension(CCWUtils.calculateVariableReferenceUrl(CcwCodebookVariable.LINE_HCT_HGB_RSLT_NUM), new Reference(hctHgbObservation));
        item.addExtension(hctHgbObservationReference);
    }
    if (nationalDrugCode.isPresent()) {
        addExtensionCoding(item, TransformerConstants.CODING_NDC, TransformerConstants.CODING_NDC, TransformerUtils.retrieveFDADrugCodeDisplay(nationalDrugCode.get()), nationalDrugCode.get());
    }
    return item;
}
Also used : IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) Extension(org.hl7.fhir.dstu3.model.Extension) AdjudicationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent) Reference(org.hl7.fhir.dstu3.model.Reference) SimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity) Observation(org.hl7.fhir.dstu3.model.Observation) Period(org.hl7.fhir.dstu3.model.Period) SimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity) Quantity(org.hl7.fhir.dstu3.model.Quantity) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis)

Example 17 with SimpleQuantity

use of org.hl7.fhir.dstu2016may.model.SimpleQuantity in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method mapEobCommonItemRevenue.

/**
 * Transforms the common item level data elements between the {@link InpatientClaimLine} {@link
 * OutpatientClaimLine} {@link HospiceClaimLine} {@link HHAClaimLine}and {@link SNFClaimLine}
 * claim types to FHIR. The method parameter fields from {@link InpatientClaimLine} {@link
 * OutpatientClaimLine} {@link HospiceClaimLine} {@link HHAClaimLine}and {@link SNFClaimLine} are
 * listed below and their corresponding RIF CCW fields (denoted in all CAPS below from {@link
 * InpatientClaimColumn} {@link OutpatientClaimColumn} {@link HopsiceClaimColumn} {@link
 * HHAClaimColumn} and {@link SNFClaimColumn}).
 *
 * @param item the {@ ItemComponent} to modify
 * @param eob the {@ ExplanationOfBenefit} to modify
 * @param revenueCenterCode REV_CNTR,
 * @param rateAmount REV_CNTR_RATE_AMT,
 * @param totalChargeAmount REV_CNTR_TOT_CHRG_AMT,
 * @param nonCoveredChargeAmount REV_CNTR_NCVRD_CHRG_AMT,
 * @param unitCount REV_CNTR_UNIT_CNT,
 * @param nationalDrugCodeQuantity REV_CNTR_NDC_QTY,
 * @param nationalDrugCodeQualifierCode REV_CNTR_NDC_QTY_QLFR_CD,
 * @param revenueCenterRenderingPhysicianNPI RNDRNG_PHYSN_NPI
 * @return the {@link ItemComponent}
 */
static ItemComponent mapEobCommonItemRevenue(ItemComponent item, ExplanationOfBenefit eob, String revenueCenterCode, BigDecimal rateAmount, BigDecimal totalChargeAmount, BigDecimal nonCoveredChargeAmount, BigDecimal unitCount, Optional<BigDecimal> nationalDrugCodeQuantity, Optional<String> nationalDrugCodeQualifierCode, Optional<String> revenueCenterRenderingPhysicianNPI) {
    item.setRevenue(createCodeableConcept(eob, CcwCodebookVariable.REV_CNTR, revenueCenterCode));
    item.addAdjudication().setCategory(TransformerUtils.createAdjudicationCategory(CcwCodebookVariable.REV_CNTR_RATE_AMT)).setAmount(createMoney(rateAmount));
    item.addAdjudication().setCategory(TransformerUtils.createAdjudicationCategory(CcwCodebookVariable.REV_CNTR_TOT_CHRG_AMT)).setAmount(createMoney(totalChargeAmount));
    item.addAdjudication().setCategory(TransformerUtils.createAdjudicationCategory(CcwCodebookVariable.REV_CNTR_NCVRD_CHRG_AMT)).setAmount(createMoney(nonCoveredChargeAmount));
    SimpleQuantity qty = new SimpleQuantity();
    qty.setValue(unitCount);
    item.setQuantity(qty);
    if (nationalDrugCodeQualifierCode.isPresent()) {
        /*
       * TODO: Is NDC count only ever present when line quantity isn't set? Depending on that, it
       * may be that we should stop using this as an extension and instead set the code & system on
       * the FHIR quantity field.
       */
        // TODO Shouldn't this be part of the same Extension with the NDC code itself?
        Extension drugQuantityExtension = createExtensionQuantity(CcwCodebookVariable.REV_CNTR_NDC_QTY, nationalDrugCodeQuantity);
        Quantity drugQuantity = (Quantity) drugQuantityExtension.getValue();
        TransformerUtils.setQuantityUnitInfo(CcwCodebookVariable.REV_CNTR_NDC_QTY_QLFR_CD, nationalDrugCodeQualifierCode, eob, drugQuantity);
        item.addExtension(drugQuantityExtension);
    }
    if (revenueCenterRenderingPhysicianNPI.isPresent()) {
        TransformerUtils.addCareTeamPractitioner(eob, item, TransformerConstants.CODING_NPI_US, revenueCenterRenderingPhysicianNPI.get(), ClaimCareteamrole.PRIMARY);
    }
    return item;
}
Also used : IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) Extension(org.hl7.fhir.dstu3.model.Extension) SimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity) SimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity) Quantity(org.hl7.fhir.dstu3.model.Quantity)

Example 18 with SimpleQuantity

use of org.hl7.fhir.dstu2016may.model.SimpleQuantity in project beneficiary-fhir-data by CMSgov.

the class TransformerUtilsV2 method mapEobCommonItemCarrierDME.

/**
 * Transforms the common item level data elements between the {@link CarrierClaimLine} and {@link
 * DMEClaimLine} claim types to FHIR. The method parameter fields from {@link CarrierClaimLine}
 * and {@link DMEClaimLine} are listed below and their corresponding RIF CCW fields (denoted in
 * all CAPS below from {@link CarrierClaimColumn} and {@link DMEClaimColumn}).
 *
 * @param item the {@ ItemComponent} to modify
 * @param eob the {@ ExplanationOfBenefit} to modify
 * @param claimId CLM_ID,
 * @param serviceCount LINE_SRVC_CNT,
 * @param placeOfServiceCode LINE_PLACE_OF_SRVC_CD,
 * @param firstExpenseDate LINE_1ST_EXPNS_DT,
 * @param lastExpenseDate LINE_LAST_EXPNS_DT,
 * @param beneficiaryPaymentAmount LINE_BENE_PMT_AMT,
 * @param providerPaymentAmount LINE_PRVDR_PMT_AMT,
 * @param beneficiaryPartBDeductAmount LINE_BENE_PTB_DDCTBL_AMT,
 * @param primaryPayerCode LINE_BENE_PRMRY_PYR_CD,
 * @param primaryPayerPaidAmount LINE_BENE_PRMRY_PYR_PD_AMT,
 * @param betosCode BETOS_CD,
 * @param paymentAmount LINE_NCH_PMT_AMT,
 * @param paymentCode LINE_PMT_80_100_CD,
 * @param coinsuranceAmount LINE_COINSRNC_AMT,
 * @param submittedChargeAmount LINE_SBMTD_CHRG_AMT,
 * @param allowedChargeAmount LINE_ALOWD_CHRG_AMT,
 * @param processingIndicatorCode LINE_PRCSG_IND_CD,
 * @param serviceDeductibleCode LINE_SERVICE_DEDUCTIBLE,
 * @param hctHgbTestTypeCode LINE_HCT_HGB_TYPE_CD
 * @param hctHgbTestResult LINE_HCT_HGB_RSLT_NUM,
 * @param cmsServiceTypeCode LINE_CMS_TYPE_SRVC_CD,
 * @param nationalDrugCode LINE_NDC_CD,
 * @param beneficiaryId BENE_ID,
 * @param referringPhysicianNpi RFR_PHYSN_NPI
 * @return the {@link ItemComponent}
 */
static ItemComponent mapEobCommonItemCarrierDME(ItemComponent item, ExplanationOfBenefit eob, String claimId, int sequence, BigDecimal serviceCount, String placeOfServiceCode, Optional<LocalDate> firstExpenseDate, Optional<LocalDate> lastExpenseDate, BigDecimal beneficiaryPaymentAmount, BigDecimal providerPaymentAmount, BigDecimal beneficiaryPartBDeductAmount, Optional<Character> primaryPayerCode, BigDecimal primaryPayerPaidAmount, Optional<String> betosCode, BigDecimal paymentAmount, Optional<Character> paymentCode, BigDecimal coinsuranceAmount, BigDecimal submittedChargeAmount, BigDecimal allowedChargeAmount, Optional<String> processingIndicatorCode, Optional<Character> serviceDeductibleCode, Optional<String> hctHgbTestTypeCode, BigDecimal hctHgbTestResult, char cmsServiceTypeCode, Optional<String> nationalDrugCode) {
    // LINE_SRVC_CNT => ExplanationOfBenefit.item.quantity
    item.setQuantity(new SimpleQuantity().setValue(serviceCount));
    // LINE_CMS_TYPE_SRVC_CD => ExplanationOfBenefit.item.category
    item.setCategory(createCodeableConcept(eob, CcwCodebookVariable.LINE_CMS_TYPE_SRVC_CD, cmsServiceTypeCode));
    // LINE_PLACE_OF_SRVC_CD => ExplanationOfBenefit.item.location
    item.setLocation(createCodeableConcept(eob, CcwCodebookVariable.LINE_PLACE_OF_SRVC_CD, placeOfServiceCode));
    // BETOS_CD => ExplanationOfBenefit.item.extension
    betosCode.ifPresent(code -> item.addExtension(createExtensionCoding(eob, CcwCodebookVariable.BETOS_CD, code)));
    // LINE_LAST_EXPNS_DT => ExplanationOfBenefit.item.servicedPeriod
    if (firstExpenseDate.isPresent() && lastExpenseDate.isPresent()) {
        validatePeriodDates(firstExpenseDate, lastExpenseDate);
        item.setServiced(new Period().setStart((convertToDate(firstExpenseDate.get())), TemporalPrecisionEnum.DAY).setEnd((convertToDate(lastExpenseDate.get())), TemporalPrecisionEnum.DAY));
    } else // LINE_1ST_EXPNS_DT => ExplanationOfBenefit.item.servicedDate
    if (firstExpenseDate.isPresent()) {
        item.setServiced(new DateType(convertToDate(firstExpenseDate.get())));
    }
    // LINE_NCH_PMT_AMT => ExplanationOfBenefit.item.adjudication
    Optional<AdjudicationComponent> nchPmtAmtAdjudication = createAdjudicationAmtSlice(CcwCodebookVariable.LINE_NCH_PMT_AMT, C4BBAdjudication.BENEFIT, paymentAmount);
    addAdjudication(item, nchPmtAmtAdjudication);
    // LINE_PMT_80_100_CD => ExplanationOfBenefit.item.adjudication.extension
    if (paymentCode.isPresent() && nchPmtAmtAdjudication.isPresent()) {
        nchPmtAmtAdjudication.get().addExtension(createExtensionCoding(eob, CcwCodebookVariable.LINE_PMT_80_100_CD, paymentCode));
    }
    // PAID_TO_PATIENT => ExplanationOfBenefit.item.adjudication
    addAdjudication(item, createAdjudicationAmtSlice(CcwCodebookVariable.LINE_BENE_PMT_AMT, C4BBAdjudication.PAID_TO_PATIENT, beneficiaryPaymentAmount));
    // LINE_PRVDR_PMT_AMT => ExplanationOfBenefit.item.adjudication
    addAdjudication(item, createAdjudicationAmtSlice(CcwCodebookVariable.LINE_PRVDR_PMT_AMT, C4BBAdjudication.PAID_TO_PROVIDER, providerPaymentAmount));
    // LINE_BENE_PTB_DDCTBL_AMT => ExplanationOfBenefit.item.adjudication
    addAdjudication(item, createAdjudicationAmtSlice(CcwCodebookVariable.LINE_BENE_PTB_DDCTBL_AMT, C4BBAdjudication.DEDUCTIBLE, beneficiaryPartBDeductAmount));
    // LINE_BENE_PRMRY_PYR_CD => ExplanationOfBenefit.item.extension
    primaryPayerCode.ifPresent(code -> item.addExtension(createExtensionCoding(eob, CcwCodebookVariable.LINE_BENE_PRMRY_PYR_CD, code)));
    // LINE_BENE_PRMRY_PYR_PD_AMT => ExplanationOfBenefit.item.adjudication
    addAdjudication(item, createAdjudicationAmtSlice(CcwCodebookVariable.LINE_BENE_PRMRY_PYR_PD_AMT, C4BBAdjudication.PRIOR_PAYER_PAID, primaryPayerPaidAmount));
    // LINE_COINSRNC_AMT => ExplanationOfBenefit.item.adjudication
    addAdjudication(item, createAdjudicationAmtSlice(CcwCodebookVariable.LINE_COINSRNC_AMT, C4BBAdjudication.COINSURANCE, coinsuranceAmount));
    // LINE_SBMTD_CHRG_AMT => ExplanationOfBenefit.item.adjudication
    addAdjudication(item, createAdjudicationAmtSlice(CcwCodebookVariable.LINE_SBMTD_CHRG_AMT, C4BBAdjudication.SUBMITTED, submittedChargeAmount));
    // LINE_ALOWD_CHRG_AMT => ExplanationOfBenefit.item.adjudication
    addAdjudication(item, createAdjudicationAmtSlice(CcwCodebookVariable.LINE_ALOWD_CHRG_AMT, C4BBAdjudication.ELIGIBLE, submittedChargeAmount));
    // LINE_BENE_PRMRY_PYR_CD => ExplanationOfBenefit.item.extension
    processingIndicatorCode.ifPresent(code -> item.addExtension(createExtensionCoding(eob, CcwCodebookVariable.LINE_PRCSG_IND_CD, code)));
    // LINE_SERVICE_DEDUCTIBLE => ExplanationOfBenefit.item.extension
    serviceDeductibleCode.ifPresent(code -> item.addExtension(createExtensionCoding(eob, CcwCodebookVariable.LINE_SERVICE_DEDUCTIBLE, code)));
    // LINE_HCT_HGB_RSLT_NUM => Observation.value
    if (hctHgbTestTypeCode.isPresent()) {
        String observationId = "line-observation-" + sequence;
        String observationRef = "#" + observationId;
        // The `item` will link to a `supportingInfo` that references the embedded Observation
        SupportingInformationComponent comp = addInformation(eob, CcwCodebookVariable.LINE_HCT_HGB_RSLT_NUM);
        comp.setValue(new Reference(observationRef));
        // Create embedded Observation in ExplanationOfBenefit.contained
        Observation hctHgbObservation = findOrCreateContainedObservation(eob, observationId);
        hctHgbObservation.setStatus(ObservationStatus.UNKNOWN);
        hctHgbObservation.setCode(createCodeableConcept(eob, CcwCodebookVariable.LINE_HCT_HGB_TYPE_CD, hctHgbTestTypeCode));
        hctHgbObservation.setValue(new Quantity().setValue(hctHgbTestResult));
        // Link item.informationSequence to the new `supportingInfo` entry
        item.addInformationSequence(comp.getSequence());
    }
    // LINE_NDC_CD => ExplanationOfBenefit.item.productOrService.extension
    addNationalDrugCode(item, nationalDrugCode);
    return item;
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) AdjudicationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent) Reference(org.hl7.fhir.r4.model.Reference) SimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity) Observation(org.hl7.fhir.r4.model.Observation) Period(org.hl7.fhir.r4.model.Period) SimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity) Quantity(org.hl7.fhir.r4.model.Quantity) DateType(org.hl7.fhir.r4.model.DateType)

Example 19 with SimpleQuantity

use of org.hl7.fhir.dstu2016may.model.SimpleQuantity in project beneficiary-fhir-data by CMSgov.

the class PartDEventTransformerV2Test method shouldHaveRefillNumberSupInfo.

@Test
public void shouldHaveRefillNumberSupInfo() {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("refillnum", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType", "refillnum", "Refill Number"))).setValue(new SimpleQuantity().setValue(3));
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) SimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity) Test(org.junit.jupiter.api.Test)

Example 20 with SimpleQuantity

use of org.hl7.fhir.dstu2016may.model.SimpleQuantity in project elexis-server by elexis.

the class ClaimTest method createClaim.

@Test
public void createClaim() {
    // claim needs a coverage, a diagnose, a practitioner, an encounter and
    // items
    Coverage coverage = new Coverage();
    // minimal coverage information
    coverage.setBeneficiary(new Reference(new IdDt("Patient", AllTests.getTestDatabaseInitializer().getPatient().getId())));
    coverage.setType(new CodeableConcept().addCoding(new Coding(CodingSystem.ELEXIS_COVERAGE_TYPE.getSystem(), "KVG", "Test")));
    MethodOutcome coverageOutcome = client.create().resource(coverage).execute();
    assertTrue(coverageOutcome.getCreated());
    Bundle results = client.search().forResource(Encounter.class).where(Encounter.IDENTIFIER.exactly().systemAndIdentifier("www.elexis.info/consultationid", TestDatabaseInitializer.getBehandlung().getId())).returnBundle(Bundle.class).execute();
    List<BundleEntryComponent> entries = results.getEntry();
    assertFalse(entries.isEmpty());
    Encounter encounter = (Encounter) entries.get(0).getResource();
    Claim claim = new Claim();
    claim.addInsurance().setCoverage(new Reference("Coverage/" + coverageOutcome.getId()));
    claim.setProvider(new Reference("Practitioner/" + TestDatabaseInitializer.getMandant().getId()));
    claim.addDiagnosis().setDiagnosis(new CodeableConcept().addCoding(new Coding(CodingSystem.ELEXIS_DIAGNOSE_TESSINERCODE.getSystem(), "A1", "")));
    claim.addSupportingInfo().setValue(new StringType("Encounter/" + encounter.getId()));
    ItemComponent item = claim.addItem();
    item.setQuantity(new SimpleQuantity().setValue(1));
    item.setProductOrService(new CodeableConcept().addCoding(new Coding("www.elexis.info/billing/tarmed", "00.0010", "")));
    List<IBilled> before = AllTests.getModelService().getQuery(IBilled.class).execute();
    MethodOutcome outcome = client.create().resource(claim).execute();
    assertNotNull(outcome);
    assertTrue(outcome.getCreated());
    List<IBilled> after = AllTests.getModelService().getQuery(IBilled.class).execute();
    assertTrue(after.size() - before.size() == 1);
    // "00.0010" can only be billed once ...
    boolean failed = false;
    try {
        outcome = client.create().resource(claim).execute();
    } catch (InternalErrorException e) {
        failed = true;
    }
    assertTrue(failed);
}
Also used : StringType(org.hl7.fhir.r4.model.StringType) Reference(org.hl7.fhir.r4.model.Reference) Bundle(org.hl7.fhir.r4.model.Bundle) SimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity) IdDt(ca.uhn.fhir.model.primitive.IdDt) Coverage(org.hl7.fhir.r4.model.Coverage) InternalErrorException(ca.uhn.fhir.rest.server.exceptions.InternalErrorException) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) IBilled(ch.elexis.core.model.IBilled) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Coding(org.hl7.fhir.r4.model.Coding) ItemComponent(org.hl7.fhir.r4.model.Claim.ItemComponent) Encounter(org.hl7.fhir.r4.model.Encounter) Claim(org.hl7.fhir.r4.model.Claim) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.Test)

Aggregations

SimpleQuantity (org.hl7.fhir.dstu3.model.SimpleQuantity)9 SimpleQuantity (org.hl7.fhir.r4.model.SimpleQuantity)7 JsonObject (com.google.gson.JsonObject)6 Coding (org.hl7.fhir.r4.model.Coding)6 ArrayList (java.util.ArrayList)5 TypeRef (org.hl7.fhir.definitions.model.TypeRef)5 JsonElement (com.google.gson.JsonElement)4 Date (java.util.Date)4 Quantity (org.hl7.fhir.dstu3.model.Quantity)4 Reference (org.hl7.fhir.dstu3.model.Reference)4 SupportingInformationComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent)4 Reference (org.hl7.fhir.r4.model.Reference)4 BigDecimal (java.math.BigDecimal)3 Coding (org.hl7.fhir.dstu3.model.Coding)3 Extension (org.hl7.fhir.dstu3.model.Extension)3 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)3 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)3 Quantity (org.hl7.fhir.r4.model.Quantity)3 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)3 InvalidRifValueException (gov.cms.bfd.model.rif.parse.InvalidRifValueException)2