public IActionResult List(DataSourceRequest command) { ViewBag.FormName = "TreatmentRecord"; var model = new TreatmentRecordListModel(); ViewBag.PageSizeDropdown = SelectListHelper.GetPageSizeDropdown(command.PageSize.ToString()); var PagedList = _reportService.GetAllTreatmentRecords( page_num: command.Page, page_size: command.PageSize == 0 ? 10 : command.PageSize, GetAll: command.PageSize == 0 ? true : false); PagedList.List = PagedList.List.Select(a => { a.HospitalName = (a.HospitalName != null) ? _encryptionService.DecryptText(a.HospitalName) : null; a.ContactPerson = (a.ContactPerson != null) ? _encryptionService.DecryptText(a.ContactPerson) : null; a.NurseFirstName = (a.NurseFirstName != null) ? _encryptionService.DecryptText(a.NurseFirstName) : null; a.NurseLastName = (a.NurseLastName != null) ? _encryptionService.DecryptText(a.NurseLastName) : null; a.PateintName = (a.PateintName != null) ? _encryptionService.DecryptText(a.PateintName) : null; a.MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR) : null; return(a); }).ToList(); model.List = PagedList.List.GetPaged(command.Page, command.PageSize, PagedList.TotalRecords); PrepareTreatmentRecordModel(model); return(View(model)); }
protected virtual void PrepareTreatmentRecordModel(TreatmentRecordListModel 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() }); } }
public IActionResult List(DataSourceRequest command, TreatmentRecordListModel model, string submittbutton) { ViewBag.FormName = "TreatmentRecord"; switch (submittbutton) { //25/10/19 aakansha pdf case "ExportPDF": var treatmentRecords = _reportService.GetAllTreatmentRecords( 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, DaignosisId: model.DaignosisId, StartDate: model.StartDate.ToString(), EndDate: model.EndDate.ToString() ); return(ExportTreatmentRecordList(treatmentRecords.List)); //31/10/19 aakansha excel case "ExportExcel": var treatmentRecordsExcel = _reportService.GetAllTreatmentRecords( 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, DaignosisId: model.DaignosisId, StartDate: model.StartDate.ToString(), EndDate: model.EndDate.ToString() ); treatmentRecordsExcel.List = treatmentRecordsExcel.List.Select(a => { a.HospitalName = (a.HospitalName != null) ? _encryptionService.DecryptText(a.HospitalName) : null; a.ContactPerson = (a.ContactPerson != null) ? _encryptionService.DecryptText(a.ContactPerson) : null; a.NurseFirstName = (a.NurseFirstName != null) ? _encryptionService.DecryptText(a.NurseFirstName) : null; a.NurseLastName = (a.NurseLastName != null) ? _encryptionService.DecryptText(a.NurseLastName) : null; a.PateintName = (a.PateintName != null) ? _encryptionService.DecryptText(a.PateintName) : null; a.MR = (a.MR != null) ? _encryptionService.DecryptText(a.MR) : null; return(a); }).ToList(); return(ExportReport(treatmentRecordsExcel, "Treatment Record")); case "ExprtWord": var treatmentRecordsWord = _reportService.GetAllTreatmentRecords( 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, DaignosisId: model.DaignosisId, StartDate: model.StartDate.ToString(), EndDate: model.EndDate.ToString() ); return(CreateTreatmentRecordDoc(treatmentRecordsWord)); } ViewBag.PageSizeDropdown = SelectListHelper.GetPageSizeDropdown(command.PageSize.ToString()); var PagedList = _reportService.GetAllTreatmentRecords( 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, DaignosisId: model.DaignosisId, StartDate: model.StartDate.ToString(), EndDate: model.EndDate.ToString()); PagedList.List = PagedList.List.Select(a => { a.HospitalName = _encryptionService.DecryptText(a.HospitalName); a.ContactPerson = _encryptionService.DecryptText(a.ContactPerson); a.NurseFirstName = _encryptionService.DecryptText(a.NurseFirstName); a.NurseLastName = _encryptionService.DecryptText(a.NurseLastName); a.PateintName = _encryptionService.DecryptText(a.PateintName); a.MR = _encryptionService.DecryptText(a.MR); return(a); }).ToList(); model.List = PagedList.List.GetPaged(command.Page, command.PageSize, PagedList.TotalRecords); PrepareTreatmentRecordModel(model); return(View(model)); }