public static List <OPDHistoryUpdateModel> GetPayingPatient(Guid?opdHistoryId) { try { List <OPDHistoryUpdateModel> list = new List <OPDHistoryUpdateModel>(); using (var db = new HMSEntities()) { var data = db.OPDHistoryUpdates .Where(t => t.OPDHistoryId == opdHistoryId && t.UpdatedField == "PayingAmount") .OrderBy(c => c.CreatedOn).ToList(); foreach (OPDHistoryUpdate t in data) { OPDHistoryUpdateModel model = new OPDHistoryUpdateModel(); model.Id = t.Id; model.OPDHistoryId = t.OPDHistoryId; model.UpdatedBy = t.UpdatedBy; model.UpdatedName = t.UpdatedBy.HasValue ? UserDetail.GetNameById(t.UpdatedBy.Value) : string.Empty; model.UpdatedField = t.UpdatedField; model.UpdatedValue = t.UpdatedValue; model.PreviousValue = t.PreviousValue; model.CreatedOn = t.CreatedOn; list.Add(model); } } return(list); } catch (Exception ex) { throw ex; } }
public List <PatientDetailModel> GetGenericReport(Expression <Func <PatientDetail, bool> > predicate) { try { List <PatientDetailModel> list = new List <PatientDetailModel>(); using (var db = new HMSEntities()) { var data = db.PatientDetails.Where(t => t.IsDischarged == true).Where(predicate).OrderBy(t => t.CreatedOn).ToList(); foreach (PatientDetail t in data) { PatientDetailModel model = new PatientDetailModel(); model.Id = t.Id; model.FullName = t.FullName; model.Address = t.Address; model.CasePaperNumber = t.CasePaperNumber; model.Gender = t.Gender; model.PhoneNumber = t.PhoneNumber; model.MobileNumber = t.MobileNumber; model.Age = t.Age; model.IsAdmitted = t.IsAdmitted; model.AdmittedDate = t.AdmittedDate; model.IsDischarged = t.IsDischarged; model.DischargedDate = t.DischargedDate; model.RefferedDoctor = t.RefferedDoctor; model.RefferedDoctorName = t.DoctorDetail.FullName; model.CasePaperIssuedDate = t.CasePaperIssuedDate; model.CasePaperExpiryDate = t.CasePaperExpiryDate; model.WardNumberId = t.WardNumberId; model.WardName = t.WardDetail != null ? t.WardDetail.Name : string.Empty; model.RoomNumber = t.RoomNumber; model.RoomTypeId = t.RoomTypeId; model.RoomTypeName = t.RoomType != null ? t.RoomType.Name : string.Empty; model.DepartmentId = t.DepartmentId; model.DepartmentName = t.Department != null ? t.Department.Name : string.Empty; model.AadharCard = t.AadharCard; model.PanCard = t.PanCard; model.IsActive = t.IsActive; model.IsDeleted = t.IsDeleted; model.CreatedOn = t.CreatedOn; model.CreatedBy = t.CreatedBy; model.ModifiedOn = t.ModifiedOn; model.ModifiedBy = t.ModifiedBy; model.IPDBillAmount = t.IPDHistories.Any(o => o.PatientId == t.Id) ? t.IPDHistories.FirstOrDefault(o => o.PatientId == t.Id).TotalAmount : 0.00M; model.ReceivedBy = t.IPDHistories.Any(o => o.PatientId == t.Id) ? t.IPDHistories.FirstOrDefault(o => o.PatientId == t.Id).ReceivedBy : null; model.ReceivedName = model.ReceivedBy.HasValue ? UserDetail.GetNameById(model.ReceivedBy.Value) : string.Empty; list.Add(model); } } return(list); } catch (Exception ex) { throw ex; } }