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; }
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; }