Search in sources :

Example 1 with PositiveIntType

use of org.hl7.fhir.dstu3.model.PositiveIntType in project synthea by synthetichealth.

the class FhirStu3 method encounterClaim.

/**
 * Create an entry for the given Claim, associated to an Encounter.
 *
 * @param rand Source of randomness to use when generating ids etc
 * @param personEntry Entry for the person
 * @param bundle The Bundle to add to
 * @param encounterEntry The current Encounter
 * @param claim the Claim object
 * @return the added Entry
 */
private static BundleEntryComponent encounterClaim(RandomNumberGenerator rand, BundleEntryComponent personEntry, Bundle bundle, BundleEntryComponent encounterEntry, Claim claim) {
    org.hl7.fhir.dstu3.model.Claim claimResource = new org.hl7.fhir.dstu3.model.Claim();
    org.hl7.fhir.dstu3.model.Encounter encounterResource = (org.hl7.fhir.dstu3.model.Encounter) encounterEntry.getResource();
    claimResource.setStatus(ClaimStatus.ACTIVE);
    claimResource.setUse(org.hl7.fhir.dstu3.model.Claim.Use.COMPLETE);
    // duration of encounter
    claimResource.setBillablePeriod(encounterResource.getPeriod());
    claimResource.setPatient(new Reference(personEntry.getFullUrl()));
    claimResource.setOrganization(encounterResource.getServiceProvider());
    // add item for encounter
    claimResource.addItem(new ItemComponent(new PositiveIntType(1)).addEncounter(new Reference(encounterEntry.getFullUrl())));
    int itemSequence = 2;
    int conditionSequence = 1;
    int procedureSequence = 1;
    int informationSequence = 1;
    for (Claim.ClaimEntry claimEntry : claim.items) {
        HealthRecord.Entry item = claimEntry.entry;
        if (Costs.hasCost(item)) {
            // update claimItems list
            ItemComponent claimItem = new ItemComponent(new PositiveIntType(itemSequence));
            Code primaryCode = item.codes.get(0);
            String system = ExportHelper.getSystemURI(primaryCode.system);
            CodeableConcept serviceProvided = new CodeableConcept().addCoding(new Coding().setCode(primaryCode.code).setVersion("v1").setSystem(system));
            claimItem.setService(serviceProvided);
            // calculate the cost of the procedure
            Money moneyResource = new Money();
            moneyResource.setCode("USD");
            moneyResource.setSystem("urn:iso:std:iso:4217");
            moneyResource.setValue(item.getCost());
            claimItem.setNet(moneyResource);
            if (item instanceof HealthRecord.Procedure) {
                Type procedureReference = new Reference(item.fullUrl);
                ProcedureComponent claimProcedure = new ProcedureComponent(new PositiveIntType(procedureSequence), procedureReference);
                claimResource.addProcedure(claimProcedure);
                claimItem.addProcedureLinkId(procedureSequence);
                procedureSequence++;
            } else {
                Reference informationReference = new Reference(item.fullUrl);
                SpecialConditionComponent informationComponent = new SpecialConditionComponent();
                informationComponent.setSequence(informationSequence);
                informationComponent.setValue(informationReference);
                CodeableConcept category = new CodeableConcept();
                category.getCodingFirstRep().setSystem("http://hl7.org/fhir/claiminformationcategory").setCode("info");
                informationComponent.setCategory(category);
                claimResource.addInformation(informationComponent);
                claimItem.addInformationLinkId(informationSequence);
                claimItem.setService(claimResource.getType());
                informationSequence++;
            }
            claimResource.addItem(claimItem);
        } else {
            // assume it's a Condition, we don't have a Condition class specifically
            // add diagnosisComponent to claim
            Reference diagnosisReference = new Reference(item.fullUrl);
            org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent diagnosisComponent = new org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent(new PositiveIntType(conditionSequence), diagnosisReference);
            claimResource.addDiagnosis(diagnosisComponent);
            // update claimItems with diagnosis
            ItemComponent diagnosisItem = new ItemComponent(new PositiveIntType(itemSequence));
            diagnosisItem.addDiagnosisLinkId(conditionSequence);
            claimResource.addItem(diagnosisItem);
            conditionSequence++;
        }
        itemSequence++;
    }
    Money moneyResource = new Money();
    moneyResource.setCode("USD");
    moneyResource.setSystem("urn:iso:std:iso:4217");
    moneyResource.setValue(claim.getTotalClaimCost());
    claimResource.setTotal(moneyResource);
    return newEntry(rand, bundle, claimResource);
}
Also used : ProcedureComponent(org.hl7.fhir.dstu3.model.Claim.ProcedureComponent) PositiveIntType(org.hl7.fhir.dstu3.model.PositiveIntType) Money(org.hl7.fhir.dstu3.model.Money) Coding(org.hl7.fhir.dstu3.model.Coding) ItemComponent(org.hl7.fhir.dstu3.model.Claim.ItemComponent) SupplyDeliverySuppliedItemComponent(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Procedure(org.mitre.synthea.world.concepts.HealthRecord.Procedure) Reference(org.hl7.fhir.dstu3.model.Reference) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) ContactPoint(org.hl7.fhir.dstu3.model.ContactPoint) SpecialConditionComponent(org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent) HealthRecord(org.mitre.synthea.world.concepts.HealthRecord) Type(org.hl7.fhir.dstu3.model.Type) DigitalMediaType(org.hl7.fhir.dstu3.model.Media.DigitalMediaType) EncounterType(org.mitre.synthea.world.concepts.HealthRecord.EncounterType) CodeType(org.hl7.fhir.dstu3.model.CodeType) IntegerType(org.hl7.fhir.dstu3.model.IntegerType) PositiveIntType(org.hl7.fhir.dstu3.model.PositiveIntType) NodeType(org.hl7.fhir.utilities.xhtml.NodeType) StringType(org.hl7.fhir.dstu3.model.StringType) BooleanType(org.hl7.fhir.dstu3.model.BooleanType) DateType(org.hl7.fhir.dstu3.model.DateType) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) BundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType) DecimalType(org.hl7.fhir.dstu3.model.DecimalType) AllergyIntoleranceType(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType) Claim(org.mitre.synthea.world.concepts.Claim) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 2 with PositiveIntType

use of org.hl7.fhir.dstu3.model.PositiveIntType in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composePositiveInt.

protected void composePositiveInt(Complex parent, String parentType, String name, PositiveIntType value, int index) {
    if (value == null)
        return;
    Complex t = parent.predicate("fhir:" + parentType + "." + name);
    t.predicate("fhir:value", ttlLiteral(value.asStringValue()));
    composeElement(t, parentType, name, value, index);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 3 with PositiveIntType

use of org.hl7.fhir.dstu3.model.PositiveIntType in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composePositiveInt.

protected void composePositiveInt(Complex parent, String parentType, String name, PositiveIntType value, int index) {
    if (value == null)
        return;
    Complex t = parent.predicate("fhir:" + parentType + "." + name);
    t.predicate("fhir:value", ttlLiteral(value.asStringValue()));
    composeElement(t, parentType, name, value, index);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 4 with PositiveIntType

use of org.hl7.fhir.dstu3.model.PositiveIntType in project org.hl7.fhir.core by hapifhir.

the class JsonParser method composeType.

protected void composeType(String prefix, Type type) throws IOException {
    if (type == null)
        ;
    else if (type instanceof Age)
        composeAge(prefix + "Age", (Age) type);
    else if (type instanceof Count)
        composeCount(prefix + "Count", (Count) type);
    else if (type instanceof Money)
        composeMoney(prefix + "Money", (Money) type);
    else if (type instanceof Distance)
        composeDistance(prefix + "Distance", (Distance) type);
    else if (type instanceof Duration)
        composeDuration(prefix + "Duration", (Duration) type);
    else if (type instanceof SimpleQuantity)
        composeSimpleQuantity(prefix + "SimpleQuantity", (SimpleQuantity) type);
    else if (type instanceof Period)
        composePeriod(prefix + "Period", (Period) type);
    else if (type instanceof Coding)
        composeCoding(prefix + "Coding", (Coding) type);
    else if (type instanceof Range)
        composeRange(prefix + "Range", (Range) type);
    else if (type instanceof Quantity)
        composeQuantity(prefix + "Quantity", (Quantity) type);
    else if (type instanceof Attachment)
        composeAttachment(prefix + "Attachment", (Attachment) type);
    else if (type instanceof Ratio)
        composeRatio(prefix + "Ratio", (Ratio) type);
    else if (type instanceof Annotation)
        composeAnnotation(prefix + "Annotation", (Annotation) type);
    else if (type instanceof SampledData)
        composeSampledData(prefix + "SampledData", (SampledData) type);
    else if (type instanceof Reference)
        composeReference(prefix + "Reference", (Reference) type);
    else if (type instanceof CodeableConcept)
        composeCodeableConcept(prefix + "CodeableConcept", (CodeableConcept) type);
    else if (type instanceof Identifier)
        composeIdentifier(prefix + "Identifier", (Identifier) type);
    else if (type instanceof Signature)
        composeSignature(prefix + "Signature", (Signature) type);
    else if (type instanceof TriggerDefinition)
        composeTriggerDefinition(prefix + "TriggerDefinition", (TriggerDefinition) type);
    else if (type instanceof ElementDefinition)
        composeElementDefinition(prefix + "ElementDefinition", (ElementDefinition) type);
    else if (type instanceof Timing)
        composeTiming(prefix + "Timing", (Timing) type);
    else if (type instanceof ModuleMetadata)
        composeModuleMetadata(prefix + "ModuleMetadata", (ModuleMetadata) type);
    else if (type instanceof ActionDefinition)
        composeActionDefinition(prefix + "ActionDefinition", (ActionDefinition) type);
    else if (type instanceof Address)
        composeAddress(prefix + "Address", (Address) type);
    else if (type instanceof HumanName)
        composeHumanName(prefix + "HumanName", (HumanName) type);
    else if (type instanceof DataRequirement)
        composeDataRequirement(prefix + "DataRequirement", (DataRequirement) type);
    else if (type instanceof Meta)
        composeMeta(prefix + "Meta", (Meta) type);
    else if (type instanceof ParameterDefinition)
        composeParameterDefinition(prefix + "ParameterDefinition", (ParameterDefinition) type);
    else if (type instanceof ContactPoint)
        composeContactPoint(prefix + "ContactPoint", (ContactPoint) type);
    else if (type instanceof MarkdownType) {
        composeMarkdownCore(prefix + "Markdown", (MarkdownType) type, false);
        composeMarkdownExtras(prefix + "Markdown", (MarkdownType) type, false);
    } else if (type instanceof UnsignedIntType) {
        composeUnsignedIntCore(prefix + "UnsignedInt", (UnsignedIntType) type, false);
        composeUnsignedIntExtras(prefix + "UnsignedInt", (UnsignedIntType) type, false);
    } else if (type instanceof CodeType) {
        composeCodeCore(prefix + "Code", (CodeType) type, false);
        composeCodeExtras(prefix + "Code", (CodeType) type, false);
    } else if (type instanceof IdType) {
        composeIdCore(prefix + "Id", (IdType) type, false);
        composeIdExtras(prefix + "Id", (IdType) type, false);
    } else if (type instanceof OidType) {
        composeOidCore(prefix + "Oid", (OidType) type, false);
        composeOidExtras(prefix + "Oid", (OidType) type, false);
    } else if (type instanceof PositiveIntType) {
        composePositiveIntCore(prefix + "PositiveInt", (PositiveIntType) type, false);
        composePositiveIntExtras(prefix + "PositiveInt", (PositiveIntType) type, false);
    } else if (type instanceof UuidType) {
        composeUuidCore(prefix + "Uuid", (UuidType) type, false);
        composeUuidExtras(prefix + "Uuid", (UuidType) type, false);
    } else if (type instanceof IntegerType) {
        composeIntegerCore(prefix + "Integer", (IntegerType) type, false);
        composeIntegerExtras(prefix + "Integer", (IntegerType) type, false);
    } else if (type instanceof DateTimeType) {
        composeDateTimeCore(prefix + "DateTime", (DateTimeType) type, false);
        composeDateTimeExtras(prefix + "DateTime", (DateTimeType) type, false);
    } else if (type instanceof DateType) {
        composeDateCore(prefix + "Date", (DateType) type, false);
        composeDateExtras(prefix + "Date", (DateType) type, false);
    } else if (type instanceof DecimalType) {
        composeDecimalCore(prefix + "Decimal", (DecimalType) type, false);
        composeDecimalExtras(prefix + "Decimal", (DecimalType) type, false);
    } else if (type instanceof UriType) {
        composeUriCore(prefix + "Uri", (UriType) type, false);
        composeUriExtras(prefix + "Uri", (UriType) type, false);
    } else if (type instanceof Base64BinaryType) {
        composeBase64BinaryCore(prefix + "Base64Binary", (Base64BinaryType) type, false);
        composeBase64BinaryExtras(prefix + "Base64Binary", (Base64BinaryType) type, false);
    } else if (type instanceof TimeType) {
        composeTimeCore(prefix + "Time", (TimeType) type, false);
        composeTimeExtras(prefix + "Time", (TimeType) type, false);
    } else if (type instanceof StringType) {
        composeStringCore(prefix + "String", (StringType) type, false);
        composeStringExtras(prefix + "String", (StringType) type, false);
    } else if (type instanceof BooleanType) {
        composeBooleanCore(prefix + "Boolean", (BooleanType) type, false);
        composeBooleanExtras(prefix + "Boolean", (BooleanType) type, false);
    } else if (type instanceof InstantType) {
        composeInstantCore(prefix + "Instant", (InstantType) type, false);
        composeInstantExtras(prefix + "Instant", (InstantType) type, false);
    } else
        throw new Error("Unhandled type");
}
Also used : FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError)

Example 5 with PositiveIntType

use of org.hl7.fhir.dstu3.model.PositiveIntType in project org.hl7.fhir.core by hapifhir.

the class UnsignedInt10_40 method convertUnsignedIntToPositive.

public static UnsignedIntType convertUnsignedIntToPositive(PositiveIntType src) {
    UnsignedIntType tgt = src.hasValue() ? new UnsignedIntType(src.getValueAsString()) : new UnsignedIntType();
    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
    return tgt;
}
Also used : UnsignedIntType(org.hl7.fhir.r4.model.UnsignedIntType)

Aggregations

Test (org.junit.jupiter.api.Test)6 PositiveIntType (org.hl7.fhir.r4.model.PositiveIntType)5 Reference (org.hl7.fhir.r4.model.Reference)5 PositiveIntType (org.hl7.fhir.r4b.model.PositiveIntType)5 DisplayName (org.junit.jupiter.api.DisplayName)5 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)4 Money (org.hl7.fhir.r4.model.Money)4 Claim (org.mitre.synthea.world.concepts.Claim)4 Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)4 PositiveIntType (org.hl7.fhir.dstu3.model.PositiveIntType)3 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)3 TransformerConstants (gov.cms.bfd.server.war.commons.TransformerConstants)2 C4BBIdentifierType (gov.cms.bfd.server.war.commons.carin.C4BBIdentifierType)2 C4BBOrganizationIdentifierType (gov.cms.bfd.server.war.commons.carin.C4BBOrganizationIdentifierType)2 BadCodeMonkeyException (gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException)2 BigDecimal (java.math.BigDecimal)2 Date (java.util.Date)2 List (java.util.List)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2