当前位置: 首页>>代码示例>>Java>>正文


Java Patient.addName方法代码示例

本文整理汇总了Java中org.hl7.fhir.instance.model.Patient.addName方法的典型用法代码示例。如果您正苦于以下问题:Java Patient.addName方法的具体用法?Java Patient.addName怎么用?Java Patient.addName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hl7.fhir.instance.model.Patient的用法示例。


在下文中一共展示了Patient.addName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testExtensionOnComposite

import org.hl7.fhir.instance.model.Patient; //导入方法依赖的package包/类
@Test
public void testExtensionOnComposite() throws Exception {

	Patient patient = new Patient();

	HumanName name = patient.addName();
	name.addFamily("Shmoe");
	HumanName given = name.addGiven("Joe");
	Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue( new StringType("Hello"));
	given.getExtension().add(ext2);
	String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
	ourLog.info(output);

	String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
	assertThat(enc, containsString("<name><extension url=\"http://examples.com#givenext\"><valueString value=\"Hello\"/></extension><family value=\"Shmoe\"/><given value=\"Joe\"/></name>"));

	Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, new StringReader(enc));
	assertEquals(1, parsed.getName().get(0).getExtension().size());
	Extension ext = parsed.getName().get(0).getExtension().get(0);
	assertEquals("Hello", ((IPrimitiveType<?>)ext.getValue()).getValue());

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:23,代码来源:XmlParserTest.java

示例2: testExtensionOnPrimitive

import org.hl7.fhir.instance.model.Patient; //导入方法依赖的package包/类
@Test
public void testExtensionOnPrimitive() throws Exception {

	Patient patient = new Patient();

	HumanName name = patient.addName();
	StringType family = name.addFamilyElement();
	family.setValue("Shmoe");

	Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue( new StringType("Hello"));
	family.getExtension().add(ext2);
	String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
	ourLog.info(output);

	String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
	assertThat(enc, containsString("<name><family value=\"Shmoe\"><extension url=\"http://examples.com#givenext\"><valueString value=\"Hello\"/></extension></family></name>"));

	Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, new StringReader(enc));
	assertEquals(1, parsed.getName().get(0).getFamily().get(0).getExtension().size());
	Extension ext = parsed.getName().get(0).getFamily().get(0).getExtension().get(0);
	assertEquals("Hello", ((IPrimitiveType<?>)ext.getValue()).getValue());

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:24,代码来源:XmlParserTest.java

示例3: testExtensionOnComposite

import org.hl7.fhir.instance.model.Patient; //导入方法依赖的package包/类
@Test
public void testExtensionOnComposite() throws Exception {

  Patient patient = new Patient();

  HumanName name = patient.addName();
  name.addFamily("Shmoe");
  HumanName given = name.addGiven("Joe");
  Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue(new StringType("Hello"));
  given.getExtension().add(ext2);
  String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
  ourLog.info(output);

  String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
  assertThat(enc, containsString(
      "<name><extension url=\"http://examples.com#givenext\"><valueString value=\"Hello\"/></extension><family value=\"Shmoe\"/><given value=\"Joe\"/></name>"));

  Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, new StringReader(enc));
  assertEquals(1, parsed.getName().get(0).getExtension().size());
  Extension ext = parsed.getName().get(0).getExtension().get(0);
  assertEquals("Hello", ((IPrimitiveType<?>) ext.getValue()).getValue());

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:24,代码来源:XmlParserHl7OrgDstu2Test.java

示例4: testExtensionOnPrimitive

import org.hl7.fhir.instance.model.Patient; //导入方法依赖的package包/类
@Test
public void testExtensionOnPrimitive() throws Exception {

  Patient patient = new Patient();

  HumanName name = patient.addName();
  StringType family = name.addFamilyElement();
  family.setValue("Shmoe");

  Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue(new StringType("Hello"));
  family.getExtension().add(ext2);
  String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
  ourLog.info(output);

  String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
  assertThat(enc, containsString(
      "<name><family value=\"Shmoe\"><extension url=\"http://examples.com#givenext\"><valueString value=\"Hello\"/></extension></family></name>"));

  Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, new StringReader(enc));
  assertEquals(1, parsed.getName().get(0).getFamily().get(0).getExtension().size());
  Extension ext = parsed.getName().get(0).getFamily().get(0).getExtension().get(0);
  assertEquals("Hello", ((IPrimitiveType<?>) ext.getValue()).getValue());

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:25,代码来源:XmlParserHl7OrgDstu2Test.java

示例5: addNames

import org.hl7.fhir.instance.model.Patient; //导入方法依赖的package包/类
public static void addNames(AdtMessage source, Patient target, Mapper mapper) throws TransformException, MapperException {
    List<HumanName> names = NameConverter.convert(PatientCommon.getPatientNames(source.getPidSegment()), mapper);

    for (HumanName name : names)
        if (name != null)
            target.addName(name);
}
 
开发者ID:endeavourhealth,项目名称:HL7Receiver,代码行数:8,代码来源:PatientCommon.java

示例6: newPatient

import org.hl7.fhir.instance.model.Patient; //导入方法依赖的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

示例7: testMoreExtensions

import org.hl7.fhir.instance.model.Patient; //导入方法依赖的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

示例8: testExtensionOnPrimitive

import org.hl7.fhir.instance.model.Patient; //导入方法依赖的package包/类
@Test
public void testExtensionOnPrimitive() throws Exception {

	Patient patient = new Patient();

	HumanName name = patient.addName();
	StringType family = name.addFamilyElement();
	family.setValue("Shmoe");

	family.addExtension().setUrl("http://examples.com#givenext").setValue( new StringType("Hello"));
	String enc = new FhirContext().newJsonParser().encodeResourceToString(patient);
	ourLog.info(enc);
	//@formatter:off
	assertThat(enc, containsString(("{\n" + 
			"    \"resourceType\":\"Patient\",\n" + 
			"    \"name\":[\n" + 
			"        {\n" + 
			"            \"family\":[\n" + 
			"                \"Shmoe\"\n" + 
			"            ],\n" + 
			"            \"_family\":[\n" + 
			"                {\n" + 
			"                    \"extension\":[\n" + 
			"                        {\n" + 
			"                            \"url\":\"http://examples.com#givenext\",\n" + 
			"                            \"valueString\":\"Hello\"\n" + 
			"                        }\n" + 
			"                    ]\n" + 
			"                }\n" + 
			"            ]\n" + 
			"        }\n" + 
			"    ]\n" + 
			"}").replace("\n", "").replaceAll(" +", "")));
	//@formatter:on

	Patient parsed = new FhirContext().newJsonParser().parseResource(Patient.class, new StringReader(enc));
	assertEquals(1, parsed.getName().get(0).getFamily().get(0).getExtension().size());
	Extension ext = parsed.getName().get(0).getFamily().get(0).getExtension().get(0);
	assertEquals("Hello", ((IPrimitiveType<?>)ext.getValue()).getValue());

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:42,代码来源:JsonParserTest.java

示例9: testMoreExtensions

import org.hl7.fhir.instance.model.Patient; //导入方法依赖的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.Patient.addName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。