當前位置: 首頁>>代碼示例>>Java>>正文


Java IdentifierUse類代碼示例

本文整理匯總了Java中org.hl7.fhir.instance.model.Identifier.IdentifierUse的典型用法代碼示例。如果您正苦於以下問題:Java IdentifierUse類的具體用法?Java IdentifierUse怎麽用?Java IdentifierUse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IdentifierUse類屬於org.hl7.fhir.instance.model.Identifier包,在下文中一共展示了IdentifierUse類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: newPatient

import org.hl7.fhir.instance.model.Identifier.IdentifierUse; //導入依賴的package包/類
public Patient newPatient() {
  final Patient p = new Patient();

  if (rand.nextBoolean()) {
    ObjectId id = new ObjectId();
    p.setId(id.toHexString());
  } else {
    p.setId(UUID.randomUUID().toString());
  }

  p.setGender(rand.nextBoolean() ? AdministrativeGender.MALE
      : AdministrativeGender.FEMALE);
  
  final String ssn =
      String.format("%03d-%02d-%04d", rand.nextInt(999)+1, rand.nextInt(99)+1, rand.nextInt(9999)+1 );
  
  p.addIdentifier(newIdentifier(IdentifierUse.OFFICIAL, "SSN", ssn));

  HumanName bsmith= 
      HumanNameUtil.newHumanName("Bill Smith", new String[] {"Smith"}, new String [] {"Bill"}, null, NameUse.USUAL);
  HumanName wsmith = 
      HumanNameUtil.newHumanName("W Smith", new String[] {"Smith"}, new String [] {"Bill"}, new String [] {"Jr"});
  p.addName(bsmith);
  p.addName(wsmith);

  long msec = (long) (rand.nextFloat() * System.currentTimeMillis());
  p.setBirthDate(new Date(msec));
  
  p.addTelecom((new ContactPointBuilder()).email("[email protected]").home().build());
  p.addTelecom((new ContactPointBuilder()).email("[email protected]").work().build());
  
  p.addTelecom((new ContactPointBuilder()).phone("248.555.0743").home().build());
  p.addTelecom((new ContactPointBuilder()).phone("248.557.1243").work().build());
  
  return p;
}
 
開發者ID:mitre,項目名稱:ptmatchadapter,代碼行數:37,代碼來源:SimplePatientCsvFormatTest.java

示例2: newIdentifier

import org.hl7.fhir.instance.model.Identifier.IdentifierUse; //導入依賴的package包/類
public Identifier newIdentifier(IdentifierUse use, String system, String value) {
  final Identifier id = new Identifier();

  id.setSystem(system);
  id.setUse(use);
  id.setValue(value);
  return id;
}
 
開發者ID:mitre,項目名稱:ptmatchadapter,代碼行數:9,代碼來源:SimplePatientCsvFormatTest.java

示例3: testMoreExtensions

import org.hl7.fhir.instance.model.Identifier.IdentifierUse; //導入依賴的package包/類
@Test
public void testMoreExtensions() throws Exception {

    Patient patient = new Patient();
    patient.addIdentifier().setUse(IdentifierUse.OFFICIAL).setSystem("urn:example").setValue("7000135");

    Extension ext = new Extension();
    ext.setUrl("http://example.com/extensions#someext");
    ext.setValue(new DateTimeType("2011-01-02T11:13:15"));

    // Add the extension to the resource
    patient.getExtension().add(ext);
    // END SNIPPET: resourceExtension

    // START SNIPPET: resourceStringExtension
    HumanName name = patient.addName();
    name.addFamily("Shmoe");
    StringType given = name.addGivenElement();
    given.setValue("Joe");
    Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue(new StringType("given"));
    given.getExtension().add(ext2);

    StringType given2 = name.addGivenElement();
    given2.setValue("Shmoe");
    Extension given2ext = new Extension().setUrl("http://examples.com#givenext_parent");
    given2.getExtension().add(given2ext);
    given2ext.addExtension().setUrl("http://examples.com#givenext_child").setValue(new StringType("CHILD"));
    // END SNIPPET: resourceStringExtension

    // START SNIPPET: subExtension
    Extension parent = new Extension().setUrl("http://example.com#parent");
    patient.getExtension().add(parent);

    Extension child1 = new Extension().setUrl("http://example.com#child").setValue(new StringType("value1"));
    parent.getExtension().add(child1);

    Extension child2 = new Extension().setUrl("http://example.com#child").setValue(new StringType("value1"));
    parent.getExtension().add(child2);
    // END SNIPPET: subExtension

    String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
    ourLog.info(output);

    String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
    assertThat(enc, containsString("<Patient xmlns=\"http://hl7.org/fhir\"><extension><url value=\"http://example.com/extensions#someext\"/><valueDateTime value=\"2011-01-02T11:13:15\"/></extension>"));
    assertThat(
            enc,
            containsString("<extension><extension><url value=\"http://example.com#child\"/><valueString value=\"value1\"/></extension><extension><url value=\"http://example.com#child\"/><valueString value=\"value1\"/></extension><url value=\"http://example.com#parent\"/></extension>"));
    assertThat(enc, containsString("<given value=\"Joe\"><extension><url value=\"http://examples.com#givenext\"/><valueString value=\"given\"/></extension></given>"));
    assertThat(enc, containsString("<given value=\"Shmoe\"><extension><extension><url value=\"http://examples.com#givenext\"/><valueString value=\"given\"/></extension><url value=\"http://examples.com#givenext_child\"/></extension></given>"));
}
 
開發者ID:gajen0981,項目名稱:FHIR-Server,代碼行數:52,代碼來源:JsonParserTest.java

示例4: testMoreExtensions

import org.hl7.fhir.instance.model.Identifier.IdentifierUse; //導入依賴的package包/類
@Test
public void testMoreExtensions() throws Exception {

  Patient patient = new Patient();
  patient.addIdentifier().setUse(IdentifierUse.OFFICIAL).setSystem("urn:example").setValue("7000135");

  Extension ext = new Extension();
  ext.setUrl("http://example.com/extensions#someext");
  ext.setValue(new DateTimeType("2011-01-02T11:13:15"));

  // Add the extension to the resource
  patient.getExtension().add(ext);
  // END SNIPPET: resourceExtension

  // START SNIPPET: resourceStringExtension
  HumanName name = patient.addName();
  name.addFamily("Shmoe");
  StringType given = name.addGivenElement();
  given.setValue("Joe");
  Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue(new StringType("given"));
  given.getExtension().add(ext2);

  StringType given2 = name.addGivenElement();
  given2.setValue("Shmoe");
  Extension given2ext = new Extension().setUrl("http://examples.com#givenext_parent");
  given2.getExtension().add(given2ext);
  given2ext.addExtension().setUrl("http://examples.com#givenext_child").setValue(new StringType("CHILD"));
  // END SNIPPET: resourceStringExtension

  // START SNIPPET: subExtension
  Extension parent = new Extension().setUrl("http://example.com#parent");
  patient.getExtension().add(parent);

  Extension child1 = new Extension().setUrl("http://example.com#child").setValue(new StringType("value1"));
  parent.getExtension().add(child1);

  Extension child2 = new Extension().setUrl("http://example.com#child").setValue(new StringType("value1"));
  parent.getExtension().add(child2);
  // END SNIPPET: subExtension

  String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
  ourLog.info(output);

  String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
  assertThat(enc, containsString(
      "<Patient xmlns=\"http://hl7.org/fhir\"><extension url=\"http://example.com/extensions#someext\"><valueDateTime value=\"2011-01-02T11:13:15\"/></extension>"));
  assertThat(enc, containsString(
      "<extension url=\"http://example.com#parent\"><extension url=\"http://example.com#child\"><valueString value=\"value1\"/></extension><extension url=\"http://example.com#child\"><valueString value=\"value1\"/></extension></extension>"));
  assertThat(enc, containsString(
      "<given value=\"Joe\"><extension url=\"http://examples.com#givenext\"><valueString value=\"given\"/></extension></given>"));
  assertThat(enc, containsString(
      "<given value=\"Shmoe\"><extension url=\"http://examples.com#givenext_parent\"><extension url=\"http://examples.com#givenext_child\"><valueString value=\"CHILD\"/></extension></extension></given>"));
}
 
開發者ID:jamesagnew,項目名稱:hapi-fhir,代碼行數:54,代碼來源:XmlParserHl7OrgDstu2Test.java


注:本文中的org.hl7.fhir.instance.model.Identifier.IdentifierUse類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。