本文整理汇总了Java中ca.uhn.fhir.model.dstu2.resource.Patient类的典型用法代码示例。如果您正苦于以下问题:Java Patient类的具体用法?Java Patient怎么用?Java Patient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Patient类属于ca.uhn.fhir.model.dstu2.resource包,在下文中一共展示了Patient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onBindViewHolder
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Patient patient = data.get(position);
StringBuilder b = new StringBuilder("Identifier");
for (IdentifierDt i : patient.getIdentifier()) {
if (i.isEmpty()) {
continue;
}
b.append(" ").append(i.getValue());
}
holder.header.setText(b.toString().trim());
String html = patient.getText().getDiv().getValueAsString();
if (html != null && html.length() > 0) {
holder.content.setText(Html.fromHtml(html));
}
}
开发者ID:botunge,项目名称:HapiFhirAndroidSample,代码行数:17,代码来源:PatientListActivity.java
示例2: testServiceCallInRHS
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testServiceCallInRHS() {
Assert.assertNotNull(kBase);
KieSession kSession = kBase.newKieSession();
kSession.setGlobal("myConditionsProviderService", new MyConditionsProviderServiceImpl());
System.out.println(" ---- Starting testServiceCallInRHS() Test ---");
Patient patient = (Patient) new Patient().setId("Patient/1");
FactHandle patientHandle = kSession.insert(patient);
Assert.assertEquals(50, kSession.fireAllRules());
//A modification of the patient will execute the service
patient.addName(new HumanNameDt().addFamily("Richards"));
kSession.update(patientHandle, patient);
Assert.assertEquals(50, kSession.fireAllRules());
System.out.println(" ---- Finished testServiceCallInRHS() Test ---");
kSession.dispose();
}
开发者ID:Salaboy,项目名称:drools-workshop,代码行数:22,代码来源:WrongServiceRulesJUnitTest.java
示例3: testObservationAndPatientRelated
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testObservationAndPatientRelated() {
Assert.assertNotNull(kBase);
KieSession kSession = kBase.newKieSession();
System.out.println(" ---- Starting testObservationAndPatientRelated() Test ---");
Patient patient = (Patient) new Patient().setId("Patient/1");
Observation observation = (Observation) new Observation().setId("Observation/1");
observation.setSubject(new ResourceReferenceDt(patient));
kSession.insert(observation);
Assert.assertEquals(0, kSession.fireAllRules());
System.out.println(" ---- Finished testObservationAndPatientRelated() Test ---");
kSession.dispose();
}
开发者ID:Salaboy,项目名称:drools-workshop,代码行数:18,代码来源:NonFactsRulesJUnitTest.java
示例4: testPatientAndAnRelatedObservation
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testPatientAndAnRelatedObservation() {
Assert.assertNotNull(kBase);
KieSession kSession = kBase.newKieSession();
System.out.println(" ---- Starting testRoomAndHouseRelated() Test ---");
Patient patient = (Patient) new Patient().setId("Patient/1");
kSession.insert(patient);
kSession.insert(new Observation()
.setSubject(new ResourceReferenceDt(patient))
.setId("Observation/1")
);
Assert.assertEquals(2, kSession.fireAllRules());
System.out.println(" ---- Finished testRoomAndHouseRelated() Test ---");
kSession.dispose();
}
开发者ID:Salaboy,项目名称:drools-workshop,代码行数:18,代码来源:MultiConditionRulesJUnitTest.java
示例5: testPersistSearchParamDate
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testPersistSearchParamDate() {
List<Patient> found = toList(ourPatientDao.search(Patient.SP_BIRTHDATE, new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2000-01-01")));
int initialSize2000 = found.size();
found = toList(ourPatientDao.search(Patient.SP_BIRTHDATE, new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2002-01-01")));
int initialSize2002 = found.size();
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:system").setValue("001");
patient.setBirthDate(new DateDt("2001-01-01"));
ourPatientDao.create(patient);
found = toList(ourPatientDao.search(Patient.SP_BIRTHDATE, new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2000-01-01")));
assertEquals(1 + initialSize2000, found.size());
found = toList(ourPatientDao.search(Patient.SP_BIRTHDATE, new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2002-01-01")));
assertEquals(initialSize2002, found.size());
// If this throws an exception, that would be an acceptable outcome as well..
found = toList(ourPatientDao.search(Patient.SP_BIRTHDATE + "AAAA", new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2000-01-01")));
assertEquals(0, found.size());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:26,代码来源:FhirResourceDaoDstu2Test.java
示例6: test20PatientsInALocation
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void test20PatientsInALocation() {
Assert.assertNotNull(kBase);
KieSession kSession = kBase.newKieSession();
System.out.println(" ---- Starting test20PatientsInALocation() Test ---");
Location location = (Location) new FixedCapacityLocation()
.setCapacity(15)
.setId("Location/1");
List<Patient> patients = generatePatients(20);
for(Patient p : patients){
kSession.insert(p);
}
kSession.insert(location);
Assert.assertEquals(1, kSession.fireAllRules());
System.out.println(" ---- Finished test20PatientsInALocation() Test ---");
kSession.dispose();
}
开发者ID:Salaboy,项目名称:drools-workshop,代码行数:22,代码来源:AccumulationRulesJUnitTest.java
示例7: testUpdateWithIfMatch
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testUpdateWithIfMatch() throws Exception {
Patient p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue("001");
String resBody = ourCtx.newXmlParser().encodeResourceToString(p);
HttpPut http;
http = new HttpPut("http://localhost:" + ourPort + "/Patient/2");
http.setEntity(new StringEntity(resBody, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
http.addHeader(Constants.HEADER_IF_MATCH, "\"221\"");
CloseableHttpResponse status = ourClient.execute(http);
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
assertEquals("Patient/2/_history/221", ourLastId.toUnqualified().getValue());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:17,代码来源:ETagServerTest.java
示例8: testOutOfBoundsDate
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
/**
* See issue #50
*/
@Test
public void testOutOfBoundsDate() {
Patient p = new Patient();
p.setBirthDate(new DateDt("2000-15-31"));
String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(p);
ourLog.info(encoded);
assertThat(encoded, StringContains.containsString("2000-15-31"));
p = ourCtx.newXmlParser().parseResource(Patient.class, encoded);
assertEquals("2000-15-31", p.getBirthDateElement().getValueAsString());
assertEquals("2001-03-31", new SimpleDateFormat("yyyy-MM-dd").format(p.getBirthDate()));
ValidationResult result = ourCtx.newValidator().validateWithResult(p);
String resultString = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(result.getOperationOutcome());
ourLog.info(resultString);
assertEquals(2, result.getOperationOutcome().getIssue().size());
assertThat(resultString, StringContains.containsString("cvc-pattern-valid: Value '2000-15-31'"));
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:25,代码来源:ResourceValidatorDstu2Test.java
示例9: main
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@SuppressWarnings("unused")
public static void main(String[] args) throws DataFormatException, IOException {
Patient patient = new Patient();
patient.addIdentifier().setUse(IdentifierUseEnum.OFFICIAL).setSystem("urn:fake:mrns").setValue("7000135");
patient.addIdentifier().setUse(IdentifierUseEnum.SECONDARY).setSystem("urn:fake:otherids").setValue("3287486");
patient.addName().addFamily("Smith").addGiven("John").addGiven("Q").addSuffix("Junior");
patient.setGender(AdministrativeGenderEnum.MALE);
FhirContext ctx = new FhirContext();
String xmlEncoded = ctx.newXmlParser().encodeResourceToString(patient);
String jsonEncoded = ctx.newJsonParser().encodeResourceToString(patient);
MyClientInterface client = ctx.newRestfulClient(MyClientInterface.class, "http://foo/fhir");
IdentifierDt searchParam = new IdentifierDt("urn:someidentifiers", "7000135");
List<Patient> clients = client.findPatientsByIdentifier(searchParam);
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:21,代码来源:QuickUsage.java
示例10: opInstance
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Operation(name="$OP_INSTANCE")
public Parameters opInstance(
@IdParam IdDt theId,
@OperationParam(name="PARAM1") StringDt theParam1,
@OperationParam(name="PARAM2") Patient theParam2
) {
//@formatter:on
ourLastMethod = "$OP_INSTANCE";
ourLastId = theId;
ourLastParam1 = theParam1;
ourLastParam2 = theParam2;
Parameters retVal = new Parameters();
retVal.addParameter().setName("RET1").setValue(new StringDt("RETVAL1"));
return retVal;
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:18,代码来源:OperationServerTest.java
示例11: testEncodeBundleNewBundleNoText
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testEncodeBundleNewBundleNoText() {
ca.uhn.fhir.model.dstu2.resource.Bundle b = new ca.uhn.fhir.model.dstu2.resource.Bundle();
b.getText().setDiv("");
b.getText().getStatus().setValueAsString("");
;
Entry e = b.addEntry();
e.setResource(new Patient());
String val = new FhirContext().newJsonParser().setPrettyPrint(false).encodeResourceToString(b);
ourLog.info(val);
assertThat(val, not(containsString("text")));
val = new FhirContext().newXmlParser().setPrettyPrint(false).encodeResourceToString(b);
ourLog.info(val);
assertThat(val, not(containsString("text")));
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:21,代码来源:JsonParserDstu2Test.java
示例12: codes
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@SuppressWarnings("unused")
public static void codes() {
// START SNIPPET: codes
Patient patient = new Patient();
// You can set this code using a String if you want. Note that
// for "closed" valuesets (such as the one used for Patient.gender)
// you must use one of the strings defined by the FHIR specification.
// You must not define your own.
patient.getGenderElement().setValue("male");
// HAPI also provides Java enumerated types which make it easier to
// deal with coded values. This code achieves the exact same result
// as the code above.
patient.setGender(AdministrativeGenderEnum.MALE);
// You can also retrieve coded values the same way
String genderString = patient.getGenderElement().getValueAsString();
AdministrativeGenderEnum genderEnum = patient.getGenderElement().getValueAsEnum();
// The following is a shortcut to create
patient.setMaritalStatus(MaritalStatusCodesEnum.M);
// END SNIPPET: codes
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:26,代码来源:FhirDataModel.java
示例13: testSearchByString
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testSearchByString() throws Exception {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8"));
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
//@formatter:off
Bundle response = client.search()
.forResource("Patient")
.where(Patient.NAME.matches().value("james"))
.execute();
//@formatter:on
assertEquals("http://example.com/fhir/Patient?name=james", capt.getValue().getURI().toString());
assertEquals(Patient.class, response.getEntries().get(0).getResource().getClass());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:24,代码来源:GenericClientTestDstu2.java
示例14: testIIncludedResourcesNonContainedInExtensionJson
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testIIncludedResourcesNonContainedInExtensionJson() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=extInclude&_pretty=true&_format=json");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = ourCtx.newJsonParser().parseBundle(responseContent);
ourLog.info(responseContent);
assertEquals(3, bundle.size());
assertEquals(new IdDt("Patient/p1"), bundle.toListOfResources().get(0).getId().toUnqualifiedVersionless());
assertEquals(new IdDt("Patient/p2"), bundle.toListOfResources().get(1).getId().toUnqualifiedVersionless());
assertEquals(new IdDt("Organization/o1"), bundle.toListOfResources().get(2).getId().toUnqualifiedVersionless());
assertEquals(BundleEntrySearchModeEnum.INCLUDE, bundle.getEntries().get(2).getSearchMode().getValueAsEnum());
Patient p1 = (Patient) bundle.toListOfResources().get(0);
assertEquals(0, p1.getContained().getContainedResources().size());
Patient p2 = (Patient) bundle.toListOfResources().get(1);
assertEquals(0, p2.getContained().getContainedResources().size());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:26,代码来源:IncludeDstu2Test.java
示例15: searchForPatients
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Search
private List<IResource> searchForPatients() {
// Create an organization
Organization org = new Organization();
org.setId("Organization/65546");
org.setName("Test Organization");
// Create a patient
Patient patient = new Patient();
patient.setId("Patient/1333");
patient.addIdentifier().setSystem("urn:mrns").setValue("253345");
patient.getManagingOrganization().setResource(org);
// Here we return only the patient object, which has links to other resources
List<IResource> retVal = new ArrayList<IResource>();
retVal.add(patient);
return retVal;
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:19,代码来源:IncludesExamples.java
示例16: testSaveAndRetrieveWithContained
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testSaveAndRetrieveWithContained() {
Patient p1 = new Patient();
p1.addIdentifier().setSystem("urn:system:rpdstu2").setValue("testSaveAndRetrieveWithContained01");
Organization o1 = new Organization();
o1.addIdentifier().setSystem("urn:system:rpdstu2").setValue("testSaveAndRetrieveWithContained02");
p1.getManagingOrganization().setResource(o1);
IdDt newId = ourClient.create().resource(p1).execute().getId();
Patient actual = ourClient.read(Patient.class, newId);
assertEquals(1, actual.getContained().getContainedResources().size());
assertThat(actual.getText().getDiv().getValueAsString(), containsString("<td>Identifier</td><td>testSaveAndRetrieveWithContained01</td>"));
Bundle b = ourClient.search().forResource("Patient").where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system:rpdstu2", "testSaveAndRetrieveWithContained01")).prettyPrint().execute();
assertEquals(1, b.size());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:21,代码来源:ResourceProviderDstu2Test.java
示例17: findPatients
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Search
public List<Patient> findPatients(
@RequiredParam(name=Patient.SP_IDENTIFIER) StringParam theParameter,
@Sort SortSpec theSort) {
List<Patient> retVal=new ArrayList<Patient>(); // populate this
// theSort is null unless a _sort parameter is actually provided
if (theSort != null) {
// The name of the param to sort by
String param = theSort.getParamName();
// The sort order, or null
SortOrderEnum order = theSort.getOrder();
// This will be populated if a second _sort was specified
SortSpec subSort = theSort.getChain();
// ...apply the sort...
}
return retVal;
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:24,代码来源:RestfulPatientResourceProviderMore.java
示例18: testReadForcedIdVersionHistory
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testReadForcedIdVersionHistory() throws InterruptedException {
Patient p1 = new Patient();
p1.addIdentifier().setSystem("urn:system").setValue("testReadVorcedIdVersionHistory01");
p1.setId("testReadVorcedIdVersionHistory");
IdDt p1id = ourPatientDao.update(p1).getId();
assertEquals("testReadVorcedIdVersionHistory", p1id.getIdPart());
p1.addIdentifier().setSystem("urn:system").setValue("testReadVorcedIdVersionHistory02");
p1.setId(p1id);
IdDt p1idv2 = ourPatientDao.update(p1).getId();
assertEquals("testReadVorcedIdVersionHistory", p1idv2.getIdPart());
assertNotEquals(p1id.getValue(), p1idv2.getValue());
Patient v1 = ourPatientDao.read(p1id);
assertEquals(1, v1.getIdentifier().size());
Patient v2 = ourPatientDao.read(p1idv2);
assertEquals(2, v2.getIdentifier().size());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:23,代码来源:FhirResourceDaoDstu2Test.java
示例19: testTransactionDeleteNoMatchUrl
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testTransactionDeleteNoMatchUrl() {
String methodName = "testTransactionDeleteNoMatchUrl";
Patient p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.setId("Patient/" + methodName);
IdDt id = ourPatientDao.update(p).getId();
ourLog.info("Created patient, got it: {}", id);
Bundle request = new Bundle();
request.addEntry().getTransaction().setMethod(HTTPVerbEnum.DELETE).setUrl("Patient?identifier=urn%3Asystem%7C" + methodName);
Bundle res = ourSystemDao.transaction(request);
assertEquals(2, res.getEntry().size());
assertEquals(Constants.STATUS_HTTP_204_NO_CONTENT + "", res.getEntry().get(1).getTransactionResponse().getStatus());
try {
ourPatientDao.read(id.toVersionless());
fail();
} catch (ResourceGoneException e) {
// ok
}
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:26,代码来源:FhirSystemDaoDstu2Test.java
示例20: testOneIncludeJson
import ca.uhn.fhir.model.dstu2.resource.Patient; //导入依赖的package包/类
@Test
public void testOneIncludeJson() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_include=foo&_format=json");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
ourLog.info(responseContent);
Bundle bundle = ourCtx.newJsonParser().parseBundle(responseContent);
assertEquals(1, bundle.size());
Patient p = bundle.getResources(Patient.class).get(0);
assertEquals(1, p.getName().size());
assertEquals("Hello", p.getId().getIdPart());
assertEquals("foo", p.getName().get(0).getFamilyFirstRep().getValue());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:20,代码来源:IncludeDstu2Test.java
注:本文中的ca.uhn.fhir.model.dstu2.resource.Patient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论