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

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

            try
            {
                var activeCorePCM = _cohortRuleUtil.GetCareTeamActiveCorePCM(careTeam);

                if (activeCorePCM != null)
                {
                    //We need to add Active Core PCM from the CohortPatientView for the referenced individual
                    if (!data.UsersContactIds.IsNullOrEmpty())
                    {
                        _contactEndpointUtil.AddPCMToCohortPatientView(data.PatientId, activeCorePCM.ContactId, data.Version, data.ContractNumber, data.UserId, data.UsersContactIds.Contains(activeCorePCM.ContactId));
                    }
                }

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

                _logger.Log(ex);
            }
            return(response);
        }
示例#2
0
        public string GetCareTeamActiveCorePCMId(CohortRuleCheckData cohortRuleCheckData)
        {
            string res          = null;
            var    careTeamData = EndpointUtil.GetCareTeam(new GetCareTeamRequest
            {
                ContactId      = cohortRuleCheckData.ContactId,
                ContractNumber = cohortRuleCheckData.ContractNumber,
                UserId         = cohortRuleCheckData.UserId
            });

            if (careTeamData != null)
            {
                var careTeam = Mapper.Map <CareTeam>(careTeamData);
                var m        = _cohortRuleUtil.GetCareTeamActiveCorePCM(careTeam);
                if (m != null)
                {
                    res = m.Id;
                }
            }
            return(res);
        }