Search in sources :

Example 61 with SupportingInformationComponent

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

the class TransformerUtilsV2 method createInformationAdmPeriodSlice.

/**
 * Optionally creates an `admissionperiod` {@link SupportingInformationComponent} slice.
 *
 * @param periodStart Period start
 * @param periodEnd Period end
 * @return The created {@link SupportingInformationComponent}
 */
static Optional<SupportingInformationComponent> createInformationAdmPeriodSlice(ExplanationOfBenefit eob, Optional<LocalDate> periodStart, Optional<LocalDate> periodEnd) {
    // Create a range if we can
    if (periodStart.isPresent() || periodEnd.isPresent()) {
        validatePeriodDates(periodStart, periodEnd);
        // Create the period
        Period period = new Period();
        periodStart.ifPresent(start -> period.setStart(convertToDate(start), TemporalPrecisionEnum.DAY));
        periodEnd.ifPresent(end -> period.setEnd(convertToDate(end), TemporalPrecisionEnum.DAY));
        int maxSequence = eob.getSupportingInfo().stream().mapToInt(i -> i.getSequence()).max().orElse(0);
        // Create the SupportingInfo element
        return Optional.of(new SupportingInformationComponent().setSequence(maxSequence + 1).setCategory(new CodeableConcept().addCoding(createC4BBSupportingInfoCoding(C4BBSupportingInfoType.ADMISSION_PERIOD))).setTiming(period));
    } else {
        return Optional.empty();
    }
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Period(org.hl7.fhir.r4.model.Period) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 62 with SupportingInformationComponent

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

the class TransformerUtilsV2 method addInformationSliceWithCode.

static Optional<SupportingInformationComponent> addInformationSliceWithCode(ExplanationOfBenefit eob, C4BBSupportingInfoType slice, CcwCodebookInterface categoryVariable, CcwCodebookInterface codeSystemVariable, Optional<?> codeValue) {
    if (codeValue.isPresent()) {
        SupportingInformationComponent infoComponent = addInformationSlice(eob, slice);
        CodeableConcept infoCode = new CodeableConcept().addCoding(createCoding(eob, codeSystemVariable, codeValue));
        infoComponent.setCode(infoCode);
        return Optional.of(infoComponent);
    } else {
        return Optional.empty();
    }
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 63 with SupportingInformationComponent

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

the class TransformerUtilsV2 method addCommonGroupInpatientSNF.

/**
 * Adds field values to the benefit balance component that are common between the Inpatient and
 * SNF claim types.
 *
 * @param eob the {@link ExplanationOfBenefit} to map the fields into
 * @param coinsuranceDayCount BENE_TOT_COINSRNC_DAYS_CNT: a {@link BigDecimal} shared field
 *     representing the coinsurance day count for the claim
 * @param nonUtilizationDayCount CLM_NON_UTLZTN_DAYS_CNT: a {@link BigDecimal} shared field
 *     representing the non-utilization day count for the claim
 * @param deductibleAmount NCH_BENE_IP_DDCTBL_AMT: a {@link BigDecimal} shared field representing
 *     the deductible amount for the claim
 * @param partACoinsuranceLiabilityAmount NCH_BENE_PTA_COINSRNC_LBLTY_AM: a {@link BigDecimal}
 *     shared field representing the part A coinsurance amount for the claim
 * @param bloodPintsFurnishedQty NCH_BLOOD_PNTS_FRNSHD_QTY: a {@link BigDecimal} shared field
 *     representing the blood pints furnished quantity for the claim
 * @param noncoveredCharge NCH_IP_NCVRD_CHRG_AMT: a {@link BigDecimal} shared field representing
 *     the non-covered charge for the claim
 * @param totalDeductionAmount NCH_IP_TOT_DDCTN_AMT: a {@link BigDecimal} shared field
 *     representing the total deduction amount for the claim
 * @param claimPPSCapitalDisproportionateShareAmt CLM_PPS_CPTL_DSPRPRTNT_SHR_AMT: an {@link
 *     Optional}&lt;{@link BigDecimal}&gt; shared field representing the claim PPS capital
 *     disproportionate share amount for the claim
 * @param claimPPSCapitalExceptionAmount CLM_PPS_CPTL_EXCPTN_AMT: an {@link Optional}&lt;{@link
 *     BigDecimal}&gt; shared field representing the claim PPS capital exception amount for the
 *     claim
 * @param claimPPSCapitalFSPAmount CLM_PPS_CPTL_FSP_AMT: an {@link Optional}&lt;{@link
 *     BigDecimal}&gt; shared field representing the claim PPS capital FSP amount for the claim
 * @param claimPPSCapitalIMEAmount CLM_PPS_CPTL_IME_AMT: an {@link Optional}&lt;{@link
 *     BigDecimal}&gt; shared field representing the claim PPS capital IME amount for the claim
 * @param claimPPSCapitalOutlierAmount CLM_PPS_CPTL_OUTLIER_AMT: an {@link Optional}&lt;{@link
 *     BigDecimal}&gt; shared field representing the claim PPS capital outlier amount for the
 *     claim
 * @param claimPPSOldCapitalHoldHarmlessAmount CLM_PPS_OLD_CPTL_HLD_HRMLS_AMT: an {@link
 *     Optional}&lt;{@link BigDecimal}&gt; shared field representing the claim PPS old capital
 *     hold harmless amount for the claim
 */
static void addCommonGroupInpatientSNF(ExplanationOfBenefit eob, BigDecimal coinsuranceDayCount, BigDecimal nonUtilizationDayCount, BigDecimal deductibleAmount, BigDecimal partACoinsuranceLiabilityAmount, BigDecimal bloodPintsFurnishedQty, BigDecimal noncoveredCharge, BigDecimal totalDeductionAmount, Optional<BigDecimal> claimPPSCapitalDisproportionateShareAmt, Optional<BigDecimal> claimPPSCapitalExceptionAmount, Optional<BigDecimal> claimPPSCapitalFSPAmount, Optional<BigDecimal> claimPPSCapitalIMEAmount, Optional<BigDecimal> claimPPSCapitalOutlierAmount, Optional<BigDecimal> claimPPSOldCapitalHoldHarmlessAmount) {
    // BENE_TOT_COINSRNC_DAYS_CNT => ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalInt(eob, CcwCodebookVariable.BENE_TOT_COINSRNC_DAYS_CNT, coinsuranceDayCount);
    // CLM_NON_UTLZTN_DAYS_CNT => ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalInt(eob, CcwCodebookVariable.CLM_NON_UTLZTN_DAYS_CNT, nonUtilizationDayCount);
    // NCH_BENE_IP_DDCTBL_AMT => ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalAmt(eob, CcwCodebookVariable.NCH_BENE_IP_DDCTBL_AMT, deductibleAmount);
    // NCH_BENE_PTA_COINSRNC_LBLTY_AMT =>
    // ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalAmt(eob, CcwCodebookVariable.NCH_BENE_PTA_COINSRNC_LBLTY_AMT, partACoinsuranceLiabilityAmount);
    // NCH_BLOOD_PNTS_FRNSHD_QTY =>
    // ExplanationOfBenefit.supportingInfo.valueQuantity
    SupportingInformationComponent nchBloodPntsFrnshdQtyInfo = addInformation(eob, CcwCodebookVariable.NCH_BLOOD_PNTS_FRNSHD_QTY);
    Quantity bloodPintsQuantity = new Quantity();
    bloodPintsQuantity.setValue(bloodPintsFurnishedQty);
    bloodPintsQuantity.setSystem(TransformerConstants.CODING_SYSTEM_UCUM).setCode(TransformerConstants.CODING_SYSTEM_UCUM_PINT_CODE).setUnit(TransformerConstants.CODING_SYSTEM_UCUM_PINT_DISPLAY);
    nchBloodPntsFrnshdQtyInfo.setValue(bloodPintsQuantity);
    // NCH_IP_NCVRD_CHRG_AMT => ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalAmt(eob, CcwCodebookVariable.NCH_IP_NCVRD_CHRG_AMT, noncoveredCharge);
    // NCH_IP_TOT_DDCTN_AMT => ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalAmt(eob, CcwCodebookVariable.NCH_IP_TOT_DDCTN_AMT, totalDeductionAmount);
    // CLM_PPS_CPTL_DSPRPRTNT_SHR_AMT => ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalAmt(eob, CcwCodebookVariable.CLM_PPS_CPTL_DSPRPRTNT_SHR_AMT, claimPPSCapitalDisproportionateShareAmt);
    // CLM_PPS_CPTL_EXCPTN_AMT => ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalAmt(eob, CcwCodebookVariable.CLM_PPS_CPTL_EXCPTN_AMT, claimPPSCapitalExceptionAmount);
    // CLM_PPS_CPTL_FSP_AMT => ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalAmt(eob, CcwCodebookVariable.CLM_PPS_CPTL_FSP_AMT, claimPPSCapitalFSPAmount);
    // CLM_PPS_CPTL_IME_AMT => ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalAmt(eob, CcwCodebookVariable.CLM_PPS_CPTL_IME_AMT, claimPPSCapitalIMEAmount);
    // CLM_PPS_CPTL_OUTLIER_AMT => ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalAmt(eob, CcwCodebookVariable.CLM_PPS_CPTL_OUTLIER_AMT, claimPPSCapitalOutlierAmount);
    // CLM_PPS_OLD_CPTL_HLD_HRMLS_AMT => ExplanationOfBenefit.benefitBalance.financial
    addBenefitBalanceFinancialMedicalAmt(eob, CcwCodebookVariable.CLM_PPS_OLD_CPTL_HLD_HRMLS_AMT, claimPPSOldCapitalHoldHarmlessAmount);
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) SimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity) Quantity(org.hl7.fhir.r4.model.Quantity)

Example 64 with SupportingInformationComponent

use of org.hl7.fhir.r4.model.Claim.SupportingInformationComponent 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 65 with SupportingInformationComponent

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

the class TransformerUtilsV2 method addCommonEobInformationInpatientSNF.

/**
 * Adds EOB information to fields that are common between the Inpatient and SNF claim types.
 *
 * @param eob the {@link ExplanationOfBenefit} that fields will be added to by this method
 * @param admissionTypeCd CLM_IP_ADMSN_TYPE_CD: a {@link Character} shared field representing the
 *     admission type cd for the claim
 * @param sourceAdmissionCd CLM_SRC_IP_ADMSN_CD: an {@link Optional}&lt;{@link Character}&gt;
 *     shared field representing the source admission cd for the claim
 * @param noncoveredStayFromDate NCH_VRFD_NCVRD_STAY_FROM_DT: an {@link Optional}&lt;{@link
 *     LocalDate}&gt; shared field representing the non-covered stay from date for the claim
 * @param noncoveredStayThroughDate NCH_VRFD_NCVRD_STAY_THRU_DT: an {@link Optional}&lt;{@link
 *     LocalDate}&gt; shared field representing the non-covered stay through date for the claim
 * @param coveredCareThroughDate NCH_ACTV_OR_CVRD_LVL_CARE_THRU: an {@link Optional}&lt;{@link
 *     LocalDate}&gt; shared field representing the covered stay through date for the claim
 * @param medicareBenefitsExhaustedDate NCH_BENE_MDCR_BNFTS_EXHTD_DT_I: an {@link
 *     Optional}&lt;{@link LocalDate}&gt; shared field representing the medicare benefits
 *     exhausted date for the claim
 * @param diagnosisRelatedGroupCd CLM_DRG_CD: an {@link Optional}&lt;{@link String}&gt; shared
 *     field representing the non-covered stay from date for the claim
 */
static void addCommonEobInformationInpatientSNF(ExplanationOfBenefit eob, Character admissionTypeCd, Optional<Character> sourceAdmissionCd, Optional<LocalDate> noncoveredStayFromDate, Optional<LocalDate> noncoveredStayThroughDate, Optional<LocalDate> coveredCareThroughDate, Optional<LocalDate> medicareBenefitsExhaustedDate, Optional<String> diagnosisRelatedGroupCd) {
    // CLM_IP_ADMSN_TYPE_CD => ExplanationOfBenefit.supportingInfo.code
    addInformationWithCode(eob, CcwCodebookVariable.CLM_IP_ADMSN_TYPE_CD, CcwCodebookVariable.CLM_IP_ADMSN_TYPE_CD, admissionTypeCd);
    // CLM_SRC_IP_ADMSN_CD => ExplanationOfBenefit.supportingInfo.code
    if (sourceAdmissionCd.isPresent()) {
        addInformationWithCode(eob, CcwCodebookVariable.CLM_SRC_IP_ADMSN_CD, CcwCodebookVariable.CLM_SRC_IP_ADMSN_CD, sourceAdmissionCd);
    }
    // ExplanationOfBenefit.supportingInfo.timingPeriod
    if (noncoveredStayFromDate.isPresent() || noncoveredStayThroughDate.isPresent()) {
        validatePeriodDates(noncoveredStayFromDate, noncoveredStayThroughDate);
        SupportingInformationComponent nchVrfdNcvrdStayInfo = addInformation(eob, CcwCodebookVariable.NCH_VRFD_NCVRD_STAY_FROM_DT);
        Period nchVrfdNcvrdStayPeriod = new Period();
        noncoveredStayFromDate.ifPresent(d -> nchVrfdNcvrdStayPeriod.setStart(convertToDate(d), TemporalPrecisionEnum.DAY));
        noncoveredStayThroughDate.ifPresent(d -> nchVrfdNcvrdStayPeriod.setEnd(convertToDate(d), TemporalPrecisionEnum.DAY));
        nchVrfdNcvrdStayInfo.setTiming(nchVrfdNcvrdStayPeriod);
    }
    // ExplanationOfBenefit.supportingInfo.timingDate
    if (coveredCareThroughDate.isPresent()) {
        SupportingInformationComponent nchActvOrCvrdLvlCareThruInfo = TransformerUtilsV2.addInformation(eob, CcwCodebookVariable.NCH_ACTV_OR_CVRD_LVL_CARE_THRU);
        nchActvOrCvrdLvlCareThruInfo.setTiming(new DateType(TransformerUtilsV2.convertToDate(coveredCareThroughDate.get())));
    }
    // ExplanationOfBenefit.supportingInfo.timingDate
    if (medicareBenefitsExhaustedDate.isPresent()) {
        SupportingInformationComponent nchBeneMdcrBnftsExhtdDtIInfo = TransformerUtilsV2.addInformation(eob, CcwCodebookVariable.NCH_BENE_MDCR_BNFTS_EXHTD_DT_I);
        nchBeneMdcrBnftsExhtdDtIInfo.setTiming(new DateType(TransformerUtilsV2.convertToDate(medicareBenefitsExhaustedDate.get())));
    }
    // diagnosisRelatedGroupCd
    // CLM_DRG_CD => ExplanationOfBenefit.supportingInfo
    diagnosisRelatedGroupCd.ifPresent(cd -> addInformationWithCode(eob, CcwCodebookVariable.CLM_DRG_CD, CcwCodebookVariable.CLM_DRG_CD, cd));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Period(org.hl7.fhir.r4.model.Period) DateType(org.hl7.fhir.r4.model.DateType)

Aggregations

SupportingInformationComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent)68 Coding (org.hl7.fhir.r4.model.Coding)59 Test (org.junit.jupiter.api.Test)59 SupportingInformationComponent (org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent)11 DateType (org.hl7.fhir.r4.model.DateType)11 Period (org.hl7.fhir.r4.model.Period)6 SNFClaimLine (gov.cms.bfd.model.rif.SNFClaimLine)4 Quantity (org.hl7.fhir.r4.model.Quantity)4 Diagnosis (gov.cms.bfd.server.war.commons.Diagnosis)3 BigDecimal (java.math.BigDecimal)3 SimpleDateFormat (java.text.SimpleDateFormat)3 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)3 SimpleQuantity (org.hl7.fhir.r4.model.SimpleQuantity)3 FhirContext (ca.uhn.fhir.context.FhirContext)2 TemporalPrecisionEnum (ca.uhn.fhir.model.api.TemporalPrecisionEnum)2 CcwCodebookVariable (gov.cms.bfd.model.codebook.data.CcwCodebookVariable)2 CcwCodebookInterface (gov.cms.bfd.model.codebook.model.CcwCodebookInterface)2 CarrierClaim (gov.cms.bfd.model.rif.CarrierClaim)2 CarrierClaimColumn (gov.cms.bfd.model.rif.CarrierClaimColumn)2 CarrierClaimLine (gov.cms.bfd.model.rif.CarrierClaimLine)2