public async Task <IActionResult> SearchPatient()
        {
            AppUserDetailsVM currentUser = await GetCurrentUser();

            if (currentUser.Not_A_Doctor())
            {
                return(RedirectToAction("AccessDenied", "Account", new { Area = "Identity" }));
            }

            //## Get Current Doctor's - Regular Patients
            var regularPatients = await _patientService.GetRegularPatientList(currentUser.Id);

            //## Doctor will Search Patients and Create a new Prescription
            PrescriptionCreateInitialVM vm = new PrescriptionCreateInitialVM()
            {
                DoctorId   = currentUser.Id,
                HospitalId = currentUser.CurrentRole.OrganisationId,
                PatientId  = 1,

                PatientsList      = regularPatients,
                PatientsListTitle = $"Recent visitors",
                HospitalDetails   = null,
                DoctorDetails     = null
            };

            SetDoctorsProfileValues(currentUser);

            return(View(vm));
        }
        public async Task <IActionResult> ViewPatient(int id)
        {
            if (id < 1)
            {
                return(RedirectToAction("Index"));
            }
            AppUserDetailsVM currentUser = await GetCurrentUser();

            if (currentUser.Not_A_Doctor())
            {
                return(RedirectToAction("AccessDenied", "Account", new { Area = "Identity" }));
            }

            AppUserDetailsVM patientDetails = await _appUserService.Find(id, true);

            ClinicalHistoryVM patientClinicalInfo = await _patientService.GetClinicalDetails(id);

            DoctorViewPatientWrapperVM vm = new DoctorViewPatientWrapperVM()
            {
                Doctor = currentUser,
                PatientProfileWrapper = new PatientProfileWrapperVM()
                {
                    Patient      = patientDetails,
                    ClinicalInfo = patientClinicalInfo,
                }
            };

            SetDoctorsProfileValues(currentUser);

            return(View(vm));
        }
Esempio n. 3
0
        public async Task <IActionResult> FinishAndPreview(PrescriptionConfirmSaveVM vm)
        {
            AppUserDetailsVM currentUser = await GetCurrentUser();

            if (currentUser.Not_A_Doctor())
            {
                return(RedirectToAction("AccessDenied", "Account", new { Area = "Identity" }));
            }

            return(PartialView("Areas/Doctor/Views/Prescription/_FinishAndPreview.cshtml"));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create(int id)
        {
            AppUserDetailsVM currentUser = await GetCurrentUser();

            if (currentUser.Not_A_Doctor())
            {
                return(RedirectToAction("AccessDenied", "Account", new { Area = "Identity" }));
            }


            if (id < 1)
            {
                return(RedirectToAction("SearchPatient", "Home", new { Area = "Doctor" }));
            }

            //## we get the PrescriptionId via Post call. use that to get Prescription info- Doctor, Hospital, Patient
            //## Doctor has already initiated a "New Prescription" from "Doctor/Home/StartNewPrescription()"- which is their Home page
            var prescription = await _prescriptionService.Find(id);

            if (prescription is null || prescription.Status != (int)PrescriptionStatus.Draft)
            {
                return(RedirectToAction("SearchPatient", "Home", new { Area = "Doctor" }));
            }


            var newPrescriptionId = prescription.Id;

            var chamber = await _appUserService.Get_DoctorChamber(currentUser.Email);

            AppUserDetailsVM patientDetails = await _appUserService.Find(prescription.PatientId, includeAddressBook : true);

            ClinicalHistoryVM clinicialInfo = await _patientService.GetClinicalDetails(patientDetails.Id);

            //var chiefComplaints = await _patientService.GetPatientChiefComplaints(patientDetails.Id);

            //## PrescriptionCreateVM- will have all necessary info to make a Prescription-
            //## When the Doc needs to see preview of Prescription before Print/Save

            var vm = new PrescriptionCreateVM()
            {
                Id             = newPrescriptionId,
                Doctor         = currentUser, //## Doctor details is at- AppUserDetailsVM.DoctorDetailsVM()
                ChamberDetails = chamber,
                PatientDetails = patientDetails,
                //AllergyList = clinicialInfo.AllergyList,
                ClinicialInfo = clinicialInfo, //## AllergyList is withi ClinicalInfo
            };

            //## Re-factor UserDetails- 'Doctor' type values
            SetDoctorsProfileValues(currentUser);

            return(View(vm));
        }
Esempio n. 5
0
        public async Task <IActionResult> GetPrescription_HTML(int id)
        {
            AppUserDetailsVM currentUser = await GetCurrentUser();

            if (currentUser.Not_A_Doctor())
            {
                return(RedirectToAction("AccessDenied", "Account", new { Area = "Identity" }));
            }

            var result = await _prescriptionService.GetPrescription_HTML(id);

            return(Json(result));
        }
Esempio n. 6
0
        public async Task <IActionResult> Create_Prescription_HTML(int id, string contents)
        {
            AppUserDetailsVM currentUser = await GetCurrentUser();

            if (currentUser.Not_A_Doctor())
            {
                return(RedirectToAction("AccessDenied", "Account", new { Area = "Identity" }));
            }

            var result = await _prescriptionService.Create_Prescription_HTML(id, contents);

            return(Json(result ? "success" : "fail"));
        }
Esempio n. 7
0
        public async Task <IActionResult> Index()
        {
            AppUserDetailsVM currentUser = await GetCurrentUser();

            if (currentUser.Not_A_Doctor())
            {
                return(RedirectToAction("AccessDenied", "Account", new { Area = "Identity" }));
            }

            var availableRoles = await _appAuthorisationService.GetUserRolesFromCache(currentUser.Id);

            currentUser.RolesList = availableRoles;

            //## Re-factor UserDetails- 'Doctor' type values
            SetDoctorsProfileValues(currentUser);

            return(View(currentUser));
        }
        public async Task <IActionResult> Index()
        {
            AppUserDetailsVM currentUser = await GetCurrentUser();

            if (currentUser.Not_A_Doctor())
            {
                return(RedirectToAction("AccessDenied", "Account", new { Area = "Identity" }));
            }

            //## This is the Dashboard Page of a Doctor. Can view- Chart, Profile, Search Patients and Create a new Prescription
            PrescriptionCreateInitialVM vm = new PrescriptionCreateInitialVM()
            {
                DoctorId   = currentUser.Id,
                HospitalId = currentUser.CurrentRole.OrganisationId,
                PatientId  = 1,

                //HospitalDetails = null,
                //DoctorDetails = null
            };

            SetDoctorsProfileValues(currentUser);

            return(View(vm));
        }