function Patient(fhirpatient) {
    var patient = fhirpatient;

    return {
        "lastname": () => {
            if (patient.name) {
                var nameElement = patient.name.find((element) => {
                    return (element.use == "usual");
                });
                if (nameElement)
                    return nameElement.family;
            }
            return undefined;
        },
        "gender": () => {
            if(patient.gender)
                return patient.gender;
            return undefined;
            
        },
        "date": () => {
            if(patient.birthDate)
                return patient.birthDate;
        },
        "home": () => {
            if (patient.address) {
                var addressElement = patient.address.find((element) => {
                    return (element.use == "home");
                });
                if (addressElement)
                    return (addressElement.postalCode + " " + addressElement.city);
            }
            return undefined;
        },
        "country": () => {
            if (patient.address) {
                var addressElement = patient.address.find((element) => {
                    return (element.use == "home");
                });
                if (addressElement)
                    return (addressElement.country);
            }
            return undefined;
        },
    }
}