Search in sources :

Example 1 with CodeableConceptDt

use of ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt in project cqf-ruler by DBCG.

the class CompositionBuilder method initializeDstu2.

@Override
protected void initializeDstu2(T theResource) {
    super.initializeDstu2(theResource);
    ca.uhn.fhir.model.dstu2.resource.Composition composition = (ca.uhn.fhir.model.dstu2.resource.Composition) theResource;
    List<ResourceReferenceDt> author = new ArrayList<>();
    author.add(new ResourceReferenceDt(myAuthor));
    composition.setDate(new DateTimeDt(myDate)).setIdentifier(new IdentifierDt(getIdentifier().getKey(), getIdentifier().getValue())).setStatus(CompositionStatusEnum.forCode(myStatus)).setSubject(new ResourceReferenceDt(mySubject)).setTitle(myTitle).setType(new CodeableConceptDt().addCoding(new CodingDt().setSystem(getTypeSetting().getSystem()).setCode(getTypeSetting().getCode()).setDisplay(getTypeSetting().getDisplay()))).setAuthor(author).setCustodian(new ResourceReferenceDt(myCustodian));
}
Also used : IdentifierDt(ca.uhn.fhir.model.dstu2.composite.IdentifierDt) ResourceReferenceDt(ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt) CodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt) ArrayList(java.util.ArrayList) DateTimeDt(ca.uhn.fhir.model.primitive.DateTimeDt) CodingDt(ca.uhn.fhir.model.dstu2.composite.CodingDt)

Example 2 with CodeableConceptDt

use of ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt 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 3 with CodeableConceptDt

use of ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt in project synthea by synthetichealth.

the class FhirDstu2 method report.

/**
 * Map the given Report to a FHIR DiagnosticReport 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 Report to
 * @param encounterEntry
 *          Current Encounter entry
 * @param report
 *          The Report
 * @return The added Entry
 */
private static Entry report(RandomNumberGenerator rand, Entry personEntry, Bundle bundle, Entry encounterEntry, Report report) {
    DiagnosticReport reportResource = new DiagnosticReport();
    reportResource.setStatus(DiagnosticReportStatusEnum.FINAL);
    /*
     * Technically, the CodeableConcept system should be "http://hl7.org/fhir/v2/0074"
     * But the official Argonauts profiles incorrectly list the category pattern as
     * the ValueSet (which contains the above system) as
     * "http://hl7.org/fhir/ValueSet/diagnostic-service-sections", so we repeat the
     * error here.
     */
    CodeableConceptDt category = new CodeableConceptDt("http://hl7.org/fhir/ValueSet/diagnostic-service-sections", "LAB");
    reportResource.setCategory(category);
    reportResource.setCode(mapCodeToCodeableConcept(report.codes.get(0), LOINC_URI));
    reportResource.setSubject(new ResourceReferenceDt(personEntry.getFullUrl()));
    reportResource.setEncounter(new ResourceReferenceDt(encounterEntry.getFullUrl()));
    reportResource.setEffective(convertFhirDateTime(report.start, true));
    reportResource.setIssued(new InstantDt(new Date(report.start)));
    ca.uhn.fhir.model.dstu2.resource.Encounter encounter = (ca.uhn.fhir.model.dstu2.resource.Encounter) encounterEntry.getResource();
    reportResource.setPerformer(encounter.getServiceProvider());
    for (Observation observation : report.observations) {
        ResourceReferenceDt reference = new ResourceReferenceDt(observation.fullUrl);
        reference.setDisplay(observation.codes.get(0).display);
        List<ResourceReferenceDt> result = new ArrayList<ResourceReferenceDt>();
        result.add(reference);
        reportResource.setResult(result);
    }
    return newEntry(rand, bundle, reportResource);
}
Also used : CodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt) ResourceReferenceDt(ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt) ArrayList(java.util.ArrayList) DiagnosticReport(ca.uhn.fhir.model.dstu2.resource.DiagnosticReport) Date(java.util.Date) Observation(org.mitre.synthea.world.concepts.HealthRecord.Observation) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) InstantDt(ca.uhn.fhir.model.primitive.InstantDt)

Example 4 with CodeableConceptDt

use of ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt in project eCRNow by drajer-health.

the class Dstu2CdaResultGenerator method generateResultsSection.

public static String generateResultsSection(Dstu2FhirData data, LaunchDetails details) {
    StringBuilder hsb = new StringBuilder(5000);
    StringBuilder sb = new StringBuilder(2000);
    StringBuilder resultEntries = new StringBuilder();
    List<Observation> results = data.getLabResults();
    if (results != null && results.size() > 0) {
        hsb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.COMP_EL_NAME));
        hsb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.SECTION_EL_NAME));
        hsb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.LAB_RESULTS_SEC_TEMPLATE_ID));
        hsb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.LAB_RESULTS_SEC_TEMPLATE_ID, CdaGeneratorConstants.LAB_RESULTS_SEC_TEMPLATE_ID_EXT));
        hsb.append(CdaGeneratorUtils.getXmlForCD(CdaGeneratorConstants.CODE_EL_NAME, CdaGeneratorConstants.LAB_RESULTS_SEC_CODE, CdaGeneratorConstants.LOINC_CODESYSTEM_OID, CdaGeneratorConstants.LOINC_CODESYSTEM_NAME, CdaGeneratorConstants.LAB_RESULTS_SEC_NAME));
        // Add Title
        hsb.append(CdaGeneratorUtils.getXmlForText(CdaGeneratorConstants.TITLE_EL_NAME, CdaGeneratorConstants.LAB_RESULTS_SEC_TITLE));
        // Add Narrative Text
        hsb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.TEXT_EL_NAME));
        // Create Table Header.
        List<String> list = new ArrayList<String>();
        list.add(CdaGeneratorConstants.LABTEST_TABLE_COL_1_TITLE);
        list.add(CdaGeneratorConstants.LABTEST_TABLE_COL_2_TITLE);
        list.add(CdaGeneratorConstants.LABTEST_TABLE_COL_3_TITLE);
        hsb.append(CdaGeneratorUtils.getXmlForTableHeader(list, CdaGeneratorConstants.TABLE_BORDER, CdaGeneratorConstants.TABLE_WIDTH));
        // Add Table Body
        hsb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.TABLE_BODY_EL_NAME));
        int rowNum = 1;
        Boolean triggerCodesAdded = false;
        for (Observation obs : results) {
            String obsDisplayName = CdaGeneratorConstants.UNKNOWN_VALUE;
            List<CodingDt> cds = null;
            if (obs.getCode() != null && obs.getCode().getCodingFirstRep() != null) {
                cds = obs.getCode().getCoding();
                if (!StringUtils.isEmpty(obs.getCode().getCodingFirstRep().getDisplay())) {
                    obsDisplayName = obs.getCode().getCodingFirstRep().getDisplay();
                } else if (!StringUtils.isEmpty(obs.getCode().getText())) {
                    obsDisplayName = obs.getCode().getText();
                }
            }
            Map<String, String> bodyvals = new HashMap<String, String>();
            bodyvals.put(CdaGeneratorConstants.LABTEST_TABLE_COL_1_BODY_CONTENT, obsDisplayName);
            String val = CdaGeneratorConstants.UNKNOWN_VALUE;
            if (obs.getValue() != null) {
                val = Dstu2CdaFhirUtilities.getStringForIDataType(obs.getValue());
            }
            bodyvals.put(CdaGeneratorConstants.LABTEST_TABLE_COL_2_BODY_CONTENT, val);
            String dt = CdaGeneratorConstants.UNKNOWN_VALUE;
            if (obs.getEffective() != null) {
                dt = Dstu2CdaFhirUtilities.getStringForIDataType(obs.getEffective());
            }
            bodyvals.put(CdaGeneratorConstants.LABTEST_TABLE_COL_3_BODY_CONTENT, dt);
            sb.append(CdaGeneratorUtils.addTableRow(bodyvals, rowNum));
            // Setup the Organizer and Entries
            StringBuilder lrEntry = new StringBuilder();
            // Add the Entries.
            lrEntry.append(CdaGeneratorUtils.getXmlForActEntry(CdaGeneratorConstants.TYPE_CODE_DEF));
            // Add the Organizer Act
            lrEntry.append(CdaGeneratorUtils.getXmlForAct(CdaGeneratorConstants.ORGANIZER_EL_NAME, CdaGeneratorConstants.ORGANIZER_CLASS_CODE_CLUSTER, CdaGeneratorConstants.MOOD_CODE_DEF));
            lrEntry.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.LAB_RESULTS_ORG_TEMPLATE_ID));
            lrEntry.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.LAB_RESULTS_ORG_TEMPLATE_ID, CdaGeneratorConstants.LAB_RESULTS_ORG_TEMPLATE_ID_EXT));
            lrEntry.append(CdaGeneratorUtils.getXmlForIIUsingGuid());
            // Fix the Code to be the same as the result code..
            lrEntry.append(Dstu2CdaFhirUtilities.getCodingXml(cds, CdaGeneratorConstants.CODE_EL_NAME));
            lrEntry.append(CdaGeneratorUtils.getXmlForCD(CdaGeneratorConstants.STATUS_CODE_EL_NAME, CdaGeneratorConstants.COMPLETED_STATUS));
            // Add the actual Result Observation
            lrEntry.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.COMP_EL_NAME));
            lrEntry.append(CdaGeneratorUtils.getXmlForAct(CdaGeneratorConstants.OBS_ACT_EL_NAME, CdaGeneratorConstants.OBS_CLASS_CODE, CdaGeneratorConstants.MOOD_CODE_DEF));
            lrEntry.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.LAB_RESULTS_ENTRY_TEMPLATE_ID));
            lrEntry.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.LAB_RESULTS_ENTRY_TEMPLATE_ID, CdaGeneratorConstants.LAB_RESULTS_ENTRY_TEMPLATE_ID_EXT));
            lrEntry.append(CdaGeneratorUtils.getXmlForIIUsingGuid());
            lrEntry.append(Dstu2CdaFhirUtilities.getCodingXml(cds, CdaGeneratorConstants.CODE_EL_NAME));
            lrEntry.append(CdaGeneratorUtils.getXmlForCD(CdaGeneratorConstants.STATUS_CODE_EL_NAME, CdaGeneratorConstants.COMPLETED_STATUS));
            lrEntry.append(Dstu2CdaFhirUtilities.getIDataTypeXml(obs.getEffective(), CdaGeneratorConstants.EFF_TIME_EL_NAME, false));
            lrEntry.append(Dstu2CdaFhirUtilities.getIDataTypeXml(obs.getValue(), CdaGeneratorConstants.VAL_EL_NAME, true));
            // Add interpretation code.
            if ((obs.getInterpretation() != null) && (obs.getInterpretation().getCoding() != null) && (obs.getInterpretation().getCoding().size() > 0)) {
                logger.info(" Adding Interpretaion Code ");
                List<CodeableConceptDt> cdt = new ArrayList<CodeableConceptDt>();
                cdt.add(obs.getInterpretation());
                lrEntry.append(Dstu2CdaFhirUtilities.getCodeableConceptXml(cdt, CdaGeneratorConstants.INTERPRETATION_CODE_EL_NAME, false));
            }
            // End Tag for Entry Relationship
            lrEntry.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.OBS_ACT_EL_NAME));
            lrEntry.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.COMP_EL_NAME));
            if (!triggerCodesAdded) {
                lrEntry.append(addTriggerCodes(data, details, obs, cds));
                triggerCodesAdded = true;
            }
            // End Tags for Entries
            lrEntry.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ORGANIZER_EL_NAME));
            lrEntry.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ENTRY_EL_NAME));
            resultEntries.append(lrEntry);
            rowNum++;
        }
        // End the Sb string.
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.TABLE_BODY_EL_NAME));
        // End Table.
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.TABLE_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.TEXT_EL_NAME));
        hsb.append(sb);
        // Add lab results
        hsb.append(resultEntries);
        // Complete the section end tags.
        hsb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.SECTION_EL_NAME));
        hsb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.COMP_EL_NAME));
    } else {
        hsb.append(generateEmptyLabResults());
    }
    return hsb.toString();
}
Also used : CodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Observation(ca.uhn.fhir.model.dstu2.resource.Observation) CodingDt(ca.uhn.fhir.model.dstu2.composite.CodingDt)

Example 5 with CodeableConceptDt

use of ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt in project eCRNow by drajer-health.

the class Dstu2CdaImmunizationGenerator method generateImmunizationSection.

public static String generateImmunizationSection(Dstu2FhirData data, LaunchDetails details) {
    StringBuilder sb = new StringBuilder(2000);
    List<Immunization> imms = data.getImmunizations();
    if (imms != null && imms.size() > 0) {
        // Generate the component and section end tags
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.COMP_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.SECTION_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_SEC_TEMPLATE_ID));
        sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_SEC_TEMPLATE_ID, CdaGeneratorConstants.IMMUNIZATION_SEC_TEMPLATE_ID_EXT));
        sb.append(CdaGeneratorUtils.getXmlForCD(CdaGeneratorConstants.CODE_EL_NAME, CdaGeneratorConstants.IMMUNIZATION_SEC_CODE, CdaGeneratorConstants.LOINC_CODESYSTEM_OID, CdaGeneratorConstants.LOINC_CODESYSTEM_NAME, CdaGeneratorConstants.IMMUNIZATION_SEC_NAME));
        // add Title
        sb.append(CdaGeneratorUtils.getXmlForText(CdaGeneratorConstants.TITLE_EL_NAME, CdaGeneratorConstants.IMMUNIZATION_SEC_TITLE));
        // add Narrative Text
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.TEXT_EL_NAME));
        // Create Table Header.
        List<String> list = new ArrayList<String>();
        list.add(CdaGeneratorConstants.IMM_TABLE_COL_1_TITLE);
        list.add(CdaGeneratorConstants.IMM_TABLE_COL_2_TITLE);
        sb.append(CdaGeneratorUtils.getXmlForTableHeader(list, CdaGeneratorConstants.TABLE_BORDER, CdaGeneratorConstants.TABLE_WIDTH));
        // add Table Body
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.TABLE_BODY_EL_NAME));
        // add Body Rows
        int rowNum = 1;
        for (Immunization imm : imms) {
            String medDisplayName = CdaGeneratorConstants.UNKNOWN_VALUE;
            if (imm.getVaccineCode() != null && imm.getVaccineCode().getCodingFirstRep() != null && !StringUtils.isEmpty(imm.getVaccineCode().getCodingFirstRep().getDisplay())) {
                medDisplayName = imm.getVaccineCode().getCodingFirstRep().getDisplay();
            }
            String dt = null;
            if (imm.getDate() != null) {
                dt = imm.getDate().toString();
            }
            Map<String, String> bodyvals = new HashMap<String, String>();
            bodyvals.put(CdaGeneratorConstants.IMM_TABLE_COL_1_BODY_CONTENT, medDisplayName);
            bodyvals.put(CdaGeneratorConstants.IMM_TABLE_COL_2_BODY_CONTENT, dt);
            sb.append(CdaGeneratorUtils.addTableRow(bodyvals, rowNum));
            // TODO: ++rowNum or rowNum++
            ++rowNum;
        }
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.TABLE_BODY_EL_NAME));
        // End Table.
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.TABLE_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.TEXT_EL_NAME));
        for (Immunization imm : imms) {
            // add the Entries.
            sb.append(CdaGeneratorUtils.getXmlForActEntry(CdaGeneratorConstants.TYPE_CODE_DEF));
            // add the medication Act
            sb.append(CdaGeneratorUtils.getXmlForAct(CdaGeneratorConstants.MED_ACT_EL_NAME, CdaGeneratorConstants.MED_CLASS_CODE, CdaGeneratorConstants.MOOD_CODE_DEF));
            sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_ACTIVITY_TEMPLATE_ID));
            sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_ACTIVITY_TEMPLATE_ID, CdaGeneratorConstants.IMMUNIZATION_ACTIVITY_TEMPLATE_ID_EXT));
            sb.append(CdaGeneratorUtils.getXmlForII(details.getAssigningAuthorityId(), imm.getId().getIdPart()));
            // set status code
            sb.append(CdaGeneratorUtils.getXmlForCD(CdaGeneratorConstants.STATUS_CODE_EL_NAME, CdaGeneratorConstants.COMPLETED_STATUS));
            // Set up Effective Time for start and End time.
            sb.append(Dstu2CdaFhirUtilities.getDateTimeTypeXml(imm.getDateElement(), CdaGeneratorConstants.EFF_TIME_EL_NAME));
            // add the consumable presentation.
            sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.CONSUMABLE_EL_NAME));
            sb.append(CdaGeneratorUtils.getXmlForStartElementWithClassCode(CdaGeneratorConstants.MAN_PROD_EL_NAME, CdaGeneratorConstants.MANU_CLASS_CODE));
            sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_MEDICATION_INFORMATION));
            sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_MEDICATION_INFORMATION, CdaGeneratorConstants.IMMUNIZATION_MEDICATION_INFORMATION_EXT));
            sb.append(CdaGeneratorUtils.getXmlForIIUsingGuid());
            sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.MANU_MAT_EL_NAME));
            List<CodeableConceptDt> cds = new ArrayList<CodeableConceptDt>();
            cds.add(imm.getVaccineCode());
            sb.append(Dstu2CdaFhirUtilities.getCodeableConceptXml(cds, CdaGeneratorConstants.CODE_EL_NAME, false));
            sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.MANU_MAT_EL_NAME));
            sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.MAN_PROD_EL_NAME));
            sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.CONSUMABLE_EL_NAME));
            // End Tags for Entries
            sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.MED_ACT_EL_NAME));
            sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ENTRY_EL_NAME));
        }
        // Complete the section end tags.
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.SECTION_EL_NAME));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.COMP_EL_NAME));
    } else {
        sb.append(generateEmptyImmunizations());
    }
    return sb.toString();
}
Also used : Immunization(ca.uhn.fhir.model.dstu2.resource.Immunization) CodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Aggregations

CodeableConceptDt (ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt)24 ArrayList (java.util.ArrayList)18 Date (java.util.Date)11 Entry (ca.uhn.fhir.model.dstu2.resource.Bundle.Entry)9 Bundle (ca.uhn.fhir.model.dstu2.resource.Bundle)7 CodingDt (ca.uhn.fhir.model.dstu2.composite.CodingDt)6 ResourceReferenceDt (ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt)5 DateTimeDt (ca.uhn.fhir.model.primitive.DateTimeDt)5 HashMap (java.util.HashMap)4 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)4 Condition (ca.uhn.fhir.model.dstu2.resource.Condition)3 BoundCodeableConceptDt (ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt)2 IdentifierDt (ca.uhn.fhir.model.dstu2.composite.IdentifierDt)2 SimpleQuantityDt (ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt)2 DiagnosticReport (ca.uhn.fhir.model.dstu2.resource.DiagnosticReport)2 Immunization (ca.uhn.fhir.model.dstu2.resource.Immunization)2 MedicationAdministration (ca.uhn.fhir.model.dstu2.resource.MedicationAdministration)2 Observation (ca.uhn.fhir.model.dstu2.resource.Observation)2 List (java.util.List)2 BaseQuantityDt (ca.uhn.fhir.model.base.composite.BaseQuantityDt)1