Java Code Examples for org.hl7.fhir.r4.model.Patient#setId()

The following examples show how to use org.hl7.fhir.r4.model.Patient#setId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Example07_ClientReadAndUpdate.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static void main(String[] theArgs) {
   // Create a client
	FhirContext ctx = FhirContext.forR4();
	IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/R4");

	Patient patient = new Patient();
	patient.setId("Patient/example"); // Give the patient an ID
	patient.addName().setFamily("Simpson").addGiven("Homer");
	patient.setGender(Enumerations.AdministrativeGender.MALE);

	// Update the patient
	MethodOutcome outcome = client
        .update()
        .resource(patient)
        .execute();
	
	System.out.println("Now have ID: " + outcome.getId());
}
 
Example 2
Source File: IPatientPatientAttributeMapper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public void elexisToFhir(IPatient source, Patient target, SummaryEnum summaryEnum,
	Set<Include> includes){
	
	target.setId(new IdDt("Patient", source.getId()));
	mapMetaData(source, target);
	if(SummaryEnum.DATA != summaryEnum) {
		mapNarrative(source, target);
	}
	if (SummaryEnum.TEXT == summaryEnum || SummaryEnum.COUNT == summaryEnum) {
		return;
	}
	
	mapIdentifiersAndPatientNumber(source, target);
	target.setName(contactHelper.getHumanNames(source));
	target.setGender(contactHelper.getGender(source.getGender()));
	target.setBirthDate(contactHelper.getBirthDate(source));
	mapAddressTelecom(source, target);
	mapComments(source, target);
	mapMaritalStatus(source, target);
	mapRelatedContacts(source, target);
	mapContactImage(source, target);
}
 
Example 3
Source File: Example01_PatientResourceProvider.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Constructor
 */
public Example01_PatientResourceProvider() {
   Patient pat1 = new Patient();
   pat1.setId("1");
   pat1.addIdentifier().setSystem("http://acme.com/MRNs").setValue("7000135");
   pat1.addName().setFamily("Simpson").addGiven("Homer").addGiven("J");
   myPatients.put("1", pat1);
}
 
Example 4
Source File: Hints.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Constructor */
public Hints() {
	Patient pat1 = new Patient();
	pat1.setId("1");
	pat1.addIdentifier().setSystem("http://acme.com/MRNs").setValue("7000135");
	pat1.addName().setFamily("Simpson").addGiven("Homer").addGiven("J");
	myPatients.put("1", pat1);
}
 
Example 5
Source File: Hints.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Create
public MethodOutcome create(@ResourceParam Patient thePatient) {
	// Give the resource the next sequential ID
	int id = myNextId++;
	thePatient.setId(new IdType(id));

	// Store the resource in memory
	myPatients.put(Integer.toString(id), thePatient);

	// Inform the server of the ID for the newly stored resource
	return new MethodOutcome().setId(thePatient.getIdElement());
}
 
Example 6
Source File: TestData.java    From bunsen with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a FHIR Patient for testing purposes.
 */
public static Patient newPatient() {

  Patient patient = new Patient();

  patient.setId("test-patient");
  patient.setMultipleBirth(new IntegerType(1));

  return patient;
}