use of org.hl7.fhir.r4.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.r4.model.Enumerations.AdministrativeGender in project quality-measure-and-cohort-service by Alvearie.
the class FhirTestBase method mockPatientRetrievalTimeout.
protected Patient mockPatientRetrievalTimeout(String id, AdministrativeGender gender, int ageInYears, int delayMillis) {
Patient patient = getPatient(id, gender, ageInYears);
mockeDelayedFhirResourceRetrieval(get(urlEqualTo("/" + patient.getClass().getSimpleName() + "/" + patient.getId() + "?_format=json")), getFhirParser(), patient, getFhirServerConfig(), 200, delayMillis);
return patient;
}
use of org.hl7.fhir.r4.model.Enumerations.AdministrativeGender in project quality-measure-and-cohort-service by Alvearie.
the class FhirTestBase method getPatient.
protected Patient getPatient(String id, AdministrativeGender gender, int ageInYears) {
OffsetDateTime birthDate;
Patient patient = new Patient();
patient.setId(id);
patient.setGender(gender);
birthDate = OffsetDateTime.now().minusYears(ageInYears);
patient.setBirthDate(Date.from(birthDate.toInstant()));
return patient;
}
use of org.hl7.fhir.r4.model.Enumerations.AdministrativeGender in project quality-measure-and-cohort-service by Alvearie.
the class FhirTestBase method getPatient.
protected Patient getPatient(String id, Enumerations.AdministrativeGender administrativeGender, String birthDateStr) throws ParseException {
Patient patient = new Patient();
patient.setId(id);
patient.setGender(administrativeGender);
if (birthDateStr != null) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date birthDate = format.parse(birthDateStr);
patient.setBirthDate(birthDate);
}
return patient;
}
use of org.hl7.fhir.r4.model.Enumerations.AdministrativeGender in project quality-measure-and-cohort-service by Alvearie.
the class R4DataProviderFactoryTest method verifyDataProviderMap.
private void verifyDataProviderMap(Map<String, CqlDataProvider> dataProviderMap) {
Assert.assertEquals(1, dataProviderMap.size());
DataProvider dataProvider = dataProviderMap.get(R4DataProviderFactory.FHIR_R4_URL);
Iterable<Object> iterable = dataProvider.retrieve("Patient", "id", PATIENT_ID, "Patient", null, null, null, null, null, null, null, null);
List<Object> list = new ArrayList<>();
iterable.forEach(list::add);
Assert.assertEquals(1, list.size());
Object possiblePatient = list.get(0);
Assert.assertTrue("Returned value not type Patient", possiblePatient instanceof Patient);
Patient patient = (Patient) possiblePatient;
AdministrativeGender actual = patient.getGender();
Assert.assertEquals(AdministrativeGender.OTHER, actual);
}
Aggregations