예제 #1
0
        private void SetStrings(NotCompletedAssessmentData data, NotCompletedAssessmentParameters 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.ReportName             = _resourcesManager.GetResourceManagerByName(reportName).GetString("ReportName");
            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.HeaderAssessmentStatus = _resourcesManager.GetResourceManagerByName(reportName).GetString("HeaderAssessmentStatus");
            data.HeaderViewAssessment   = _resourcesManager.GetResourceManagerByName(reportName).GetString("HeaderViewAssessment");
        }
예제 #2
0
        private NotCompletedAssessmentData GetData(NotCompletedAssessmentParameters parameters, string reportName)
        {
            using (var connection = _connectionFactory.CreateConnection())
            {
                var assessmentsNotCompleted = connection.Query <NotCompletedAssessmentDto>(GetQuery(parameters)).ToList();
                if (!assessmentsNotCompleted.Any())
                {
                    return(null);
                }
                var assessments = GetListOfAssessments(parameters);
                var ncData      = new NotCompletedAssessmentData {
                    Data = new List <NotCompletedAssessmentDataObject> ()
                };
                var patientKey = new Guid();

                foreach (var assessmentNotComplete in assessmentsNotCompleted)
                {
                    if (patientKey == assessmentNotComplete.PatientKey)
                    {
                        continue;
                    }
                    patientKey = assessmentNotComplete.PatientKey;
                    var key  = patientKey;
                    var rows = assessmentsNotCompleted.Where(a => a.PatientKey == key).ToList();

                    var patientDto = new PatientDto
                    {
                        Name   = new PersonName(assessmentNotComplete.PatientFirstName, assessmentNotComplete.PatientLastName),
                        Gender = new LookupDto {
                            Name = assessmentNotComplete.PatientGender
                        },
                        UniqueIdentifier = assessmentNotComplete.PatientKey.ToString(),
                        PatientAge       = assessmentNotComplete.PatientAge
                    };
                    ncData.Data.AddRange(AddNotStartedAssessmentsForPatient(
                                             parameters,
                                             rows,
                                             patientDto,
                                             assessments,
                                             reportName).Data);
                }
                return(ncData.Data.Any() ? ncData : null);
            }
        }
예제 #3
0
        private NotCompletedAssessmentData AddNotStartedAssessmentsForPatient(
            NotCompletedAssessmentParameters parameters,
            List <NotCompletedAssessmentDto> notCompletedAssessmentDtos,
            PatientDto patientDto,
            IEnumerable <Assessment> assessments,
            string reportName)
        {
            DateTime?startDate;
            DateTime?endDate;

            GetParameterStartEndDate(parameters, out startDate, out endDate);
            var ncData = new NotCompletedAssessmentData {
                Data = new List <NotCompletedAssessmentDataObject>()
            };

            foreach (var data in assessments)
            {
                var assessmentNameNotComplete = _resourcesManager.GetResourceManagerByName(
                    data.AssessmentName).GetString(
                    "_" + data.AssessmentCode);
                Guid?assessmentInstanceKey     = null;
                var  notCompletedAssessmentDto = notCompletedAssessmentDtos.Where(a => a.AssessmentCode == data.AssessmentCode).ToList();
                var  status  = _resourcesManager.GetResourceManagerByName(reportName).GetString("NotStarted");
                var  process = true;
                foreach (var notCompleted in notCompletedAssessmentDto)
                {
                    var createdTime = DateTime.Parse(notCompleted.CreatedTime.ToShortDateString());
                    process = true;
                    if (notCompleted.AssessmentInstanceKey != null)
                    {
                        if (notCompleted.IsSubmitted == false && startDate != null && endDate != null &&
                            createdTime >= startDate && createdTime <= endDate)
                        {
                            assessmentInstanceKey = notCompleted.AssessmentInstanceKey;
                            status = _resourcesManager.GetResourceManagerByName(reportName).GetString("Started");
                            break;
                        }
                        if (notCompleted.IsSubmitted && startDate != null && endDate != null &&
                            createdTime >= startDate && createdTime <= endDate)
                        {
                            process = false;
                        }
                    }
                }
                if (!process)
                {
                    continue;
                }
                var assessment = new NotCompletedAssessmentDataObject
                {
                    Age = patientDto.PatientAge,
                    AssessmentInstanceKey = assessmentInstanceKey,
                    AssessmentName        = assessmentNameNotComplete,
                    Gender           = patientDto.Gender.Name,
                    PatientFirstName = patientDto.Name.FirstName,
                    PatientLastName  = patientDto.Name.LastName,
                    PatientKey       = new Guid(patientDto.UniqueIdentifier),
                    PatientName      = patientDto.Name.FirstName + " " + patientDto.Name.LastName,
                    AssessmentStatus = status
                };

                ncData.Data.Add(assessment);
            }
            return(ncData);
        }
예제 #4
0
        private XRTableRow GetHeaderRow(NotCompletedAssessmentData source)
        {
            var headerFont   = new Font("Times New Roman", 13F);
            var trHeader     = new XRTableRow();
            var tdNameHeader = new XRTableCell
            {
                Text          = source.HeaderName,
                CanGrow       = true,
                Borders       = BorderSide.Bottom,
                BorderWidth   = 3,
                BorderColor   = Color.DarkGray,
                TextAlignment = TextAlignment.BottomLeft,
                Font          = headerFont,
                SizeF         = new Size(NameHeaderWidth, Height),
            };

            trHeader.Cells.Add(tdNameHeader);
            var tdAgeHeader = new XRTableCell
            {
                Text          = source.HeaderAge,
                CanGrow       = true,
                Borders       = BorderSide.Bottom,
                BorderWidth   = 3,
                BorderColor   = Color.DarkGray,
                TextAlignment = TextAlignment.BottomCenter,
                Font          = headerFont,
                SizeF         = new Size(AgeHeaderWidth, Height),
            };

            trHeader.Cells.Add(tdAgeHeader);
            var tdGenderHeader = new XRTableCell
            {
                Text          = source.HeaderGender,
                CanGrow       = true,
                Borders       = BorderSide.Bottom,
                BorderWidth   = 3,
                BorderColor   = Color.DarkGray,
                TextAlignment = TextAlignment.BottomCenter,
                Font          = headerFont
            };

            trHeader.Cells.Add(tdGenderHeader);
            var tdAssessmentNameHeader = new XRTableCell
            {
                Text          = source.HeaderAssessmentName,
                CanGrow       = true,
                Borders       = BorderSide.Bottom,
                BorderWidth   = 3,
                BorderColor   = Color.DarkGray,
                TextAlignment = TextAlignment.BottomCenter,
                Font          = headerFont,
                SizeF         = new Size(AssessmentNameHeaderWidth, Height),
            };

            trHeader.Cells.Add(tdAssessmentNameHeader);
            var tdAssessmentStatusHeader = new XRTableCell
            {
                Text          = source.HeaderAssessmentStatus,
                CanGrow       = true,
                Borders       = BorderSide.Bottom,
                BorderWidth   = 3,
                BorderColor   = Color.DarkGray,
                TextAlignment = TextAlignment.BottomCenter,
                Font          = headerFont
            };

            trHeader.Cells.Add(tdAssessmentStatusHeader);
            var tdViewHeader = new XRTableCell
            {
                Text          = source.HeaderViewAssessment,
                CanGrow       = true,
                Borders       = BorderSide.Bottom,
                BorderWidth   = 3,
                BorderColor   = Color.DarkGray,
                TextAlignment = TextAlignment.BottomCenter,
                Font          = headerFont
            };

            trHeader.Cells.Add(tdViewHeader);
            return(trHeader);
        }