Search in sources :

Example 11 with Diagnosis

use of gov.cms.bfd.server.war.commons.Diagnosis in project beneficiary-fhir-data by CMSgov.

the class CarrierClaimTransformerV2 method transformClaim.

/**
 * @param claimGroup the CCW {@link CarrierClaim} to transform
 * @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
 *     CarrierClaim}
 */
private static ExplanationOfBenefit transformClaim(CarrierClaim claimGroup, Optional<Boolean> includeTaxNumbers) {
    ExplanationOfBenefit eob = new ExplanationOfBenefit();
    // Required values not directly mapped
    eob.getMeta().addProfile(ProfileConstants.C4BB_EOB_NONCLINICIAN_PROFILE_URL);
    // TODO: ExplanationOfBenefit.outcome is a required field. Needs to be mapped.
    // eob.setOutcome(?)
    // Common group level fields between all claim types
    // Claim Type + Claim ID => ExplanationOfBenefit.id
    // CLM_ID => ExplanationOfBenefit.identifier
    // CLM_GRP_ID => ExplanationOfBenefit.identifier
    // BENE_ID + Coverage Type => ExplanationOfBenefit.insurance.coverage
    // (reference)
    // BENE_ID => ExplanationOfBenefit.patient (reference)
    // FINAL_ACTION => ExplanationOfBenefit.status
    // CLM_FROM_DT => ExplanationOfBenefit.billablePeriod.start
    // CLM_THRU_DT => ExplanationOfBenefit.billablePeriod.end
    // CLM_PMT_AMT => ExplanationOfBenefit.payment.amount
    TransformerUtilsV2.mapEobCommonClaimHeaderData(eob, claimGroup.getClaimId(), claimGroup.getBeneficiaryId(), ClaimTypeV2.CARRIER, claimGroup.getClaimGroupId().toPlainString(), MedicareSegment.PART_B, Optional.of(claimGroup.getDateFrom()), Optional.of(claimGroup.getDateThrough()), Optional.of(claimGroup.getPaymentAmount()), claimGroup.getFinalAction());
    // NCH_WKLY_PROC_DT => ExplanationOfBenefit.supportinginfo.timingDate
    TransformerUtilsV2.addInformation(eob, TransformerUtilsV2.createInformationRecievedDateSlice(eob, CcwCodebookVariable.NCH_WKLY_PROC_DT, Optional.of(claimGroup.getWeeklyProcessDate())));
    // map eob type codes into FHIR
    // NCH_CLM_TYPE_CD            => ExplanationOfBenefit.type.coding
    // EOB Type                   => ExplanationOfBenefit.type.coding
    // Claim Type (Professional)  => ExplanationOfBenefit.type.coding
    // NCH_NEAR_LINE_REC_IDENT_CD => ExplanationOfBenefit.extension
    TransformerUtilsV2.mapEobType(eob, ClaimTypeV2.CARRIER, Optional.of(claimGroup.getNearLineRecordIdCode()), Optional.of(claimGroup.getClaimTypeCode()));
    // CARR_CLM_PRMRY_PYR_PD_AMT => ExplanationOfBenefit.total.amount
    TransformerUtilsV2.addTotal(eob, TransformerUtilsV2.createTotalAdjudicationAmountSlice(eob, CcwCodebookVariable.CLM_TOT_CHRG_AMT, C4BBAdjudication.PRIOR_PAYER_PAID, claimGroup.getPrimaryPayerPaidAmount()));
    // Common group level fields between Carrier and DME
    // BENE_ID =>
    // CARR_NUM                       => ExplanationOfBenefit.extension
    // CLM_CLNCL_TRIL_NUM             => ExplanationOfBenefit.extension
    // CARR_CLM_CASH_DDCTBL_APLD_AMT  => ExplanationOfBenefit.benefitBalance.financial
    // CARR_CLM_PMT_DNL_CD            => ExplanationOfBenefit.extension
    // RFR_PHYSN_NPI                  => ExplanationOfBenefit.referral.identifier
    // => ExplanationOfBenefit.careteam.provider
    // RFR_PHYSN_UPIN                 => ExplanationOfBenefit.referral.identifier
    // => ExplanationOfBenefit.careteam.provider
    // CARR_CLM_PRVDR_ASGNMT_IND_SW   => ExplanationOfBenefit.extension
    // NCH_CLM_PRVDR_PMT_AMT          => ExplanationOfBenefit.benefitBalance.financial
    // NCH_CLM_BENE_PMT_AMT           => ExplanationOfBenefit.benefitBalance.financial
    // NCH_CARR_CLM_SBMTD_CHRG_AMT    => ExplanationOfBenefit.benefitBalance.financial
    // NCH_CARR_CLM_ALOWD_AMT         => ExplanationOfBenefit.benefitBalance.financial
    // CLM_DISP_CD                    => ExplanationOfBenefit.disposition
    // CARR_CLM_CNTL_NUM              => ExplanationOfBenefit.extension
    TransformerUtilsV2.mapEobCommonGroupCarrierDME(eob, claimGroup.getBeneficiaryId(), claimGroup.getCarrierNumber(), claimGroup.getClinicalTrialNumber(), claimGroup.getBeneficiaryPartBDeductAmount(), claimGroup.getPaymentDenialCode(), claimGroup.getReferringPhysicianNpi(), claimGroup.getReferringPhysicianUpin(), claimGroup.getProviderAssignmentIndicator(), claimGroup.getProviderPaymentAmount(), claimGroup.getBeneficiaryPaymentAmount(), claimGroup.getSubmittedChargeAmount(), claimGroup.getAllowedChargeAmount(), claimGroup.getClaimDispositionCode(), claimGroup.getClaimCarrierControlNumber());
    // ICD_DGNS_VRSN_CD(1-12) => diagnosis.diagnosisCodeableConcept
    for (Diagnosis diagnosis : DiagnosisUtilV2.extractDiagnoses(claimGroup)) {
        DiagnosisUtilV2.addDiagnosisCode(eob, diagnosis, ClaimTypeV2.CARRIER);
    }
    // CARR_CLM_RFRNG_PIN_NUM => ExplanationOfBenefit.careteam.provider
    TransformerUtilsV2.addCareTeamMember(eob, C4BBPractitionerIdentifierType.NPI, C4BBClaimProfessionalAndNonClinicianCareTeamRole.REFERRING, Optional.ofNullable(claimGroup.getReferringProviderIdNumber()));
    // CARR_CLM_ENTRY_CD => ExplanationOfBenefit.extension
    eob.addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.CARR_CLM_ENTRY_CD, claimGroup.getClaimEntryCode()));
    // Process line items
    for (CarrierClaimLine line : claimGroup.getLines()) {
        ItemComponent item = eob.addItem();
        // LINE_NUM => ExplanationOfBenefit.item.sequence
        item.setSequence(line.getLineNumber().intValue());
        // PRF_PHYSN_NPI => ExplanationOfBenefit.careTeam.provider
        Optional<CareTeamComponent> performing = TransformerUtilsV2.addCareTeamMember(eob, item, C4BBPractitionerIdentifierType.NPI, C4BBClaimProfessionalAndNonClinicianCareTeamRole.PERFORMING, line.getPerformingPhysicianNpi());
        // Fall back to UPIN if NPI not present
        if (!line.getPerformingPhysicianNpi().isPresent()) {
            performing = TransformerUtilsV2.addCareTeamMember(eob, item, C4BBPractitionerIdentifierType.UPIN, C4BBClaimProfessionalAndNonClinicianCareTeamRole.PERFORMING, line.getPerformingPhysicianUpin());
        }
        // Update the responsible flag
        performing.ifPresent(p -> {
            p.setResponsible(true);
            // PRVDR_SPCLTY => ExplanationOfBenefit.careTeam.qualification
            p.setQualification(TransformerUtilsV2.createCodeableConcept(eob, CcwCodebookVariable.PRVDR_SPCLTY, line.getProviderSpecialityCode()));
            // CARR_LINE_PRVDR_TYPE_CD => ExplanationOfBenefit.careTeam.extension
            p.addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.CARR_LINE_PRVDR_TYPE_CD, line.getProviderTypeCode()));
            // PRTCPTNG_IND_CD => ExplanationOfBenefit.careTeam.extension
            p.addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.PRTCPTNG_IND_CD, line.getProviderParticipatingIndCode()));
        });
        // ORG_NPI_NUM => ExplanationOfBenefit.careTeam.provider
        TransformerUtilsV2.addCareTeamMember(eob, item, C4BBPractitionerIdentifierType.NPI, C4BBClaimProfessionalAndNonClinicianCareTeamRole.PRIMARY, line.getOrganizationNpi());
        // CARR_LINE_RDCD_PMT_PHYS_ASTN_C => ExplanationOfBenefit.item.adjudication
        TransformerUtilsV2.addAdjudication(item, TransformerUtilsV2.createAdjudicationDenialReasonSlice(eob, CcwCodebookVariable.CARR_LINE_RDCD_PMT_PHYS_ASTN_C, String.valueOf(line.getReducedPaymentPhysicianAsstCode())));
        // HCPCS_CD               => ExplanationOfBenefit.item.productOrService
        // HCPCS_1ST_MDFR_CD      => ExplanationOfBenefit.item.modifier
        // HCPCS_2ND_MDFR_CD      => ExplanationOfBenefit.item.modifier
        // CARR_CLM_HCPCS_YR_CD   => ExplanationOfBenefit.item.modifier.version
        TransformerUtilsV2.mapHcpcs(eob, item, line.getHcpcsCode(), claimGroup.getHcpcsYearCode(), Arrays.asList(line.getHcpcsInitialModifierCode(), line.getHcpcsSecondModifierCode()));
        // tax num should be as a extension
        if (includeTaxNumbers.orElse(false)) {
            item.addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.TAX_NUM, line.getProviderTaxNumber()));
        }
        // CARR_LINE_ANSTHSA_UNIT_CNT => ExplanationOfBenefit.item.extension
        if (line.getAnesthesiaUnitCount().compareTo(BigDecimal.ZERO) > 0) {
            item.addExtension(TransformerUtilsV2.createExtensionQuantity(CcwCodebookVariable.CARR_LINE_ANSTHSA_UNIT_CNT, line.getAnesthesiaUnitCount()));
        }
        // CARR_LINE_MTUS_CNT => ExplanationOfBenefit.item.extension
        if (!line.getMtusCount().equals(BigDecimal.ZERO)) {
            item.addExtension(TransformerUtilsV2.createExtensionQuantity(CcwCodebookVariable.CARR_LINE_MTUS_CNT, line.getMtusCount()));
        }
        // CARR_LINE_MTUS_CD => ExplanationOfBenefit.item.extension
        line.getMtusCode().ifPresent(code -> item.addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.CARR_LINE_MTUS_CNT, code)));
        // Common item level fields between Carrier and DME
        // LINE_SRVC_CNT            => ExplanationOfBenefit.item.quantity
        // LINE_CMS_TYPE_SRVC_CD    => ExplanationOfBenefit.item.category
        // LINE_PLACE_OF_SRVC_CD    => ExplanationOfBenefit.item.location
        // BETOS_CD                 => ExplanationOfBenefit.item.extension
        // LINE_1ST_EXPNS_DT        => ExplanationOfBenefit.item.servicedPeriod
        // LINE_LAST_EXPNS_DT       => ExplanationOfBenefit.item.servicedPeriod
        // LINE_NCH_PMT_AMT         => ExplanationOfBenefit.item.adjudication
        // LINE_PMT_80_100_CD       => ExplanationOfBenefit.item.adjudication.extension
        // PAID_TO_PATIENT          => ExplanationOfBenefit.item.adjudication
        // LINE_PRVDR_PMT_AMT       => ExplanationOfBenefit.item.adjudication
        // LINE_BENE_PTB_DDCTBL_AMT => ExplanationOfBenefit.item.adjudication
        // LINE_BENE_PRMRY_PYR_CD   => ExplanationOfBenefit.item.extension
        // LINE_BENE_PRMRY_PYR_PD_AMT => ExplanationOfBenefit.item.adjudication
        // LINE_COINSRNC_AMT        => ExplanationOfBenefit.item.adjudication
        // LINE_SBMTD_CHRG_AMT      => ExplanationOfBenefit.item.adjudication
        // LINE_ALOWD_CHRG_AMT      => ExplanationOfBenefit.item.adjudication
        // LINE_BENE_PRMRY_PYR_CD   => ExplanationOfBenefit.item.extension
        // LINE_SERVICE_DEDUCTIBLE  => ExplanationOfBenefit.item.extension
        // LINE_HCT_HGB_TYPE_CD     => Observation.code
        // LINE_HCT_HGB_RSLT_NUM    => Observation.value
        // LINE_NDC_CD              => ExplanationOfBenefit.item.productOrService
        TransformerUtilsV2.mapEobCommonItemCarrierDME(item, eob, claimGroup.getClaimId(), item.getSequence(), line.getServiceCount(), line.getPlaceOfServiceCode(), line.getFirstExpenseDate(), line.getLastExpenseDate(), line.getBeneficiaryPaymentAmount(), line.getProviderPaymentAmount(), line.getBeneficiaryPartBDeductAmount(), line.getPrimaryPayerCode(), line.getPrimaryPayerPaidAmount(), line.getBetosCode(), line.getPaymentAmount(), line.getPaymentCode(), line.getCoinsuranceAmount(), line.getSubmittedChargeAmount(), line.getAllowedChargeAmount(), line.getProcessingIndicatorCode(), line.getServiceDeductibleCode(), line.getHctHgbTestTypeCode(), line.getHctHgbTestResult(), line.getCmsServiceTypeCode(), line.getNationalDrugCode());
        // LINE_ICD_DGNS_CD      => ExplanationOfBenefit.item.diagnosisSequence
        // LINE_ICD_DGNS_VRSN_CD => ExplanationOfBenefit.item.diagnosisSequence
        DiagnosisUtilV2.addDiagnosisLink(eob, item, Diagnosis.from(line.getDiagnosisCode(), line.getDiagnosisCodeVersion(), DiagnosisLabel.OTHER), ClaimTypeV2.CARRIER);
        // PRVDR_STATE_CD => ExplanationOfBenefit.item.location.extension
        line.getProviderStateCode().ifPresent(code -> item.getLocation().addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.PRVDR_STATE_CD, code)));
        // PRVDR_ZIP => ExplanationOfBenefit.item.location.extension
        line.getProviderZipCode().ifPresent(code -> item.getLocation().addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.PRVDR_ZIP, code)));
        // CARR_LINE_PRCNG_LCLTY_CD => ExplanationOfBenefit.item.location.extension
        item.getLocation().addExtension(TransformerUtilsV2.createExtensionCoding(eob, CcwCodebookVariable.CARR_LINE_PRCNG_LCLTY_CD, line.getLinePricingLocalityCode()));
        // CARR_LINE_CLIA_LAB_NUM => ExplanationOfBenefit.item.location.extension
        line.getCliaLabNumber().ifPresent(num -> item.getLocation().addExtension(TransformerUtilsV2.createExtensionIdentifier(CcwCodebookVariable.CARR_LINE_CLIA_LAB_NUM, num)));
    }
    TransformerUtilsV2.setLastUpdated(eob, claimGroup.getLastUpdated());
    return eob;
}
Also used : CarrierClaimLine(gov.cms.bfd.model.rif.CarrierClaimLine) ItemComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) CareTeamComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent)

Example 12 with Diagnosis

use of gov.cms.bfd.server.war.commons.Diagnosis in project beneficiary-fhir-data by CMSgov.

the class SNFClaimTransformer method transformClaim.

/**
 * @param claimGroup the CCW {@link SNFClaim} to transform
 * @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
 *     SNFClaim}
 */
private static ExplanationOfBenefit transformClaim(SNFClaim claimGroup) {
    ExplanationOfBenefit eob = new ExplanationOfBenefit();
    // Common group level fields between all claim types
    TransformerUtils.mapEobCommonClaimHeaderData(eob, claimGroup.getClaimId(), claimGroup.getBeneficiaryId(), ClaimType.SNF, claimGroup.getClaimGroupId().toPlainString(), MedicareSegment.PART_A, Optional.of(claimGroup.getDateFrom()), Optional.of(claimGroup.getDateThrough()), Optional.of(claimGroup.getPaymentAmount()), claimGroup.getFinalAction());
    TransformerUtils.mapEobWeeklyProcessDate(eob, claimGroup.getWeeklyProcessDate());
    // map eob type codes into FHIR
    TransformerUtils.mapEobType(eob, ClaimType.SNF, Optional.of(claimGroup.getNearLineRecordIdCode()), Optional.of(claimGroup.getClaimTypeCode()));
    // set the provider number which is common among several claim types
    TransformerUtils.setProviderNumber(eob, claimGroup.getProviderNumber());
    // add EOB information to fields that are common between the Inpatient and SNF claim types
    TransformerUtils.addCommonEobInformationInpatientSNF(eob, claimGroup.getAdmissionTypeCd(), claimGroup.getSourceAdmissionCd(), claimGroup.getNoncoveredStayFromDate(), claimGroup.getNoncoveredStayThroughDate(), claimGroup.getCoveredCareThroughDate(), claimGroup.getMedicareBenefitsExhaustedDate(), claimGroup.getDiagnosisRelatedGroupCd());
    if (claimGroup.getPatientStatusCd().isPresent()) {
        TransformerUtils.addInformationWithCode(eob, CcwCodebookVariable.NCH_PTNT_STUS_IND_CD, CcwCodebookVariable.NCH_PTNT_STUS_IND_CD, claimGroup.getPatientStatusCd().get());
    }
    // Common group level fields between Inpatient, HHA, Hospice and SNF
    TransformerUtils.mapEobCommonGroupInpHHAHospiceSNF(eob, claimGroup.getClaimAdmissionDate(), claimGroup.getBeneficiaryDischargeDate(), Optional.of(claimGroup.getUtilizationDayCount()));
    /*
     * add field values to the benefit balances that are common between the
     * Inpatient and SNF claim types
     */
    TransformerUtils.addCommonGroupInpatientSNF(eob, claimGroup.getCoinsuranceDayCount(), claimGroup.getNonUtilizationDayCount(), claimGroup.getDeductibleAmount(), claimGroup.getPartACoinsuranceLiabilityAmount(), claimGroup.getBloodPintsFurnishedQty(), claimGroup.getNoncoveredCharge(), claimGroup.getTotalDeductionAmount(), claimGroup.getClaimPPSCapitalDisproportionateShareAmt(), claimGroup.getClaimPPSCapitalExceptionAmount(), claimGroup.getClaimPPSCapitalFSPAmount(), claimGroup.getClaimPPSCapitalIMEAmount(), claimGroup.getClaimPPSCapitalOutlierAmount(), claimGroup.getClaimPPSOldCapitalHoldHarmlessAmount());
    if (claimGroup.getQualifiedStayFromDate().isPresent() || claimGroup.getQualifiedStayThroughDate().isPresent()) {
        TransformerUtils.validatePeriodDates(claimGroup.getQualifiedStayFromDate(), claimGroup.getQualifiedStayThroughDate());
        SupportingInformationComponent nchQlfydStayInfo = TransformerUtils.addInformation(eob, CcwCodebookVariable.NCH_QLFYD_STAY_FROM_DT);
        Period nchQlfydStayPeriod = new Period();
        if (claimGroup.getQualifiedStayFromDate().isPresent())
            nchQlfydStayPeriod.setStart(TransformerUtils.convertToDate((claimGroup.getQualifiedStayFromDate().get())), TemporalPrecisionEnum.DAY);
        if (claimGroup.getQualifiedStayThroughDate().isPresent())
            nchQlfydStayPeriod.setEnd(TransformerUtils.convertToDate((claimGroup.getQualifiedStayThroughDate().get())), TemporalPrecisionEnum.DAY);
        nchQlfydStayInfo.setTiming(nchQlfydStayPeriod);
    }
    // Common group level fields between Inpatient, Outpatient and SNF
    TransformerUtils.mapEobCommonGroupInpOutSNF(eob, claimGroup.getBloodDeductibleLiabilityAmount(), claimGroup.getOperatingPhysicianNpi(), claimGroup.getOtherPhysicianNpi(), claimGroup.getClaimQueryCode(), claimGroup.getMcoPaidSw());
    // Common group level fields between Inpatient, Outpatient Hospice, HHA and SNF
    TransformerUtils.mapEobCommonGroupInpOutHHAHospiceSNF(eob, claimGroup.getOrganizationNpi(), claimGroup.getClaimFacilityTypeCode(), claimGroup.getClaimFrequencyCode(), claimGroup.getClaimNonPaymentReasonCode(), claimGroup.getPatientDischargeStatusCode(), claimGroup.getClaimServiceClassificationTypeCode(), claimGroup.getClaimPrimaryPayerCode(), claimGroup.getAttendingPhysicianNpi(), claimGroup.getTotalChargeAmount(), claimGroup.getPrimaryPayerPaidAmount(), claimGroup.getFiscalIntermediaryNumber(), claimGroup.getFiDocumentClaimControlNumber(), claimGroup.getFiOriginalClaimControlNumber());
    for (Diagnosis diagnosis : TransformerUtils.extractDiagnoses1Thru12(claimGroup.getDiagnosisAdmittingCode(), claimGroup.getDiagnosisAdmittingCodeVersion(), claimGroup.getDiagnosisPrincipalCode(), claimGroup.getDiagnosisPrincipalCodeVersion(), claimGroup.getDiagnosis1Code(), claimGroup.getDiagnosis1CodeVersion(), claimGroup.getDiagnosis2Code(), claimGroup.getDiagnosis2CodeVersion(), claimGroup.getDiagnosis3Code(), claimGroup.getDiagnosis3CodeVersion(), claimGroup.getDiagnosis4Code(), claimGroup.getDiagnosis4CodeVersion(), claimGroup.getDiagnosis5Code(), claimGroup.getDiagnosis5CodeVersion(), claimGroup.getDiagnosis6Code(), claimGroup.getDiagnosis6CodeVersion(), claimGroup.getDiagnosis7Code(), claimGroup.getDiagnosis7CodeVersion(), claimGroup.getDiagnosis8Code(), claimGroup.getDiagnosis8CodeVersion(), claimGroup.getDiagnosis9Code(), claimGroup.getDiagnosis9CodeVersion(), claimGroup.getDiagnosis10Code(), claimGroup.getDiagnosis10CodeVersion(), claimGroup.getDiagnosis11Code(), claimGroup.getDiagnosis11CodeVersion(), claimGroup.getDiagnosis12Code(), claimGroup.getDiagnosis12CodeVersion())) TransformerUtils.addDiagnosisCode(eob, diagnosis);
    for (Diagnosis diagnosis : TransformerUtils.extractDiagnoses13Thru25(claimGroup.getDiagnosis13Code(), claimGroup.getDiagnosis13CodeVersion(), claimGroup.getDiagnosis14Code(), claimGroup.getDiagnosis14CodeVersion(), claimGroup.getDiagnosis15Code(), claimGroup.getDiagnosis15CodeVersion(), claimGroup.getDiagnosis16Code(), claimGroup.getDiagnosis16CodeVersion(), claimGroup.getDiagnosis17Code(), claimGroup.getDiagnosis17CodeVersion(), claimGroup.getDiagnosis18Code(), claimGroup.getDiagnosis18CodeVersion(), claimGroup.getDiagnosis19Code(), claimGroup.getDiagnosis19CodeVersion(), claimGroup.getDiagnosis20Code(), claimGroup.getDiagnosis20CodeVersion(), claimGroup.getDiagnosis21Code(), claimGroup.getDiagnosis21CodeVersion(), claimGroup.getDiagnosis22Code(), claimGroup.getDiagnosis22CodeVersion(), claimGroup.getDiagnosis23Code(), claimGroup.getDiagnosis23CodeVersion(), claimGroup.getDiagnosis24Code(), claimGroup.getDiagnosis24CodeVersion(), claimGroup.getDiagnosis25Code(), claimGroup.getDiagnosis25CodeVersion())) TransformerUtils.addDiagnosisCode(eob, diagnosis);
    for (Diagnosis diagnosis : TransformerUtils.extractExternalDiagnoses1Thru12(claimGroup.getDiagnosisExternalFirstCode(), claimGroup.getDiagnosisExternalFirstCodeVersion(), claimGroup.getDiagnosisExternal1Code(), claimGroup.getDiagnosisExternal1CodeVersion(), claimGroup.getDiagnosisExternal2Code(), claimGroup.getDiagnosisExternal2CodeVersion(), claimGroup.getDiagnosisExternal3Code(), claimGroup.getDiagnosisExternal3CodeVersion(), claimGroup.getDiagnosisExternal4Code(), claimGroup.getDiagnosisExternal4CodeVersion(), claimGroup.getDiagnosisExternal5Code(), claimGroup.getDiagnosisExternal5CodeVersion(), claimGroup.getDiagnosisExternal6Code(), claimGroup.getDiagnosisExternal6CodeVersion(), claimGroup.getDiagnosisExternal7Code(), claimGroup.getDiagnosisExternal7CodeVersion(), claimGroup.getDiagnosisExternal8Code(), claimGroup.getDiagnosisExternal8CodeVersion(), claimGroup.getDiagnosisExternal9Code(), claimGroup.getDiagnosisExternal9CodeVersion(), claimGroup.getDiagnosisExternal10Code(), claimGroup.getDiagnosisExternal10CodeVersion(), claimGroup.getDiagnosisExternal11Code(), claimGroup.getDiagnosisExternal11CodeVersion(), claimGroup.getDiagnosisExternal12Code(), claimGroup.getDiagnosisExternal12CodeVersion())) TransformerUtils.addDiagnosisCode(eob, diagnosis);
    for (CCWProcedure procedure : TransformerUtils.extractCCWProcedures(claimGroup.getProcedure1Code(), claimGroup.getProcedure1CodeVersion(), claimGroup.getProcedure1Date(), claimGroup.getProcedure2Code(), claimGroup.getProcedure2CodeVersion(), claimGroup.getProcedure2Date(), claimGroup.getProcedure3Code(), claimGroup.getProcedure3CodeVersion(), claimGroup.getProcedure3Date(), claimGroup.getProcedure4Code(), claimGroup.getProcedure4CodeVersion(), claimGroup.getProcedure4Date(), claimGroup.getProcedure5Code(), claimGroup.getProcedure5CodeVersion(), claimGroup.getProcedure5Date(), claimGroup.getProcedure6Code(), claimGroup.getProcedure6CodeVersion(), claimGroup.getProcedure6Date(), claimGroup.getProcedure7Code(), claimGroup.getProcedure7CodeVersion(), claimGroup.getProcedure7Date(), claimGroup.getProcedure8Code(), claimGroup.getProcedure8CodeVersion(), claimGroup.getProcedure8Date(), claimGroup.getProcedure9Code(), claimGroup.getProcedure9CodeVersion(), claimGroup.getProcedure9Date(), claimGroup.getProcedure10Code(), claimGroup.getProcedure10CodeVersion(), claimGroup.getProcedure10Date(), claimGroup.getProcedure11Code(), claimGroup.getProcedure11CodeVersion(), claimGroup.getProcedure11Date(), claimGroup.getProcedure12Code(), claimGroup.getProcedure12CodeVersion(), claimGroup.getProcedure12Date(), claimGroup.getProcedure13Code(), claimGroup.getProcedure13CodeVersion(), claimGroup.getProcedure13Date(), claimGroup.getProcedure14Code(), claimGroup.getProcedure14CodeVersion(), claimGroup.getProcedure14Date(), claimGroup.getProcedure15Code(), claimGroup.getProcedure15CodeVersion(), claimGroup.getProcedure15Date(), claimGroup.getProcedure16Code(), claimGroup.getProcedure16CodeVersion(), claimGroup.getProcedure16Date(), claimGroup.getProcedure17Code(), claimGroup.getProcedure17CodeVersion(), claimGroup.getProcedure17Date(), claimGroup.getProcedure18Code(), claimGroup.getProcedure18CodeVersion(), claimGroup.getProcedure18Date(), claimGroup.getProcedure19Code(), claimGroup.getProcedure19CodeVersion(), claimGroup.getProcedure19Date(), claimGroup.getProcedure20Code(), claimGroup.getProcedure20CodeVersion(), claimGroup.getProcedure20Date(), claimGroup.getProcedure21Code(), claimGroup.getProcedure21CodeVersion(), claimGroup.getProcedure21Date(), claimGroup.getProcedure22Code(), claimGroup.getProcedure22CodeVersion(), claimGroup.getProcedure22Date(), claimGroup.getProcedure23Code(), claimGroup.getProcedure23CodeVersion(), claimGroup.getProcedure23Date(), claimGroup.getProcedure24Code(), claimGroup.getProcedure24CodeVersion(), claimGroup.getProcedure24Date(), claimGroup.getProcedure25Code(), claimGroup.getProcedure25CodeVersion(), claimGroup.getProcedure25Date())) TransformerUtils.addProcedureCode(eob, procedure);
    for (SNFClaimLine claimLine : claimGroup.getLines()) {
        ItemComponent item = eob.addItem();
        item.setSequence(claimLine.getLineNumber().intValue());
        item.setLocation(new Address().setState((claimGroup.getProviderStateCode())));
        TransformerUtils.mapHcpcs(eob, item, Optional.empty(), claimLine.getHcpcsCode(), Collections.emptyList());
        // Common item level fields between Inpatient, Outpatient, HHA, Hospice and SNF
        TransformerUtils.mapEobCommonItemRevenue(item, eob, claimLine.getRevenueCenter(), claimLine.getRateAmount(), claimLine.getTotalChargeAmount(), claimLine.getNonCoveredChargeAmount(), BigDecimal.valueOf(claimLine.getUnitCount()), claimLine.getNationalDrugCodeQuantity(), claimLine.getNationalDrugCodeQualifierCode(), claimLine.getRevenueCenterRenderingPhysicianNPI());
        // Common group level field coinsurance between Inpatient, HHA, Hospice and SNF
        TransformerUtils.mapEobCommonGroupInpHHAHospiceSNFCoinsurance(eob, item, claimLine.getDeductibleCoinsuranceCd());
    }
    TransformerUtils.setLastUpdated(eob, claimGroup.getLastUpdated());
    return eob;
}
Also used : SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent) SNFClaimLine(gov.cms.bfd.model.rif.SNFClaimLine) Address(org.hl7.fhir.dstu3.model.Address) CCWProcedure(gov.cms.bfd.server.war.commons.CCWProcedure) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) Period(org.hl7.fhir.dstu3.model.Period) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit)

Example 13 with Diagnosis

use of gov.cms.bfd.server.war.commons.Diagnosis 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 14 with Diagnosis

use of gov.cms.bfd.server.war.commons.Diagnosis in project beneficiary-fhir-data by CMSgov.

the class DiagnosisTest method assertMatches.

static void assertMatches(Character version, String system) {
    Optional<String> code = Optional.of("code");
    Optional<Character> prsntOnAdmsn = Optional.of('Y');
    Optional<Diagnosis> diagnosis = Diagnosis.from(code, Optional.of(version), prsntOnAdmsn);
    assertEquals(prsntOnAdmsn, diagnosis.get().getPresentOnAdmission());
    assertEquals(system, diagnosis.get().getFhirSystem());
    TransformerTestUtils.assertHasCoding(system, code.get(), diagnosis.get().toCodeableConcept().getCoding());
    CodeableConcept codeableConcept = new CodeableConcept();
    Coding coding = codeableConcept.addCoding();
    coding.setSystem(system).setCode(code.get());
    assertTrue(diagnosis.get().isContainedIn(codeableConcept));
}
Also used : Coding(org.hl7.fhir.dstu3.model.Coding) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 15 with Diagnosis

use of gov.cms.bfd.server.war.commons.Diagnosis in project beneficiary-fhir-data by CMSgov.

the class InpatientClaimTransformerTest method assertMatches.

/**
 * Verifies that the {@link ExplanationOfBenefit} "looks like" it should, if it were produced from
 * the specified {@link InpatientClaim}.
 *
 * @param claim the {@link InpatientClaim} that the {@link ExplanationOfBenefit} was generated
 *     from
 * @param eob the {@link ExplanationOfBenefit} that was generated from the specified {@link
 *     InpatientClaim}
 * @throws FHIRException (indicates test failure)
 */
static void assertMatches(InpatientClaim claim, ExplanationOfBenefit eob) throws FHIRException {
    // Test to ensure group level fields between all claim types match
    TransformerTestUtils.assertEobCommonClaimHeaderData(eob, claim.getClaimId(), claim.getBeneficiaryId(), ClaimType.INPATIENT, claim.getClaimGroupId().toPlainString(), MedicareSegment.PART_A, Optional.of(claim.getDateFrom()), Optional.of(claim.getDateThrough()), Optional.of(claim.getPaymentAmount()), claim.getFinalAction());
    // test the common field provider number is set as expected in the EOB
    TransformerTestUtils.assertProviderNumber(eob, claim.getProviderNumber());
    if (claim.getPatientStatusCd().isPresent())
        TransformerTestUtils.assertInfoWithCodeEquals(CcwCodebookVariable.NCH_PTNT_STUS_IND_CD, CcwCodebookVariable.NCH_PTNT_STUS_IND_CD, claim.getPatientStatusCd(), eob);
    TransformerTestUtils.assertAdjudicationTotalAmountEquals(CcwCodebookVariable.CLM_PASS_THRU_PER_DIEM_AMT, claim.getPassThruPerDiemAmount(), eob);
    TransformerTestUtils.assertAdjudicationTotalAmountEquals(CcwCodebookVariable.NCH_PROFNL_CMPNT_CHRG_AMT, claim.getProfessionalComponentCharge(), eob);
    TransformerTestUtils.assertAdjudicationTotalAmountEquals(CcwCodebookVariable.CLM_TOT_PPS_CPTL_AMT, claim.getClaimTotalPPSCapitalAmount(), eob);
    TransformerTestUtils.assertAdjudicationTotalAmountEquals(CcwCodebookVariable.IME_OP_CLM_VAL_AMT, claim.getIndirectMedicalEducationAmount(), eob);
    TransformerTestUtils.assertAdjudicationTotalAmountEquals(CcwCodebookVariable.DSH_OP_CLM_VAL_AMT, claim.getDisproportionateShareAmount(), eob);
    // test common eob information between Inpatient, HHA, Hospice and SNF claims are set as
    // expected
    TransformerTestUtils.assertEobCommonGroupInpHHAHospiceSNFEquals(eob, claim.getClaimAdmissionDate(), claim.getBeneficiaryDischargeDate(), Optional.of(claim.getUtilizationDayCount()));
    // test common benefit components between SNF and Inpatient claims are set as expected
    TransformerTestUtils.assertCommonGroupInpatientSNF(eob, claim.getCoinsuranceDayCount(), claim.getNonUtilizationDayCount(), claim.getDeductibleAmount(), claim.getPartACoinsuranceLiabilityAmount(), claim.getBloodPintsFurnishedQty(), claim.getNoncoveredCharge(), claim.getTotalDeductionAmount(), claim.getClaimPPSCapitalDisproportionateShareAmt(), claim.getClaimPPSCapitalExceptionAmount(), claim.getClaimPPSCapitalFSPAmount(), claim.getClaimPPSCapitalIMEAmount(), claim.getClaimPPSCapitalOutlierAmount(), claim.getClaimPPSOldCapitalHoldHarmlessAmount());
    // test common eob information between SNF and Inpatient claims are set as expected
    TransformerTestUtils.assertCommonEobInformationInpatientSNF(eob, claim.getNoncoveredStayFromDate(), claim.getNoncoveredStayThroughDate(), claim.getCoveredCareThoughDate(), claim.getMedicareBenefitsExhaustedDate(), claim.getDiagnosisRelatedGroupCd());
    TransformerTestUtils.assertAdjudicationTotalAmountEquals(CcwCodebookVariable.NCH_DRG_OUTLIER_APRVD_PMT_AMT, claim.getDrgOutlierApprovedPaymentAmount(), eob);
    // Test to ensure common group fields between Inpatient, Outpatient and SNF
    // match
    TransformerTestUtils.assertEobCommonGroupInpOutSNFEquals(eob, claim.getBloodDeductibleLiabilityAmount(), claim.getOperatingPhysicianNpi(), claim.getOtherPhysicianNpi(), claim.getClaimQueryCode(), claim.getMcoPaidSw());
    // Test to ensure common group fields between Inpatient, Outpatient HHA, Hospice
    // and SNF match
    TransformerTestUtils.assertEobCommonGroupInpOutHHAHospiceSNFEquals(eob, claim.getOrganizationNpi(), claim.getClaimFacilityTypeCode(), claim.getClaimFrequencyCode(), claim.getClaimNonPaymentReasonCode(), claim.getPatientDischargeStatusCode(), claim.getClaimServiceClassificationTypeCode(), claim.getClaimPrimaryPayerCode(), claim.getAttendingPhysicianNpi(), claim.getTotalChargeAmount(), claim.getPrimaryPayerPaidAmount(), claim.getFiscalIntermediaryNumber(), claim.getFiDocumentClaimControlNumber(), claim.getFiOriginalClaimControlNumber());
    assertEquals(9, eob.getDiagnosis().size());
    // test to ensure the diagnosis code display lookup table process works
    Optional<Diagnosis> diagnosis = Diagnosis.from(claim.getDiagnosis5Code(), claim.getDiagnosis5CodeVersion());
    TransformerTestUtils.assertHasCoding(diagnosis.get().getFhirSystem(), null, TransformerUtils.retrieveIcdCodeDisplay(diagnosis.get().getCode()), diagnosis.get().getCode(), eob.getDiagnosis().get(6).getDiagnosisCodeableConcept().getCoding());
    CCWProcedure ccwProcedure = new CCWProcedure(claim.getProcedure1Code(), claim.getProcedure1CodeVersion(), claim.getProcedure1Date());
    TransformerTestUtils.assertHasCoding(ccwProcedure.getFhirSystem().toString(), claim.getProcedure1Code().get(), eob.getProcedure().get(0).getProcedureCodeableConcept().getCoding());
    assertEquals(TransformerUtils.convertToDate(claim.getProcedure1Date().get()), eob.getProcedure().get(0).getDate());
    // test to ensure the procedure code display lookup table process works
    CCWProcedure ccwProcedureDisplay = new CCWProcedure(claim.getProcedure6Code(), claim.getProcedure6CodeVersion(), claim.getProcedure6Date());
    TransformerTestUtils.assertHasCoding(ccwProcedureDisplay.getFhirSystem().toString(), null, TransformerUtils.retrieveProcedureCodeDisplay(claim.getProcedure6Code().get()), claim.getProcedure6Code().get(), eob.getProcedure().get(5).getProcedureCodeableConcept().getCoding());
    assertEquals(1, eob.getItem().size());
    ItemComponent eobItem0 = eob.getItem().get(0);
    InpatientClaimLine claimLine1 = claim.getLines().get(0);
    assertEquals(claimLine1.getLineNumber(), new BigDecimal(eobItem0.getSequence()));
    assertEquals(claim.getProviderStateCode(), eobItem0.getLocationAddress().getState());
    TransformerTestUtils.assertHcpcsCodes(eobItem0, claimLine1.getHcpcsCode(), Optional.empty(), Optional.empty(), Optional.empty(), 0);
    // Test to ensure common group field coinsurance between Inpatient, HHA, Hospice and SNF match
    TransformerTestUtils.assertEobCommonGroupInpHHAHospiceSNFCoinsuranceEquals(eobItem0, claimLine1.getDeductibleCoinsuranceCd());
    String claimControlNumber = "0000000000";
    // Test to ensure item level fields between Inpatient, Outpatient, HHA, Hopsice
    // and SNF match
    TransformerTestUtils.assertEobCommonItemRevenueEquals(eobItem0, eob, claimLine1.getRevenueCenter(), claimLine1.getRateAmount(), claimLine1.getTotalChargeAmount(), claimLine1.getNonCoveredChargeAmount(), claimLine1.getUnitCount(), claimControlNumber, claimLine1.getNationalDrugCodeQuantity(), claimLine1.getNationalDrugCodeQualifierCode(), claimLine1.getRevenueCenterRenderingPhysicianNPI(), 0);
    // verify {@link
    // TransformerUtils#mapEobType(CodeableConcept,ClaimType,Optional,Optional)}
    // method worked as expected for this claim type
    TransformerTestUtils.assertMapEobType(eob.getType(), ClaimType.INPATIENT, Optional.of(org.hl7.fhir.dstu3.model.codesystems.ClaimType.INSTITUTIONAL), Optional.of(claim.getNearLineRecordIdCode()), Optional.of(claim.getClaimTypeCode()));
    // Test lastUpdated
    TransformerTestUtils.assertLastUpdatedEquals(claim.getLastUpdated(), eob);
}
Also used : CCWProcedure(gov.cms.bfd.server.war.commons.CCWProcedure) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis) BigDecimal(java.math.BigDecimal) InpatientClaimLine(gov.cms.bfd.model.rif.InpatientClaimLine)

Aggregations

Diagnosis (gov.cms.bfd.server.war.commons.Diagnosis)21 ItemComponent (org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent)10 ExplanationOfBenefit (org.hl7.fhir.dstu3.model.ExplanationOfBenefit)9 ExplanationOfBenefit (org.hl7.fhir.r4.model.ExplanationOfBenefit)9 ItemComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent)8 CcwCodebookVariable (gov.cms.bfd.model.codebook.data.CcwCodebookVariable)7 BadCodeMonkeyException (gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException)7 Optional (java.util.Optional)7 CCWProcedure (gov.cms.bfd.server.war.commons.CCWProcedure)6 MetricRegistry (com.codahale.metrics.MetricRegistry)5 InpatientClaimLine (gov.cms.bfd.model.rif.InpatientClaimLine)5 DiagnosisLabel (gov.cms.bfd.server.war.commons.Diagnosis.DiagnosisLabel)5 MedicareSegment (gov.cms.bfd.server.war.commons.MedicareSegment)5 IntStream (java.util.stream.IntStream)5 CcwCodebookInterface (gov.cms.bfd.model.codebook.model.CcwCodebookInterface)4 CarrierClaimLine (gov.cms.bfd.model.rif.CarrierClaimLine)4 HHAClaimLine (gov.cms.bfd.model.rif.HHAClaimLine)4 HospiceClaimLine (gov.cms.bfd.model.rif.HospiceClaimLine)4 OutpatientClaimLine (gov.cms.bfd.model.rif.OutpatientClaimLine)4 BufferedReader (java.io.BufferedReader)4