public void GivenIStoreThePatientInTheRegisterPatientResourceFormat()
        {
            Patients.Count.ShouldBeGreaterThanOrEqualTo(1, "No patients were returned for the patient search.");

            var patient = Patients.First();

            var registerPatient = new Patient();

            var identifier = patient.Identifier.FirstOrDefault(x => x.System == FhirConst.IdentifierSystems.kNHSNumber);

            if (identifier != null)
            {
                registerPatient.Identifier.Add(new Identifier(identifier.System, identifier.Value));
            }

            var name = patient.Name.First();

            if (name != null)
            {
                registerPatient.Name.Add(NameHelper.CreateOfficialName("GPConnectGivenName", "GPConnectFamilyName"));
            }

            registerPatient.Gender           = patient.Gender ?? AdministrativeGender.Unknown;
            registerPatient.BirthDateElement = patient.BirthDateElement ?? new Date();

            _fhirResourceRepository.Patient = registerPatient;
        }
        public void CreateAPatientWhichDoesNoteExistOnPDSAndStoreIt()
        {
            // amended github ref 115 (demonstrator)
            // RMB 24-10-2018
            //            var patientIdentifier = new Identifier(FhirConst.IdentifierSystems.kNHSNumber, "9019546082");
            var nhsNumber         = GlobalContext.PatientNhsNumberMap["patient14"];
            var patientIdentifier = new Identifier(FhirConst.IdentifierSystems.kNHSNumber, nhsNumber);

            patientIdentifier.Extension.Add(new Extension
            {
                Url   = FhirConst.StructureDefinitionSystems.kExtCcGpcNhsNumVerification,
                Value = new CodeableConcept(FhirConst.CodeSystems.kCcNhsNumVerification, "01", "Number present and verified")
            });

            var returnPatient = new Patient
            {
                Name = new List <HumanName>
                {
                    NameHelper.CreateOfficialName("GPConnectGivenName", "GPConnectFamilyName")
                },
                Gender           = AdministrativeGender.Other,
                BirthDateElement = new Date("2017-05-05"),
                Identifier       = new List <Identifier>
                {
                    patientIdentifier
                }
            };

            _fhirResourceRepository.Patient = returnPatient;
        }
        public void SetTheStoredPatientDemographicsToNotMatchTheNhsNumber()
        {
            _fhirResourceRepository.Patient.Name = new List <HumanName>
            {
                NameHelper.CreateOfficialName("GPConnectGivenName", "GPConnectFamilyName")
            };

            _fhirResourceRepository.Patient.Gender = AdministrativeGender.Other;

            _fhirResourceRepository.Patient.BirthDateElement = new Date("2017-05-05");
        }
Exemple #4
0
        public Patient BuildPatient()
        {
            var patientIdentifier = new Identifier(FhirConst.IdentifierSystems.kNHSNumber, _registerPatient.SPINE_NHS_NUMBER);

            patientIdentifier.Extension.Add(new Extension
            {
                Url   = FhirConst.StructureDefinitionSystems.kExtCcGpcNhsNumVerification,
                Value = new CodeableConcept(FhirConst.CodeSystems.kCcNhsNumVerification, "01", "Number present and verified", null)
            });

            var patientToRegister = new Patient
            {
                BirthDateElement = new Date(_registerPatient.DOB),
                Name             = new List <HumanName>
                {
                    NameHelper.CreateOfficialName(_registerPatient.NAME_GIVEN, _registerPatient.NAME_FAMILY)
                },
                Identifier = new List <Identifier>
                {
                    patientIdentifier
                }
            };

            //SJD 31/07/2019 #269 meta.profile added to request payload
            var patientMeta = new Meta();

            {
                IEnumerable <string> MetaProfile = new string[] { FhirConst.StructureDefinitionSystems.kPatient };
                patientMeta.Profile = MetaProfile;
            }

            patientToRegister.Meta = patientMeta;

            switch (_registerPatient.GENDER)
            {
            case "MALE":
                patientToRegister.Gender = AdministrativeGender.Male;
                break;

            case "FEMALE":
                patientToRegister.Gender = AdministrativeGender.Female;
                break;

            case "OTHER":
                patientToRegister.Gender = AdministrativeGender.Other;
                break;

            case "UNKNOWN":
                patientToRegister.Gender = AdministrativeGender.Unknown;
                break;
            }

            return(patientToRegister);
        }
        public Patient BuildPatient()
        {
            var patientIdentifier = new Identifier(FhirConst.IdentifierSystems.kNHSNumber, _registerPatient.SPINE_NHS_NUMBER);

            patientIdentifier.Extension.Add(new Extension
            {
                Url   = FhirConst.StructureDefinitionSystems.kExtCcGpcNhsNumVerification,
                Value = new CodeableConcept(FhirConst.CodeSystems.kCcNhsNumVerification, "01", "Number present and verified")
            });

            var patientToRegister = new Patient
            {
                BirthDateElement = new Date(_registerPatient.DOB),
                Name             = new List <HumanName>
                {
                    NameHelper.CreateOfficialName(_registerPatient.NAME_GIVEN, _registerPatient.NAME_FAMILY)
                },
                Identifier = new List <Identifier>
                {
                    patientIdentifier
                }
            };

            switch (_registerPatient.GENDER)
            {
            case "MALE":
                patientToRegister.Gender = AdministrativeGender.Male;
                break;

            case "FEMALE":
                patientToRegister.Gender = AdministrativeGender.Female;
                break;

            case "OTHER":
                patientToRegister.Gender = AdministrativeGender.Other;
                break;

            case "UNKNOWN":
                patientToRegister.Gender = AdministrativeGender.Unknown;
                break;
            }

            return(patientToRegister);
        }