Beispiel #1
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;
            }
        }
Beispiel #2
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;
            }
        }