Exemplo n.º 1
0
        /// <summary>
        ///     Saves the template patients with specific response and across assessments.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="reportName">Name of the report.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>A task as type ActionResult.</returns>
        private async Task <ActionResult> SaveTemplatePatientsWithSpecificResponseAndAcrossAssessments(
            Guid?key, string reportName, PatientsWithSpecificResponseParametersDto parameters)
        {
            ViewData["ReportName"] = reportName;
            parameters.ReportName  = reportName;
            parameters.Responses   = parameters.JsonResponse == null ? null : JsonConvert.DeserializeObject <List <QuestionResponse> > (parameters.JsonResponse);

            ////todo: need to think about saving organizationKey instead of patientKey
            var requestDispatcher = CreateAsyncRequestDispatcher();

            requestDispatcher.Add(
                new SaveReportTemplateRequest
            {
                ReportTemplate =
                    new ReportTemplateDto
                {
                    Key              = key ?? Guid.Empty,
                    Name             = reportName,
                    SystemAccountKey = UserContext.Current.SystemAccountKey.GetValueOrDefault(),
                    PatientKey       = parameters.PatientKey,
                    Parameters       = parameters,
                    ReportType       = ReportType.Template,
                    ReportState      = new LookupDto {
                        Code = "Normal"
                    }
                }
            });
            if (DoesReportTemplateExist(reportName, ReportType.Template.ToString(), parameters))
            {
                return(Json(new { success = true, error = Controllers.TemplateAlreadyExists }, JsonRequestBehavior.AllowGet));
            }
            var response = await requestDispatcher.GetAsync <SaveReportTemplateResponse> ();

            return(Json(new { success = true, reportTempate = response.ReportTemplate }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Saves the report patients with specific response and across assessments.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="reportName">Name of the report.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>Returns a Task as type ActionResult.</returns>
        private async Task <ActionResult> SaveReportPatientsWithSpecificResponseAndAcrossAssessments(
            Guid?key, string reportName, PatientsWithSpecificResponseParametersDto parameters)
        {
            parameters.Responses = parameters.JsonResponse == null ? null : JsonConvert.DeserializeObject <List <QuestionResponse> > (parameters.JsonResponse);
            if (parameters.TimePeriod != null && !string.IsNullOrEmpty(parameters.TimePeriod.Code))
            {
                DateTime?startDate;
                DateTime?endDate;
                GetRange(parameters.TimePeriod.Code, out startDate, out endDate);
                parameters.TimePeriod = null;
                parameters.StartDate  = startDate;
                parameters.EndDate    = endDate;
            }

            var requestDispatcher = CreateAsyncRequestDispatcher();

            requestDispatcher.Add(
                new SaveReportTemplateRequest
            {
                ReportTemplate =
                    new ReportTemplateDto
                {
                    Key              = key ?? Guid.Empty,
                    Name             = reportName,
                    SystemAccountKey = UserContext.Current.SystemAccountKey.GetValueOrDefault(),
                    PatientKey       = parameters.PatientKey,
                    Parameters       = parameters,
                    ReportType       = ReportType.Saved,
                    ReportState      = new LookupDto {
                        Code = "Normal"
                    }
                }
            });

            if (DoesReportTemplateExist(reportName, ReportType.Saved.ToString(), parameters))
            {
                return(Json(new { success = true, error = Controllers.SavedReportAlreadyExists }, JsonRequestBehavior.AllowGet));
            }

            var response = await requestDispatcher.GetAsync <SaveReportTemplateResponse> ();

            return(Json(new { success = true, reportTempate = response.ReportTemplate }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        private async Task <ActionResult> PatientsWithSpecificResponseAndAcrossAssessmentsExport(string reportName, PatientsWithSpecificResponseParametersDto parameters)
        {
            var requestDispatcher = CreateAsyncRequestDispatcher();

            ViewData["ReportName"]     = reportName;
            parameters.ReportName      = reportName;
            parameters.Responses       = JsonConvert.DeserializeObject <List <QuestionResponse> > (parameters.JsonResponse);
            parameters.OrganizationKey = UserContext.Current.OrganizationKey;
            requestDispatcher.Add(new GetPatientsWithSpecificResponseReportRequest {
                PatientsWithSpecificResponseParametersDto = parameters
            });
            var response = await requestDispatcher.GetAsync <GetReportResponse> ();

            return(ReportViewerExtension.ExportTo((XtraReport)response.Report));
        }
Exemplo n.º 4
0
 public async Task <ActionResult> SaveReportTemplatePatientsWithSpecificResponseAcrossAssessments(
     Guid?key, string reportName, PatientsWithSpecificResponseParametersDto parameters)
 {
     return(await SaveTemplatePatientsWithSpecificResponseAndAcrossAssessments(key, reportName, parameters));
 }
Exemplo n.º 5
0
        /// <summary>
        ///     Patientses the with specific response parameters dto report builder.
        /// </summary>
        /// <param name="reportName">Name of the report.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>A task as type ActionResult.</returns>
        public async Task <ActionResult> PatientsWithSpecificResponseParametersDtoReportBuilder(string reportName, PatientsWithSpecificResponseParametersDto parameters)
        {
            var requestDispatcher = CreateAsyncRequestDispatcher();

            ViewData["ReportName"]     = reportName;
            parameters.ReportName      = reportName;
            parameters.Responses       = parameters.JsonResponse == null ? null : JsonConvert.DeserializeObject <List <QuestionResponse> > (parameters.JsonResponse);
            parameters.OrganizationKey = UserContext.Current.OrganizationKey;
            requestDispatcher.Add(new GetPatientsWithSpecificResponseReportRequest {
                PatientsWithSpecificResponseParametersDto = parameters
            });
            var response = await requestDispatcher.GetAsync <GetReportResponse> ();

            return(GetReportBuilderPartial(reportName, parameters, response.Report));
        }
Exemplo n.º 6
0
 /// <summary>
 ///     Patientses the with specific response export report builder viewer.
 /// </summary>
 /// <param name="reportName">Name of the report.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>Returns a Task as type ActionResult.</returns>
 public async Task <ActionResult> PatientsWithSpecificResponseExportReportBuilderViewer(string reportName, PatientsWithSpecificResponseParametersDto parameters)
 {
     return(await PatientsWithSpecificResponseAndAcrossAssessmentsExport(reportName, parameters));
 }