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


Java Patient类代码示例

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


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

示例1: testEncodeContainedWithNarrativeIsSuppresed

import org.hl7.fhir.instance.model.Patient; //导入依赖的package包/类
@Test
public void testEncodeContainedWithNarrativeIsSuppresed() throws Exception {
	IParser parser = ourCtx.newXmlParser().setPrettyPrint(true);

	// Create an organization, note that the organization does not have an ID
	Organization org = new Organization();
	org.getNameElement().setValue("Contained Test Organization");
	org.getText().setDivAsString("<div>FOOBAR</div>");

	// Create a patient
	Patient patient = new Patient();
	patient.setId("Patient/1333");
	patient.addIdentifier().setSystem("urn:mrns").setValue( "253345");
	patient.getText().setDivAsString("<div>BARFOO</div>");
	patient.getManagingOrganization().setResource(org);
	
	String encoded = parser.encodeResourceToString(patient);
	ourLog.info(encoded);
	assertThat(encoded, not(containsString("FOOBAR")));
	assertThat(encoded, (containsString("BARFOO")));
	
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:23,代码来源:XmlParserTest.java

示例2: buidContactInfo

import org.hl7.fhir.instance.model.Patient; //导入依赖的package包/类
/**
 * Concatenate contact point information as a string of comma-separated
 * values.
 * 
 * @param patient
 * @return String containing comma-separated list of contact information
 */
private String buidContactInfo(Patient patient) {
  final StringBuilder sb = new StringBuilder(100);

  List<ContactPoint> matches = ContactPointUtil.find(patient.getTelecom(),
      ContactPointSystem.PHONE, ContactPointUse.MOBILE);

  if (matches.size() > 0) {
    sb.append(matches.get(0).getValue());
  }

  for (ContactPointSystem system : telecomSystems) {
    for (ContactPointUse use : telecomUses) {
      matches = ContactPointUtil.find(patient.getTelecom(), system, use);
      sb.append(COMMA);
      if (matches.size() > 0) {
        sb.append(matches.get(0).getValue());
      }
    }
  }

  return sb.toString();
}
 
开发者ID:mitre,项目名称:ptmatchadapter,代码行数:30,代码来源:SimplePatientCsvFormat.java

示例3: testToCsv

import org.hl7.fhir.instance.model.Patient; //导入依赖的package包/类
@Test
public void testToCsv() {
  final SimplePatientCsvFormat fmt = new SimplePatientCsvFormat();

  Patient patient = newPatient();

  
  JXPathContext patientCtx = JXPathContext.newContext(patient);
  Pointer ptr = patientCtx.getPointer("identifier[system='SSN']");
  assertNotNull(ptr);
  Identifier id = (Identifier) ptr.getValue();
  if (id != null) {
    assertNotNull("ssn", id.getValue());
  }
  Object obj1 = ptr.getNode();

  ptr = patientCtx.getPointer("name[use='official']");
  assertNotNull(ptr);
  Object obj2 = ptr.getValue();
  ptr = patientCtx.getPointer("name[not(use)]");
  assertNotNull(ptr);
  obj2 = ptr.getValue();
  
  String str = fmt.toCsv(patient);
  LOG.info("CSV: {}", str);
  assertTrue(str.length() > 0);
  // Ensure the literal, null doesn't appear
  assertTrue(!str.contains("null"));
  // Ensure there is no sign of array delimiters
  assertTrue(!str.contains("["));
  // Ensure line doesn't end with a comma
  assertTrue(!str.endsWith(","));
  assertTrue(str.contains("Smith"));
  
  List<ContactPoint> matches = ContactPointUtil.find(
      patient.getTelecom(), ContactPointSystem.PHONE, ContactPointUse.WORK);
  assertNotNull(matches);
  assertNotNull(matches.get(0));
}
 
开发者ID:mitre,项目名称:ptmatchadapter,代码行数:40,代码来源:SimplePatientCsvFormatTest.java

示例4: testEncodeBundleCategory

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

	Bundle b = new Bundle();
	BundleEntryComponent e = b.addEntry();
	e.setResource(new Patient());
	e.getResource().getMeta().addTag().setSystem("scheme").setCode( "term").setDisplay( "label");

	String val = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(b);
	ourLog.info(val);

	assertThat(val, StringContains.containsString("<category term=\"term\" label=\"label\" scheme=\"scheme\"/>"));

	b = ourCtx.newXmlParser().parseResource(Bundle.class, val);
	assertEquals(1, b.getEntry().size());
	assertEquals(1, b.getEntry().get(0).getResource().getMeta().getTag().size());
	assertEquals("scheme", b.getEntry().get(0).getResource().getMeta().getTag().get(0).getSystem());
	assertEquals("term", b.getEntry().get(0).getResource().getMeta().getTag().get(0).getCode());
	assertEquals("label", b.getEntry().get(0).getResource().getMeta().getTag().get(0).getDisplay());
	assertNull(b.getEntry().get(0).getResource());

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

示例5: testEncodeExtensionWithResourceContent

import org.hl7.fhir.instance.model.Patient; //导入依赖的package包/类
@Test
public void testEncodeExtensionWithResourceContent() {
	IParser parser = ourCtx.newXmlParser();

	Patient patient = new Patient();
	patient.addAddress().setUse(AddressUse.HOME);
	patient.addExtension().setUrl("urn:foo").setValue( new Reference("Organization/123"));

	String val = parser.encodeResourceToString(patient);
	ourLog.info(val);
	assertThat(val, StringContains.containsString("<extension url=\"urn:foo\"><valueResource><reference value=\"Organization/123\"/></valueResource></extension>"));

	Patient actual = parser.parseResource(Patient.class, val);
	assertEquals(AddressUse.HOME, patient.getAddress().get(0).getUse());
	List<Extension> ext = actual.getExtension();
	assertEquals(1, ext.size());
	Reference ref = (Reference) ext.get(0).getValue();
	assertEquals("Organization/123", ref.getReference());

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

示例6: testEncodeNarrativeBlockInBundle

import org.hl7.fhir.instance.model.Patient; //导入依赖的package包/类
@Test
public void testEncodeNarrativeBlockInBundle() throws Exception {
	Patient p = new Patient();
	p.addIdentifier().setSystem("foo").setValue("bar");
	p.getText().setStatus(NarrativeStatus.GENERATED);
	p.getText().setDivAsString("<div>hello</div>");

	Bundle b = new Bundle();
	b.setTotal(123);
	b.addEntry().setResource(p);

	String out = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(b);
	ourLog.info(out);
	assertThat(out, containsString("<div xmlns=\"http://www.w3.org/1999/xhtml\">hello</div>"));

	p.getText().setDivAsString("<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">hello</xhtml:div>");
	out = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(b);
	ourLog.info(out);
	assertThat(out, containsString("<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">hello</xhtml:div>"));

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

示例7: testEncodeResourceRef

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

	Patient patient = new Patient();
	patient.setManagingOrganization(new Reference());

	IParser p = ourCtx.newXmlParser();
	String str = p.encodeResourceToString(patient);
	assertThat(str, IsNot.not(StringContains.containsString("managingOrganization")));

	Reference ref = new Reference();
	ref.setReference("Organization/123");
	ref.setDisplay("DISPLAY!");
	patient.setManagingOrganization(ref);
	str = p.encodeResourceToString(patient);
	assertThat(str, StringContains.containsString("<managingOrganization><reference value=\"Organization/123\"/><display value=\"DISPLAY!\"/></managingOrganization>"));

	Organization org = new Organization();
	org.addIdentifier().setSystem("foo").setValue("bar");
	patient.setManagingOrganization(new Reference(org));
	str = p.encodeResourceToString(patient);
	assertThat(str, StringContains.containsString("<contained><Organization"));

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

示例8: testEncodeUndeclaredExtensionWithAddressContent

import org.hl7.fhir.instance.model.Patient; //导入依赖的package包/类
@Test
public void testEncodeUndeclaredExtensionWithAddressContent() {
	IParser parser = ourCtx.newXmlParser();

	Patient patient = new Patient();
	patient.addAddress().setUse(AddressUse.HOME);
	patient.addExtension().setUrl("urn:foo").setValue(new Address().addLine("line1"));

	String val = parser.encodeResourceToString(patient);
	ourLog.info(val);
	assertThat(val, StringContains.containsString("<extension url=\"urn:foo\"><valueAddress><line value=\"line1\"/></valueAddress></extension>"));

	MyPatientWithOneDeclaredAddressExtension actual = parser.parseResource(MyPatientWithOneDeclaredAddressExtension.class, val);
	assertEquals(AddressUse.HOME, patient.getAddress().get(0).getUse());
	Address ref = actual.getFoo();
	assertEquals("line1", ref.getLine().get(0).getValue());

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

示例9: 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

示例10: 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

示例11: testReEncode

import org.hl7.fhir.instance.model.Patient; //导入依赖的package包/类
@Test
public void testReEncode() throws SAXException, IOException {

	//@formatter:off
	String msg = "<Patient xmlns=\"http://hl7.org/fhir\">" 
			+ "<identifier><label value=\"SSN\" /><system value=\"http://orionhealth.com/mrn\" /><value value=\"PRP1660\" /></identifier>"
			+ "</Patient>";
	//@formatter:on

	Patient patient1 = ourCtx.newXmlParser().parseResource(Patient.class, msg);
	String encoded1 = ourCtx.newXmlParser().encodeResourceToString(patient1);

	Diff d = new Diff(new StringReader(msg), new StringReader(encoded1));
	assertTrue(d.toString(), d.identical());

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

示例12: testParseWithXmlHeader

import org.hl7.fhir.instance.model.Patient; //导入依赖的package包/类
@Test
public void testParseWithXmlHeader() throws ConfigurationException, DataFormatException {
	IParser p = ourCtx.newXmlParser();

	//@formatter:off
	String msg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
			"<Patient xmlns=\"http://hl7.org/fhir\">\n" + 
			"	<identifier>\n" + 
			"		<label value=\"IdentifierLabel\"/>\n" + 
			"	</identifier>\n" + 
			"</Patient>";
	//@formatter:on

	Patient resource = (Patient) p.parseResource(msg);
	assertEquals("IdentifierLabel", resource.getIdentifier().get(0).getLabel());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:17,代码来源:XmlParserTest.java

示例13: testEncodeNarrativeBlockInBundle

import org.hl7.fhir.instance.model.Patient; //导入依赖的package包/类
@Test
public void testEncodeNarrativeBlockInBundle() throws Exception {
	Patient p = new Patient();
	p.addIdentifier().setSystem("foo").setValue("bar");
	p.getText().setStatus(NarrativeStatus.GENERATED);
	p.getText().setDivAsString("<div>hello</div>");

	Bundle b = new Bundle();
	b.setTotal(123);
	b.addEntry().setResource(p);

	String out = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b);
	ourLog.info(out);
	assertThat(out, containsString("<div>hello</div>"));

	p.getText().setDivAsString("<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">hello</xhtml:div>");
	out = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b);
	ourLog.info(out);
	// Backslashes need to be escaped because they are in a JSON value
	assertThat(out, containsString("<xhtml:div xmlns:xhtml=\\\"http://www.w3.org/1999/xhtml\\\">hello</xhtml:div>"));

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

示例14: testEncodeNonContained

import org.hl7.fhir.instance.model.Patient; //导入依赖的package包/类
@Test
public void testEncodeNonContained() {
	Organization org = new Organization();
	org.setId("Organization/65546");
	org.getNameElement().setValue("Contained Test Organization");

	Patient patient = new Patient();
	patient.setId("Patient/1333");
	patient.addIdentifier().setSystem("urn:mrns").setValue("253345");
	patient.getManagingOrganization().setResource(org);
	
	Bundle b = new Bundle();
	b.addEntry().setResource(patient);
	
	String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b);
	ourLog.info(encoded);
	assertThat(encoded, not(containsString("contained")));
	assertThat(encoded, containsString("\"reference\":\"Organization/65546\""));
	
	encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient);
	ourLog.info(encoded);
	assertThat(encoded, not(containsString("contained")));
	assertThat(encoded, containsString("\"reference\":\"Organization/65546\""));
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:25,代码来源:JsonParserTest.java

示例15: testEncodeIds

import org.hl7.fhir.instance.model.Patient; //导入依赖的package包/类
@Test
	public void testEncodeIds() {
		Patient pt = new Patient();
		pt.addIdentifier().setSystem("sys").setValue( "val");
		
		List_ list = new List_();
		list.setId("listId");
		list.addEntry().setItem(new Reference(pt)).setDeleted(true);
		
		String enc = ourCtx.newJsonParser().encodeResourceToString(list);
		ourLog.info(enc);
		
		assertThat(enc, containsString("\"id\":\"1\""));
		
		List_ parsed = ourCtx.newJsonParser().parseResource(List_.class,enc);
		assertEquals(Patient.class, parsed.getEntry().get(0).getItem().getResource().getClass());

		enc = enc.replace("\"id\"", "\"_id\"");
		parsed = ourCtx.newJsonParser().parseResource(List_.class,enc);
		assertEquals(Patient.class, parsed.getEntry().get(0).getItem().getResource().getClass());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:22,代码来源:JsonParserTest.java


注:本文中的org.hl7.fhir.instance.model.Patient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。