public IActionResult Index(long diagnoseId, string patientId, string patientName) { DiagnoseModel diagnoseModel; if (diagnoseId != -1) { Diagnose diagnose = _diagnoseService.GetByIdAsync(diagnoseId).Result; diagnoseModel = new DiagnoseModel { Id = diagnose.Id, DiagnoseExists = true, Stage = diagnose.Stage, DistantMetastasis = diagnose.DistantMetastasis, PrimaryTumor = diagnose.PrimaryTumor, RegionalLymphNodes = diagnose.RegionalLymphNodes, PatientId = patientId, PatientName = patientName }; } else { diagnoseModel = new DiagnoseModel { DiagnoseExists = false, PatientId = patientId, PatientName = patientName }; } return(View("/Views/Diagnose/DoctorExistingDiagnoseView.cshtml", diagnoseModel)); }
public IActionResult Index() { List <Patient> patients = _patientsService.SelectForDoctorUIDAsync(_userManager.GetUserId(HttpContext.User)).Result; List <DoctorDashboardPatientModel> patientsOutput = new List <DoctorDashboardPatientModel>(); patients.ForEach(patient => { long diagnoseId = -1; long treatmentId = -1; long healthCheckId = -1; if (patient.ActiveDiagnoseId > 0) { Diagnose diagnose = _diagnoseService.GetByIdAsync(patient.ActiveDiagnoseId).Result; diagnoseId = diagnose.Id; if (diagnose.Treatment != null) { treatmentId = diagnose.Treatment.Id; } HealthCheck healthCheck = _healthCheckService.getLastForDiagnoseAsync(diagnose.Id).Result; if (healthCheck != null) { healthCheckId = healthCheck.Id; } } ApplicationUser patientPrincipal = _userManager.FindByIdAsync(patient.UserId).Result; patientsOutput.Add(new DoctorDashboardPatientModel() { Id = patient.UserId, PhoneNumber = patient.PhoneNumber, DiagnoseId = diagnoseId, TreatmentId = treatmentId, LastHealthCheckId = healthCheckId, Name = patientPrincipal.FirstName + " " + patientPrincipal.LastName }); }); return(View("/Views/Dashboard/Doctor/DoctorDashboardHome.cshtml", patientsOutput)); }