public async Task <GetPatient.Model> Handle(GetPatient.Query request, CancellationToken cancellationToken)
        {
            #region how nested Bundle was handled
            //var transaction = new TransactionBuilder(_client.Endpoint);

            //var patientById = new SearchParams()
            // .Where($"_id={request.PatientId}");

            //transaction.Search(patientById, "Patient");// went away from the transaction builder because it returned nested Bundles (which were handled successfullly, but no need to add complexity) and added an additional search to the server. Unclear if the Include method is also a serach but I should be much more effiecient. Also, not all servers support TransactionsBuilder.
            //transaction.Search(conception, "Observation");
            //var qResult = await _client.TransactionAsync(transaction.ToBundle());

            //var patBundle = (Bundle)qResult.Entry.First().Resource;
            //var pat = (Patient)patBundle.Entry.First().Resource;

            //var concpetionBundle = (Bundle)qResult.Entry[1].Resource;
            #endregion

            //var conception = new SearchParams()
            //                .Where($"subject={request.PatientId}")
            //                .Where("code=33067-0")//Fixed to ConceptionDate LOINC
            //                .LimitTo(1)//Incase there is more than one, though there shouldnt be, but I added two to the FHIR server to see what happens
            //                .Include("Observation:subject");//TODO: this will get all Observation infor from the server on Patient?

            var qResult = await client.ReadAsync <Patient>($"Patient/{request.PatientId}");

            //var conceptionObservation = (Observation)qResult.Entry[0].Resource;
            //var conceptionFhirDateTime = (FhirDateTime)conceptionObservation.Value;
            //var pat = (Patient)qResult.Entry[1].Resource;

            //Create map from FHIR Patient to your Patient.
            //Decided to see what it would be like if my Patient type inheirited FHIRs.
            var modelPatient = new LockStepPatient()
            {
                FhirPatient = qResult,
                LastName    = qResult.Name[0].Family,
            };
            modelPatient.GivenNames.AddRange(qResult.Name.SelectMany(n => n.GivenElement.Select(nm => nm.Value)));
            modelPatient.DateOfBirth = qResult.BirthDateElement.ToDateTimeOffset();
            return(new GetPatient.Model()
            {
                QueriedPatient = modelPatient
            });
        }
Exemplo n.º 2
0
        public async Task <GetPatient.Model> Handle(GetPatient.Query request, CancellationToken cancellationToken)
        {
            var qResult = await client.ReadAsync <Patient>($"Patient/{request.PatientId}");

            //Create map from FHIR Patient to your Patient.
            //Decided to see what it would be like if my Patient type inheirited FHIRs.
            var modelPatient = new LockStepPatient()
            {
                FhirPatient = qResult,
                LastName    = qResult.Name[0].Family,
            };

            modelPatient.GivenNames.AddRange(qResult.Name.SelectMany(n => n.GivenElement.Select(nm => nm.Value)));
            modelPatient.DateOfBirth = qResult.BirthDateElement.ToDateTimeOffset();
            return(new GetPatient.Model()
            {
                QueriedPatient = modelPatient
            });
        }
Exemplo n.º 3
0
        private void GetPatientsFromBundle(Hl7.Fhir.Model.Bundle bundle)
        {
            Bundle = bundle;

            CanMoveFirst    = Bundle.FirstLink == null;
            CanMovePrevious = Bundle.PreviousLink == null;
            CanMoveNext     = Bundle.NextLink == null;
            CanMoveLast     = Bundle.LastLink == null;

            if (Patients.Count > 0)
            {
                Patients.Clear();
            }
            foreach (var e in Bundle.Entry)
            {
                var patient = new LockStepPatient();
                Hl7.Fhir.Model.Patient p = (Hl7.Fhir.Model.Patient)e.Resource;
                //var meds = PatientService.GetMedicationRequestsAsync(p.Id).GetAwaiter().GetResult();
                patient.FhirPatient = p;
                // patient.Medications = meds.Requests;
                Patients.Add(patient);
            }
        }
        protected override async Task OnInitializedAsync()
        {
            var pat = await PatientService.GetPatientAsync("921330");

            patientdata = pat.QueriedPatient;
        }
Exemplo n.º 5
0
 public abstract void EnterStatus(LockStepPatient patient);
Exemplo n.º 6
0
 public abstract void TransferPatient(LockStepPatient patient, int roomId);
Exemplo n.º 7
0
 public abstract void DischargePatient(LockStepPatient patient);