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();
}
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();
}
Aggregations