Example #1
0
        public ActionResult DeallocateTeamMember(Application.Entities.TeamMember model)
        {
            try
            {
                if (model.UserIds == null)
                {
                    return(RedirectToAction("Edit", "Patient", new { patientId = model.PatientId }));
                }

                _patientService.DeallocateTeamMember(model.PatientId, model.UserIds);
            }
            catch (BusinessRuleException ex)
            {
                TempData["Message_DeallocateTeamMember"] = ex.Message;
                TempData["Message_Data_PatientId"]       = model.PatientId;
                TempData["Message_Data_UserIds"]         = string.Join(",", model.UserIds);
            }

            return(RedirectToAction("Edit", "Patient", new { patientId = model.PatientId }));
        }
Example #2
0
        public ActionResult Edit(Guid patientId)
        {
            var baseObject = GetBaseObject();

            Application.Entities.Patient patient = _patientService.Get(patientId);

            IList <Application.EntityViews.MeasurementTool> measurementTools = _patientService.ListMeasurementTools(patientId);
            IList <Application.EntityViews.TeamMember>      teamMembers      = _patientService.ListTeamMembers(patientId);
            IList <Application.EntityViews.Visit>           visits           = _visitService.ListVisits(patientId);
            IList <Application.EntityViews.EpisodeOfCare>   episodesOfCare   = _patientService.ListEpisodesOfCare(patientId, baseObject.User.CurrentFacility.Id);

            Application.Entities.TeamMember teamMember = _patientService.GetTeamMember(patientId, baseObject.User.CurrentFacility);

            if (!patient.CanAccess(baseObject.User, teamMembers, baseObject.User.Permissions))
            {
                throw new BusinessRuleException("You are not autorized to view this patient");
            }

            return(View(new ViewObjects.Patient.Edit(baseObject)
            {
                Patient = patient,
                MeasurementTools = measurementTools,
                TeamMembers = teamMembers,
                Visits = visits,
                TeamMember = teamMember,
                EpisodesOfCare = episodesOfCare,
                EpisodeOfCare = new Application.Entities.EpisodeOfCare()
                {
                    ImpairmentGroups = _listRepository.GetImpairmentGroups(),
                    DischargeTypes = _listRepository.GetDischargeTypes(),
                    AdmissionTypes = _listRepository.GetAdmissionTypes(),
                    FacilityId = baseObject.User.CurrentFacility.Id,
                    userId = baseObject.User.Id
                },
                MeasurementToolList = new SelectList(_listRepository.GetMeasurementTools().Where(x => measurementTools.Count(y => y.Id == x.Id) == 0), "Id", "Name"),
                FrequencyList = new SelectList(_listRepository.GetFrequencies(), "Id", "Name"),
            }));
        }
Example #3
0
        public ActionResult AllocateTeamMember(Application.Entities.TeamMember model)
        {
            try
            {
                if (model.FacilityId == Guid.Empty)
                {
                    throw new BusinessRuleException("Facility cannot be empty");
                }

                if (model.UserIds == null)
                {
                    throw new BusinessRuleException("Users cannot be empty");
                }

                _patientService.AllocateTeamMember(model);
            }
            catch (BusinessRuleException ex)
            {
                TempData["Message_AllocateTeamMember"] = ex.Message;
            }

            return(RedirectToAction("Edit", "Patient", new { patientId = model.PatientId }));
        }