Exemplo n.º 1
0
        public ActionResult ScheduleQuestionnaire(string patientId, int episodeId, FormCollection collection)
        {
            PatientEpisodeClient uec = new PatientEpisodeClient();
            bool          success    = true;
            List <string> messages   = new List <string>();

            foreach (string key in collection.Keys)
            {
                if (key.StartsWith("questionnaire."))
                {
                    OperationResult result = uec.ScheduleQuestionnaireForEpisode(collection[key], episodeId, string.Empty);
                    if (!result.Succeeded)
                    {
                        success = false;
                        messages.Add(result.ErrorMessages);
                    }
                }
            }

            //OperationResult result = uec.ScheduleQuestionnaireForEpisode(pro, episodeId, schedule);

            if (success)
            {
                TempData["NotificationMessage"] = "The questionnaires have been assigned";
            }
            else
            {
                TempData["ErrorMessage"] = "There has been an error assigned the questionnaires. " + messages.Aggregate((s1, s2) => { return(s1 + "<br />" + s2); });
            }
            return(RedirectToAction("CurrentCondition", new { patientId = patientId, episodeId = episodeId }));
        }
Exemplo n.º 2
0
        public ProLoaderQuestionnaireFormat()
        {
            this.userClient = new UserClient();
            this.userClient.Login("admin", "Welc0me!");
            this.userClient.UserHasMultipleRoles("admin");
            this.userClient.SelectRole("admin", "Administrator");

            RequestHeader header = new RequestHeader();

            header.SessionId = this.userClient.GetConfiguration.SessionId;

            this.proClient                 = new ProClient();
            this.questionnaireClient       = new QuestionnaireClient();
            this.questionnaireFormatClient = new QuestionnaireFormatClient();
            this.userQuestionnaireClient   = new PatientEpisodeClient();
            this.patientClient             = new PatientClient();

            this.questionnaireClient = new QuestionnaireClient();
            this.questionnaireClient.RequestHeader = header;

            this.questionnaireFormatClient = new QuestionnaireFormatClient();
            this.questionnaireFormatClient.RequestHeader = header;

            this.userQuestionnaireClient = new PatientEpisodeClient();
            this.userQuestionnaireClient.RequestHeader = header;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Function that saves the answer of the submitted PRO
        /// </summary>
        /// <param name="formCollection">Contains all the information of the PRO</param>
        /// <param name="completed">Indicates if the PRO is fully answered or not</param>
        public static OperationResult SaveQuestionnaireResponses(Dictionary <string, string> formCollection, bool completed)
        {
            PatientEpisodeClient uec = new PatientEpisodeClient();
            //ViewBag.Message = "Your PRO responses have been submitted.";
            int    questionnaireId = formCollection.ContainsKey("questionnaireId") ? Convert.ToInt32(formCollection["questionnaireId"]) : 0;
            string anonymous       = formCollection.ContainsKey("anonymous") ? formCollection["anonymous"] : null;
            int    groupId         = formCollection.ContainsKey("groupId") ? Convert.ToInt32(formCollection["groupId"]) : 0;

            List <QuestionnaireResponse> questionnaireResponses = ResponseParser.ParseResponses(formCollection);

            if (!string.IsNullOrWhiteSpace(anonymous))
            {
                return(uec.SaveAnonymouseQuestionnaireResponse(anonymous, questionnaireId, groupId, completed, questionnaireResponses));
            }
            else
            {
                return(uec.SaveQuestionnaireResponseForCurrentUser(questionnaireId, groupId, completed, questionnaireResponses));
            }
        }
Exemplo n.º 4
0
        public Message CreatePatientAppointment(PatientAppointment patient)
        {
            if (MessageStore.WasMessageReceived(patient.messageReference))
            {
                return new Message()
                       {
                           success = true, messageReference = DateTime.Now.ToString()
                       }
            }
            ;

            // TODO Check if message was already received
            PatientClient uc     = new PatientClient();
            var           result = uc.CreatePatient(patient.Id, patient.Email, patient.Email, patient.Title, patient.FirstName, patient.LastName, patient.DateOfBirth, patient.Mobile);

            if (result.Succeeded)
            {
                PatientEpisodeClient uec = new PatientEpisodeClient();

                var result2 = uec.AssignEpisode(result.Data, patient.BasicCondition, patient.AppointmentDate, null, patient.PractitionerId);

                if (result2.Succeeded)
                {
                    MessageStore.MessageReceived(patient.messageReference, patient.Xml, DateTime.Now);
                    return(new Message()
                    {
                        success = true
                    });
                }
                return(new Message()
                {
                    success = false, ErrorMessage = result2.ErrorMessages
                });
            }

            return(new Message()
            {
                success = false, ErrorMessage = result.ErrorMessages
            });
        }
    }
Exemplo n.º 5
0
        public ActionResult CurrentCondition(string patientId, int?episodeId, FormCollection collection)
        {
            PatientEpisodeClient uec    = new PatientEpisodeClient();
            PatientClient        client = new PatientClient();
            var clientResult            = client.GetDetailsForPatient(patientId);

            if (!clientResult.Succeeded)
            {
                ViewBag.ErrorMessage += clientResult.ErrorMessages;
            }
            else
            {
                //uec.GetConditionQuestionnaire(episodeId);
                ProClient pro = new ProClient();

                QuestionnaireClient qc = new QuestionnaireClient();
                ViewBag.Questionnaires = qc.GetAllQuestionnairesWithTags().Questionnaires;

                var uecResult = uec.GetEpisodesWithDetailsForPatient(patientId);

                if (!uecResult.Succeeded)
                {
                    ViewBag.ErrorMessage = uecResult.ErrorMessages;
                    return(View());
                }

                uecResult.Episodes.Sort((e1, e2) =>
                {
                    if (e1.MileStones.Count == 0 && e2.MileStones.Count == 0)
                    {
                        return(0);
                    }
                    if (e1.MileStones.Count > 0 && e2.MileStones.Count == 0)
                    {
                        return(-1);
                    }
                    if (e1.MileStones.Count == 0 && e2.MileStones.Count > 0)
                    {
                        return(1);
                    }

                    DateTime e1D = e1.MileStones.OrderByDescending(e => e.MilestoneDate).First().MilestoneDate;
                    DateTime e2D = e2.MileStones.OrderByDescending(e => e.MilestoneDate).First().MilestoneDate;

                    return(e1D.CompareTo(e2D));
                });

                ViewBag.Episodes  = uecResult.Episodes;
                ViewBag.Patient   = clientResult.PatientDetails;
                ViewBag.PatientId = patientId;

                if (!episodeId.HasValue)
                {
                    episodeId       = 0;
                    ViewBag.Episode = new Episode();
                }
                else
                {
                    ViewBag.Episode = uecResult.Episodes.Where(e => e.Id == episodeId.Value).FirstOrDefault();
                }

                //if(episodeId.HasValue)
                {
                    ViewBag.EpisodeId = episodeId.Value;
                    var assignedQuestionnaires = uec.GetAssignedQuestionnairesForEpisode(episodeId.Value).AssignedQuestionnaires;
                    ViewBag.AssignedQuestionnaires = assignedQuestionnaires;
                    Dictionary <Episode, Dictionary <string, Dictionary <string, object> > > data;
                    Dictionary <Episode, Dictionary <string, List <ProDomainResultSet> > >   sets = ProResults.GetProDomainResultSetForPatient(patientId, episodeId.Value, out data);
                    ViewBag.DomainResultsSetData = data;
                    ViewBag.DomainResultsSet     = sets;
                    ViewBag.howManyColumns       = 5;
                }
            }

            return(View());
        }
Exemplo n.º 6
0
        public ActionResult Patient(string patientId, PatientDetails details, string externalEpisodeId, string Condition, string PractitionerId, DateTime?Date)
        {
            if (string.IsNullOrWhiteSpace(patientId))
            {
                return(RedirectToAction("SeachPatients"));
            }

            if (details != null && !string.IsNullOrWhiteSpace(details.FirstName) && !string.IsNullOrWhiteSpace(details.LastName))
            {
                details.Id = patientId;
                PatientClient pc     = new PatientClient();
                var           result = pc.SavePatientDetails(patientId, details);
                if (result.Succeeded)
                {
                    return(RedirectToAction("Patient", new { patientId = patientId }));
                }
                ViewBag.ErrorMessage = result.ErrorMessages;
            }
            else if (!string.IsNullOrWhiteSpace(Condition))
            {
                PatientEpisodeClient uec    = new PatientEpisodeClient();
                OperationResult      result = uec.AssignEpisode(patientId, Condition, Date, externalEpisodeId, PractitionerId);

                if (result.Succeeded)
                {
                    return(RedirectToAction("Patient", new { patientId = patientId }));
                }
                ViewBag.ErrorMessage = result.ErrorMessages;
            }

            PatientClient client       = new PatientClient();
            var           clientResult = client.GetDetailsForPatient(patientId);

            if (!clientResult.Succeeded)
            {
                ViewBag.ErrorMessage += clientResult.ErrorMessages;
                return(View());
            }
            else
            {
                PatientEpisodeClient uec = new PatientEpisodeClient();
                var uecResult            = uec.GetEpisodesForPatient(patientId);

                if (!uecResult.Succeeded)
                {
                    ViewBag.ErrorMessage = uecResult.ErrorMessages;
                    return(View());
                }

                uecResult.Episodes.Sort((e1, e2) =>
                {
                    if (e1.MileStones.Count == 0 && e2.MileStones.Count == 0)
                    {
                        return(0);
                    }
                    if (e1.MileStones.Count > 0 && e2.MileStones.Count == 0)
                    {
                        return(-1);
                    }
                    if (e1.MileStones.Count == 0 && e2.MileStones.Count > 0)
                    {
                        return(1);
                    }

                    DateTime e1D = e1.MileStones.OrderByDescending(e => e.MilestoneDate).First().MilestoneDate;
                    DateTime e2D = e2.MileStones.OrderByDescending(e => e.MilestoneDate).First().MilestoneDate;

                    return(e1D.CompareTo(e2D));
                });

                ViewBag.Episodes  = uecResult.Episodes;
                ViewBag.PatientId = patientId;

                var ucClient = new UserClient();
                var ucResult = ucClient.GetPractitioners();
                ViewBag.Practitioners = ucResult.StringDictionary;
                return(View(clientResult.PatientDetails));
            }
        }