コード例 #1
0
        private ChartAcrossAssessmentsData GetData(ChartAcrossAssessmentsParameters parameters)
        {
            var returnData = new ChartAcrossAssessmentsData();

            using (var connection = _connectionFactory.CreateConnection())
            {
                var reportDtos = connection.Query <ChartAcrossAssessmentsDto>(GetQuery(parameters)).ToList();
                if (!reportDtos.Any())
                {
                    return(null);
                }
                var data = reportDtos.Select(
                    reportDto => new ChartAcrossAssessmentsDataObject
                {
                    ResponseType          = reportDto.ResponseType,
                    IsCode                = reportDto.IsCode,
                    Age                   = reportDto.PatientAge,
                    Gender                = reportDto.GenderCode.Substring(0, 1),
                    PatientName           = reportDto.PatientFirstName + " " + reportDto.PatientLastName,
                    AssessmentDate        = reportDto.LastModifiedTime.ToShortDateString(),
                    PatientKey            = reportDto.PatientKey,
                    AssessmentInstanceKey = reportDto.AssessmentInstanceKey,
                    AssessmentName        = _resourcesManager.GetResourceManagerByName(reportDto.AssessmentName).GetString("_" + reportDto.AssessmentCode),
                    ItemDefinitionCode    = reportDto.ItemDefinitionCode,
                    Question              = _resourcesManager.GetResourceManagerByName(reportDto.AssessmentName).GetString("_" + reportDto.ItemDefinitionCode),
                    Response              = GetResponseValue(reportDto)
                }).ToList();
                returnData.Data = data;
            }
            return(returnData);
        }
コード例 #2
0
        private void SetStrings(ChartAcrossAssessmentsData data, ChartAcrossAssessmentsParameters reportParams, string reportName)
        {
            if (reportParams == null || data == null)
            {
                return;
            }

            var start     = reportParams.StartDate;
            var end       = reportParams.EndDate;
            var dateRange = start.GetValueOrDefault().ToShortDateString() + " - " + end.GetValueOrDefault().ToShortDateString();

            if (reportParams.TimePeriod != null)
            {
                reportParams.TimePeriod.GetRange(out start, out end);
                dateRange = reportParams.TimePeriod.DisplayName;
            }
            var ageRange = _resourcesManager.GetResourceManagerByName(reportName).GetString("NA");

            if (reportParams.AgeRangeLow != null && reportParams.AgeRangeHigh != null)
            {
                ageRange = reportParams.AgeRangeLow + " - " + reportParams.AgeRangeHigh;
            }
            var gender = _resourcesManager.GetResourceManagerByName(reportName).GetString("NA");

            if (!string.IsNullOrWhiteSpace(reportParams.Gender))
            {
                gender = reportParams.Gender;
            }
            var assessment = _resourcesManager.GetResourceManagerByName(reportName).GetString("All");

            if (!string.IsNullOrWhiteSpace(reportParams.AssessmentName))
            {
                assessment = reportParams.AssessmentName;
            }
            data.AssessmentParameter    = _resourcesManager.GetResourceManagerByName(reportName).GetString("Assessment") + ": " + assessment;
            data.DateRangeParameter     = _resourcesManager.GetResourceManagerByName(reportName).GetString("DateRange") + ": " + dateRange;
            data.AgeGroupParameter      = _resourcesManager.GetResourceManagerByName(reportName).GetString("AgeGroup") + ": " + ageRange;
            data.GenderParameter        = _resourcesManager.GetResourceManagerByName(reportName).GetString("Gender") + ": " + gender;
            data.TotalQuestionsForQuery = _resourcesManager.GetResourceManagerByName(reportName).GetString("TotalQuestionsForQuery") +
                                          ": " + data.Data.GroupBy(a => a.ItemDefinitionCode).Select(group => group.First()).Count();
            data.TotalNumberOfSpecifiedResults = _resourcesManager.GetResourceManagerByName(reportName).GetString("TotalNumberOfSpecificResults") +
                                                 ": " + data.Data.Count();
            data.TotalNumberOfAssessmentsDuringTimeFrame = _resourcesManager.GetResourceManagerByName(reportName).GetString("TotalNumberOfAssessmentsDuringTimeFrame") +
                                                           ": " + data.Data.GroupBy(a => a.PatientKey).Select(group => group.First()).Count();
            data.LocalizedQuestionResponses = GetQuestionResponsesFromResource(reportParams);

            data.ReportName = _resourcesManager.GetResourceManagerByName(reportName).GetString("ReportName");

            data.HeaderQuestion = _resourcesManager.GetResourceManagerByName(reportName).GetString("HeaderQuestion");
            data.HeaderSpecificResponseValue = _resourcesManager.GetResourceManagerByName(reportName).GetString("HeaderSpecificResponse");
            data.HeaderName           = _resourcesManager.GetResourceManagerByName(reportName).GetString("HeaderName");
            data.HeaderAge            = _resourcesManager.GetResourceManagerByName(reportName).GetString("HeaderAge");
            data.HeaderGender         = _resourcesManager.GetResourceManagerByName(reportName).GetString("HeaderGender");
            data.HeaderAssessmentName = _resourcesManager.GetResourceManagerByName(reportName).GetString("HeaderAssessmentName");
            data.HeaderAssessmentDate = _resourcesManager.GetResourceManagerByName(reportName).GetString("AssessmentDate");
            data.HeaderGivenResponse  = _resourcesManager.GetResourceManagerByName(reportName).GetString("GivenResponse");
            data.HeaderViewAssessment = _resourcesManager.GetResourceManagerByName(reportName).GetString("HeaderViewAssessment");
        }