public DataObject simplifyReferenceTerm(ConceptReferenceTerm term) throws Exception {

    List<Object> propertyNamesAndValues = new ArrayList<Object>();

    if (term == null
        || StringUtils.isBlank(term.getCode())
        || StringUtils.isEmpty(term.getCode())) {

      propertyNamesAndValues.add("termCode");
      propertyNamesAndValues.add("");
      propertyNamesAndValues.add("termId");
      propertyNamesAndValues.add("");
      propertyNamesAndValues.add("termName");
      propertyNamesAndValues.add("No Snomed CT Reference Terms Mapped To This Concept");

    } else {

      propertyNamesAndValues.add("termCode");
      propertyNamesAndValues.add((term.getCode()));
      propertyNamesAndValues.add("termId");
      propertyNamesAndValues.add((term.getId()));

      if (term.getName() != null) {
        propertyNamesAndValues.add("termName");
        propertyNamesAndValues.add(term.getName());
      }
    }
    DataObject dataObject = DataObject.create(propertyNamesAndValues);
    return dataObject;
  }
 private void addTRCodingsForReferenceTerms(
     Concept concept,
     IdMappingsRepository idMappingsRepository,
     CodeableConceptDt codeableConcept,
     ConceptMap mapping) {
   ConceptReferenceTerm conceptReferenceTerm = mapping.getConceptReferenceTerm();
   IdMapping idMapping = idMappingsRepository.findByInternalId(conceptReferenceTerm.getUuid());
   if (idMapping != null) {
     addFHIRCoding(
         codeableConcept,
         conceptReferenceTerm.getCode(),
         idMapping.getUri(),
         concept.getName().getName());
   }
 }
  private HashMap<ConceptReferenceTerm, List<Concept>> getAssociatedConceptsToRefTerms(
      Set<ConceptReferenceTerm> terms) {

    ConceptService conceptService = (ConceptService) Context.getService(ConceptService.class);
    HashMap<ConceptReferenceTerm, List<Concept>> hmconceptsToRefTerms =
        new HashMap<ConceptReferenceTerm, List<Concept>>();

    for (ConceptReferenceTerm refTerm : terms) {

      List<Concept> mappedConcept =
          conceptService.getConceptsByMapping(
              refTerm.getCode(), refTerm.getConceptSource().getName(), false);
      hmconceptsToRefTerms.put(refTerm, mappedConcept);
    }
    return hmconceptsToRefTerms;
  }