Example #1
0
        public CohortRuleResponse Run(CareTeam careTeam, CohortRuleCheckData data)
        {
            var response = new CohortRuleResponse();

            try
            {
                if (careTeam == null)
                {
                    throw new ArgumentNullException("careTeam");
                }

                //Check if any of the members have active core PCM role.
                if (!_cohortRuleUtil.CheckIfCareTeamHasActiveCorePCM(careTeam))
                {
                    //Add to UnAssigned PCM.
                    var isSuccessful = _contactEndpointUtil.RemovePCMCohortPatientView(data.PatientId, data.Version, data.ContractNumber, data.UserId);

                    response.IsSuccessful = isSuccessful;
                }
            }
            catch (Exception ex)
            {
                response.IsSuccessful = false;
                response.ErrorCode    = "UnAssignedPCMRule.Cohort.Error";
                response.Message      = ex.Message;

                _logger.Log(ex);
            }

            return(response);
        }