Java Code Examples for org.hl7.fhir.dstu3.model.ContactPoint#setValue()

The following examples show how to use org.hl7.fhir.dstu3.model.ContactPoint#setValue() . 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: Convert.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
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 2
Source File: IEEE11073Convertor.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
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 3
Source File: Example02_EnumeratedTypes.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void main(String[] theArgs) {

      Patient pat = new Patient();

      pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J");
      pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135");

      // Enumerated types are provided for many coded elements
      ContactPoint contact = pat.addTelecom();
      contact.setUse(ContactPoint.ContactPointUse.HOME);
      contact.setSystem(ContactPoint.ContactPointSystem.PHONE);
      contact.setValue("1 (416) 340-4800");

      pat.setGender(Enumerations.AdministrativeGender.MALE);
   }
 
Example 4
Source File: Example02_EnumeratedTypes.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void main(String[] theArgs) {

      Patient pat = new Patient();

      pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J");
      pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135");

      // Enumerated types are provided for many coded elements
      ContactPoint contact = pat.addTelecom();
      contact.setUse(ContactPoint.ContactPointUse.HOME);
      contact.setSystem(ContactPoint.ContactPointSystem.PHONE);
      contact.setValue("1 (416) 340-4800");

      pat.setGender(Enumerations.AdministrativeGender.MALE);
   }