Search in sources :

Example 1 with ORGANIZATION

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project beneficiary-fhir-data by CMSgov.

the class TransformerUtilsV2 method findOrCreateContainedOrg.

/**
 * Looks for an {@link Organization} with the given resource ID in {@link
 * ExplanationOfBenefit#getContained()} or adds one if it doesn't exist
 *
 * @param eob the {@link ExplanationOfBenefit} to modify
 * @param id The resource ID
 * @return The found or new {@link Organization} resource
 */
static Resource findOrCreateContainedOrg(ExplanationOfBenefit eob, String id) {
    Optional<Resource> org = eob.getContained().stream().filter(r -> r.getId() == id).findFirst();
    // If it isn't there, add one
    if (!org.isPresent()) {
        org = Optional.of(new Organization().setId(id));
        org.get().getMeta().addProfile(ProfileConstants.C4BB_ORGANIZATION_URL);
        eob.getContained().add(org.get());
    }
    return org.get();
}
Also used : Arrays(java.util.Arrays) CcwCodebookInterface(gov.cms.bfd.model.codebook.model.CcwCodebookInterface) SimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity) Constants(ca.uhn.fhir.rest.api.Constants) Identifier(org.hl7.fhir.r4.model.Identifier) Reference(org.hl7.fhir.r4.model.Reference) StringUtils(org.apache.commons.lang3.StringUtils) BigDecimal(java.math.BigDecimal) ItemComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Map(java.util.Map) CcwCodebookMissingVariable(gov.cms.bfd.model.codebook.data.CcwCodebookMissingVariable) TemporalPrecisionEnum(ca.uhn.fhir.model.api.TemporalPrecisionEnum) Value(gov.cms.bfd.model.codebook.model.Value) Coverage(org.hl7.fhir.r4.model.Coverage) IdDt(ca.uhn.fhir.model.primitive.IdDt) ReflectionUtils(gov.cms.bfd.server.war.commons.ReflectionUtils) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) BenefitBalanceComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent) Period(org.hl7.fhir.r4.model.Period) Set(java.util.Set) StandardCharsets(java.nio.charset.StandardCharsets) ZoneId(java.time.ZoneId) UncheckedIOException(java.io.UncheckedIOException) Coding(org.hl7.fhir.r4.model.Coding) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) RaceCategory(gov.cms.bfd.server.war.commons.RaceCategory) ExplanationOfBenefitStatus(org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus) Use(org.hl7.fhir.r4.model.ExplanationOfBenefit.Use) C4BBClaimIdentifierType(gov.cms.bfd.server.war.commons.carin.C4BBClaimIdentifierType) IAnyResource(org.hl7.fhir.instance.model.api.IAnyResource) Money(org.hl7.fhir.r4.model.Money) Strings(com.google.common.base.Strings) CCWUtils(gov.cms.bfd.server.war.commons.CCWUtils) RequestDetails(ca.uhn.fhir.rest.api.server.RequestDetails) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) UnsignedIntType(org.hl7.fhir.r4.model.UnsignedIntType) CCWProcedure(gov.cms.bfd.server.war.commons.CCWProcedure) Quantity(org.hl7.fhir.r4.model.Quantity) CareTeamComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent) OffsetLinkBuilder(gov.cms.bfd.server.war.commons.OffsetLinkBuilder) LinkBuilder(gov.cms.bfd.server.war.commons.LinkBuilder) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) IOException(java.io.IOException) C4BBClaimProfessionalAndNonClinicianCareTeamRole(gov.cms.bfd.server.war.commons.carin.C4BBClaimProfessionalAndNonClinicianCareTeamRole) InputStreamReader(java.io.InputStreamReader) FDADrugDataUtilityApp(gov.cms.bfd.server.war.FDADrugDataUtilityApp) AdjudicationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) MDC(org.slf4j.MDC) Bundle(org.hl7.fhir.r4.model.Bundle) BufferedReader(java.io.BufferedReader) TotalComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent) Date(java.util.Date) LoggerFactory(org.slf4j.LoggerFactory) BenefitComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent) ProcedureComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) C4BBAdjudicationDiscriminator(gov.cms.bfd.server.war.commons.carin.C4BBAdjudicationDiscriminator) Patient(org.hl7.fhir.r4.model.Patient) DateType(org.hl7.fhir.r4.model.DateType) Collection(java.util.Collection) Resource(org.hl7.fhir.r4.model.Resource) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) Beneficiary(gov.cms.bfd.model.rif.Beneficiary) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) C4BBOrganizationIdentifierType(gov.cms.bfd.server.war.commons.carin.C4BBOrganizationIdentifierType) LocalDate(java.time.LocalDate) Optional(java.util.Optional) Extension(org.hl7.fhir.r4.model.Extension) PositiveIntType(org.hl7.fhir.r4.model.PositiveIntType) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ClaimCareteamrole(org.hl7.fhir.r4.model.codesystems.ClaimCareteamrole) DataFormatException(ca.uhn.fhir.parser.DataFormatException) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) ProfileConstants(gov.cms.bfd.server.war.commons.ProfileConstants) HashMap(java.util.HashMap) ExBenefitcategory(org.hl7.fhir.r4.model.codesystems.ExBenefitcategory) HashSet(java.util.HashSet) C4BBClaimPharmacyTeamRole(gov.cms.bfd.server.war.commons.carin.C4BBClaimPharmacyTeamRole) C4BBIdentifierType(gov.cms.bfd.server.war.commons.carin.C4BBIdentifierType) Address(org.hl7.fhir.r4.model.Address) InvalidRifValueException(gov.cms.bfd.model.rif.parse.InvalidRifValueException) NoSuchElementException(java.util.NoSuchElementException) Nonnull(javax.annotation.Nonnull) C4BBAdjudication(gov.cms.bfd.server.war.commons.carin.C4BBAdjudication) Observation(org.hl7.fhir.r4.model.Observation) ObservationStatus(org.hl7.fhir.r4.model.Observation.ObservationStatus) C4BBPractitionerIdentifierType(gov.cms.bfd.server.war.commons.carin.C4BBPractitionerIdentifierType) C4BBSupportingInfoType(gov.cms.bfd.server.war.commons.carin.C4BBSupportingInfoType) Logger(org.slf4j.Logger) C4BBClaimInstitutionalCareTeamRole(gov.cms.bfd.server.war.commons.carin.C4BBClaimInstitutionalCareTeamRole) Organization(org.hl7.fhir.r4.model.Organization) ResourceType(org.hl7.fhir.r4.model.ResourceType) CurrencyIdentifier(gov.cms.bfd.server.war.r4.providers.BeneficiaryTransformerV2.CurrencyIdentifier) URLEncoder(java.net.URLEncoder) RemittanceOutcome(org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome) InputStream(java.io.InputStream) Assert(org.springframework.util.Assert) Organization(org.hl7.fhir.r4.model.Organization) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) IAnyResource(org.hl7.fhir.instance.model.api.IAnyResource) Resource(org.hl7.fhir.r4.model.Resource)

Example 2 with ORGANIZATION

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project beneficiary-fhir-data by CMSgov.

the class FissClaimTransformerV2 method getContainedProvider.

private static Resource getContainedProvider(PreAdjFissClaim claimGroup) {
    Organization organization = new Organization();
    if (claimGroup.getMedaProv_6() != null) {
        organization.getIdentifier().add(new Identifier().setType(new CodeableConcept(new Coding(C4BBOrganizationIdentifierType.PRN.getSystem(), C4BBOrganizationIdentifierType.PRN.toCode(), C4BBOrganizationIdentifierType.PRN.getDisplay()))).setSystem(BBCodingSystems.PROVIDER_NUM).setValue(claimGroup.getMedaProv_6()));
    }
    if (claimGroup.getFedTaxNumber() != null) {
        organization.getIdentifier().add(new Identifier().setType(new CodeableConcept(new Coding(C4BBOrganizationIdentifierType.TAX.getSystem(), C4BBOrganizationIdentifierType.TAX.toCode(), C4BBOrganizationIdentifierType.TAX.getDisplay()))).setSystem(BBCodingSystems.FISS.TAX_NUM).setValue(claimGroup.getFedTaxNumber()));
    }
    if (claimGroup.getNpiNumber() != null) {
        organization.getIdentifier().add(new Identifier().setType(new CodeableConcept(new Coding(C4BBIdentifierType.NPI.getSystem(), C4BBIdentifierType.NPI.toCode(), C4BBIdentifierType.NPI.getDisplay()))).setSystem(TransformerConstants.CODING_NPI_US).setValue(claimGroup.getNpiNumber()));
    }
    organization.setId("provider-org");
    return organization;
}
Also used : Organization(org.hl7.fhir.r4.model.Organization) Identifier(org.hl7.fhir.r4.model.Identifier) Coding(org.hl7.fhir.r4.model.Coding) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 3 with ORGANIZATION

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project beneficiary-fhir-data by CMSgov.

the class McsClaimTransformerV2 method getContainedProvider.

private static Resource getContainedProvider(PreAdjMcsClaim claimGroup) {
    Organization organization = new Organization();
    if (claimGroup.getIdrBillProvType() != null) {
        organization.getExtension().add(new Extension(BBCodingSystems.MCS.BILL_PROV_TYPE).setValue(new Coding(BBCodingSystems.MCS.BILL_PROV_TYPE, claimGroup.getIdrBillProvType(), null)));
    }
    if (claimGroup.getIdrBillProvSpec() != null) {
        organization.getExtension().add(new Extension(BBCodingSystems.MCS.BILL_PROV_SPEC).setValue(new Coding(BBCodingSystems.MCS.BILL_PROV_SPEC, claimGroup.getIdrBillProvSpec(), null)));
    }
    if (claimGroup.getIdrBillProvEin() != null) {
        organization.getIdentifier().add(new Identifier().setType(new CodeableConcept(new Coding(C4BBOrganizationIdentifierType.TAX.getSystem(), C4BBOrganizationIdentifierType.TAX.toCode(), C4BBOrganizationIdentifierType.TAX.getDisplay()))).setSystem(BBCodingSystems.MCS.BILL_PROV_EIN).setValue(claimGroup.getIdrBillProvEin()));
    }
    if (claimGroup.getIdrBillProvNum() != null) {
        organization.getIdentifier().add(new Identifier().setType(new CodeableConcept(new Coding(C4BBIdentifierType.NPI.getSystem(), C4BBIdentifierType.NPI.toCode(), C4BBIdentifierType.NPI.getDisplay()))).setSystem(TransformerConstants.CODING_NPI_US).setValue(claimGroup.getIdrBillProvNpi()));
    }
    organization.setId("provider-org");
    return organization;
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) Organization(org.hl7.fhir.r4.model.Organization) Identifier(org.hl7.fhir.r4.model.Identifier) Coding(org.hl7.fhir.r4.model.Coding) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 4 with ORGANIZATION

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project beneficiary-fhir-data by CMSgov.

the class OutpatientClaimTransformerV2Test method shouldHaveClmMcoPdSwSupInfo.

@Test
public void shouldHaveClmMcoPdSwSupInfo() {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("https://bluebutton.cms.gov/resources/variables/clm_mco_pd_sw", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/claiminformationcategory", "info", "Information"), new Coding("https://bluebutton.cms.gov/resources/codesystem/information", "https://bluebutton.cms.gov/resources/variables/clm_mco_pd_sw", "Claim MCO Paid Switch")), // Code
    new Coding("https://bluebutton.cms.gov/resources/variables/clm_mco_pd_sw", "0", "No managed care organization (MCO) payment"));
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) Test(org.junit.jupiter.api.Test)

Example 5 with ORGANIZATION

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project beneficiary-fhir-data by CMSgov.

the class InpatientClaimTransformerV2Test method shouldHaveClmMcoPdSwSupInfo.

@Test
public void shouldHaveClmMcoPdSwSupInfo() {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("https://bluebutton.cms.gov/resources/variables/clm_mco_pd_sw", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/claiminformationcategory", "info", "Information"), new Coding("https://bluebutton.cms.gov/resources/codesystem/information", "https://bluebutton.cms.gov/resources/variables/clm_mco_pd_sw", "Claim MCO Paid Switch")), // Code
    new Coding("https://bluebutton.cms.gov/resources/variables/clm_mco_pd_sw", "0", "No managed care organization (MCO) payment"));
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)101 Organization (org.hl7.fhir.dstu3.model.Organization)90 Organization (org.hl7.fhir.r4.model.Organization)69 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)41 Resource (org.hl7.fhir.r4.model.Resource)38 ArrayList (java.util.ArrayList)34 List (java.util.List)33 Reference (org.hl7.fhir.r4.model.Reference)33 Identifier (org.hl7.fhir.r4.model.Identifier)30 Bundle (org.hl7.fhir.dstu3.model.Bundle)27 UUID (java.util.UUID)26 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)25 Patient (org.hl7.fhir.r4.model.Patient)25 IdType (org.hl7.fhir.dstu3.model.IdType)24 Bundle (org.hl7.fhir.r4.model.Bundle)24 Coding (org.hl7.fhir.r4.model.Coding)24 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)19 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)17 Reference (org.hl7.fhir.dstu3.model.Reference)16 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)16