本文整理汇总了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;
}
示例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;
}
示例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>"));
}
示例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>"));
}