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)); }
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)); }
public async Task <IActionResult> Index() { //## Somethig like Patient Dashboard //var _userEmail = _userManager.GetUserName(HttpContext.User); AppUserDetailsVM currentUser = await GetCurrentUser(); ClinicalHistoryVM clinicalInfo = await _patientService.GetClinicalDetails(currentUser.Id); PatientProfileWrapperVM vm = new PatientProfileWrapperVM() { Patient = currentUser, //## This is Patient Profile... Patient/Home/Index Page ClinicalInfo = clinicalInfo, LabResults = null, //## Not required in Profile Page PrescriptionList = null, //## Not required in Profile Page }; //## Re-factor UserDetails- 'Patient' type values SetPatientProfileValues(currentUser); return(View(vm)); }