Search in sources :

Example 1 with SupplyDeliverySuppliedItemComponent

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

the class FhirR4 method supplyDelivery.

/**
 * Map the JsonObject for a Supply into a FHIR SupplyDelivery and add it to the Bundle.
 *
 * @param rand           Source of randomness to use when generating ids etc
 * @param personEntry    The Person entry.
 * @param bundle         Bundle to add to.
 * @param supply         The supplied object to add.
 * @param encounter      The encounter during which the supplies were delivered
 * @return The added Entry.
 */
private static BundleEntryComponent supplyDelivery(RandomNumberGenerator rand, BundleEntryComponent personEntry, Bundle bundle, HealthRecord.Supply supply, Encounter encounter) {
    SupplyDelivery supplyResource = new SupplyDelivery();
    supplyResource.setStatus(SupplyDeliveryStatus.COMPLETED);
    supplyResource.setPatient(new Reference(personEntry.getFullUrl()));
    CodeableConcept type = new CodeableConcept();
    type.addCoding().setCode("device").setDisplay("Device").setSystem("http://terminology.hl7.org/CodeSystem/supply-item-type");
    supplyResource.setType(type);
    SupplyDeliverySuppliedItemComponent suppliedItem = new SupplyDeliverySuppliedItemComponent();
    suppliedItem.setItem(mapCodeToCodeableConcept(supply.codes.get(0), SNOMED_URI));
    suppliedItem.setQuantity(new Quantity(supply.quantity));
    supplyResource.setSuppliedItem(suppliedItem);
    supplyResource.setOccurrence(convertFhirDateTime(supply.start, true));
    return newEntry(rand, bundle, supplyResource);
}
Also used : Reference(org.hl7.fhir.r4.model.Reference) DocumentReference(org.hl7.fhir.r4.model.DocumentReference) SupplyDelivery(org.hl7.fhir.r4.model.SupplyDelivery) SimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity) Quantity(org.hl7.fhir.r4.model.Quantity) SupplyDeliverySuppliedItemComponent(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 2 with SupplyDeliverySuppliedItemComponent

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

the class FhirStu3 method supplyDelivery.

/**
 * Map the JsonObject for a Supply into a FHIR SupplyDelivery and add it to the Bundle.
 *
 * @param rand           Source of randomness to use when generating ids etc
 * @param personEntry    The Person entry.
 * @param bundle         Bundle to add to.
 * @param supply         The supplied object to add.
 * @param encounter      The encounter during which the supplies were delivered
 * @return The added Entry.
 */
private static BundleEntryComponent supplyDelivery(RandomNumberGenerator rand, BundleEntryComponent personEntry, Bundle bundle, HealthRecord.Supply supply, Encounter encounter) {
    SupplyDelivery supplyResource = new SupplyDelivery();
    supplyResource.setStatus(SupplyDeliveryStatus.COMPLETED);
    supplyResource.setPatient(new Reference(personEntry.getFullUrl()));
    CodeableConcept type = new CodeableConcept();
    type.addCoding().setCode("device").setDisplay("Device").setSystem("http://hl7.org/fhir/supply-item-type");
    supplyResource.setType(type);
    SupplyDeliverySuppliedItemComponent suppliedItem = new SupplyDeliverySuppliedItemComponent();
    suppliedItem.setItem(mapCodeToCodeableConcept(supply.codes.get(0), SNOMED_URI));
    SimpleQuantity quantity = new SimpleQuantity();
    quantity.setValue(supply.quantity);
    suppliedItem.setQuantity(quantity);
    supplyResource.setSuppliedItem(suppliedItem);
    supplyResource.setOccurrence(convertFhirDateTime(supply.start, true));
    return newEntry(rand, bundle, supplyResource);
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) SupplyDelivery(org.hl7.fhir.dstu3.model.SupplyDelivery) SimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity) SupplyDeliverySuppliedItemComponent(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Aggregations

CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 Reference (org.hl7.fhir.dstu3.model.Reference)1 SimpleQuantity (org.hl7.fhir.dstu3.model.SimpleQuantity)1 SupplyDelivery (org.hl7.fhir.dstu3.model.SupplyDelivery)1 SupplyDeliverySuppliedItemComponent (org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent)1 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)1 DocumentReference (org.hl7.fhir.r4.model.DocumentReference)1 Quantity (org.hl7.fhir.r4.model.Quantity)1 Reference (org.hl7.fhir.r4.model.Reference)1 SimpleQuantity (org.hl7.fhir.r4.model.SimpleQuantity)1 SupplyDelivery (org.hl7.fhir.r4.model.SupplyDelivery)1 SupplyDeliverySuppliedItemComponent (org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent)1