@SuppressWarnings("unused") public static void codeableConcepts() { // START SNIPPET: codeableConcepts Patient patient = new Patient(); // Coded types can naturally be set using plain strings CodingDt statusCoding = patient.getMaritalStatus().addCoding(); statusCoding.setSystem("http://hl7.org/fhir/v3/MaritalStatus"); statusCoding.setCode("M"); statusCoding.setDisplay("Married"); // You could add a second coding to the field if needed too. This // can be useful if you want to convey the concept using different // codesystems. CodingDt secondStatus = patient.getMaritalStatus().addCoding(); secondStatus.setCode("H"); secondStatus.setSystem("http://example.com#maritalStatus"); secondStatus.setDisplay("Happily Married"); // CodeableConcept also has a text field meant to convey // a user readable version of the concepts it conveys. patient.getMaritalStatus().setText("Happily Married"); // There are also accessors for retrieving values String firstCode = patient.getMaritalStatus().getCoding().get(0).getCode(); String secondCode = patient.getMaritalStatus().getCoding().get(1).getCode(); // END SNIPPET: codeableConcepts }
protected MetaDt toMetaDt(Collection<TagDefinition> tagDefinitions) { MetaDt retVal = new MetaDt(); 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; }
/** * Creates a new Coding with the given system and code */ public CodingDt(String theSystem, String theCode) { setSystem(theSystem); setCode(theCode); }
/** * Constructor which creates a CodeableConceptDt with one coding repetition, containing * the given system and code */ public CodeableConceptDt(String theSystem, String theCode) { addCoding().setSystem(theSystem).setCode(theCode); }
coding.setCode("29463-7").setSystem("http://loinc.org").setDisplay("Body Weight");
public static CodeableConceptDt createServiceCategory(String sc, String shortDx, String longDx) { CodeableConceptDt cpt = new CodeableConceptDt(); cpt.setText(longDx); CodingDt coding = new CodingDt(); coding.setCode(sc); coding.setDisplay(shortDx); cpt.getCoding().add(coding); return cpt; }
.addCoding() .setSystem("http://loinc.org") .setCode("789-8") .setDisplay("Erythrocytes [#/volume] in Blood by Automated count"); observation.setValue(
protected MetaDt toMetaDt(Collection<TagDefinition> tagDefinitions) { MetaDt retVal = new MetaDt(); 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; }
private static synchronized void loadServiceCategories() { if (serviceCategories == null) { Map<String, CodeableConceptDt> map = new LinkedHashMap<String, CodeableConceptDt>(); Bundle bundle = ClientUtil.getFhirClient().search().forResource(ValueSet.class) .where(ValueSet.NAME.matchesExactly().value("EncounterType")).execute(); for (ValueSet vs : FhirUtil.getEntries(bundle, ValueSet.class)) { UriDt system = vs.getDefine().getSystemElement(); for (ValueSet.DefineConcept concept : vs.getDefine().getConcept()) { CodeableConceptDt cc = new CodeableConceptDt(); CodingDt coding = cc.addCoding(); coding.setCode(concept.getCode()); coding.setDisplay(concept.getDisplay()); coding.setSystem(system); cc.setText(concept.getDefinition()); map.put(coding.getCode(), cc); } } serviceCategories = map; } return; }