Search in sources :

Example 6 with AdministrativeGender

use of org.hl7.fhir.r4.model.Enumerations.AdministrativeGender in project org.hl7.fhir.core by hapifhir.

the class FamilyMemberHistory method setProperty.

@Override
public void setProperty(String name, Base value) throws FHIRException {
    if (name.equals("identifier"))
        this.getIdentifier().add(castToIdentifier(value));
    else if (name.equals("patient"))
        // Reference
        this.patient = castToReference(value);
    else if (name.equals("date"))
        // DateTimeType
        this.date = castToDateTime(value);
    else if (name.equals("status"))
        // Enumeration<FamilyHistoryStatus>
        this.status = new FamilyHistoryStatusEnumFactory().fromType(value);
    else if (name.equals("name"))
        // StringType
        this.name = castToString(value);
    else if (name.equals("relationship"))
        // CodeableConcept
        this.relationship = castToCodeableConcept(value);
    else if (name.equals("gender"))
        // Enumeration<AdministrativeGender>
        this.gender = new AdministrativeGenderEnumFactory().fromType(value);
    else if (name.equals("born[x]"))
        // Type
        this.born = (Type) value;
    else if (name.equals("age[x]"))
        // Type
        this.age = (Type) value;
    else if (name.equals("deceased[x]"))
        // Type
        this.deceased = (Type) value;
    else if (name.equals("note"))
        // Annotation
        this.note = castToAnnotation(value);
    else if (name.equals("condition"))
        this.getCondition().add((FamilyMemberHistoryConditionComponent) value);
    else
        super.setProperty(name, value);
}
Also used : AdministrativeGenderEnumFactory(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGenderEnumFactory)

Example 7 with AdministrativeGender

use of org.hl7.fhir.r4.model.Enumerations.AdministrativeGender in project org.hl7.fhir.core by hapifhir.

the class FamilyMemberHistory method setProperty.

@Override
public Base setProperty(String name, Base value) throws FHIRException {
    if (name.equals("identifier")) {
        this.getIdentifier().add(castToIdentifier(value));
    } else if (name.equals("definition")) {
        this.getDefinition().add(castToReference(value));
    } else if (name.equals("status")) {
        value = new FamilyHistoryStatusEnumFactory().fromType(castToCode(value));
        // Enumeration<FamilyHistoryStatus>
        this.status = (Enumeration) value;
    } else if (name.equals("notDone")) {
        // BooleanType
        this.notDone = castToBoolean(value);
    } else if (name.equals("notDoneReason")) {
        // CodeableConcept
        this.notDoneReason = castToCodeableConcept(value);
    } else if (name.equals("patient")) {
        // Reference
        this.patient = castToReference(value);
    } else if (name.equals("date")) {
        // DateTimeType
        this.date = castToDateTime(value);
    } else if (name.equals("name")) {
        // StringType
        this.name = castToString(value);
    } else if (name.equals("relationship")) {
        // CodeableConcept
        this.relationship = castToCodeableConcept(value);
    } else if (name.equals("gender")) {
        value = new AdministrativeGenderEnumFactory().fromType(castToCode(value));
        // Enumeration<AdministrativeGender>
        this.gender = (Enumeration) value;
    } else if (name.equals("born[x]")) {
        // Type
        this.born = castToType(value);
    } else if (name.equals("age[x]")) {
        // Type
        this.age = castToType(value);
    } else if (name.equals("estimatedAge")) {
        // BooleanType
        this.estimatedAge = castToBoolean(value);
    } else if (name.equals("deceased[x]")) {
        // Type
        this.deceased = castToType(value);
    } else if (name.equals("reasonCode")) {
        this.getReasonCode().add(castToCodeableConcept(value));
    } else if (name.equals("reasonReference")) {
        this.getReasonReference().add(castToReference(value));
    } else if (name.equals("note")) {
        this.getNote().add(castToAnnotation(value));
    } else if (name.equals("condition")) {
        this.getCondition().add((FamilyMemberHistoryConditionComponent) value);
    } else
        return super.setProperty(name, value);
    return value;
}
Also used : AdministrativeGenderEnumFactory(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGenderEnumFactory)

Example 8 with AdministrativeGender

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);
        }
    }
}
Also used : InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) AdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender)

Example 9 with AdministrativeGender

use of org.hl7.fhir.r4.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));
        }
    }
}
Also used : AdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender)

Example 10 with AdministrativeGender

use of org.hl7.fhir.r4.model.Enumerations.AdministrativeGender in project quality-measure-and-cohort-service by Alvearie.

the class FhirTestBase method mockPatientRetrieval.

protected Patient mockPatientRetrieval(String id, AdministrativeGender gender, int ageInYears) {
    Patient patient = getPatient(id, gender, ageInYears);
    mockFhirResourceRetrieval(patient);
    return patient;
}
Also used : Patient(org.hl7.fhir.r4.model.Patient)

Aggregations

Patient (org.hl7.fhir.r4.model.Patient)6 AdministrativeGender (org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender)2 AdministrativeGender (org.hl7.fhir.r4.model.Enumerations.AdministrativeGender)2 InvalidRequestException (ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)1 CqlDataProvider (com.ibm.cohort.cql.data.CqlDataProvider)1 SimpleDateFormat (java.text.SimpleDateFormat)1 OffsetDateTime (java.time.OffsetDateTime)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 AdministrativeGenderEnumFactory (org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGenderEnumFactory)1 AdministrativeGenderEnumFactory (org.hl7.fhir.dstu2016may.model.Enumerations.AdministrativeGenderEnumFactory)1 AdministrativeGenderEnumFactory (org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGenderEnumFactory)1 DataProvider (org.opencds.cqf.cql.engine.data.DataProvider)1