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()); }
public ActionResult QuestionnaireResults(string patientId, int?episodeId, int?questionnaireId) { Dictionary <Episode, Dictionary <string, Dictionary <string, object> > > data; Dictionary <Episode, Dictionary <string, List <ProDomainResultSet> > > sets = ProResults.GetProDomainResultSetForQuestionnaireAndPatient(patientId, episodeId.HasValue ? episodeId.Value : 0, questionnaireId.HasValue ? questionnaireId.Value : 0, out data); ViewBag.Data = data; ViewBag.howManyColumns = 5; return(View(sets)); }