Java Code Examples for org.hl7.fhir.dstu3.model.Coding#getCode()

The following examples show how to use org.hl7.fhir.dstu3.model.Coding#getCode() . 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: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("rawtypes")
private String describeTransformCCorC(StructureMapGroupRuleTargetComponent tgt) throws FHIRException {
  if (tgt.getParameter().size() < 2)
    return null;
  Type p1 = tgt.getParameter().get(0).getValue();
  Type p2 = tgt.getParameter().get(1).getValue();
  if (p1 instanceof IdType || p2 instanceof IdType)
    return null;
  if (!(p1 instanceof PrimitiveType) || !(p2 instanceof PrimitiveType))
    return null;
  String uri = ((PrimitiveType) p1).asStringValue();
  String code = ((PrimitiveType) p2).asStringValue();
  if (Utilities.noString(uri))
    throw new FHIRException("Describe Transform, but the uri is blank");
  if (Utilities.noString(code))
    throw new FHIRException("Describe Transform, but the code is blank");
  Coding c = buildCoding(uri, code);
  return NarrativeGenerator.describeSystem(c.getSystem())+"#"+c.getCode()+(c.hasDisplay() ? "("+c.getDisplay()+")" : "");
}
 
Example 2
Source File: ArgonautConverter.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void count(Coding c, Map<String, Integer> map) {
	String s = c.getSystem()+"::"+c.getCode();
	if (map.containsKey(s))
		map.put(s, map.get(s)+1);
	else
		map.put(s, 1);
}
 
Example 3
Source File: ProfileUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private String summariseCoding(Coding value) {
  String uri = value.getSystem();
  String system = NarrativeGenerator.describeSystem(uri);
  if (Utilities.isURL(system)) {
    if (system.equals("http://cap.org/protocols"))
      system = "CAP Code";
  }
  return system+" "+value.getCode();
}
 
Example 4
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void renderCoding(Coding c, XhtmlNode x, boolean showCodeDetails) {
  String s = "";
  if (c.hasDisplayElement())
    s = c.getDisplay();
  if (Utilities.noString(s))
    s = lookupCode(c.getSystem(), c.getCode());

  if (Utilities.noString(s))
    s = c.getCode();

  if (showCodeDetails) {
    x.addText(s+" (Details: "+describeSystem(c.getSystem())+" code "+c.getCode()+" = '"+lookupCode(c.getSystem(), c.getCode())+"', stated as '"+c.getDisplay()+"')");
  } else
    x.span(null, "{"+c.getSystem()+" "+c.getCode()+"}").addText(s);
}
 
Example 5
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private String getCodingReference(Coding cc, String system) {
  if (cc.getSystem().equals(system))
    return "#"+cc.getCode();
  if (cc.getSystem().equals("http://snomed.info/sct"))
    return "http://snomed.info/sct/"+cc.getCode();
  if (cc.getSystem().equals("http://loinc.org"))
    return "http://s.details.loinc.org/LOINC/"+cc.getCode()+".html";
  return null;
}
 
Example 6
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public String gen(Coding code) {
 if (code == null)
 	return null;
 if (code.hasDisplayElement())
 	return code.getDisplay();
 if (code.hasCodeElement())
 	return code.getCode();
 return null;
}
 
Example 7
Source File: CodingUtilities.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
public static String present(Coding coding) {
  if (coding == null)
    return "";
  return coding.getSystem()+"::"+coding.getCode();
}
 
Example 8
Source File: BaseWorkerContext.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private String cacheId(Coding coding) {
  return "|" + coding.getSystem() + "|" + coding.getVersion() + "|" + coding.getCode() + "|"
    + coding.getDisplay();
}