/** * Convenience constructor * * @param theSystem The {@link #setSystem(String) code system} * @param theCode The {@link #setCode(String) code} * @param theDisplay The {@link #setDisplay(String) human readable display} */ public Coding(String theSystem, String theCode, String theDisplay) { setSystem(theSystem); setCode(theCode); setDisplay(theDisplay); } /**
/** * Convenience method which adds a security tag * * @param theSystem The code system * @param theCode The code * @param theDisplay The display name * @return Returns a reference to <code>this</code> for easy chaining */ public Meta addSecurity(String theSystem, String theCode, String theDisplay) { addSecurity().setSystem(theSystem).setCode(theCode).setDisplay(theDisplay); return this; } /**
/** * Convenience method which adds a tag * * @param theSystem The code system * @param theCode The code * @param theDisplay The display name * @return Returns a reference to <code>this</code> for easy chaining */ public Meta addTag(String theSystem, String theCode, String theDisplay) { addTag().setSystem(theSystem).setCode(theCode).setDisplay(theDisplay); return this; } /**
public static CodeableConcept newCodeableConcept(String code, String system, String display) { CodeableConcept cc = new CodeableConcept(); Coding c = new Coding(); c.setCode(code); c.setSystem(system); c.setDisplay(display); cc.getCoding().add(c); return cc; }
public static Coding makeCoding(String code) throws FHIRException { String[] parts = code.split("\\|"); Coding c = new Coding(); if (parts.length == 2) { c.setSystem(parts[0]); c.setCode(parts[1]); } else if (parts.length == 3) { c.setSystem(parts[0]); c.setCode(parts[1]); c.setDisplay(parts[2]); } else throw new FHIRException("Unable to understand the code '"+code+"'. Use the format system|code(|display)"); return c; }
public List<Coding> getCodingProperties(String thePropertyName) { List<Coding> retVal = new ArrayList<>(); for (TermConceptProperty next : getProperties()) { if (thePropertyName.equals(next.getKey())) { if (next.getType() == TermConceptPropertyTypeEnum.CODING) { Coding coding = new Coding(); coding.setSystem(next.getCodeSystem()); coding.setCode(next.getValue()); coding.setDisplay(next.getDisplay()); retVal.add(coding); } } } return retVal; }
public Coding castToCoding(Base b) throws FHIRException { if (b instanceof Coding) return (Coding) b; else if (b instanceof Element) { ICoding c = ((Element) b).getAsICoding(); if (c == null) throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Coding"); return new Coding().setCode(c.getCode()).setSystem(c.getSystem()).setVersion(c.getVersion()).setDisplay(c.getDisplay()); } else if (b instanceof ICoding) { ICoding c = (ICoding) b; return new Coding().setCode(c.getCode()).setSystem(c.getSystem()).setVersion(c.getVersion()).setDisplay(c.getDisplay()); } else throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Coding"); }
public static Coding readAsCoding(Element item) { Coding c = new Coding(); c.setSystem(item.getNamedChildValue("system")); c.setVersion(item.getNamedChildValue("version")); c.setCode(item.getNamedChildValue("code")); c.setDisplay(item.getNamedChildValue("display")); return c; }
protected Meta toMeta(Collection<TagDefinition> tagDefinitions) { Meta retVal = new Meta(); for (TagDefinition next : tagDefinitions) { switch (next.getTagType()) { case PROFILE: retVal.addProfile(next.getCode()); break; case SECURITY_LABEL: retVal.addSecurity().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; case TAG: retVal.addTag().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; } } return retVal; }
public org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.instance.model.Coding src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); copyElement(src, tgt); tgt.setSystem(src.getSystem()); tgt.setVersion(src.getVersion()); tgt.setCode(src.getCode()); tgt.setDisplay(src.getDisplay()); tgt.setUserSelected(src.getUserSelected()); return tgt; }
/** * @param theAdd If true, add the code. If false, remove the code. * @param theCodeCounter */ private void addCodeIfNotAlreadyAdded(ValueSet.ValueSetExpansionComponent theExpansionComponent, Set<String> theAddedCodes, TermConcept theConcept, boolean theAdd, AtomicInteger theCodeCounter) { String code = theConcept.getCode(); if (theAdd && theAddedCodes.add(code)) { String codeSystem = theConcept.getCodeSystemVersion().getCodeSystem().getCodeSystemUri(); ValueSet.ValueSetExpansionContainsComponent contains = theExpansionComponent.addContains(); contains.setCode(code); contains.setSystem(codeSystem); contains.setDisplay(theConcept.getDisplay()); for (TermConceptDesignation nextDesignation : theConcept.getDesignations()) { contains .addDesignation() .setValue(nextDesignation.getValue()) .getUse() .setSystem(nextDesignation.getUseSystem()) .setCode(nextDesignation.getUseCode()) .setDisplay(nextDesignation.getUseDisplay()); } theCodeCounter.incrementAndGet(); } if (!theAdd && theAddedCodes.remove(code)) { String codeSystem = theConcept.getCodeSystemVersion().getCodeSystem().getCodeSystemUri(); removeCodeFromExpansion(codeSystem, code, theExpansionComponent); theCodeCounter.decrementAndGet(); } }
.setSystem(prop.getCodeSystem()) .setCode(prop.getCode()) .setDisplay(prop.getDisplay())); } else { throw new IllegalStateException("Don't know how to handle " + next.getClass());
.setSystem(element.getSystem()) .setVersion(element.getSystemVersion()) .setDisplay(element.getDisplay()) );
.setSystem(element.getSystem()) .setVersion(element.getSystemVersion()) .setDisplay(element.getDisplay()) );
public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.dstu2016may.model.Coding src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); copyElement(src, tgt); if (src.hasSystem()) tgt.setSystem(src.getSystem()); if (src.hasVersion()) tgt.setVersion(src.getVersion()); if (src.hasCode()) tgt.setCode(src.getCode()); if (src.hasDisplay()) tgt.setDisplay(src.getDisplay()); if (src.hasUserSelected()) tgt.setUserSelected(src.getUserSelected()); return tgt; }
.setSystem(target.getSystem()) .setVersion(target.getSystemVersion()) .setDisplay(target.getDisplay()) );
.setSystem(target.getSystem()) .setVersion(target.getSystemVersion()) .setDisplay(target.getDisplay()) );
if (vr != null && vr.getDisplay() != null) display = vr.getDisplay(); return new Coding().setSystem(system).setCode(code).setDisplay(display);
public static Coding readAsCoding(Element item) { Coding c = new Coding(); c.setSystem(item.getNamedChildValue("system")); c.setVersion(item.getNamedChildValue("version")); c.setCode(item.getNamedChildValue("code")); c.setDisplay(item.getNamedChildValue("display")); return c; }
public org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.instance.model.Coding src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); copyElement(src, tgt); tgt.setSystem(src.getSystem()); tgt.setVersion(src.getVersion()); tgt.setCode(src.getCode()); tgt.setDisplay(src.getDisplay()); tgt.setUserSelected(src.getUserSelected()); return tgt; }