org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem Java Examples
The following examples show how to use
org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.
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: Example04_EncodeResource.java From fhirstarters with BSD 3-Clause "New" or "Revised" License | 6 votes |
public static void main(String[] theArgs) { // Create a Patient Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J"); pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135"); pat.addTelecom().setUse(ContactPointUse.HOME).setSystem(ContactPointSystem.PHONE).setValue("1 (416) 340-4800"); pat.setGender(AdministrativeGender.MALE); // Create a context FhirContext ctx = FhirContext.forDstu3(); // Create a JSON parser IParser parser = ctx.newJsonParser(); parser.setPrettyPrint(true); String encode = parser.encodeResourceToString(pat); System.out.println(encode); }
Example #2
Source File: Convert.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public ContactPoint makeContactFromTEL(Element e) throws Exception { if (e == null) return null; if (e.hasAttribute("nullFlavor")) return null; ContactPoint c = new ContactPoint(); String use = e.getAttribute("use"); if (use != null) { if (use.equals("H") || use.equals("HP") || use.equals("HV")) c.setUse(ContactPointUse.HOME); else if (use.equals("WP") || use.equals("DIR") || use.equals("PUB")) c.setUse(ContactPointUse.WORK); else if (use.equals("TMP")) c.setUse(ContactPointUse.TEMP); else if (use.equals("BAD")) c.setUse(ContactPointUse.OLD); } if (e.getAttribute("value") != null) { String[] url = e.getAttribute("value").split(":"); if (url.length == 1) { c.setValue(url[0].trim()); c.setSystem(ContactPointSystem.PHONE); } else { if (url[0].equals("tel")) c.setSystem(ContactPointSystem.PHONE); else if (url[0].equals("mailto")) c.setSystem(ContactPointSystem.EMAIL); else if (e.getAttribute("value").contains(":")) c.setSystem(ContactPointSystem.OTHER); else c.setSystem(ContactPointSystem.PHONE); c.setValue(url[1].trim()); } } return c; }
Example #3
Source File: IEEE11073Convertor.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private static ConceptMap generateLoincMdcMap(CodeSystem mdc, String dst, String src) throws IOException, FHIRException { ConceptMap cm = new ConceptMap(); cm.setId("loinc-mdc"); cm.setUrl("http:/???/fhir/ConceptMap/loinc-mdc"); cm.setVersion("[todo]"); cm.setName("LoincMdcCrossMap"); cm.setTitle("Cross Map between LOINC and MDC"); cm.setStatus(PublicationStatus.DRAFT); cm.setExperimental(true); cm.setDateElement(new DateTimeType()); cm.setPublisher("HL7, Inc"); ContactDetail cd = cm.addContact(); cd.setName("LOINC + IEEE"); ContactPoint cp = cd.addTelecom(); cp.setSystem(ContactPointSystem.URL); cp.setValue("http://loinc.org"); cm.setDescription("A Cross Map between the LOINC and MDC Code systems"); cm.setPurpose("To implementers map between medical device codes and LOINC codes"); cm.setCopyright("This content LOINC \u00ae is copyright \u00a9 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use"); cm.setSource(new UriType("http://loinc.org/vs")); cm.setTarget(new UriType(MDC_ALL_VALUES)); ConceptMapGroupComponent g = cm.addGroup(); g.setSource("urn:iso:std:iso:11073:10101"); g.setTarget("http://loinc.org"); CSVReader csv = new CSVReader(new FileInputStream(src)); csv.readHeaders(); while (csv.line()) { SourceElementComponent e = g.addElement(); e.setCode(csv.cell("IEEE_CF_CODE10")); e.setDisplay(csv.cell("IEEE_DESCRIPTION")); TargetElementComponent t = e.addTarget(); t.setEquivalence(ConceptMapEquivalence.EQUIVALENT); t.setCode(csv.cell("LOINC_NUM")); t.setDisplay(csv.cell("LOINC_LONG_COMMON_NAME")); } new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(dst, "conceptmap-"+cm.getId()+".xml")), cm); System.out.println("Done"); return cm; }
Example #4
Source File: ResourceUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static void renderContactPoint(StringBuilder b, ContactPoint cp) { if (cp != null && !cp.isEmpty()) { if (cp.getSystem() == ContactPointSystem.EMAIL) b.append("<a href=\"mailto:"+cp.getValue()+"\">"+cp.getValue()+"</a>"); else if (cp.getSystem() == ContactPointSystem.FAX) b.append("Fax: "+cp.getValue()); else if (cp.getSystem() == ContactPointSystem.OTHER) b.append("<a href=\""+cp.getValue()+"\">"+cp.getValue()+"</a>"); else b.append(cp.getValue()); } }
Example #5
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private static String describeSystem(ContactPointSystem system) { if (system == null) return ""; switch (system) { case PHONE: return "ph: "; case FAX: return "fax: "; default: return ""; } }
Example #6
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private void addTelecom(XhtmlNode p, ContactPoint c) { if (c.getSystem() == ContactPointSystem.PHONE) { p.tx("Phone: "+c.getValue()); } else if (c.getSystem() == ContactPointSystem.FAX) { p.tx("Fax: "+c.getValue()); } else if (c.getSystem() == ContactPointSystem.EMAIL) { p.ah( "mailto:"+c.getValue()).addText(c.getValue()); } else if (c.getSystem() == ContactPointSystem.URL) { if (c.getValue().length() > 30) p.ah(c.getValue()).addText(c.getValue().substring(0, 30)+"..."); else p.ah(c.getValue()).addText(c.getValue()); } }
Example #7
Source File: Factory.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
public static ContactPoint newContactPoint(ContactPointSystem system, String value) { ContactPoint res = new ContactPoint(); res.setSystem(system); res.setValue(value); return res; }