Search in sources :

Example 6 with PreAdjMcsDiagnosisCode

use of gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode in project beneficiary-fhir-data by CMSgov.

the class McsClaimTransformerV2 method getItems.

private static List<Claim.ItemComponent> getItems(PreAdjMcsClaim claimGroup) {
    return ObjectUtils.defaultIfNull(claimGroup.getDetails(), List.<PreAdjMcsDetail>of()).stream().map(detail -> {
        Claim.ItemComponent item = new Claim.ItemComponent().setSequence(detail.getPriority() + 1).setProductOrService(new CodeableConcept(new Coding(BBCodingSystems.HCPCS, detail.getIdrProcCode(), null))).setServiced(new Period().setStart(localDateToDate(detail.getIdrDtlFromDate())).setEnd(localDateToDate(detail.getIdrDtlToDate()))).setModifier(getModifiers(detail));
        // Set the DiagnosisSequence only if the detail Dx Code is not null and present in the
        // Dx table.
        Optional.ofNullable(detail.getIdrDtlPrimaryDiagCode()).ifPresent(detailDiagnosisCode -> {
            Optional<PreAdjMcsDiagnosisCode> matchingCode = claimGroup.getDiagCodes().stream().filter(diagnosisCode -> codesAreEqual(diagnosisCode.getIdrDiagCode(), detailDiagnosisCode)).findFirst();
            matchingCode.ifPresent(diagnosisCode -> item.setDiagnosisSequence(List.of(new PositiveIntType(diagnosisCode.getPriority() + 1))));
        });
        return item;
    }).sorted(Comparator.comparing(Claim.ItemComponent::getSequence)).collect(Collectors.toList());
}
Also used : IntStream(java.util.stream.IntStream) Trace(com.newrelic.api.agent.Trace) Date(java.util.Date) Identifier(org.hl7.fhir.r4.model.Identifier) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Reference(org.hl7.fhir.r4.model.Reference) Money(org.hl7.fhir.r4.model.Money) PreAdjMcsClaim(gov.cms.bfd.model.rda.PreAdjMcsClaim) C4BBIdentifierType(gov.cms.bfd.server.war.commons.carin.C4BBIdentifierType) PreAdjMcsDetail(gov.cms.bfd.model.rda.PreAdjMcsDetail) ObjectUtils(org.apache.commons.lang3.ObjectUtils) ClaimType(org.hl7.fhir.r4.model.codesystems.ClaimType) Meta(org.hl7.fhir.r4.model.Meta) MetricRegistry(com.codahale.metrics.MetricRegistry) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) Period(org.hl7.fhir.r4.model.Period) Resource(org.hl7.fhir.r4.model.Resource) ProcessPriority(org.hl7.fhir.r4.model.codesystems.ProcessPriority) Collectors(java.util.stream.Collectors) BBCodingSystems(gov.cms.bfd.server.war.commons.BBCodingSystems) AbstractTransformerV2(gov.cms.bfd.server.war.r4.providers.preadj.common.AbstractTransformerV2) Organization(org.hl7.fhir.r4.model.Organization) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) C4BBOrganizationIdentifierType(gov.cms.bfd.server.war.commons.carin.C4BBOrganizationIdentifierType) PreAdjMcsDiagnosisCode(gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode) Coding(org.hl7.fhir.r4.model.Coding) Timer(com.codahale.metrics.Timer) Optional(java.util.Optional) Extension(org.hl7.fhir.r4.model.Extension) PositiveIntType(org.hl7.fhir.r4.model.PositiveIntType) Comparator(java.util.Comparator) Claim(org.hl7.fhir.r4.model.Claim) Coding(org.hl7.fhir.r4.model.Coding) Period(org.hl7.fhir.r4.model.Period) PreAdjMcsDiagnosisCode(gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode) PositiveIntType(org.hl7.fhir.r4.model.PositiveIntType) PreAdjMcsClaim(gov.cms.bfd.model.rda.PreAdjMcsClaim) Claim(org.hl7.fhir.r4.model.Claim) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 7 with PreAdjMcsDiagnosisCode

use of gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode in project beneficiary-fhir-data by CMSgov.

the class McsClaimTransformer method transformMessageArrays.

private void transformMessageArrays(McsClaim from, PreAdjMcsClaim to, DataTransformer transformer, Instant now, String namePrefix) {
    for (short index = 0; index < from.getMcsDetailsCount(); ++index) {
        final String itemNamePrefix = namePrefix + "detail" + "-" + index + "-";
        final McsDetail itemFrom = from.getMcsDetails(index);
        final PreAdjMcsDetail itemTo = transformMessageImpl(itemFrom, transformer, now, itemNamePrefix);
        itemTo.setIdrClmHdIcn(from.getIdrClmHdIcn());
        itemTo.setPriority(index);
        to.getDetails().add(itemTo);
    }
    for (short index = 0; index < from.getMcsDiagnosisCodesCount(); ++index) {
        final String itemNamePrefix = namePrefix + "diagCode" + "-" + index + "-";
        final McsDiagnosisCode itemFrom = from.getMcsDiagnosisCodes(index);
        final PreAdjMcsDiagnosisCode itemTo = transformMessageImpl(itemFrom, transformer, now, itemNamePrefix);
        itemTo.setIdrClmHdIcn(from.getIdrClmHdIcn());
        itemTo.setPriority(index);
        to.getDiagCodes().add(itemTo);
    }
    for (short index = 0; index < from.getMcsAdjustmentsCount(); ++index) {
        final String itemNamePrefix = namePrefix + "adjustment" + "-" + index + "-";
        final McsAdjustment itemFrom = from.getMcsAdjustments(index);
        final PreAdjMcsAdjustment itemTo = transformMessageImpl(itemFrom, transformer, now, itemNamePrefix);
        itemTo.setIdrClmHdIcn(from.getIdrClmHdIcn());
        itemTo.setPriority(index);
        to.getAdjustments().add(itemTo);
    }
    for (short index = 0; index < from.getMcsAuditsCount(); ++index) {
        final String itemNamePrefix = namePrefix + "audit" + "-" + index + "-";
        final McsAudit itemFrom = from.getMcsAudits(index);
        final PreAdjMcsAudit itemTo = transformMessageImpl(itemFrom, transformer, now, itemNamePrefix);
        itemTo.setIdrClmHdIcn(from.getIdrClmHdIcn());
        itemTo.setPriority(index);
        to.getAudits().add(itemTo);
    }
    for (short index = 0; index < from.getMcsLocationsCount(); ++index) {
        final String itemNamePrefix = namePrefix + "location" + "-" + index + "-";
        final McsLocation itemFrom = from.getMcsLocations(index);
        final PreAdjMcsLocation itemTo = transformMessageImpl(itemFrom, transformer, now, itemNamePrefix);
        itemTo.setIdrClmHdIcn(from.getIdrClmHdIcn());
        itemTo.setPriority(index);
        to.getLocations().add(itemTo);
    }
}
Also used : McsDiagnosisCode(gov.cms.mpsm.rda.v1.mcs.McsDiagnosisCode) PreAdjMcsDiagnosisCode(gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode) PreAdjMcsAudit(gov.cms.bfd.model.rda.PreAdjMcsAudit) McsAudit(gov.cms.mpsm.rda.v1.mcs.McsAudit) PreAdjMcsAudit(gov.cms.bfd.model.rda.PreAdjMcsAudit) PreAdjMcsAdjustment(gov.cms.bfd.model.rda.PreAdjMcsAdjustment) McsLocation(gov.cms.mpsm.rda.v1.mcs.McsLocation) PreAdjMcsLocation(gov.cms.bfd.model.rda.PreAdjMcsLocation) PreAdjMcsDetail(gov.cms.bfd.model.rda.PreAdjMcsDetail) McsDetail(gov.cms.mpsm.rda.v1.mcs.McsDetail) PreAdjMcsAdjustment(gov.cms.bfd.model.rda.PreAdjMcsAdjustment) McsAdjustment(gov.cms.mpsm.rda.v1.mcs.McsAdjustment) PreAdjMcsDiagnosisCode(gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode) PreAdjMcsLocation(gov.cms.bfd.model.rda.PreAdjMcsLocation) PreAdjMcsDetail(gov.cms.bfd.model.rda.PreAdjMcsDetail)

Example 8 with PreAdjMcsDiagnosisCode

use of gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode in project beneficiary-fhir-data by CMSgov.

the class McsClaimTransformer method transformMessageImpl.

private PreAdjMcsDiagnosisCode transformMessageImpl(McsDiagnosisCode from, DataTransformer transformer, Instant now, String namePrefix) {
    final PreAdjMcsDiagnosisCode to = new PreAdjMcsDiagnosisCode();
    transformer.copyEnumAsString(namePrefix + PreAdjMcsDiagnosisCode.Fields.idrDiagIcdType, true, 1, PreAdjMcsDiagnosisCode_idrDiagIcdType_Extractor.getEnumString(from), to::setIdrDiagIcdType);
    transformer.copyString(namePrefix + PreAdjMcsDiagnosisCode.Fields.idrDiagCode, false, 1, 7, from.getIdrDiagCode(), to::setIdrDiagCode);
    to.setLastUpdated(now);
    return to;
}
Also used : PreAdjMcsDiagnosisCode(gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode)

Aggregations

PreAdjMcsDiagnosisCode (gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode)8 PreAdjMcsDetail (gov.cms.bfd.model.rda.PreAdjMcsDetail)7 PreAdjMcsClaim (gov.cms.bfd.model.rda.PreAdjMcsClaim)6 MetricRegistry (com.codahale.metrics.MetricRegistry)2 McsDetail (gov.cms.mpsm.rda.v1.mcs.McsDetail)2 McsDiagnosisCode (gov.cms.mpsm.rda.v1.mcs.McsDiagnosisCode)2 BigDecimal (java.math.BigDecimal)2 Instant (java.time.Instant)2 LocalDate (java.time.LocalDate)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 IntStream (java.util.stream.IntStream)2 Claim (org.hl7.fhir.r4.model.Claim)2 Test (org.junit.jupiter.api.Test)2 Timer (com.codahale.metrics.Timer)1 Trace (com.newrelic.api.agent.Trace)1 Mbi (gov.cms.bfd.model.rda.Mbi)1 PreAdjFissClaim (gov.cms.bfd.model.rda.PreAdjFissClaim)1 PreAdjFissDiagnosisCode (gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode)1 PreAdjFissProcCode (gov.cms.bfd.model.rda.PreAdjFissProcCode)1