Esempio n. 1
0
        internal static CohortPatientViewData RequestCohortPatientViewData(string patientId, IAppDomainRequest request)
        {
            try
            {
                double version        = request.Version;
                string contractNumber = request.ContractNumber;
                string context        = "NG";

                IRestClient client = new JsonServiceClient();

                string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/patient/{4}/cohortpatientview/",
                                                                  DDPatientServiceUrl,
                                                                  context,
                                                                  version,
                                                                  contractNumber,
                                                                  patientId), request.UserId);

                GetCohortPatientViewResponse response =
                    client.Get <GetCohortPatientViewResponse>(url);

                return(response.CohortPatientView);
            }
            catch (Exception ex)
            {
                throw new Exception("AD:PlanElementEndpointUtil:RequestCohortPatientViewData()::" + ex.Message, ex.InnerException);
            }
        }
Esempio n. 2
0
        public GetCohortPatientViewResponse GetCohortPatientView(string patientId)
        {
            Uri getCohortUri = new Uri(string.Format("{0}/Patient/{1}/{2}/{3}/patient/{4}/cohortpatientview?UserId={5}",
                                                     Url,
                                                     Context,
                                                     Version,
                                                     ContractNumber,
                                                     patientId,
                                                     HeaderUserId));

            HttpClient getCohortClient = GetHttpClient(getCohortUri);

            var getCohortResponse        = getCohortClient.GetStringAsync(getCohortUri);
            var getCohortResponseContent = getCohortResponse.Result;

            string getCohortResponseString = getCohortResponseContent;
            GetCohortPatientViewResponse responseContact = null;

            using (var getCohortMsResponse = new MemoryStream(Encoding.Unicode.GetBytes(getCohortResponseString)))
            {
                var getContactSerializer = new DataContractJsonSerializer(typeof(GetCohortPatientViewResponse));
                responseContact = (GetCohortPatientViewResponse)getContactSerializer.ReadObject(getCohortMsResponse);
            }

            return(responseContact);
        }
Esempio n. 3
0
        public GetCohortPatientViewResponse GetCohortPatientView(GetCohortPatientViewRequest request)
        {
            IPatientRepository repo = Factory.GetRepository(request, RepositoryType.CohortPatientView);

            GetCohortPatientViewResponse   result            = new GetCohortPatientViewResponse();
            ICollection <SelectExpression> selectExpressions = new List <SelectExpression>();

            // PatientID
            SelectExpression patientSelectExpression = new SelectExpression();

            patientSelectExpression.FieldName       = MECohortPatientView.PatientIDProperty;
            patientSelectExpression.Type            = SelectExpressionType.EQ;
            patientSelectExpression.Value           = request.PatientID;
            patientSelectExpression.ExpressionOrder = 1;
            patientSelectExpression.GroupID         = 1;
            selectExpressions.Add(patientSelectExpression);

            APIExpression apiExpression = new APIExpression();

            apiExpression.Expressions = selectExpressions;

            Tuple <string, IEnumerable <object> > cohortPatientView = repo.Select(apiExpression);

            if (cohortPatientView != null)
            {
                List <CohortPatientViewData> cpd = cohortPatientView.Item2.Cast <CohortPatientViewData>().ToList();
                result.CohortPatientView = cpd[0];
            }

            return(result);
        }
Esempio n. 4
0
        public void UpdateCohortPatientView(string patientId, string careMemberContactId)
        {
            GetCohortPatientViewResponse getResponse = GetCohortPatientView(patientId);

            if (getResponse != null && getResponse.CohortPatientView != null)
            {
                CohortPatientViewData cpvd = getResponse.CohortPatientView;
                // check to see if primary care manager's contactId exists in the searchfield
                if (!cpvd.SearchFields.Exists(sf => sf.FieldName == "PCM"))
                {
                    cpvd.SearchFields.Add(new SearchFieldData
                    {
                        Value     = careMemberContactId,
                        Active    = true,
                        FieldName = "PCM"
                    });
                }
                else
                {
                    cpvd.SearchFields.ForEach(sf =>
                    {
                        if (sf.FieldName == "PCM")
                        {
                            sf.Value  = careMemberContactId;
                            sf.Active = true;
                        }
                    });
                }

                PutUpdateCohortPatientViewRequest request = new PutUpdateCohortPatientViewRequest
                {
                    CohortPatientView = cpvd,
                    ContractNumber    = ContractNumber,
                    PatientID         = patientId
                };

                PutUpdateCohortPatientViewResponse response = UpdateCohortPatientView(request, patientId);
                if (string.IsNullOrEmpty(response.CohortPatientViewId))
                {
                    throw new Exception("Unable to update Cohort Patient View");
                }
            }
        }
Esempio n. 5
0
        public void Get_CohortPatientView_Response_Test()
        {
            double version        = 1.0;
            string contractNumber = "InHealth001";
            string context        = "NG";
            string patientId      = "52e26f11072ef7191c111c54";

            IRestClient client = new JsonServiceClient();

            JsonServiceClient.HttpWebRequestFilter = x =>
                                                     x.Headers.Add(string.Format("{0}: {1}", "x-Phytel-UserID", "531f2df9072ef727c4d2a3df"));

            GetCohortPatientViewResponse response =
                client.Get <GetCohortPatientViewResponse>(string.Format("{0}/{1}/{2}/{3}/patient/{4}/cohortpatientview/",
                                                                        "http://localhost:8888/Patient",
                                                                        context,
                                                                        version,
                                                                        contractNumber,
                                                                        patientId));
        }
Esempio n. 6
0
        public GetCohortPatientViewResponse Get(GetCohortPatientViewRequest request)
        {
            GetCohortPatientViewResponse response = new GetCohortPatientViewResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("PatientDD:Get()::Unauthorized Access");
                }

                response         = PatientManager.GetCohortPatientView(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex);

                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Helpers.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }
Esempio n. 7
0
        private void upsertCohortPatientView(string patientId, string contactId, double version, string contractNumber, string userId)
        {
            string context = "NG";

            try
            {
                IRestClient client = new JsonServiceClient();
                string      url    = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/patient/{4}/cohortpatientview/",
                                                                          DDPatientServiceURL,
                                                                          context,
                                                                          version,
                                                                          contractNumber,
                                                                          patientId), userId);

                GetCohortPatientViewResponse getResponse =
                    client.Get <GetCohortPatientViewResponse>(url);

                if (getResponse != null && getResponse.CohortPatientView != null)
                {
                    CohortPatientViewData cpvd = getResponse.CohortPatientView;
                    // check to see if primary care manager's contactId exists in the searchfield
                    if (!cpvd.SearchFields.Exists(sf => sf.FieldName == Constants.PCM))
                    {
                        cpvd.SearchFields.Add(new SearchFieldData
                        {
                            Value     = contactId,
                            Active    = true,
                            FieldName = Constants.PCM
                        });
                    }
                    else
                    {
                        cpvd.SearchFields.ForEach(sf =>
                        {
                            if (sf.FieldName == Constants.PCM)
                            {
                                sf.Value  = contactId;
                                sf.Active = true;
                            }
                        });
                    }

                    string cohortPatientViewURL = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/patient/{4}/cohortpatientview/update",
                                                                                       DDPatientServiceURL,
                                                                                       context,
                                                                                       version,
                                                                                       contractNumber,
                                                                                       patientId), userId);

                    PutUpdateCohortPatientViewResponse putResponse =
                        client.Put <PutUpdateCohortPatientViewResponse>(cohortPatientViewURL, new PutUpdateCohortPatientViewRequest
                    {
                        CohortPatientView = cpvd,
                        ContractNumber    = contractNumber,
                        PatientID         = patientId
                    } as object);
                }
            }
            catch (WebServiceException ex)
            {
                throw new WebServiceException("AD:UpsertCohortPatientView()::" + ex.Message, ex.InnerException);
            }
        }