org.hl7.fhir.r4.model.Enumerations.AdministrativeGender Java Examples

The following examples show how to use org.hl7.fhir.r4.model.Enumerations.AdministrativeGender. 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: Example06_ClientCreate.java    From fhirstarters with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static void main(String[] theArgs) {

      Patient pat = new Patient();
      pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J");
      pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135");
      pat.setGender(AdministrativeGender.MALE);

      // Create a context
      FhirContext ctx = FhirContext.forR4();

      // Create a client
      String serverBaseUrl = "http://hapi.fhir.org/baseR4";
      IGenericClient client = ctx.newRestfulGenericClient(serverBaseUrl);

      // Use the client to store a new resource instance
      MethodOutcome outcome = client
         .create()
         .resource(pat)
         .execute();

      // Print the ID of the newly created resource
      System.out.println(outcome.getId());
   }
 
Example #2
Source File: IPatientPatientAttributeMapper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void mapRelatedContacts(IPatient source, Patient target) {
	List<ContactComponent> contacts = new ArrayList<>();

	IPerson legalGuardian = source.getLegalGuardian();
	if (legalGuardian != null) {
		ContactComponent _legalGuardian = new ContactComponent();

		CodeableConcept addCoding = new CodeableConcept().addCoding(new Coding().setCode("N"));
		_legalGuardian.setRelationship(Collections.singletonList(addCoding));
		_legalGuardian.setId(legalGuardian.getId());
		List<HumanName> humanNames = contactHelper.getHumanNames(legalGuardian);
		_legalGuardian.setName((!humanNames.isEmpty()) ? humanNames.get(0) : null);
		List<Address> addresses = contactHelper.getAddresses(legalGuardian);
		_legalGuardian.setAddress((!addresses.isEmpty()) ? addresses.get(0) : null);
		AdministrativeGender gender = contactHelper.getGender(legalGuardian.getGender());
		_legalGuardian.setGender(gender);
		List<ContactPoint> contactPoints = contactHelper.getContactPoints(legalGuardian);
		_legalGuardian.setTelecom(contactPoints);

		contacts.add(_legalGuardian);
	}

	target.setContact(contacts);
}
 
Example #3
Source File: IPatientPatientAttributeMapper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void mapGender(Patient source, IPatient target) {
	AdministrativeGender gender = source.getGender();
	if (gender != null) {
		switch (gender) {
		case FEMALE:
			target.setGender(Gender.FEMALE);
			break;
		case MALE:
			target.setGender(Gender.MALE);
			break;
		case UNKNOWN:
			target.setGender(Gender.UNKNOWN);
			break;
		default:
			target.setGender(Gender.UNDEFINED);
		}
	}
}
 
Example #4
Source File: IContactHelper.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public AdministrativeGender getGender(Gender gender){
	if (gender == Gender.FEMALE) {
		return AdministrativeGender.FEMALE;
	} else if (gender == Gender.MALE) {
		return AdministrativeGender.MALE;
	} else if (gender == Gender.UNKNOWN) {
		return AdministrativeGender.UNKNOWN;
	} else {
		return AdministrativeGender.OTHER;
	}
}