/// <summary>
        ///     Gets the green report model.
        /// </summary>
        /// <returns>A <see cref="ReportModel" />.</returns>
        public static ReportModel GetGreenReportModel()
        {
            var reportModel = new ReportModel
            {
                Name           = ReportNames.NidaPatientSummaryReport,
                IsCustomizable = true,
                ReportSeverity = ReportSeverity.Good,
                ReportStatus   = NidaWorkflowPatientSummaryReport.Green
            };

            reportModel.AddReportItem(
                new ReportItem(
                    PropertyUtil.ExtractPropertyName <NidaReportData, string> (r => r.PositiveFeedback),
                    true));
            reportModel.AddReportItem(
                new ReportItem(
                    PropertyUtil.ExtractPropertyName <NidaReportData, string> (r => r.FollowUpHeader),
                    null,
                    null,
                    new ReportItem(
                        "FollowUpVisit",
                        true,
                        new object[] { DateTime.Now.AddYears(1).ToShortDateString() })));
            reportModel.AddReportItem(
                new ReportItem(
                    PropertyUtil.ExtractPropertyName <NidaReportData, string> (r => r.AdditionalNotes)));

            reportModel.IsPatientViewable = true;
            return(reportModel);
        }
        private static ReportModel CreateSummarySection(IResourcesManager resourcesManager, AssessmentInstance dastInstance, AssessmentInstance nidaAssessFurtherInstance)
        {
            var reportModel = new ReportModel
            {
                Name           = ReportNames.NidaPatientSummaryReport,
                IsCustomizable = true
            };
            var reportItems = new List <ReportItem> ();
            var nidaAssessFurtherResources = resourcesManager == null
                ? new ResourceManager(typeof(NidaAssessFurther))
                : resourcesManager.GetResourceManagerByName(NidaAssessFurther.AssessmentCodedConcept.Code);

            var nidaAssessFurther = new NidaAssessFurther(nidaAssessFurtherInstance);
            var displayName       = nidaAssessFurtherResources.GetString(
                "_" + AssessmentPart.GetPropertyCodedConcept <NidaAssessFurther, Lookup>(
                    a => a.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceOpioidPersonalMedicalHistoryFrequency).Code);

            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceOpioidPersonalMedicalHistoryFrequency,
                displayName);
            displayName = nidaAssessFurtherResources.GetString(
                "_" + AssessmentPart.GetPropertyCodedConcept <NidaAssessFurther, Lookup>(
                    a => a.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceCocainePersonalMedicalHistoryFrequency).Code);
            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceCocainePersonalMedicalHistoryFrequency,
                displayName);
            displayName = nidaAssessFurtherResources.GetString(
                "_" + AssessmentPart.GetPropertyCodedConcept <NidaAssessFurther, Lookup>(
                    a => a.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceMarijuanaPersonalMedicalHistoryFrequency).Code);
            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceMarijuanaPersonalMedicalHistoryFrequency,
                displayName);
            displayName = nidaAssessFurtherResources.GetString(
                "_" + AssessmentPart.GetPropertyCodedConcept <NidaAssessFurther, Lookup>(
                    a => a.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceSedativePersonalMedicalHistoryFrequency).Code);
            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceSedativePersonalMedicalHistoryFrequency,
                displayName);
            displayName = nidaAssessFurtherResources.GetString(
                "_" + AssessmentPart.GetPropertyCodedConcept <NidaAssessFurther, Lookup>(
                    a => a.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceStimulantPersonalMedicalHistoryFrequency).Code);
            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceStimulantPersonalMedicalHistoryFrequency,
                displayName);
            displayName = nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceOtherSubstanceofAbusePersonalMedicalHistorySpecify;
            CheckAddDrugFrequency(
                reportItems,
                nidaAssessFurtherResources,
                nidaAssessFurther.DrugUseFrequencyGroup.SubstanceAbuseIllicitSubstanceOtherSubstanceofAbusePersonalMedicalHistoryFrequency,
                displayName);
            reportModel.AddReportItem(
                new ReportItem(
                    PropertyUtil.ExtractPropertyName <NidaReportData, string> (r => r.SummaryHeader),
                    null,
                    new[]
            {
                dastInstance.Score.Value
            },
                    reportItems.ToArray()
                    )
            {
                ItemMetadata = new ItemMetadata {
                    MetadataItems = new List <IMetadataItem> {
                        new ReadonlyMetadataItem {
                            IsReadonly = true
                        }
                    }
                }
            });
            return(reportModel);
        }
        private static ReportModel CreateSummarySection(IResourcesManager resourcesManager, AssessmentInstance dastInstance, AssessmentInstance nidaAssessFurtherInstance)
        {
            var reportModel = new ReportModel
            {
                Name           = ReportNames.NidaPatientSummaryReport,
                IsCustomizable = true
            };
            var reportItems = new List <ReportItem> ();
            var nidaAssessFurtherResources = resourcesManager == null
                                                 ? new ResourceManager(typeof(NidaAssessFurther))
                                                 : resourcesManager.GetResourceManagerByName(NidaAssessFurther.AssessmentCodedConcept.Code);

            var otherDrug = string.Empty;

            foreach (var itemDefinition in NidaAssessFurther.DrugAndFrequencyGroup)
            {
                var item = nidaAssessFurtherInstance.ItemInstances.FirstOrDefault(i => i.ItemDefinitionCode == itemDefinition.CodedConcept.Code);
                if (item == null)
                {
                    continue;
                }

                if (item.Value is Lookup)
                {
                    if (otherDrug != string.Empty)
                    {
                        reportItems.Add(new ReportItem(
                                            PropertyUtil.ExtractPropertyName <NidaReportData, List <ReportString> > (r => r.SummaryItems),
                                            null,
                                            new object[]
                        {
                            otherDrug,
                            nidaAssessFurtherResources.GetString("_" + ((Lookup)item.Value).CodedConcept.Code)
                        }
                                            )
                        {
                            ItemMetadata = new ItemMetadata {
                                MetadataItems = new List <IMetadataItem> {
                                    new ReadonlyMetadataItem {
                                        IsReadonly = true
                                    }
                                }
                            }
                        });
                        otherDrug = string.Empty;
                    }
                    else
                    {
                        var lookupName =
                            nidaAssessFurtherResources.GetString("_" + ((Lookup)item.Value).CodedConcept.Code);
                        if (((Lookup)item.Value).Value == 0)
                        {
                            continue;
                        }
                        reportItems.Add(new ReportItem(
                                            PropertyUtil.ExtractPropertyName <NidaReportData, List <ReportString> > (r => r.SummaryItems),
                                            null,
                                            new object[]
                        {
                            nidaAssessFurtherResources.GetString("_" + item.ItemDefinitionCode),
                            lookupName
                        }
                                            )
                        {
                            ItemMetadata = new ItemMetadata {
                                MetadataItems = new List <IMetadataItem> {
                                    new ReadonlyMetadataItem {
                                        IsReadonly = true
                                    }
                                }
                            }
                        });
                    }
                }
                else
                {
                    otherDrug = item.Value.ToString();
                }
            }
            reportModel.AddReportItem(new ReportItem(
                                          PropertyUtil.ExtractPropertyName <NidaReportData, string> (r => r.SummaryHeader),
                                          null,
                                          new [] { dastInstance.Score.Value },
                                          reportItems.ToArray()
                                          )
            {
                ItemMetadata = new ItemMetadata {
                    MetadataItems = new List <IMetadataItem> {
                        new ReadonlyMetadataItem {
                            IsReadonly = true
                        }
                    }
                }
            });
            return(reportModel);
        }