Java Code Examples for org.hl7.fhir.dstu3.model.CodeableConcept#getCoding()

The following examples show how to use org.hl7.fhir.dstu3.model.CodeableConcept#getCoding() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArgonautConverter.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
private CodeableConcept inspectCode(CodeableConcept cc, Coding def) {
	if (cc != null) {
		for (Coding c : cc.getCoding()) {
			if ("http://snomed.info/sct".equals(c.getSystem())) {
				if ("ASSERTION".equals(c.getCode()))
					c.setSystem("http://hl7.org/fhir/v3/ActCode");
			}
			if ("http://hl7.org/fhir/v3/ActCode".equals(c.getSystem()) && "ASSERTION".equals(c.getCode())) {
				if (def == null)
					throw new Error("need a default code");
				c.setSystem(def.getSystem());
				c.setVersion(def.getVersion());
				c.setCode(def.getCode());
				c.setDisplay(def.getDisplay());
			}
		}
	}
	return cc;
}
 
Example 2
Source File: FindingsFormatUtilTest.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void convertCondition20() throws IOException {
	// condition format of HAPI FHIR 2.0
	String oldContent = AllTests.getResourceAsString("/rsc/json/ConditionFormat20.json");
	assertFalse(FindingsFormatUtil.isCurrentFindingsFormat(oldContent));

	Optional<String> newContent = FindingsFormatUtil.convertToCurrentFindingsFormat(oldContent);
	assertTrue(newContent.isPresent());

	IBaseResource resource = AllTests.getJsonParser().parseResource(newContent.get());
	assertTrue(resource instanceof Condition);
	Condition condition = (Condition) resource;

	// category changed from diagnosis to problem-list-item
	List<CodeableConcept> category = condition.getCategory();
	assertFalse(category.isEmpty());
	CodeableConcept code = category.get(0);
	List<Coding> coding = code.getCoding();
	assertFalse(coding.isEmpty());
	assertTrue(coding.get(0).getCode().equals(ConditionCategory.PROBLEMLISTITEM.getCode()));
	// dateRecorded changed to assertedDate
	Date assertedDate = condition.getAssertedDate();
	assertNotNull(assertedDate);
}
 
Example 3
Source File: ProfileUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private boolean hasDescription(Type fixed) {
  if (fixed instanceof Coding) {
    return ((Coding) fixed).hasDisplay();
  } else if (fixed instanceof CodeableConcept) {
    CodeableConcept cc = (CodeableConcept) fixed;
    if (cc.hasText())
      return true;
    for (Coding c : cc.getCoding())
      if (c.hasDisplay())
       return true;
  } // (fixed instanceof CodeType) || (fixed instanceof Quantity);
  return false;
}
 
Example 4
Source File: BaseWorkerContext.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private String cacheId(CodeableConcept cc) {
  StringBuilder b = new StringBuilder();
  for (Coding c : cc.getCoding()) {
    b.append("#");
    b.append(cacheId(c));
  }
  return b.toString();
}
 
Example 5
Source File: BaseWorkerContext.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private ValidationResult verifyCodeInternal(ValueSet vs, CodeableConcept code) throws Exception {
  for (Coding c : code.getCoding()) {
    ValidationResult res = verifyCodeInternal(vs, c.getSystem(), c.getCode(), c.getDisplay());
    if (res.isOk()) {
      return res;
    }
  }
  if (code.getCoding().isEmpty()) {
    return new ValidationResult(IssueSeverity.ERROR, "None code provided");
  } else {
    return new ValidationResult(IssueSeverity.ERROR,
      "None of the codes are in the specified value set");
  }
}
 
Example 6
Source File: ModelUtil.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public static List<ICoding> getCodingsFromConcept(CodeableConcept codeableConcept){
	ArrayList<ICoding> ret = new ArrayList<>();
	List<Coding> coding = codeableConcept.getCoding();
	for (Coding code : coding) {
		ret.add(new CodingWrapper(code));
	}
	return ret;
}
 
Example 7
Source File: ArgonautConverter.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void recordProcedureCode(CodeableConcept code) {
   for (Coding c : code.getCoding()) {
   	count(c, procCodes);
   }
}
 
Example 8
Source File: ArgonautConverter.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void recordConditionCode(CodeableConcept code) {
   for (Coding c : code.getCoding()) {
   	count(c, condCodes);
   }
}
 
Example 9
Source File: ArgonautConverter.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void recordAllergyCode(CodeableConcept code) {
   for (Coding c : code.getCoding()) {
   	count(c, allergyCodes);
   }
}
 
Example 10
Source File: RdfParserBase.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
protected void decorateCodeableConcept(Complex t, CodeableConcept element) {
	for (Coding c : element.getCoding())
		decorateCoding(t, c);
}