Java Code Examples for org.hl7.fhir.dstu3.model.Annotation

The following examples show how to use org.hl7.fhir.dstu3.model.Annotation. These examples are extracted from open source projects. 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 Project: org.hl7.fhir.core   Source File: NarrativeGenerator.java    License: Apache License 2.0 5 votes vote down vote up
private void renderAnnotation(Annotation a, XhtmlNode x, boolean showCodeDetails) throws FHIRException {
  StringBuilder s = new StringBuilder();
  if (a.hasAuthor()) {
    s.append("Author: ");

    if (a.hasAuthorReference())
      s.append(a.getAuthorReference().getReference());
    else if (a.hasAuthorStringType())
      s.append(a.getAuthorStringType().getValue());
  }


  if (a.hasTimeElement()) {
    if (s.length() > 0)
      s.append("; ");

    s.append("Made: ").append(a.getTimeElement().toHumanDisplay());
  }

  if (a.hasText()) {
    if (s.length() > 0)
      s.append("; ");

    s.append("Annotation: ").append(a.getText());
  }

  x.addText(s.toString());
}
 
Example 2
Source Project: elexis-3-core   Source File: ConditionAccessor.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public void addNote(DomainResource resource, String text){
	org.hl7.fhir.dstu3.model.Condition fhirCondition =
		(org.hl7.fhir.dstu3.model.Condition) resource;
	Annotation annotation = new Annotation();
	annotation.setText(text);
	fhirCondition.addNote(annotation);
}
 
Example 3
Source Project: elexis-3-core   Source File: ConditionAccessor.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public void removeNote(DomainResource resource, String text){
	org.hl7.fhir.dstu3.model.Condition fhirCondition =
		(org.hl7.fhir.dstu3.model.Condition) resource;
	List<Annotation> notes = new ArrayList<Annotation>(fhirCondition.getNote());
	notes = notes.stream().filter(annotation -> !text.equals(annotation.getText()))
		.collect(Collectors.toList());
	fhirCondition.setNote(notes);
}
 
Example 4
Source Project: org.hl7.fhir.core   Source File: NarrativeGenerator.java    License: Apache License 2.0 4 votes vote down vote up
private void renderAnnotation(Annotation annot, XhtmlNode x) {
  x.addText(annot.getText());
}
 
Example 5
Source Project: cqf-ruler   Source File: AnnotationBuilder.java    License: Apache License 2.0 4 votes vote down vote up
public AnnotationBuilder() {
    super(new Annotation());
}
 
Example 6
Source Project: elexis-3-core   Source File: ConditionAccessor.java    License: Eclipse Public License 1.0 4 votes vote down vote up
public List<String> getNotes(DomainResource resource){
	org.hl7.fhir.dstu3.model.Condition fhirCondition =
		(org.hl7.fhir.dstu3.model.Condition) resource;
	List<Annotation> notes = fhirCondition.getNote();
	return notes.stream().map(annotation -> annotation.getText()).collect(Collectors.toList());
}
 
Example 7
Source Project: bunsen   Source File: TestData.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Returns a FHIR medication request for testing purposes.
 */
public static MedicationRequest newMedRequest() {

  MedicationRequest medReq = new MedicationRequest();

  medReq.setId("test-med");

  // Medication code
  CodeableConcept med = new CodeableConcept();
  med.addCoding()
      .setSystem("http://www.nlm.nih.gov/research/umls/rxnorm")
      .setCode("582620")
      .setDisplay("Nizatidine 15 MG/ML Oral Solution [Axid]");

  med.setText("Nizatidine 15 MG/ML Oral Solution [Axid]");

  medReq.setMedication(med);

  Annotation annotation = new Annotation();

  annotation.setText("Test medication note.");

  annotation.setAuthor(
      new Reference("Provider/example")
          .setDisplay("Example provider."));

  medReq.addNote(annotation);

  return medReq;
}