protected async void PatientDeleted(PatientUI patient)
        {
            await PatientService.DeletePatient(patient.MRN);

            Patients = (await PatientService.GetAllPatients());
            StateHasChanged();
        }
Beispiel #2
0
        public async Task <IEnumerable <PatientUI> > GetAllPatients()
        {
            try
            {
                var pats = await JsonSerializer.DeserializeAsync <IEnumerable <PatientDTO> >
                               (await _httpClient.GetStreamAsync($"api/patient"), new JsonSerializerOptions()
                {
                    PropertyNameCaseInsensitive = true
                });


                List <PatientUI> returnList = new List <PatientUI>();
                foreach (PatientDTO p in pats)
                {
                    PatientUI pa = new PatientUI();
                    pa.MRN       = p.MRN;
                    pa.Firstname = p.Firstname;
                    pa.Lastname  = p.Lastname;
                    pa.Address   = p.Address;
                    pa.City      = p.City;
                    pa.State     = p.State;
                    pa.Zip       = p.Zip;
                    returnList.Add(pa);
                }
                return(returnList);
            }
            catch (Exception ex)
            {
                string err = ex.ToString();
                throw;
            }
        }
        public async void PatientSelect(PatientUI patient)
        {
            await SelectCallback.InvokeAsync(patient);

            await CloseCallback.InvokeAsync(true);

            ShowDialog = false;
            StateHasChanged();
        }
        protected async void SelectCallback(PatientUI p)
        {
            Scheduler.patient      = p;
            Scheduler.MRN          = p.MRN;
            Scheduler.ScheduleTime = ScheduleDate.ToString();
            Console.WriteLine(Scheduler.patient.Firstname);
            Console.WriteLine(Scheduler.MRN);
            Console.WriteLine(Scheduler.ScheduleTime);
            //We need to save the schedule here to the database
            await ScheduleService.Update(Scheduler);

            StateHasChanged();
        }
Beispiel #5
0
        private async Task <PatientUI> SavePatient(PatientUI pt)
        {
            PatientDTO pat = new PatientDTO();

            pat.MRN       = pt.MRN;
            pat.Firstname = pt.Firstname;
            pat.Lastname  = pt.Lastname;
            pat.Address   = pt.Address;
            pat.City      = pt.City;
            pat.State     = pt.State;
            pat.Zip       = pt.Zip;


            var patientJson = new StringContent(JsonSerializer.Serialize(pt), Encoding.UTF8, "application/json");

            try
            {
                var response = await _httpClient.PostAsync("api/Patient", patientJson);

                if (response.IsSuccessStatusCode)
                {
                    PatientDTO s = JsonSerializer.Deserialize <PatientDTO>(await response.Content.ReadAsStringAsync());
                    PatientUI  p = new PatientUI();
                    p.MRN       = s.MRN;
                    p.Firstname = s.Firstname;
                    p.Lastname  = s.Lastname;
                    p.Address   = s.Address;
                    p.City      = s.City;
                    p.State     = s.State;
                    p.Zip       = s.Zip;

                    return(p);
                }
            }
            catch (Exception ex)
            {
                string s = ex.ToString();
            }

            return(pt);
        }
Beispiel #6
0
 public void ResetDialog()
 {
     Patient = new PatientUI {
         MRN = "New", Firstname = "", Address = "", Lastname = "", City = "", State = "", Zip = ""
     };
 }
Beispiel #7
0
 public async Task <PatientUI> AddPatient(PatientUI pt)
 {
     return(await SavePatient(pt));
 }
Beispiel #8
0
        public Task UpdatePatient(PatientUI swd)
        {
            var pat = SavePatient(swd);

            return(pat);
        }