Search in sources :

Example 1 with MedicationAdministration

use of ca.uhn.fhir.model.dstu2.resource.MedicationAdministration in project synthea by synthetichealth.

the class FhirDstu2 method medicationAdministration.

/**
 * Add a MedicationAdministration if needed for the given medication.
 *
 * @param rand              Source of randomness to use when generating ids etc
 * @param personEntry       The Entry for the Person
 * @param bundle            Bundle to add the MedicationAdministration to
 * @param encounterEntry    Current Encounter entry
 * @param medication        The Medication
 * @return The added Entry
 */
private static Entry medicationAdministration(RandomNumberGenerator rand, Entry personEntry, Bundle bundle, Entry encounterEntry, Medication medication) {
    MedicationAdministration medicationResource = new MedicationAdministration();
    medicationResource.setPatient(new ResourceReferenceDt(personEntry.getFullUrl()));
    medicationResource.setEncounter(new ResourceReferenceDt(encounterEntry.getFullUrl()));
    Code code = medication.codes.get(0);
    String system = code.system.equals("SNOMED-CT") ? SNOMED_URI : RXNORM_URI;
    medicationResource.setMedication(mapCodeToCodeableConcept(code, system));
    medicationResource.setEffectiveTime(new DateTimeDt(new Date(medication.start)));
    medicationResource.setStatus(MedicationAdministrationStatusEnum.COMPLETED);
    if (medication.prescriptionDetails != null) {
        JsonObject rxInfo = medication.prescriptionDetails;
        MedicationAdministration.Dosage dosage = new MedicationAdministration.Dosage();
        // as_needed is true if present
        if ((rxInfo.has("dosage")) && (!rxInfo.has("as_needed"))) {
            SimpleQuantityDt dose = new SimpleQuantityDt();
            dose.setValue(rxInfo.get("dosage").getAsJsonObject().get("amount").getAsDouble());
            dosage.setQuantity(dose);
            if (rxInfo.has("instructions")) {
                for (JsonElement instructionElement : rxInfo.get("instructions").getAsJsonArray()) {
                    JsonObject instruction = instructionElement.getAsJsonObject();
                    dosage.setText(instruction.get("display").getAsString());
                }
            }
        }
        medicationResource.setDosage(dosage);
    }
    if (!medication.reasons.isEmpty()) {
        // Only one element in list
        Code reason = medication.reasons.get(0);
        for (Entry entry : bundle.getEntry()) {
            if (entry.getResource().getResourceName().equals("Condition")) {
                Condition condition = (Condition) entry.getResource();
                // Only one element in list
                CodeableConceptDt coding = condition.getCode();
                if (reason.code.equals(coding.getCodingFirstRep().getCode())) {
                    medicationResource.addReasonGiven(coding);
                }
            }
        }
    }
    Entry medicationAdminEntry = newEntry(rand, bundle, medicationResource);
    return medicationAdminEntry;
}
Also used : Condition(ca.uhn.fhir.model.dstu2.resource.Condition) ResourceReferenceDt(ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt) CodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt) SimpleQuantityDt(ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt) JsonObject(com.google.gson.JsonObject) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Date(java.util.Date) Entry(ca.uhn.fhir.model.dstu2.resource.Bundle.Entry) DateTimeDt(ca.uhn.fhir.model.primitive.DateTimeDt) JsonElement(com.google.gson.JsonElement) MedicationAdministration(ca.uhn.fhir.model.dstu2.resource.MedicationAdministration)

Example 2 with MedicationAdministration

use of ca.uhn.fhir.model.dstu2.resource.MedicationAdministration in project eCRNow by drajer-health.

the class LoadingQueryDstu2Bundle method createDSTU2Bundle.

public Bundle createDSTU2Bundle(LaunchDetails launchDetails, Dstu2FhirData dstu2FhirData, Date start, Date end) {
    Bundle bundle = new Bundle();
    logger.info("Initializing FHIR Context for Version:::: {}", launchDetails.getFhirVersion());
    FhirContext context = fhirContextInitializer.getFhirContext(launchDetails.getFhirVersion());
    logger.info("Initializing Client");
    IGenericClient client = fhirContextInitializer.createClient(context, launchDetails);
    // GET Patient Details and Add to Bundle
    try {
        logger.info("Get Patient Data");
        Patient patient = (Patient) fhirContextInitializer.getResouceById(launchDetails, client, context, "Patient", launchDetails.getLaunchPatientId());
        Entry patientEntry = new Entry();
        patientEntry.setResource(patient);
        bundle.addEntry(patientEntry);
    } catch (Exception e) {
        logger.error("Error in getting Patient Data", e);
    }
    // Step 1: Get Encounters for Patient based on encId. (Create a method to get
    // encounters)
    // If encId is null, find encounters for patient within the start and end time
    // provided.
    // Add to the bundle.
    // As you are adding to the bundle within Fhir Data, add the codeable concept
    // also to the list of encounterCodes.
    Encounter encounter = null;
    try {
        logger.info("Get Encounter Data");
        encounter = dstu2ResourcesData.getEncounterData(context, client, launchDetails, dstu2FhirData, start, end);
        if (encounter.getParticipant() != null) {
            List<Participant> participants = encounter.getParticipant();
            for (Participant participant : participants) {
                if (participant.getIndividual() != null) {
                    ResourceReferenceDt practitionerReference = participant.getIndividual();
                    Practitioner practitioner = (Practitioner) fhirContextInitializer.getResouceById(launchDetails, client, context, "Practitioner", practitionerReference.getReference().getIdPart());
                    Entry practitionerEntry = new Entry().setResource(practitioner);
                    bundle.addEntry(practitionerEntry);
                }
            }
        }
        if (encounter.getServiceProvider() != null) {
            ResourceReferenceDt organizationReference = encounter.getServiceProvider();
            Organization organization = (Organization) fhirContextInitializer.getResouceById(launchDetails, client, context, "Organization", organizationReference.getReference().getIdPart());
            Entry organizationEntry = new Entry().setResource(organization);
            bundle.addEntry(organizationEntry);
        }
        if (encounter.getLocation() != null) {
            List<Location> enocunterLocations = encounter.getLocation();
            for (Location location : enocunterLocations) {
                if (location.getLocation() != null) {
                    ResourceReferenceDt locationReference = location.getLocation();
                    ca.uhn.fhir.model.dstu2.resource.Location locationResource = (ca.uhn.fhir.model.dstu2.resource.Location) fhirContextInitializer.getResouceById(launchDetails, client, context, "Location", locationReference.getReference().getIdPart());
                    Entry locationEntry = new Entry().setResource(locationResource);
                    bundle.addEntry(locationEntry);
                }
            }
        }
        Entry encounterEntry = new Entry().setResource(encounter);
        bundle.addEntry(encounterEntry);
    } catch (Exception e) {
        logger.error("Error in getting Encounter Data", e);
    }
    // also to the list of ConditionCodes.
    try {
        logger.info("Get Condition Data");
        List<Condition> conditionsList = dstu2ResourcesData.getConditionData(context, client, launchDetails, dstu2FhirData, encounter, start, end);
        logger.info("Filtered ConditionsList----> {}", conditionsList.size());
        dstu2FhirData.setConditions(conditionsList);
        for (Condition condition : conditionsList) {
            Entry conditionsEntry = new Entry().setResource(condition);
            bundle.addEntry(conditionsEntry);
        }
    } catch (Exception e) {
        logger.error("Error in getting Condition Data", e);
    }
    // also to the list of labResultCodes.
    try {
        logger.info("Get Observation Data");
        List<Observation> observationList = dstu2ResourcesData.getObservationData(context, client, launchDetails, dstu2FhirData, encounter, start, end);
        logger.info("Filtered Observations----> {}", observationList.size());
        dstu2FhirData.setLabResults(observationList);
        for (Observation observation : observationList) {
            Entry observationsEntry = new Entry().setResource(observation);
            bundle.addEntry(observationsEntry);
        }
    } catch (Exception e) {
        logger.error("Error in getting Observation Data", e);
    }
    // Get Pregnancy Observations
    try {
        logger.info("Get Pregnancy Observation Data");
        List<Observation> observationList = dstu2ResourcesData.getPregnancyObservationData(context, client, launchDetails, dstu2FhirData, encounter, start, end);
        logger.info("Filtered Observations----> {}", observationList.size());
        dstu2FhirData.setPregnancyObs(observationList);
        for (Observation observation : observationList) {
            Entry observationsEntry = new Entry().setResource(observation);
            bundle.addEntry(observationsEntry);
        }
    } catch (Exception e) {
        logger.error("Error in getting Pregnancy Observation Data", e);
    }
    // Get Travel Observations
    try {
        logger.info("Get Travel Observation Data");
        List<Observation> observationList = dstu2ResourcesData.getTravelObservationData(context, client, launchDetails, dstu2FhirData, encounter, start, end);
        logger.info("Filtered Observations----> {}", observationList.size());
        dstu2FhirData.setTravelObs(observationList);
        for (Observation observation : observationList) {
            Entry observationsEntry = new Entry().setResource(observation);
            bundle.addEntry(observationsEntry);
        }
    } catch (Exception e) {
        logger.error("Error in getting Travel Observation Data", e);
    }
    // also to the list of medicationCodes.
    try {
        logger.info("Get MedicationAdministration Data");
        List<MedicationAdministration> medAdministrationsList = dstu2ResourcesData.getMedicationAdministrationData(context, client, launchDetails, dstu2FhirData, encounter, start, end);
        logger.info("Filtered MedicationAdministration-----------> {}", medAdministrationsList.size());
        dstu2FhirData.setMedicationAdministrations(medAdministrationsList);
        for (MedicationAdministration medAdministration : medAdministrationsList) {
            if (medAdministration.getMedication() != null && !medAdministration.getMedication().isEmpty() && medAdministration.getMedication() instanceof ResourceReferenceDt) {
                BaseResourceReferenceDt medRef = (BaseResourceReferenceDt) medAdministration.getMedication();
                String medReference = medRef.getReference().getValue();
                if (medReference.startsWith("#")) {
                    BaseContainedDt medAdministrationContained = medAdministration.getContained();
                    List<Medication> containedResources = (List<Medication>) medAdministrationContained.getContainedResources();
                    if (containedResources.stream().anyMatch(resource -> resource.getIdElement().getValue().equals(medReference))) {
                        logger.info("Medication Resource exists in MedicationAdministration.contained. So no need to add again in Bundle.");
                    }
                } else {
                    logger.info("Medication Reference Found=============>");
                    Medication medication = dstu2ResourcesData.getMedicationData(context, client, launchDetails, dstu2FhirData, medReference);
                    Entry medicationEntry = new Entry().setResource(medication);
                    bundle.addEntry(medicationEntry);
                    if (medication != null) {
                        List<Medication> medicationList = new ArrayList<>();
                        medicationList.add(medication);
                        dstu2FhirData.setMedicationList(medicationList);
                    }
                }
            }
            Entry medAdministrationEntry = new Entry().setResource(medAdministration);
            bundle.addEntry(medAdministrationEntry);
        }
    } catch (Exception e) {
        logger.error("Error in getting the MedicationAdministration Data", e);
    }
    try {
        logger.info("Get MedicationStatement Data");
        List<MedicationStatement> medStatementsList = dstu2ResourcesData.getMedicationStatementData(context, client, launchDetails, dstu2FhirData, encounter, start, end);
        logger.info("Filtered MedicationStatement-----------> {}", medStatementsList.size());
        for (MedicationStatement medStatement : medStatementsList) {
            Entry medStatementEntry = new Entry().setResource(medStatement);
            bundle.addEntry(medStatementEntry);
        }
        dstu2FhirData.setMedications(medStatementsList);
    } catch (Exception e) {
        logger.error("Error in getting the MedicationStatement Data", e);
    }
    try {
        logger.info("Get DiagnosticOrder Data");
        List<DiagnosticOrder> diagnosticOrdersList = dstu2ResourcesData.getDiagnosticOrderData(context, client, launchDetails, dstu2FhirData, encounter, start, end);
        logger.info("Filtered DiagnosticOrders-----------> {}", diagnosticOrdersList.size());
        dstu2FhirData.setDiagOrders(diagnosticOrdersList);
        for (DiagnosticOrder diagnosticOrder : diagnosticOrdersList) {
            Entry diagnosticOrderEntry = new Entry().setResource(diagnosticOrder);
            bundle.addEntry(diagnosticOrderEntry);
        }
    } catch (Exception e) {
        logger.error("Error in getting the DiagnosticOrder Data", e);
    }
    // Add to the bundle
    try {
        List<Immunization> immunizationsList = dstu2ResourcesData.getImmunizationData(context, client, launchDetails, dstu2FhirData, encounter, start, end);
        logger.info("Filtered Immunizations-----------> {}", immunizationsList.size());
        dstu2FhirData.setImmunizations(immunizationsList);
        for (Immunization immunization : immunizationsList) {
            Entry immunizationEntry = new Entry().setResource(immunization);
            bundle.addEntry(immunizationEntry);
        }
    } catch (Exception e) {
        logger.error("Error in getting the Immunization Data", e);
    }
    // Add to the bundle
    try {
        List<DiagnosticReport> diagnosticReportList = dstu2ResourcesData.getDiagnosticReportData(context, client, launchDetails, dstu2FhirData, encounter, start, end);
        logger.info("Filtered DiagnosticReports-----------> {}", diagnosticReportList.size());
        dstu2FhirData.setDiagReports(diagnosticReportList);
        for (DiagnosticReport diagnosticReport : diagnosticReportList) {
            Entry diagnosticReportEntry = new Entry().setResource(diagnosticReport);
            bundle.addEntry(diagnosticReportEntry);
        }
    } catch (Exception e) {
        logger.error("Error in getting the DiagnosticReport Data", e);
    }
    // Setting bundle to FHIR Data
    logger.info("------------------------------CodeableConcept Codes------------------------------");
    logger.info("Encounter Codes Size=====> {}", dstu2FhirData.getEncounterCodes().size());
    logger.info("Conditions Codes Size=====> {}", dstu2FhirData.getConditionCodes().size());
    logger.info("Observation Codes Size=====> {}", dstu2FhirData.getLabResultCodes().size());
    logger.info("Medication Codes Size=====> {}", dstu2FhirData.getMedicationCodes().size());
    logger.info("Immunization Codes Size=====> {}", dstu2FhirData.getImmuniationCodes().size());
    logger.info("DiagnosticReport Codes Size=====> {}", dstu2FhirData.getDiagnosticReportCodes().size());
    String fileName = ActionRepo.getInstance().getLogFileDirectory() + "/LoadingQueryDSTU2Bundle-" + launchDetails.getLaunchPatientId() + ".json";
    ApplicationUtils.saveDataToFile(context.newJsonParser().encodeResourceToString(bundle), fileName);
    return bundle;
}
Also used : FhirContext(ca.uhn.fhir.context.FhirContext) ResourceReferenceDt(ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt) BaseResourceReferenceDt(ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt) Organization(ca.uhn.fhir.model.dstu2.resource.Organization) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) ArrayList(java.util.ArrayList) DiagnosticReport(ca.uhn.fhir.model.dstu2.resource.DiagnosticReport) Entry(ca.uhn.fhir.model.dstu2.resource.Bundle.Entry) Medication(ca.uhn.fhir.model.dstu2.resource.Medication) Encounter(ca.uhn.fhir.model.dstu2.resource.Encounter) ArrayList(java.util.ArrayList) List(java.util.List) Condition(ca.uhn.fhir.model.dstu2.resource.Condition) Immunization(ca.uhn.fhir.model.dstu2.resource.Immunization) BaseContainedDt(ca.uhn.fhir.model.base.composite.BaseContainedDt) Bundle(ca.uhn.fhir.model.dstu2.resource.Bundle) Patient(ca.uhn.fhir.model.dstu2.resource.Patient) DiagnosticOrder(ca.uhn.fhir.model.dstu2.resource.DiagnosticOrder) BaseResourceReferenceDt(ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt) Practitioner(ca.uhn.fhir.model.dstu2.resource.Practitioner) Participant(ca.uhn.fhir.model.dstu2.resource.Encounter.Participant) Observation(ca.uhn.fhir.model.dstu2.resource.Observation) MedicationAdministration(ca.uhn.fhir.model.dstu2.resource.MedicationAdministration) MedicationStatement(ca.uhn.fhir.model.dstu2.resource.MedicationStatement) Location(ca.uhn.fhir.model.dstu2.resource.Encounter.Location)

Example 3 with MedicationAdministration

use of ca.uhn.fhir.model.dstu2.resource.MedicationAdministration in project eCRNow by drajer-health.

the class Dstu2ResourcesData method getMedicationAdministrationData.

public List<MedicationAdministration> getMedicationAdministrationData(FhirContext context, IGenericClient client, LaunchDetails launchDetails, Dstu2FhirData dstu2FhirData, Encounter encounter, Date start, Date end) {
    Bundle bundle = (Bundle) resourceData.getResourceByPatientId(launchDetails, client, context, "MedicationAdministration");
    List<MedicationAdministration> medAdministrations = new ArrayList<>();
    List<CodeableConceptDt> medicationCodes = new ArrayList<>();
    // Filter MedicationAdministrations based on Encounter Reference
    if (bundle != null && encounter != null && !encounter.getId().getValue().isEmpty()) {
        for (Entry entry : bundle.getEntry()) {
            MedicationAdministration medAdministration = (MedicationAdministration) entry.getResource();
            if (!medAdministration.getEncounter().isEmpty()) {
                if (medAdministration.getEncounter().getReference().getIdPart().equals(encounter.getIdElement().getIdPart())) {
                    medAdministrations.add(medAdministration);
                    medicationCodes.addAll(findMedicationCodes(medAdministration));
                }
            }
        }
    // If Encounter Id is not present using start and end dates to filter
    // MedicationAdministrations
    } else if (bundle != null) {
        for (Entry entry : bundle.getEntry()) {
            MedicationAdministration medAdministration = (MedicationAdministration) entry.getResource();
            // Checking If Effective Date is present in MedicationAdministration resource
            if (medAdministration.getEffectiveTime() != null) {
                Date effectiveDateTime = (Date) medAdministration.getEffectiveTime();
                if (effectiveDateTime.after(start) && effectiveDateTime.before(end)) {
                    medAdministrations.add(medAdministration);
                    medicationCodes.addAll(findMedicationCodes(medAdministration));
                }
            } else // If Effective Date is not present looking for LastUpdatedDate
            {
                Date lastUpdatedDateTime = medAdministration.getMeta().getLastUpdated();
                if (lastUpdatedDateTime.after(start) && lastUpdatedDateTime.before(end)) {
                    medAdministrations.add(medAdministration);
                    medicationCodes.addAll(findMedicationCodes(medAdministration));
                }
            }
        }
    }
    dstu2FhirData.setMedicationCodes(medicationCodes);
    return medAdministrations;
}
Also used : Entry(ca.uhn.fhir.model.dstu2.resource.Bundle.Entry) CodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt) Bundle(ca.uhn.fhir.model.dstu2.resource.Bundle) ArrayList(java.util.ArrayList) MedicationAdministration(ca.uhn.fhir.model.dstu2.resource.MedicationAdministration) Date(java.util.Date)

Example 4 with MedicationAdministration

use of ca.uhn.fhir.model.dstu2.resource.MedicationAdministration in project eCRNow by drajer-health.

the class Dstu2ResourcesData method findMedicationCodes.

private List<CodeableConceptDt> findMedicationCodes(MedicationAdministration medAdministration) {
    List<CodeableConceptDt> medicationCodes = new ArrayList<>();
    if (!medAdministration.getMedication().isEmpty() && medAdministration.getMedication() != null) {
        if (medAdministration.getMedication() instanceof CodeableConceptDt) {
            // Handle Codeable Concept
            CodeableConceptDt medicationCode = (CodeableConceptDt) medAdministration.getMedication();
            medicationCodes.add(medicationCode);
        } else {
        // Handle Reference data types
        }
    }
    return medicationCodes;
}
Also used : CodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt) ArrayList(java.util.ArrayList)

Example 5 with MedicationAdministration

use of ca.uhn.fhir.model.dstu2.resource.MedicationAdministration in project synthea by synthetichealth.

the class FhirDstu2 method medication.

/**
 * Map the given Medication to a FHIR MedicationRequest resource, and add it to the given Bundle.
 *
 * @param rand
 *          Source of randomness to use when generating ids etc
 * @param personEntry
 *          The Entry for the Person
 * @param bundle
 *          Bundle to add the Medication to
 * @param encounterEntry
 *          Current Encounter entry
 * @param medication
 *          The Medication
 * @return The added Entry
 */
private static Entry medication(RandomNumberGenerator rand, Entry personEntry, Bundle bundle, Entry encounterEntry, Medication medication) {
    MedicationOrder medicationResource = new MedicationOrder();
    medicationResource.setPatient(new ResourceReferenceDt(personEntry.getFullUrl()));
    medicationResource.setEncounter(new ResourceReferenceDt(encounterEntry.getFullUrl()));
    ca.uhn.fhir.model.dstu2.resource.Encounter encounter = (ca.uhn.fhir.model.dstu2.resource.Encounter) encounterEntry.getResource();
    medicationResource.setPrescriber(encounter.getParticipantFirstRep().getIndividual());
    Code code = medication.codes.get(0);
    String system = code.system.equals("SNOMED-CT") ? SNOMED_URI : RXNORM_URI;
    medicationResource.setMedication(mapCodeToCodeableConcept(code, system));
    medicationResource.setDateWritten(new DateTimeDt(new Date(medication.start)));
    if (medication.stop != 0L) {
        medicationResource.setStatus(MedicationOrderStatusEnum.STOPPED);
    } else {
        medicationResource.setStatus(MedicationOrderStatusEnum.ACTIVE);
    }
    if (!medication.reasons.isEmpty()) {
        // Only one element in list
        Code reason = medication.reasons.get(0);
        for (Entry entry : bundle.getEntry()) {
            if (entry.getResource().getResourceName().equals("Condition")) {
                Condition condition = (Condition) entry.getResource();
                // Only one element in list
                CodingDt coding = condition.getCode().getCoding().get(0);
                if (reason.code.equals(coding.getCode())) {
                    medicationResource.setReason(new ResourceReferenceDt(entry.getFullUrl()));
                }
            }
        }
    }
    if (medication.prescriptionDetails != null) {
        JsonObject rxInfo = medication.prescriptionDetails;
        DosageInstruction dosage = new DosageInstruction();
        // as_needed is true if present
        dosage.setAsNeeded(new BooleanDt(rxInfo.has("as_needed")));
        // as_needed is true if present
        if ((rxInfo.has("dosage")) && (!rxInfo.has("as_needed"))) {
            TimingDt timing = new TimingDt();
            Repeat timingRepeatComponent = new Repeat();
            timingRepeatComponent.setFrequency(rxInfo.get("dosage").getAsJsonObject().get("frequency").getAsInt());
            timingRepeatComponent.setPeriod(rxInfo.get("dosage").getAsJsonObject().get("period").getAsDouble());
            timingRepeatComponent.setPeriodUnits(convertUcumCode(rxInfo.get("dosage").getAsJsonObject().get("unit").getAsString()));
            timing.setRepeat(timingRepeatComponent);
            dosage.setTiming(timing);
            QuantityDt dose = new SimpleQuantityDt().setValue(rxInfo.get("dosage").getAsJsonObject().get("amount").getAsDouble());
            dosage.setDose(dose);
            if (rxInfo.has("instructions")) {
                for (JsonElement instructionElement : rxInfo.get("instructions").getAsJsonArray()) {
                    JsonObject instruction = instructionElement.getAsJsonObject();
                    Code instructionCode = new Code(SNOMED_URI, instruction.get("code").getAsString(), instruction.get("display").getAsString());
                    dosage.setAdditionalInstructions(mapCodeToCodeableConcept(instructionCode, SNOMED_URI));
                }
            }
        }
        List<DosageInstruction> dosageInstruction = new ArrayList<DosageInstruction>();
        dosageInstruction.add(dosage);
        medicationResource.setDosageInstruction(dosageInstruction);
    }
    Entry medicationEntry = newEntry(rand, bundle, medicationResource);
    // create new claim for medication
    medicationClaim(rand, personEntry, bundle, encounterEntry, medication.claim, medicationEntry);
    // Create new administration for medication, if needed
    if (medication.administration) {
        medicationAdministration(rand, personEntry, bundle, encounterEntry, medication);
    }
    return medicationEntry;
}
Also used : ResourceReferenceDt(ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt) SimpleQuantityDt(ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt) ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject) Repeat(ca.uhn.fhir.model.dstu2.composite.TimingDt.Repeat) Entry(ca.uhn.fhir.model.dstu2.resource.Bundle.Entry) TimingDt(ca.uhn.fhir.model.dstu2.composite.TimingDt) CodingDt(ca.uhn.fhir.model.dstu2.composite.CodingDt) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) MedicationOrder(ca.uhn.fhir.model.dstu2.resource.MedicationOrder) BooleanDt(ca.uhn.fhir.model.primitive.BooleanDt) DosageInstruction(ca.uhn.fhir.model.dstu2.resource.MedicationOrder.DosageInstruction) Condition(ca.uhn.fhir.model.dstu2.resource.Condition) SimpleQuantityDt(ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt) QuantityDt(ca.uhn.fhir.model.dstu2.composite.QuantityDt) Code(org.mitre.synthea.world.concepts.HealthRecord.Code) Date(java.util.Date) DateTimeDt(ca.uhn.fhir.model.primitive.DateTimeDt) JsonElement(com.google.gson.JsonElement)

Aggregations

ArrayList (java.util.ArrayList)7 Entry (ca.uhn.fhir.model.dstu2.resource.Bundle.Entry)6 MedicationAdministration (ca.uhn.fhir.model.dstu2.resource.MedicationAdministration)5 CodeableConceptDt (ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt)4 ResourceReferenceDt (ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt)4 Bundle (ca.uhn.fhir.model.dstu2.resource.Bundle)4 Condition (ca.uhn.fhir.model.dstu2.resource.Condition)4 Date (java.util.Date)4 FhirContext (ca.uhn.fhir.context.FhirContext)2 BaseContainedDt (ca.uhn.fhir.model.base.composite.BaseContainedDt)2 BaseResourceReferenceDt (ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt)2 SimpleQuantityDt (ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt)2 DiagnosticOrder (ca.uhn.fhir.model.dstu2.resource.DiagnosticOrder)2 DiagnosticReport (ca.uhn.fhir.model.dstu2.resource.DiagnosticReport)2 Encounter (ca.uhn.fhir.model.dstu2.resource.Encounter)2 Location (ca.uhn.fhir.model.dstu2.resource.Encounter.Location)2 Participant (ca.uhn.fhir.model.dstu2.resource.Encounter.Participant)2 Medication (ca.uhn.fhir.model.dstu2.resource.Medication)2 MedicationStatement (ca.uhn.fhir.model.dstu2.resource.MedicationStatement)2 Observation (ca.uhn.fhir.model.dstu2.resource.Observation)2