Search in sources :

Example 16 with CodingDt

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

the class Dstu2CdaFhirUtilities method getCodeableConceptXml.

public static String getCodeableConceptXml(List<CodeableConceptDt> cds, String cdName, Boolean valueTrue) {
    StringBuilder sb = new StringBuilder(500);
    List<CodingDt> codes = new ArrayList<CodingDt>();
    if (cds != null && cds.size() > 0) {
        CodeableConceptDt cd = cds.get(0);
        List<CodingDt> codings = cd.getCoding();
        if (codings != null && codings.size() > 0) {
            Boolean found = false;
            Boolean first = true;
            for (CodingDt code : codings) {
                Pair<String, String> csd = CdaGeneratorConstants.getCodeSystemFromUrl(code.getSystem());
                if (!StringUtils.isEmpty(csd.getValue0()))
                    codes.add(code);
            }
        }
    }
    if (!valueTrue)
        sb.append(getCodingXml(codes, cdName));
    else
        sb.append(getCodingXmlForValue(codes, cdName));
    return sb.toString();
}
Also used : CodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt) BoundCodeableConceptDt(ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt) CodingDt(ca.uhn.fhir.model.dstu2.composite.CodingDt) ArrayList(java.util.ArrayList)

Example 17 with CodingDt

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

the class Dstu2CdaHeaderGenerator method getLocationXml.

public static String getLocationXml(Location loc) {
    StringBuilder sb = new StringBuilder(500);
    if (loc != null) {
        IdentifierDt npi = Dstu2CdaFhirUtilities.getIdentifierForSystem(loc.getIdentifier(), CdaGeneratorConstants.FHIR_NPI_URL);
        if (npi != null) {
            sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA, npi.getValue()));
        } else {
            sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA, loc.getId().getValue()));
        }
        if (loc.getType() != null && loc.getType().getCoding() != null) {
            sb.append(Dstu2CdaFhirUtilities.getCodingXml(loc.getType().getCoding(), CdaGeneratorConstants.CODE_EL_NAME));
        } else {
            List<CodingDt> codes = null;
            sb.append(Dstu2CdaFhirUtilities.getCodingXml(codes, CdaGeneratorConstants.CODE_EL_NAME));
        }
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.LOCATION_EL_NAME));
        List<AddressDt> addrs = new ArrayList<AddressDt>();
        addrs.add(loc.getAddress());
        sb.append(Dstu2CdaFhirUtilities.getAddressXml(addrs));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.LOCATION_EL_NAME));
    } else {
        // ***************
        // NOTE : THIS IS TEMPORARY --------
        // For Connectathon testing add defaults, this needs to be removed after connectathon and
        // replaced with the commented out code.
        // ***************
        sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA, CdaGeneratorConstants.UNKNOWN_VALUE));
        sb.append(CdaGeneratorUtils.getXmlForCD(CdaGeneratorConstants.CODE_EL_NAME, "OF", "2.16.840.1.113883.5.111", "HL7RoleCode", "Outpatient Facility"));
        sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.LOCATION_EL_NAME));
        List<AddressDt> addrs = new ArrayList<AddressDt>();
        AddressDt addr = new AddressDt();
        List<StringDt> addrLine = new ArrayList<StringDt>();
        addrLine.add(new StringDt("0987 Facility Drive"));
        addr.setLine(addrLine);
        addr.setCity("alt Lake City");
        addr.setState("UT");
        addr.setCountry("US");
        addr.setPostalCode("84101");
        addr.setUse(AddressUseEnum.WORK);
        addrs.add(addr);
        sb.append(Dstu2CdaFhirUtilities.getAddressXml(addrs));
        sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.LOCATION_EL_NAME));
    /*	sb.append(CdaGeneratorUtils.getXmlForII(CdaGeneratorConstants.AUTHOR_NPI_AA, CdaGeneratorConstants.UNKNOWN_VALUE));
      sb.append(CdaGeneratorUtils.getXmlForNullCD(CdaGeneratorConstants.CODE_EL_NAME, CdaGeneratorConstants.NF_NI));

      sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.LOCATION_EL_NAME));
      List<AddressDt> addrs = null;
      sb.append(CdaFhirUtilities.getAddressXml(addrs));
      sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.LOCATION_EL_NAME)); */
    }
    return sb.toString();
}
Also used : IdentifierDt(ca.uhn.fhir.model.dstu2.composite.IdentifierDt) AddressDt(ca.uhn.fhir.model.dstu2.composite.AddressDt) CodingDt(ca.uhn.fhir.model.dstu2.composite.CodingDt) ArrayList(java.util.ArrayList) StringDt(ca.uhn.fhir.model.primitive.StringDt)

Aggregations

CodingDt (ca.uhn.fhir.model.dstu2.composite.CodingDt)17 DateTimeDt (ca.uhn.fhir.model.primitive.DateTimeDt)7 CodeableConceptDt (ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt)6 Entry (ca.uhn.fhir.model.dstu2.resource.Bundle.Entry)6 ArrayList (java.util.ArrayList)6 ResourceReferenceDt (ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt)5 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)5 PeriodDt (ca.uhn.fhir.model.dstu2.composite.PeriodDt)4 Condition (ca.uhn.fhir.model.dstu2.resource.Condition)4 BoundCodeableConceptDt (ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt)3 IdentifierDt (ca.uhn.fhir.model.dstu2.composite.IdentifierDt)3 QuantityDt (ca.uhn.fhir.model.dstu2.composite.QuantityDt)3 JsonObject (com.google.gson.JsonObject)3 Date (java.util.Date)3 Encounter (org.mitre.synthea.world.concepts.HealthRecord.Encounter)3 BaseQuantityDt (ca.uhn.fhir.model.base.composite.BaseQuantityDt)2 BooleanDt (ca.uhn.fhir.model.primitive.BooleanDt)2 BoundCodeDt (ca.uhn.fhir.model.primitive.BoundCodeDt)2 CodeDt (ca.uhn.fhir.model.primitive.CodeDt)2 JsonElement (com.google.gson.JsonElement)2