/** * 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); } /**
public org.hl7.fhir.r4.model.Coding convertEncounterClass(org.hl7.fhir.instance.model.Encounter.EncounterClass src) throws FHIRException { if (src == null) return null; switch (src) { case INPATIENT: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("IMP"); case OUTPATIENT: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); case AMBULATORY: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); case EMERGENCY: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("EMER"); case HOME: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("HH"); case FIELD: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("FLD"); case DAYTIME: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("SS"); case VIRTUAL: return new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("VR"); default: return null; } }
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; }
private static org.hl7.fhir.r4.model.CodeableConcept convertConditionVerificationStatus(org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus src) throws FHIRException { if (src == null) return null; org.hl7.fhir.r4.model.CodeableConcept cc = new org.hl7.fhir.r4.model.CodeableConcept(); switch (src) { case PROVISIONAL: cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("provisional"); return cc; case DIFFERENTIAL: cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("differential"); return cc; case CONFIRMED: cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("confirmed"); return cc; case REFUTED: cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("refuted"); return cc; case ENTEREDINERROR: cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("entered-in-error"); return cc; default: return null; } }
/** * 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; } /**
private static org.hl7.fhir.r4.model.CodeableConcept convertConditionClinicalStatus(String src) throws FHIRException { if (src == null) return null; org.hl7.fhir.r4.model.CodeableConcept cc = new org.hl7.fhir.r4.model.CodeableConcept(); cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode(src); return cc; }
/** * 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; }
/** * This is just a convenience method that creates a codeableconcept if one * doesn't already exist, and adds a coding to it */ public TranslationRequest addCode(String theSystem, String theCode) { Validate.notBlank(theSystem, "theSystem must not be null"); Validate.notBlank(theCode, "theCode must not be null"); if (getCodeableConcept() == null) { setCodeableConcept(new CodeableConcept()); } getCodeableConcept().addCoding(new Coding().setSystem(theSystem).setCode(theCode)); return this; }
@SuppressWarnings("rawtypes") private Coding buildCoding(Type value1, Type value2) { return new Coding().setSystem(((PrimitiveType) value1).asStringValue()).setCode(((PrimitiveType) value2).asStringValue()) ; }
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; }
private CodeableConcept makeUnits(String text, String ucum) { if (Utilities.noString(text) && Utilities.noString(ucum)) return null; CodeableConcept cc = new CodeableConcept(); cc.setText(text); cc.getCoding().add(new Coding().setCode(ucum).setSystem("http://unitsofmeasure.org")); return cc; } public Bundle getBundle() {
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(); } }
new Coding() .setCode(element.getCode()) .setSystem(element.getSystem()) .setVersion(element.getSystemVersion()) .setDisplay(element.getDisplay())
new Coding() .setCode(element.getCode()) .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; }