public IActionResult Report(DataSourceRequest command) { ViewBag.FormName = "Treatment Report"; ViewBag.SortByReportDropdown = PrepareSortByDropdown(); var model = new TreatmentsReportListModel(); ViewBag.PageSizeDropdown = SelectListHelper.GetPageSizeDropdown(command.PageSize.ToString()); var PagedList = _reportService.GetTreatmentRecordReport( page_num: command.Page, page_size: command.PageSize == 0 ? 10 : command.PageSize, GetAll: command.PageSize == 0 ? true : false, HospitalId: model.HospitalId, NurseId: model.NurseId, PatientId: model.PatientId, ProcedureId: model.ProcedureId, ReportType: model.ReportType, DiagnosisId: model.DiagnosisId, StartDate: model.StartDate.ToString(), EndDate: model.EndDate.ToString()); var report = PagedList.List.GetPaged(command.Page, command.PageSize, PagedList.TotalRecords); model.List = report.Results.Select(a => { var data = new TreatmentReportModel(); data.Date = a.Date; data.PatientName = (a.PatientName != null)?_encryptionService.DecryptText(a.PatientName):null; data.Diagnosis = a.Diagnosis; data.Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital) : null; data.MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR) : null; data.NurseFirstName = (a.NurseFirstName != null) ? _encryptionService.DecryptText(a.NurseFirstName) : null; data.NurseLastName = (a.NurseLastName != null) ? _encryptionService.DecryptText(a.NurseLastName) : null; data.procedure = a.procedure; return(data); }).ToList(); //model.List = report.List.GetPaged(command.Page, command.PageSize, PagedList.TotalRecords); PrepareTreatmentReportModel(model); return(View(model)); }
protected virtual void PrepareTreatmentReportModel(TreatmentsReportListModel model) { //Daignosis Dropdown model.AvailableDaignosis.Add(new SelectListItem { Text = "Select Daignosis", Value = "0" }); foreach (var c in _treatmentServices.GetAllDiagnosis().Where(a => a.Deleted != true)) { model.AvailableDaignosis.Add(new SelectListItem { Text = c.DiagnosisName, Value = c.Id.ToString() }); } //Patient Dropdown model.AvailablePatient.Add(new SelectListItem { Text = "Select Patient", Value = "0" }); foreach (var c in _treatmentRecordServices.GetAllPatientMaster().Where(a => a.Deleted != true)) { model.AvailablePatient.Add(new SelectListItem { Text = _encryptionService.DecryptText(c.PatientName), Value = c.Id.ToString() }); } //Hospital Dropdown model.AvailableHospital.Add(new SelectListItem { Text = "Select Hospital", Value = "0" }); foreach (var c in _hospitalServices.GetAllHospital().Where(a => a.Deleted != true)) { model.AvailableHospital.Add(new SelectListItem { Text = _encryptionService.DecryptText(c.HospitalName), Value = c.Id.ToString() }); } //Nurse Dropdown model.AvailableNurse.Add(new SelectListItem { Text = "Select Nurse", Value = "0" }); foreach (var c in _nurseServices.GetAllNurse().Where(a => a.Deleted != true)) { model.AvailableNurse.Add(new SelectListItem { Text = _encryptionService.DecryptText(c.FirstName) + " " + _encryptionService.DecryptText(c.LastName), Value = c.Id.ToString() }); } model.AvailableProcedure.Add(new SelectListItem { Text = "Select Procedure", Value = "0" }); foreach (var c in _companyProfileService.GetAllCompanyProfile().PoliciesAndProcedures.Where(a => a.IsPolicy == false)) { model.AvailableProcedure.Add(new SelectListItem { Text = c.Text, Value = c.Id.ToString() }); } }
public IActionResult Report(DataSourceRequest command, TreatmentsReportListModel model, string SubmitButton) { ViewBag.FormName = "Treatment Report"; ViewBag.SortByReportDropdown = PrepareSortByDropdown(); switch (SubmitButton) { //31/10/19 aakansha excel case "ExportExcel": var listexcel = _reportService.GetTreatmentRecordReport( page_num: command.Page, page_size: command.PageSize == 0 ? 10 : command.PageSize, GetAll: command.PageSize == 0 ? true : false, HospitalId: model.HospitalId, NurseId: model.NurseId, PatientId: model.PatientId, ProcedureId: model.ProcedureId, ReportType: model.ReportType, DiagnosisId: model.DiagnosisId, StartDate: model.StartDate.ToString(), EndDate: model.EndDate.ToString() ); listexcel.ReportType = model.ReportType; if (model.ReportType == "By Patient") { listexcel.PatientList = listexcel.List.Select( a => new TreatmentByPatientReport { Date = a.Date, Diagnosis = a.Diagnosis, Hospital = (a.Hospital != null)? _encryptionService.DecryptText(a.Hospital):null, MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR) : null, NurseFirstName = (a.NurseFirstName != null) ? _encryptionService.DecryptText(a.NurseFirstName):null, NurseLastName = (a.NurseLastName != null) ? _encryptionService.DecryptText(a.NurseLastName):null, PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName):null, procedure = a.procedure }).ToList(); } else if (model.ReportType == "By Hospital") { listexcel.HospitalList = listexcel.List.Select( a => new TreatmentByHospitalReport { Date = a.Date, PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName):null, MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR):null, procedure = a.procedure, Diagnosis = a.Diagnosis, Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital):null }).ToList(); } else if (model.ReportType == "By Nurse ") { listexcel.NurseList = listexcel.List.Select( a => new TreatmentByNurseReport { Date = a.Date, Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital):null, PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName):null, MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR):null, NurseFirstName = (a.NurseFirstName != null) ? _encryptionService.DecryptText(a.NurseFirstName):null, NurseLastName = (a.NurseLastName != null) ? _encryptionService.DecryptText(a.NurseLastName):null, procedure = a.procedure, Diagnosis = a.Diagnosis, }).ToList(); } else if (model.ReportType == "By Date") { listexcel.DateList = listexcel.List.Select( a => new TreatmentByDateReport { Date = a.Date, Diagnosis = a.Diagnosis, Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital):null, MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR):null, PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName):null, procedure = a.procedure }).ToList(); } else if (model.ReportType == "By Diagnosis") { listexcel.DiagnosisList = listexcel.List.Select( a => new TreatmentByDiagnosisReport { Date = a.Date, Diagnosis = a.Diagnosis, Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital):null, MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR):null, PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName):null, procedure = a.procedure }).ToList(); } else if (model.ReportType == "By Procedure") { listexcel.ProcedureList = listexcel.List.Select( a => new TreatmentByProcedureReport { Date = a.Date, Diagnosis = a.Diagnosis, Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital):null, MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR):null, PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName):null, procedure = a.procedure }).ToList(); } return(ExportReport(listexcel, "Treatment Report")); } var PagedList = _reportService.GetTreatmentRecordReport( page_num: command.Page, page_size: command.PageSize == 0 ? 10 : command.PageSize, GetAll: command.PageSize == 0 ? true : false, HospitalId: model.HospitalId, NurseId: model.NurseId, PatientId: model.PatientId, ProcedureId: model.ProcedureId, ReportType: model.ReportType, DiagnosisId: model.DiagnosisId, StartDate: model.StartDate.ToString(), EndDate: model.EndDate.ToString()); var report = PagedList.List.GetPaged(command.Page, command.PageSize, PagedList.TotalRecords); if (model.ReportType == "By Patient") { model.PatientList = report.Results.Select( a => { var data = new TreatmentByPatientReport(); data.Date = a.Date; //Diagnosis = a.Diagnosis, data.Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital) : null; //MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR):null, data.NurseFirstName = (a.NurseFirstName != null) ? _encryptionService.DecryptText(a.NurseFirstName) : null; data.NurseLastName = (a.NurseLastName != null) ? _encryptionService.DecryptText(a.NurseLastName) : null; data.PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName) : null; //procedure = a.procedure return(data); }).ToList(); } else if (model.ReportType == "By Hospital") { model.HospitalList = report.Results.Select( a => new TreatmentByHospitalReport { Date = a.Date, PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName):null, MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR):null, procedure = a.procedure, Diagnosis = a.Diagnosis, Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital):null }).ToList(); } else if (model.ReportType == "By Nurse ") { model.NurseList = report.Results.Select( a => new TreatmentByNurseReport { Date = a.Date, Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital):null, PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName):null, MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR):null, NurseFirstName = (a.NurseFirstName != null) ? _encryptionService.DecryptText(a.NurseFirstName):null, NurseLastName = (a.NurseLastName != null) ? _encryptionService.DecryptText(a.NurseLastName):null, procedure = a.procedure, Diagnosis = a.Diagnosis, }).ToList(); } else if (model.ReportType == "By Date") { model.DateList = report.Results.Select( a => new TreatmentByDateReport { Date = a.Date, Diagnosis = a.Diagnosis, Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital):null, MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR):null, PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName):null, procedure = a.procedure }).ToList(); } else if (model.ReportType == "By Diagnosis") { model.DiagnosisList = report.Results.Select( a => new TreatmentByDiagnosisReport { Date = a.Date, Diagnosis = a.Diagnosis, Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital):null, MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR):null, PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName):null, procedure = a.procedure }).ToList(); } else if (model.ReportType == "By Procedure") { model.ProcedureList = report.Results.Select( a => new TreatmentByProcedureReport { Date = a.Date, Diagnosis = a.Diagnosis, Hospital = (a.Hospital != null) ? _encryptionService.DecryptText(a.Hospital):null, MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR):null, PatientName = (a.PatientName != null) ? _encryptionService.DecryptText(a.PatientName):null, procedure = a.procedure }).ToList(); } //model.List = report.Results.Select(a => // { // var data = new TreatmentReportModel(); // data.Date = a.Date; // data.PatientName = _encryptionService.DecryptText(a.PatientName); // data.Diagnosis = a.Diagnosis; // data.Hospital = _encryptionService.DecryptText(a.Hospital); // data.MR = _encryptionService.DecryptText(a.MR); // data.NurseFirstName = _encryptionService.DecryptText(a.NurseFirstName); // data.NurseLastName = _encryptionService.DecryptText(a.NurseLastName); // data.procedure = a.procedure; // return data; // }).ToList(); PrepareTreatmentReportModel(model); return(View(model)); }