@Search private List<IBaseResource> 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<IBaseResource> retVal = new ArrayList<IBaseResource>(); retVal.add(patient); return retVal; } // END SNIPPET: addIncludes
@Search public List<Patient> getAllPatients() { ArrayList<Patient> retVal = new ArrayList<Patient>(); // Create a patient to return Patient patient = new Patient(); patient.setId("Patient/123"); patient.addName().addFamily("Smith").addGiven("John"); // Create a tag list and add it to the resource TagList tags = new TagList(); ResourceMetadataKeyEnum.TAG_LIST.put(patient, tags); // Add some tags to the list tags.addTag(Tag.HL7_ORG_FHIR_TAG, "http://foo/tag1.html", "Some tag"); tags.addTag(Tag.HL7_ORG_FHIR_TAG, "http://foo/tag2.html", "Another tag"); return retVal; } // END SNIPPET: serverMethod
public static void manualContained() { // START SNIPPET: manualContained // Create an organization, and give it a local ID Organization org = new Organization(); org.setId("#localOrganization"); org.getNameElement().setValue("Contained Test Organization"); // Create a patient Patient patient = new Patient(); patient.setId("Patient/1333"); patient.addIdentifier().setSystem("urn:mrns").setValue("253345"); // Set the reference, and manually add the contained resource patient.getManagingOrganization().setReference("#localOrganization"); patient.getContained().getContainedResources().add(org); String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); System.out.println(encoded); // END SNIPPET: manualContained }
theResource.setId(theId.withVersion("2")); MethodOutcome retVal = new MethodOutcome(); retVal.setCreated(true);
patient.setId("Patient/123"); patient.addName().addFamily("Smith").addGiven("John");
patient.setId(IdDt.newRandomUuid());
patient.setId("Patient/123");
while (rs.next()) { /* Do Here */ Patient patient = new Patient(); patient.setId(rs.getString(1)); patient.setName(rs.getString(2)); patient.setLastName(rs.getString(3)); patient.setGender(rs.getString(4)); patient.setAge(rs.getString(5)); patient.setPhoneNumber(rs.getString(6)); patient.setAddress(rs.getString(7)); patient.setDisease(rs.getString(8)); patient.setCondition(rs.getString(9)); patient.setRoomType(rs.getString(10)); patient.setRoomNumber(rs.getString(11)); patient.setDate(rs.getString(12)); patients.add(patient); }
changeUserContext(); Patient patient1 = new Patient(); patient1.setId("321"); patient1.getName().add(hnp.fromString(null, "Smith, Joe")); IdentifierDt ssn = new IdentifierDt(); patient1.setBirthDate(new DateDt("1958-07-27")); Patient patient2 = new Patient(); patient2.setId("123"); patient2.getName().add(hnp.fromString(null, "Doe, Jane")); IdentifierDt ssn2 = new IdentifierDt();