Example #1
0
        /// <summary>
        /// Gets the data for an anoymous Pro request
        /// </summary>
        /// <param name="patientId">The Id of the patient to get the Questionnaire For</param>
        /// <param name="questionnaireName">The name of the questionnaire to load</param>
        /// <param name="episodeId">The Id of the episode to load the questionnaire for</param>
        /// <param name="platform">The platform to load the format for</param>
        /// <returns>The Questionnaire requested</returns>
        public OperationResultAsUserQuestionnaire GetQuestionnaireForPatient(string patientId, string questionnaireName, int?episodeId, Platform platform)
        {
            if (WcfUserSessionSecurity.Current.User == null)
            {
                return(new OperationResultAsUserQuestionnaire(this.handler.MessageManager.GetError(ErrorCodes.USER_SESSION_EXPIRED), null, null, null));
            }

            PCHI.Model.Questionnaire.Questionnaire q = null;
            Format f = null;
            QuestionnaireUserResponseGroup g = null;

            try
            {
                this.handler.UserEpisodeManager.GetQuestionnaireForPatient(patientId, questionnaireName, episodeId, platform, ref q, ref f, ref g);
                OperationResultAsUserQuestionnaire result;
                if (q != null && f != null && g != null)
                {
                    result = new OperationResultAsUserQuestionnaire(null, q, f, g);
                }
                else
                {
                    result = new OperationResultAsUserQuestionnaire(this.handler.MessageManager.GetError(ErrorCodes.DATA_LOAD_ERROR), q, f, g);
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(new OperationResultAsUserQuestionnaire(ex, q, f, g));
            }
        }
Example #2
0
        /// <summary>
        /// Gets the data for an anoymous Pro request
        /// </summary>
        /// <param name="anonymous">The encrypted string providing anonymous access</param>
        /// <param name="platform">The platform to load the format for</param>
        /// <returns>The Questionnaire requested</returns>
        public InterfaceContracts.Model.OperationResultAsUserQuestionnaire GetQuestionnaireAnonymous(string anonymous, Platform platform)
        {
            PCHI.Model.Questionnaire.Questionnaire q = null;
            Format f = null;
            QuestionnaireUserResponseGroup g = null;

            try
            {
                this.handler.UserEpisodeManager.GetQuestionnaireAnonymous(anonymous, platform, ref q, ref f, ref g);
                OperationResultAsUserQuestionnaire result;
                if (q != null && f != null && g != null)
                {
                    result = new OperationResultAsUserQuestionnaire(null, q, f, g);
                }
                else
                {
                    result = new OperationResultAsUserQuestionnaire(this.handler.MessageManager.GetError(ErrorCodes.DATA_LOAD_ERROR), q, f, g);
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(new OperationResultAsUserQuestionnaire(ex, q, f, g));
            }
        }
Example #3
0
        /// <summary>
        /// Gets the last completed first visit questionnaire
        /// </summary>
        /// <param name="patientId" >The ID of the Patient to get the result for</param>
        /// <param name="episodeId">The optional Id of the episode to get the result for, if null or 0 the last filled in is retreived. If not null or greater then 0 the first completed current condition questionnaire is returned AFTER the episode was created</param>
        /// <returns>The completed questionnaire with format and answers</returns>
        public OperationResultAsUserQuestionnaire GetCompletedCurrentConditionQuestionnaire(string patientId, int?episodeId)
        {
            PCHI.Model.Questionnaire.Questionnaire q = null;
            QuestionnaireUserResponseGroup         g = null;

            try
            {
                this.handler.UserEpisodeManager.GetCompletedCurrentConditionQuestionnaire(patientId, episodeId, ref q, ref g);
                OperationResultAsUserQuestionnaire result;
                if (q != null && g != null)
                {
                    result = new OperationResultAsUserQuestionnaire(null, q, null, g);
                }
                else
                {
                    result = new OperationResultAsUserQuestionnaire(this.handler.MessageManager.GetError(ErrorCodes.DATA_LOAD_ERROR), q, null, g);
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(new OperationResultAsUserQuestionnaire(ex, q, null, g));
            }
        }