public IActionResult Medications(int PatientId) { var model = new MedicationVM(); if (User.IsInRole("Patient")) { PatientId = _userManager.Users.First(b => b.UserName == User.Identity.Name).PatientId.Value; } var user = _context.Patient.First(u => u.Id == PatientId); model.DOB = user.Dob; model.PatientId = PatientId; model.PatientName = user.FirstName + " " + user.LastName; if (User.IsInRole("HCP")) { model.Medications = _context.Medications.Where(m => m.PatientId == PatientId).ToList(); } else { model.Medications = _context.Medications.Where(m => m.PatientId == PatientId && m.Approved).ToList(); } return(View(model)); }
public IActionResult ViewTreatmentRecord(int Id) { //10/10/2019 aakansha ViewBag.FormName = "TreatmentRecord"; var treatmentRecordData = _reportService.GetAllTreatmentRecordData(Id); var AllData = new AllTreatmentRecordDataVM(); AllData.PatientVM = treatmentRecordData.PatientVM; AllData.DoctorsInfo = treatmentRecordData.DoctorsInfo; AllData.MachineMaster = treatmentRecordData.MachineMaster; AllData.PreTreatmentCheck = treatmentRecordData.PreTreatmentCheck; AllData.LabValues = treatmentRecordData.LabValues; var otherlabvaluedata = _treatmentRecordServices.GetOtherLabValueByLabValueId(AllData.LabValues.Id); foreach (var otherlabValue in otherlabvaluedata) { var data = new OtherLabValuesVM { ContentName = otherlabValue.ContentName, Id = otherlabValue.Id, ContentValue = (decimal)otherlabValue.ContentValue, LabValuesId = otherlabValue.LabValuesId }; AllData.OtherLabValuesVMs.Add(data); } AllData.SuppliesVM = treatmentRecordData.SuppliesVM; AllData.PreTreatmentAssessment = treatmentRecordData.PreTreatmentAssessment; AllData.RunValuesVM = treatmentRecordData.RunValuesVM; AllData.FinalValuesVM = treatmentRecordData.FinalValuesVM; AllData.PostTreatmentVM = treatmentRecordData.PostTreatmentVM; AllData.medication = treatmentRecordData.medication; var medication = _treatmentRecordServices.GetMedicationByPostTreatmentId(AllData.PostTreatmentVM.Id); foreach (var Medication in medication) { var data = new MedicationVM { id = Medication.Id, Name = Medication.Name, Dosage = Medication.Dosage, Route = Medication.Route, Comments = Medication.Comments, PostTreatment = Medication.PostTreatment, PostTreatmentId = Medication.PostTreatmentId, }; AllData.medication.Add(data); } AllData.NoteAndReportVM = treatmentRecordData.NoteAndReportVM; return(View(AllData)); }