Esempio n. 1
0
        public DynamicReport GovReportSummary(DateTime FromDate, DateTime ToDate)
        {
            List <SqlParameter> paramsList = new List <SqlParameter>();

            paramsList.Add(new SqlParameter("@FromDate", FromDate));
            paramsList.Add(new SqlParameter("@ToDate", ToDate));

            ReportingDbContext reportingDbContext = new ReportingDbContext(this.connStr);
            DataSet            dsCtrUsrs          = DALFunctions.GetDatasetFromStoredProc("SP_Report_Gov_Summary", paramsList, reportingDbContext);

            if (dsCtrUsrs != null && dsCtrUsrs.Tables.Count > 0)
            {
                DynamicReport dReport = new DynamicReport();

                //return an anonymous type with counter and user collection..
                var reports = new { OutNEmergServices = dsCtrUsrs.Tables[0], DiagnosticService = dsCtrUsrs.Tables[1] };
                dReport.JsonData = JsonConvert.SerializeObject(reports,
                                                               new IsoDateTimeConverter()
                {
                    DateTimeFormat = "yyyy-MM-dd"
                });
                return(dReport);
            }
            return(null);
        }
Esempio n. 2
0
        private void GetReportOnUploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                return;
            }

            DynamicReport.UpdateModel(e.Result);
            eventAggregator.GetEvent <InitialiseDynamicColumnsEvent>().Publish(null);
            OnPropertyChanged("DynamicReport");
        }
Esempio n. 3
0
        public DynamicReport PHRM_Daily_StockValue()
        {
            List <SqlParameter> paramsList         = new List <SqlParameter>();
            ReportingDbContext  reportingDbContext = new ReportingDbContext(this.connStr);
            DataSet             dsDailyRev         = DALFunctions.GetDatasetFromStoredProc("SP_Report_PHRM_Daily_StockValue", paramsList, reportingDbContext);

            DynamicReport dReport = new DynamicReport();

            dReport.Schema = null;//we have only one table returning from the database..
            //wee need datetime in yyyy-MM-dd format.
            dReport.JsonData = JsonConvert.SerializeObject(dsDailyRev.Tables[0],
                                                           new IsoDateTimeConverter()
            {
                DateTimeFormat = "yyyy-MM-dd"
            });
            return(dReport);
        }
        public DynamicReport GetBedInformation()
        {
            List <SqlParameter> paramsList = new List <SqlParameter>();

            DataSet       data    = GetDatasetFromStoredProc("sp_BedInformation", paramsList, this.connStr);
            DynamicReport dReport = new DynamicReport();
            //return an anonymous type - when mutliple table are received
            var bedinfo = new
            {
                LabelData = data.Tables[0],
                BedList   = data.Tables[1]
            };

            dReport.Schema   = null;
            dReport.JsonData = JsonConvert.SerializeObject(bedinfo);
            return(dReport);
        }
        public string BillDepartmentSummary(DateTime FromDate, DateTime ToDate)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext repDbContext = new ReportingDbContext(connString);
                DynamicReport      reportData   = repDbContext.BillDepartmentSummary(FromDate, ToDate);
                responseData.Status  = "OK";
                responseData.Results = reportData;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string PatientCensusReport(DateTime FromDate, DateTime ToDate, int?ProviderId, int?DepartmentId)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      patCensusReport    = reportingDbContext.PatientCensusReport(FromDate, ToDate, ProviderId, DepartmentId);
                responseData.Status  = "OK";
                responseData.Results = patCensusReport;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //DistrictWise Report
        public string DistrictWiseAppointmentReport(DateTime FromDate, DateTime ToDate, string CountrySubDivisionName)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext        = new ReportingDbContext(connString);
                DynamicReport      departmentwiseappointment = reportingDbContext.DistrictWiseAppointmentReport(FromDate, ToDate, CountrySubDivisionName);
                responseData.Status  = "OK";
                responseData.Results = departmentwiseappointment;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //Income segregation report
        public string IncomeSegregation(DateTime FromDate, DateTime ToDate)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      incomeSegregation  = reportingDbContext.BIL_Daily_IncomeSegregation(FromDate, ToDate);
                responseData.Status  = "OK";
                responseData.Results = incomeSegregation;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string GetSummaryReport(DateTime FromDate, DateTime ToDate)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                GovernmentReportDbContext govReportDbContext = new GovernmentReportDbContext(connString);
                DynamicReport             govReportSummary   = govReportDbContext.GovReportSummary(FromDate, ToDate);
                responseData.Status  = "OK";
                responseData.Results = govReportSummary;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string MonthlyBillingTrend()
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      dailyRevenue       = reportingDbContext.BIL_Monthly_BillingTrend();
                responseData.Status  = "OK";
                responseData.Results = dailyRevenue;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string PatientAgeRangeNGenderWise()
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      patCounts          = reportingDbContext.Patient_AgeRangeNGenderWiseCount();
                responseData.Status  = "OK";
                responseData.Results = patCounts;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //public string PatientZoneMap()
        //{
        //    DanpheHTTPResponse<DynamicReport> responseData = new DanpheHTTPResponse<DynamicReport>();
        //    try
        //    {
        //        ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
        //        DynamicReport patZoneMap = reportingDbContext.Home_PatientZoneMap();
        //        responseData.Status = "OK";
        //        responseData.Results = patZoneMap;
        //    }
        //    catch (Exception ex)
        //    {
        //        responseData.Status = "Failed";
        //        responseData.ErrorMessage = ex.Message;
        //    }
        //    return DanpheJSONConvert.SerializeObject(responseData);
        //}

        public string DepartmentAppointmentsTotal()
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      deptAppts          = reportingDbContext.Home_DeptWise_TotalAppointmentCount();
                responseData.Status  = "OK";
                responseData.Results = deptAppts;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string HomeDashboardStats()
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      dsbStats           = reportingDbContext.Home_DashboardStatistics();
                responseData.Status  = "OK";
                responseData.Results = dsbStats;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string BILLDsbCntrUsrCollection(DateTime fromDate, DateTime toDate, int?counterId)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      cntrDayData        = reportingDbContext.BIL_Daily_CounterNUsersCollection(fromDate, toDate);
                responseData.Status  = "OK";
                responseData.Results = cntrDayData;
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public string CategoryWiseLabReport(DateTime FromDate, DateTime ToDate)
        {
            DanpheHTTPResponse <DynamicReport> responseData1 = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext    = new ReportingDbContext(connString);
                DynamicReport      categorywiselabreport = reportingDbContext.CategoryWiseLabReport(FromDate, ToDate);
                responseData1.Status  = "OK";
                responseData1.Results = categorywiselabreport;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData1.Status       = "Failed";
                responseData1.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData1));
        }
        //DistrictWise Report
        public string DepartmentWiseAppointmentReport(DateTime FromDate, DateTime ToDate, string DepartmentName)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      departmentwiseappointmentReport = reportingDbContext.DepartmentWiseAppointmentReport(FromDate, ToDate, DepartmentName);
                responseData.Status  = "OK";
                responseData.Results = departmentwiseappointmentReport;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }
            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        //DistrictWise Report
        public string SalesPurchaseTrainedCompanion(DateTime FromDate, DateTime ToDate, string Status, string ItemIdCommaSeprated)
        {
            DanpheHTTPResponse <DynamicReport> responseData = new DanpheHTTPResponse <DynamicReport>();

            try
            {
                ReportingDbContext reportingDbContext = new ReportingDbContext(connString);
                DynamicReport      phrmGraph          = reportingDbContext.GetSalesPurchaseTrainedCompanion(FromDate, ToDate, Status, ItemIdCommaSeprated);
                responseData.Status  = "OK";
                responseData.Results = phrmGraph;
            }
            catch (Exception ex)
            {
                //Insert exception details into database table.
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message;
            }


            return(DanpheJSONConvert.SerializeObject(responseData));
        }
        public ResultModel <bool> CreateReport(DynamicReportViewModel reportModel)
        {
            try
            {
                if (reportModel.DynamicReportFolder == null || reportModel.DynamicReportFolder.Id == Guid.Empty)
                {
                    return(ResultMessagesEnum.FolderNotFound.ToErrorModel <bool>());
                }

                var reportFolder = _context.DynamicReportsFolders.First(x => x.Id == reportModel.DynamicReportFolder.Id);

                if (reportFolder == null)
                {
                    return(ResultMessagesEnum.FolderNotFound.ToErrorModel <bool>());
                }

                var reportDb = new DynamicReport()
                {
                    Id                    = Guid.NewGuid(),
                    Name                  = reportModel.Name,
                    ReportDataModel       = reportModel.ReportDataModel,
                    DynamicReportFolderId = reportModel.DynamicReportFolder.Id,
                    Author                = _user.Result.UserName,
                    Created               = DateTime.Now
                };

                _context.DynamicReports.Add(reportDb);
                _context.SaveChanges();
                return(new ResultModel <bool>
                {
                    IsSuccess = true,
                    KeyEntity = reportModel.Id
                });
            }
            catch
            {
                return(ResultMessagesEnum.ReportNotSaved.ToErrorModel <bool>());
            }
        }
Esempio n. 19
0
        public string Get(string reqType, string status)
        {
            HelpdeskDbContext           dbContextHelpdesk = new HelpdeskDbContext(connString);
            AdmissionDbContext          dbAdmission       = new AdmissionDbContext(connString);
            DanpheHTTPResponse <object> responseData      = new DanpheHTTPResponse <object>();



            try
            {
                //gets the EmployeeInfo from Employee table
                if (reqType == "getHelpdesk")
                {
                    //.ToList()is done two times,since we can't use requestDate.Date inside IQueryable
                    List <EmployeeInfoModel> empsInfoList = dbContextHelpdesk.GetEmployeeInfo();
                    //where d.EmployeeId == employeeId


                    responseData.Status = "OK";
                    //loads EmployeeInfo with requested status
                    responseData.Results = empsInfoList;
                }
                //gets the BedInformation from Bed,Bedtype and Ward tables
                if (reqType == "getBedinfo")
                {
                    //.ToList()is done two times,since we can't use requestDate.Date inside IQueryable
                    DynamicReport bedsInfoList = dbContextHelpdesk.GetBedInformation();

                    responseData.Status  = "OK";
                    responseData.Results = bedsInfoList;
                }
                //gets the BedInformation , Patient Information and Ward Name
                if (reqType == "getBedPatientInfo")
                {
                    var bedpatientinfo = dbAdmission.Beds.ToList().GroupJoin(dbAdmission.PatientBedInfos.ToList().Where(a => a.EndedOn == null), a => a.BedId, b => b.BedId, (a, b) =>
                                                                             new BedPatientViewModel
                    {
                        BedId            = a.BedId,
                        WardId           = a.WardId,
                        BedCode          = a.BedCode,
                        PatientId        = b.Select(s => s.PatientId).FirstOrDefault(),
                        PatientBedInfoId = b.Select(s => s.PatientBedInfoId).FirstOrDefault(),
                        StartedOn        = b.Select(s => s.StartedOn).FirstOrDefault(),
                        EndedOn          = b.Select(s => s.EndedOn).FirstOrDefault(),
                        BedNumber        = a.BedNumber,
                        IsOccupied       = a.IsOccupied
                    }).GroupJoin(dbAdmission.Patients.ToList(), a => a.PatientId, b => b.PatientId, (a, b) =>
                                 new BedPatientViewModel
                    {
                        BedId            = a.BedId,
                        WardId           = a.WardId,
                        BedCode          = a.BedCode,
                        PatientId        = b.Select(s => s.PatientId).FirstOrDefault(),
                        PatientBedInfoId = a.PatientBedInfoId,
                        StartedOn        = a.StartedOn,
                        EndedOn          = a.EndedOn,
                        BedNumber        = a.BedNumber,
                        IsOccupied       = a.IsOccupied,
                        PatientName      = b.Select(s => s.FirstName).FirstOrDefault() + " " + b.Select(s => s.MiddleName).FirstOrDefault() + " " + b.Select(s => s.LastName).FirstOrDefault(),
                        PatientCode      = b.Select(s => s.PatientCode).FirstOrDefault(),
                        Address          = b.Select(s => s.Address).FirstOrDefault()
                    }).GroupJoin(dbAdmission.Wards.ToList(), a => a.WardId, b => b.WardId, (a, b) =>
                                 new BedPatientViewModel
                    {
                        BedId            = a.BedId,
                        WardId           = b.Select(s => s.WardId).FirstOrDefault(),
                        WardName         = b.Select(s => s.WardName).FirstOrDefault(),
                        BedCode          = a.BedCode,
                        PatientId        = a.PatientId,
                        PatientBedInfoId = a.PatientBedInfoId,
                        StartedOn        = a.StartedOn,
                        EndedOn          = a.EndedOn,
                        BedNumber        = a.BedNumber,
                        IsOccupied       = a.IsOccupied,
                        PatientName      = a.PatientName,
                        PatientCode      = a.PatientCode,
                        Address          = a.Address
                    }).GroupJoin(dbAdmission.Admissions.ToList(), a => a.PatientId, b => b.PatientId, (a, b) =>
                                 new BedPatientViewModel
                    {
                        BedId              = a.BedId,
                        WardId             = a.WardId,
                        WardName           = a.WardName,
                        BedCode            = a.BedCode,
                        PatientId          = a.PatientId,
                        PatientBedInfoId   = a.PatientBedInfoId,
                        StartedOn          = a.StartedOn,
                        EndedOn            = a.EndedOn,
                        BedNumber          = a.BedNumber,
                        IsOccupied         = a.IsOccupied,
                        PatientName        = a.PatientName,
                        PatientCode        = a.PatientCode,
                        Address            = a.Address,
                        PatientVisitId     = b.Select(s => s.PatientVisitId).FirstOrDefault(),
                        PatientAdmissionId = b.Select(s => s.PatientAdmissionId).FirstOrDefault(),
                        DischargedDate     = b.Select(s => s.DischargeDate).FirstOrDefault(),
                        AdmittedDate       = b.Select(s => s.AdmissionDate).FirstOrDefault()
                    });

                    responseData.Status  = "OK";
                    responseData.Results = bedpatientinfo;
                }
                //gets the WardInformation from WardBedType and Ward tables
                if (reqType == "getWardinfo")
                {
                    //data from GetWardInformation Method from Dbcontext
                    List <WardInformationModel> wardsInfoList = dbContextHelpdesk.GetWardInformation();

                    responseData.Status  = "OK";
                    responseData.Results = wardsInfoList;
                }
                else if (reqType == "getBedFeature")
                {
                    DanpheHTTPResponse <DataTable> data = new DanpheHTTPResponse <DataTable>();
                    try
                    {
                        HelpdeskDbContext helpdeskDbContext = new HelpdeskDbContext(connString);
                        DataTable         dtResult          = helpdeskDbContext.BedFeatureReprot();
                        data.Status  = "OK";
                        data.Results = dtResult;
                    }
                    catch (Exception ex)
                    {
                        //Insert exception details into database table.
                        data.Status       = "Failed";
                        data.ErrorMessage = ex.Message;
                    }
                    return(DanpheJSONConvert.SerializeObject(data));
                }
            }
            catch (Exception ex)
            {
                responseData.Status       = "Failed";
                responseData.ErrorMessage = ex.Message + " exception details:" + ex.ToString();
            }
            return(DanpheJSONConvert.SerializeObject(responseData, true));
        }