public static LookupModel GetRatesByType(string type) { try { LookupModel model = new LookupModel(); using (var db = new HMSEntities()) { OPDRate entity = db.OPDRates.FirstOrDefault(t => t.IsActive == true && t.IsDeleted != true && t.Type == type && t.IsDefault == true); if (entity != null) { model.Id = entity.Id; model.Name = entity.Type; model.Rate = entity.Rate; model.IsFlag = entity.IsDefault; model.IsActive = entity.IsActive; model.IsDeleted = entity.IsDeleted; model.CreatedOn = entity.CreatedOn; model.CreatedBy = entity.CreatedBy; model.ModifiedOn = entity.ModifiedOn; model.ModifiedBy = entity.ModifiedBy; } } return(model); } catch (Exception ex) { throw ex; } }
public LookupModel GetById(Guid id) { try { LookupModel model = new LookupModel(); using (var db = new HMSEntities()) { OPDRate entity = db.OPDRates.Find(id); if (entity != null) { model.Id = entity.Id; model.Name = entity.Type; model.Rate = entity.Rate; model.IsFlag = entity.IsDefault; model.IsActive = entity.IsActive; model.IsDeleted = entity.IsDeleted; model.CreatedOn = entity.CreatedOn; model.CreatedBy = entity.CreatedBy; model.ModifiedOn = entity.ModifiedOn; model.ModifiedBy = entity.ModifiedBy; } } return(model); } catch (Exception ex) { throw ex; } }
public bool Update(LookupModel model) { try { bool isSaved = false; if (!IsExist(model)) { using (var db = new HMSEntities()) { //UpdateAllSequence(model.Id, model.Sequence.Value, model.PerentId); OPDRate entity = db.OPDRates.Find(model.Id); entity.Type = model.Name; entity.Rate = (!model.Rate.HasValue) ? 0.00M : model.Rate; entity.IsDefault = true; entity.ModifiedOn = DateTime.Now; entity.ModifiedBy = UserDetailSession.Id; db.SaveChanges(); isSaved = true; } } return(isSaved); } catch (Exception ex) { throw ex; } }
public bool Create(LookupModel model) { try { bool isSaved = false; if (!IsExist(model)) { using (var db = new HMSEntities()) { OPDRate entity = new OPDRate(); entity.Type = model.Name; entity.Rate = (!model.Rate.HasValue) ? 0.00M : model.Rate; entity.IsDefault = model.IsFlag; entity.IsActive = true; entity.IsDeleted = false; entity.CreatedOn = DateTime.Now; entity.CreatedBy = UserDetailSession.Id; db.OPDRates.Add(entity); db.SaveChanges(); isSaved = true; } } return(isSaved); } catch (Exception ex) { throw ex; } }
public static decimal?isFollowUpCheck(Guid?id) { using (var db = new HMSEntities()) { if (UpdateCasePaperDate(id)) { return(OPDRate.GetRatesByType("New").Rate); } else { return(OPDRate.GetRatesByType("FollowUP").Rate); } } }
public bool Create(PatientDetailModel model) { try { bool isSaved = false; if (!IsExist(model)) { using (var db = new HMSEntities()) { PatientDetail entity = new PatientDetail(); entity.FullName = model.FullName; entity.Address = model.Address; entity.CasePaperNumber = model.CasePaperNumber; entity.Gender = model.Gender; entity.PhoneNumber = model.PhoneNumber; entity.MobileNumber = model.MobileNumber; entity.Age = model.Age; entity.IsAdmitted = model.IsAdmitted; entity.AdmittedDate = model.AdmittedDate; entity.IsDischarged = model.IsDischarged.HasValue ? model.IsDischarged : false; entity.DischargedDate = model.DischargedDate; entity.RefferedDoctor = model.RefferedDoctor; entity.CasePaperIssuedDate = model.CasePaperIssuedDate; entity.CasePaperExpiryDate = model.CasePaperIssuedDate.HasValue ? model.CasePaperIssuedDate.Value.AddMonths(2) : model.CasePaperExpiryDate; entity.WardNumberId = model.WardNumberId; entity.RoomNumber = model.RoomNumber; entity.RoomTypeId = model.RoomTypeId; entity.DepartmentId = model.DepartmentId; entity.AadharCard = model.AadharCard; entity.PanCard = model.PanCard; entity.IsActive = true; entity.IsDeleted = false; entity.CreatedOn = DateTime.Now; entity.CreatedBy = UserDetailSession.Id; entity.ModifiedOn = DateTime.Now; db.PatientDetails.Add(entity); db.SaveChanges(); if (!entity.IsDischarged.Value) { if (model.OPDHistory != null) { OPDHistory historyEntity = new OPDHistory(); model.OPDHistory.PatientId = entity.Id; model.OPDHistory.CasePaperNumber = model.CasePaperNumber; model.OPDHistory.ECGAmount = (model.OPDHistory.IsECG.Value) ? OPDRate.GetRatesByType("ECG").Rate : 0.00M; model.OPDHistory.XRAYAmount = model.OPDHistory.XRAYAmount; int isFollowUp = 0; if (model.IsOldPatient && model.CasePaperIssuedDate.Value.Date < DateTime.Now.Date) { isFollowUp = 1; } isSaved = historyEntity.Create(model.OPDHistory, isFollowUp); } } else { isSaved = CreateIPDHistory(entity.Id, model.IPDBillAmount); } } } return(isSaved); } catch (Exception ex) { throw ex; } }
public bool Create(OPDHistoryModel model, int isFollowUp = 0) { try { bool isSaved = false; if (!IsExist(model.CasePaperNumber)) { using (var db = new HMSEntities()) { OPDHistory entity = new OPDHistory(); entity.PatientId = model.PatientId; entity.Sequence = getLastSerial(); entity.InTime = model.InTime; entity.OutTime = model.OutTime; entity.IsCharity = model.IsCharity.HasValue ? model.IsCharity : false; entity.IsLabCharity = model.IsLabCharity; entity.ConsultingDoctorId = model.ConsultingDoctorId; entity.IsECG = model.IsECG.HasValue ? model.IsECG : false; entity.IsXRAY = model.IsXRAY.HasValue ? model.IsXRAY : false; entity.StatusId = Status.GetStatus(t => t.Name == OPD_STATUS.Waiting.ToString()).FirstOrDefault().Id; entity.IsFollowUp = isFollowUp; if (!entity.IsCharity.Value) { if (isFollowUp == 0) { entity.Amount = OPDRate.GetRatesByType("New").Rate; } else if (isFollowUp == 1) { entity.Amount = OPDRate.GetRatesByType("FollowUP").Rate; } } else { entity.Amount = 0.00M; entity.LabTestingAmount = 0.00M; entity.XRAYAmount = 0.00M; entity.ECGAmount = 0.00M; } model.PayingAmount = entity.Amount; entity.PaidAmount = entity.Amount; entity.DueAmount = model.ECGAmount + model.XRAYAmount; //model.DueAmount != null ? model.DueAmount : Convert.ToDecimal(0.00); entity.TotalAmount = entity.Amount + model.ECGAmount + model.XRAYAmount; entity.LabTestingAmount = model.LabTestingAmount != null ? model.LabTestingAmount : Convert.ToDecimal(0.00); entity.ECGAmount = model.ECGAmount.HasValue ? model.ECGAmount : 0.00M; entity.XRAYAmount = model.XRAYAmount.HasValue ? model.XRAYAmount : 0.00M; entity.NumberofXRAY = model.NumberofXRAY.HasValue ? model.NumberofXRAY : 0; entity.ThirdPartyLabId = model.ThirdPartyLabId; entity.ThirdPartyLabAmoumt = model.ThirdPartyLabAmoumt.HasValue ? model.ThirdPartyLabAmoumt : 0.00M; entity.ReceivedBy = model.ReceivedBy; entity.Diagnose = model.Diagnose; entity.Madicines = model.Madicines; entity.CreatedBy = UserDetailSession.Id; db.OPDHistories.Add(entity); db.SaveChanges(); model.Id = entity.Id; List <OPDHistoryUpdateModel> listUpdateModel = new List <OPDHistoryUpdateModel>(); listUpdateModel = OPDHistoryModifications(model); OPDHistoryUpdate opdHistoryUpdate = new OPDHistoryUpdate(); opdHistoryUpdate.Create(listUpdateModel); isSaved = true; } } return(isSaved); } catch (Exception ex) { throw ex; } }