Ejemplo n.º 1
0
        protected async Task DischargePatient(HospitalBed bed)
        {
            var parameters = new DialogParameters();
            var patient    = bed.Patient;

            parameters.Add("patient", patient);
            parameters.Add("units", State.Value.AvailableUnits);
            parameters.Add("preSelectedBed", bed);

            var dialog = Dialog.Show <PainelDialogs.DischargePatient>($"Discharge Patient: {patient.Name}", parameters, new DialogOptions()
            {
                MaxWidth = MaxWidth.Medium, FullWidth = true
            });
            var result = await dialog.Result;

            if (!result.Cancelled)
            {
                var data = ((Guid PatientId, int CareUnitId, int HospitalBedId))result.Data;

                var ok = await PatientService.DischargePatientFromBed(
                    patientId : data.PatientId,
                    hospitalBedId : data.HospitalBedId,
                    careUnitId : data.CareUnitId);

                if (!ok)
                {
                    Snackbar.Add($"Could not discharge {patient?.Name} on bed {bed?.HospitalBedId}", Severity.Error);
                }
            }
        }