コード例 #1
0
        public bool Update(PatientDetailModel model)
        {
            try
            {
                bool isSaved = false;

                if (!IsExist(model))
                {
                    using (var db = new HMSEntities())
                    {
                        PatientDetail entity = db.PatientDetails.Find(model.Id);

                        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;
                        entity.DischargedDate      = model.DischargedDate;
                        entity.RefferedDoctor      = model.RefferedDoctor;
                        entity.CasePaperIssuedDate = model.CasePaperIssuedDate;
                        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.ModifiedOn          = DateTime.Now;
                        entity.ModifiedBy          = UserDetailSession.Id;

                        db.SaveChanges();

                        if (entity.IsDischarged.Value)
                        {
                            isSaved = CreateIPDHistory(entity.Id, model.IPDBillAmount);
                        }

                        isSaved = true;
                    }
                }


                return(isSaved);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public List <OPDHistoryModel> GetHistoryByPatientId(Guid?id)
        {
            try
            {
                List <OPDHistoryModel> list = new List <OPDHistoryModel>();

                using (var db = new HMSEntities())
                {
                    Guid?patientId = db.OPDHistories.Find(id).PatientId;
                    list = db.OPDHistories.AsEnumerable().Where(t => t.PatientId == patientId && t.Status.Name == OPD_STATUS.Done.ToString()).OrderByDescending(t => t.InTime)
                           .Select(t => new OPDHistoryModel()
                    {
                        Id                  = t.Id,
                        PatientId           = t.PatientId,
                        PatientName         = t.PatientDetail != null ? t.PatientDetail.FullName : "",
                        CasePaperNumber     = t.PatientDetail != null ? t.PatientDetail.CasePaperNumber : "",
                        Sequence            = t.Sequence,
                        InTime              = t.InTime,
                        OutTime             = t.OutTime,
                        IsCharity           = t.IsCharity,
                        IsLabCharity        = t.IsLabCharity,
                        ConsultingDoctorId  = t.ConsultingDoctorId,
                        DoctorNames         = t.DoctorDetail.FullName,
                        IsECG               = t.IsECG.HasValue ? t.IsECG : false,
                        IsXRAY              = t.IsXRAY.HasValue ? t.IsXRAY : false,
                        StatusId            = t.StatusId,
                        StatusName          = t.Status != null ? t.Status.Name : "",
                        Amount              = t.Amount,
                        PaidAmount          = t.PaidAmount,
                        DueAmount           = t.DueAmount,
                        TotalAmount         = t.TotalAmount,
                        LabTestingAmount    = t.LabTestingAmount,
                        ECGAmount           = t.ECGAmount,
                        XRAYAmount          = t.XRAYAmount,
                        NumberofXRAY        = t.NumberofXRAY.HasValue ? t.NumberofXRAY : 0,
                        ThirdPartyLabId     = t.ThirdPartyLabId,
                        ThirdPartyLabAmoumt = t.ThirdPartyLabAmoumt,
                        ReceivedBy          = t.ReceivedBy,
                        Diagnose            = t.Diagnose,
                        Madicines           = t.Madicines,
                        CreatedBy           = t.CreatedBy,
                        ModifiedBy          = t.ModifiedBy,
                        PatientDetails      = PatientDetail.SetModel(t.PatientDetail)
                    }).ToList();
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        public PatientDetailModel GetById(Guid id)
        {
            try
            {
                PatientDetailModel model = new PatientDetailModel();
                using (var db = new HMSEntities())
                {
                    PatientDetail entity = db.PatientDetails.Find(id);
                    if (entity != null)
                    {
                        model.Id                  = entity.Id;
                        model.FullName            = entity.FullName;
                        model.Address             = entity.Address;
                        model.CasePaperNumber     = entity.CasePaperNumber;
                        model.Gender              = entity.Gender;
                        model.PhoneNumber         = entity.PhoneNumber;
                        model.MobileNumber        = entity.MobileNumber;
                        model.Age                 = entity.Age;
                        model.IsAdmitted          = entity.IsAdmitted;
                        model.AdmittedDate        = entity.AdmittedDate;
                        model.IsDischarged        = entity.IsDischarged;
                        model.DischargedDate      = entity.DischargedDate;
                        model.RefferedDoctor      = entity.RefferedDoctor;
                        model.RefferedDoctorName  = entity.DoctorDetail != null ? entity.DoctorDetail.FullName : "";
                        model.CasePaperIssuedDate = entity.CasePaperIssuedDate;
                        model.CasePaperExpiryDate = entity.CasePaperExpiryDate;
                        model.WardNumberId        = entity.WardNumberId;
                        model.WardName            = entity.WardDetail != null ? entity.WardDetail.Name : "";
                        model.RoomNumber          = entity.RoomNumber;
                        model.RoomTypeId          = entity.RoomTypeId;
                        model.RoomTypeName        = entity.RoomType != null ? entity.RoomType.Name : "";
                        model.DepartmentId        = entity.DepartmentId;
                        model.DepartmentName      = entity.Department != null ? entity.Department.Name : "";
                        model.AadharCard          = entity.AadharCard;
                        model.PanCard             = entity.PanCard;
                        model.IsActive            = entity.IsActive;
                        model.IsDeleted           = entity.IsDeleted;
                        model.CreatedOn           = entity.CreatedOn;
                        model.CreatedBy           = entity.CreatedBy;
                        model.ModifiedOn          = entity.ModifiedOn;
                        model.ModifiedBy          = entity.ModifiedBy;
                        model.IPDBillAmount       = GetIPDHistory(model.Id);
                    }
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
        public OPDHistoryModel GetById(Guid id)
        {
            try
            {
                OPDHistoryModel model = new OPDHistoryModel();
                using (var db = new HMSEntities())
                {
                    OPDHistory entity = db.OPDHistories.Find(id);
                    if (entity != null)
                    {
                        model.Id                  = entity.Id;
                        model.PatientId           = entity.PatientId;
                        model.PatientName         = entity.PatientDetail != null ? entity.PatientDetail.FullName : "";
                        model.CasePaperNumber     = entity.PatientDetail != null ? entity.PatientDetail.CasePaperNumber : "";
                        model.Sequence            = entity.Sequence;
                        model.InTime              = entity.InTime;
                        model.OutTime             = entity.OutTime;
                        model.IsCharity           = entity.IsCharity;
                        model.IsLabCharity        = entity.IsLabCharity;
                        model.IsECG               = entity.IsECG.HasValue ? entity.IsECG : false;
                        model.IsXRAY              = entity.IsXRAY.HasValue ? entity.IsXRAY : false;
                        model.StatusId            = entity.StatusId;
                        model.StatusName          = entity.Status != null ? entity.Status.Name : "";
                        model.Amount              = entity.Amount;
                        model.PaidAmount          = entity.PaidAmount;
                        model.DueAmount           = entity.DueAmount;
                        model.TotalAmount         = entity.TotalAmount;
                        model.LabTestingAmount    = entity.LabTestingAmount;
                        model.ECGAmount           = entity.ECGAmount;
                        model.XRAYAmount          = entity.XRAYAmount;
                        model.NumberofXRAY        = entity.NumberofXRAY.HasValue ? entity.NumberofXRAY : 0;
                        model.ReceivedBy          = entity.ReceivedBy;
                        model.ConsultingDoctorId  = entity.ConsultingDoctorId;
                        model.ThirdPartyLabId     = entity.ThirdPartyLabId;
                        model.ThirdPartyLabAmoumt = entity.ThirdPartyLabAmoumt;
                        model.Diagnose            = entity.Diagnose;
                        model.Madicines           = entity.Madicines;
                        model.CreatedBy           = entity.CreatedBy;
                        model.ModifiedBy          = entity.ModifiedBy;
                        model.PatientDetails      = PatientDetail.SetModel(entity.PatientDetail);
                    }
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
 public bool UpdateCasePaperDate(PatientDetailModel model)
 {
     using (var db = new HMSEntities())
     {
         PatientDetail entity = db.PatientDetails.Find(model.Id);
         TimeSpan      ts     = DateTime.Now.Date - entity.CasePaperExpiryDate.Value.Date;
         if (ts.TotalDays > 0)
         {
             entity.CasePaperIssuedDate = DateTime.Now;
             entity.CasePaperExpiryDate = DateTime.Now.AddMonths(2);
             entity.ModifiedBy          = UserDetailSession.Id;
             entity.ModifiedOn          = DateTime.Now;
             db.SaveChanges();
             return(true);
         }
     }
     return(false);
 }
コード例 #6
0
        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;
            }
        }