public String getTRValueSetCode(Concept concept) {
   for (ConceptMap mapping : concept.getConceptMappings()) {
     if (mapping.getConceptMapType().getUuid().equals(ConceptMapType.SAME_AS_MAP_TYPE_UUID)) {
       return mapping.getConceptReferenceTerm().getCode();
     }
   }
   for (ConceptName conceptName : concept.getShortNames()) {
     return conceptName.getName();
   }
   return concept.getName().getName();
 }
 public CodeableConceptDt addTRCoding(Concept concept) {
   CodeableConceptDt codeableConcept = new CodeableConceptDt();
   Collection<ConceptMap> conceptMappings = concept.getConceptMappings();
   for (ConceptMap mapping : conceptMappings) {
     if (mapping.getConceptMapType().getUuid().equals(ConceptMapType.SAME_AS_MAP_TYPE_UUID)) {
       addTRCodingsForReferenceTerms(concept, idMappingsRepository, codeableConcept, mapping);
     }
   }
   addTRCodingForConcept(concept, idMappingsRepository, codeableConcept);
   return codeableConcept;
 }
 private static ConceptMap getConceptMap(String sourceHl7Code, String code, String mapTypeUuid) {
   ConceptMap conceptMap = new ConceptMap();
   ConceptReferenceTerm conceptReferenceTerm = new ConceptReferenceTerm();
   ConceptSource conceptSource = new ConceptSource();
   conceptSource.setHl7Code(sourceHl7Code);
   conceptReferenceTerm.setConceptSource(conceptSource);
   conceptReferenceTerm.setCode(code);
   conceptMap.setConceptReferenceTerm(conceptReferenceTerm);
   ConceptMapType conceptMapType = new ConceptMapType();
   if (mapTypeUuid != null) {
     conceptMapType.setUuid(mapTypeUuid);
   } else {
     conceptMapType.setUuid(ConceptMapType.SAME_AS_MAP_TYPE_UUID);
   }
   conceptMap.setConceptMapType(conceptMapType);
   return conceptMap;
 }
 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());
   }
 }