use of org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method valiateGender.
private void valiateGender(Patient patient) {
AdministrativeGender gender = patient.getGender();
if (gender != null) {
EnumSet<AdministrativeGender> genderList = EnumSet.allOf(AdministrativeGender.class);
Boolean valid = false;
for (AdministrativeGender genderItem : genderList) {
if (genderItem.toCode().equalsIgnoreCase(gender.toString())) {
valid = true;
break;
}
}
if (!valid) {
throw OperationOutcomeFactory.buildOperationOutcomeException(new InvalidRequestException(String.format("The supplied Patient gender %s is an unrecognised type.", gender)), SystemCode.BAD_REQUEST, IssueType.INVALID);
}
}
}
use of org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method validateGender.
// validateTelecomAndAddress
private void validateGender(Patient patient) {
AdministrativeGender gender = patient.getGender();
if (gender != null) {
EnumSet<AdministrativeGender> genderList = EnumSet.allOf(AdministrativeGender.class);
Boolean valid = false;
for (AdministrativeGender genderItem : genderList) {
if (genderItem.toCode().equalsIgnoreCase(gender.toString())) {
valid = true;
break;
}
}
if (!valid) {
throwInvalidRequest400_BadRequestException(String.format("The supplied Patient gender %s is an unrecognised type.", gender));
}
}
}
Aggregations