示例#1
0
        /// <summary>
        /// Initializes the report data.
        /// </summary>
        private void InitializeReportData()
        {
            try
            {
                // Make sure the base directories are created.
                CreateBaseDirectories();

#if DEBUG
                LogMessage("Initializing report data");
#endif
                #region Get base information about the website - hospitals, measures, datasets, etc.

                _reportID = Guid.NewGuid().ToString();

                _measures = new DataTable();
                _measures.Columns.Add("ID", typeof(int));
                foreach (WebsiteMeasure measure in CurrentWebsite.Measures.Where(m => m.IsSelected).ToList())
                {
                    //if (measure.IsSelected)
                    //{
                    _measures.Rows.Add(measure.ReportMeasure.Id);
                    //}
                }

                //// Get the needed DataSets
                _hospitalCompareDatasetIDs = new DataTable();
                _hospitalCompareDatasetIDs.Columns.Add("ID", typeof(int));
                _qIDatasetIDs = new DataTable();
                _qIDatasetIDs.Columns.Add("ID", typeof(int));
                foreach (WebsiteDataset dataSet in CurrentWebsite.Datasets)
                {
                    switch (dataSet.Dataset.ContentType.Name)
                    {
                    case "Hospital Compare Data":
                        // Add a new Hospital Compare dataset
                        _hospitalCompareDatasetIDs.Rows.Add(dataSet.Dataset.Id);
                        break;

                    case "AHRQ-QI Area Data":
                    case "AHRQ-QI Composite Data":
                    case "AHRQ-QI Provider Data":
                        // Add a new AHRQ QI dataset
                        _qIDatasetIDs.Rows.Add(dataSet.Dataset.Id);
                        break;
                    }
                }

                var hcParams = new[]
                {
                    new KeyValuePair <string, object>("@ReportID", _reportID),
                    new KeyValuePair <string, object>("@HospitalCompareDataset", _hospitalCompareDatasetIDs),
                    new KeyValuePair <string, object>("@Hospitals", HospitalIds),
                    new KeyValuePair <string, object>("@Measures", _measures),
                    new KeyValuePair <string, object>("@RegionType", CurrentWebsite.RegionTypeContext)
                };

                //Clean Temp_Quality Table
                ExecuteNonQuery("IF (OBJECT_ID(N'Temp_Quality')) IS NOT NULL TRUNCATE Table Temp_Quality");

                RunSproc("spQualityInitializeHCBinary", "", hcParams);
                RunSproc("spQualityInitializeHCCategorical", "", hcParams);
                RunSproc("spQualityInitializeHCOutcome", "", hcParams);
                RunSproc("spQualityInitializeHCProcess", "", hcParams);
                RunSproc("spQualityInitializeHCRatio", "", hcParams);
                RunSproc("spQualityInitializeHCScale", "", hcParams);
                RunSproc("spQualityInitializeHCStructural", "", hcParams);
                RunSproc("spQualityInitializeHCYNM", "", hcParams);

                var qiParams = new[]
                {
                    new KeyValuePair <string, object>("@ReportID", _reportID),
                    new KeyValuePair <string, object>("@QIDataset", _qIDatasetIDs),
                    new KeyValuePair <string, object>("@Hospitals", HospitalIds),
                    new KeyValuePair <string, object>("@Measures", _measures),
                    new KeyValuePair <string, object>("@RegionType", CurrentWebsite.RegionTypeContext)
                };

                RunSproc("spQualityInitializeQIComposite", "", qiParams);
                RunSproc("spQualityInitializeQIProvider", "", qiParams);
                RunSproc("spQualityInitializeQIProviderMCMC", "", qiParams);
                RunSproc("spQualityInitializeQIVolume", "", qiParams);

                QualityReportPostProcessLogic.PostProcessQualityReport(_reportID, CurrentWebsite, DataserviceProvider);

                #endregion
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
            }
        }