public org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.instance.model.Narrative src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); copyElement(src, tgt); tgt.setStatus(convertNarrativeStatus(src.getStatus())); tgt.setDiv(src.getDiv()); return tgt; }
public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.dstu2016may.model.Narrative src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); copyElement(src, tgt); tgt.setStatus(convertNarrativeStatus(src.getStatus())); tgt.setDiv(src.getDiv()); return tgt; }
protected String addReference(DomainResource r, String title, String id) throws Exception { if (r.getText() == null) r.setText(new Narrative()); if (r.getText().getDiv() == null) { r.getText().setStatus(NarrativeStatus.GENERATED); new NarrativeGenerator("", "", context).generate(r); } r.setMeta(new Meta().setLastUpdatedElement(InstantType.now())); r.setId(id); feed.getEntry().add(new BundleEntryComponent().setResource(r)); return id; }
/** * @param text - * @return fhir narrative object containing the given text wrapped in an html "div". */ static public Narrative createNarrative( final String text ) { final Narrative narrative = new Narrative(); narrative.setStatus( Narrative.NarrativeStatus.GENERATED ); final XhtmlNode htmlNode = new XhtmlNode( NodeType.Element, "div" ); htmlNode.addText( text ); narrative.setDiv( htmlNode ); return narrative; }
public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.dstu2016may.model.Narrative src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); copyElement(src, tgt); tgt.setStatus(convertNarrativeStatus(src.getStatus())); tgt.setDiv(src.getDiv()); return tgt; }
public org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.instance.model.Narrative src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); copyElement(src, tgt); tgt.setStatus(convertNarrativeStatus(src.getStatus())); tgt.setDiv(src.getDiv()); return tgt; }
public static Narrative newNarrative(NarrativeStatus status, String html) throws IOException, FHIRException { Narrative n = new Narrative(); n.setStatus(status); try { n.setDiv(new XhtmlParser().parseFragment("<div>"+Utilities.escapeXml(html)+"</div>")); } catch (org.hl7.fhir.exceptions.FHIRException e) { throw new FHIRException(e.getMessage(), e); } return n; }
public StructureMap generateMapFromMappings(StructureDefinition sd) throws IOException, FHIRException { String id = getLogicalMappingId(sd); if (id == null) return null; String prefix = ToolingExtensions.readStringExtension(sd, ToolingExtensions.EXT_MAPPING_PREFIX); String suffix = ToolingExtensions.readStringExtension(sd, ToolingExtensions.EXT_MAPPING_SUFFIX); if (prefix == null || suffix == null) return null; // we build this by text. Any element that has a mapping, we put it's mappings inside it.... StringBuilder b = new StringBuilder(); b.append(prefix); ElementDefinition root = sd.getSnapshot().getElementFirstRep(); String m = getMapping(root, id); if (m != null) b.append(m+"\r\n"); addChildMappings(b, id, "", sd, root, false); b.append("\r\n"); b.append(suffix); b.append("\r\n"); StructureMap map = parse(b.toString()); map.setId(tail(map.getUrl())); if (!map.hasStatus()) map.setStatus(PublicationStatus.DRAFT); map.getText().setStatus(NarrativeStatus.GENERATED); map.getText().setDiv(new XhtmlNode(NodeType.Element, "div")); map.getText().getDiv().addTag("pre").addText(render(map)); return map; }
protected String addReference(DomainResource r, String title, String id) throws Exception { if (r.getText() == null) r.setText(new Narrative()); if (r.getText().getDiv() == null) { r.getText().setStatus(NarrativeStatus.GENERATED); new NarrativeGenerator("", "", context).generate(r); } r.setMeta(new Meta().setLastUpdatedElement(InstantType.now())); r.setId(id); feed.getEntry().add(new BundleEntryComponent().setResource(r)); return id; }