Esempio n. 1
0
        public static ObjectId GetPatientsPrimaryCareManager(GetPrimaryCareManagerDataRequest request, IRestClient client)
        {
            try
            {
                ObjectId pcmObjectId = ObjectId.Empty;
                // [Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/PrimaryCareManager", "GET")]
                string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/PrimaryCareManager",
                                                                  DDCareMemberUrl,
                                                                  "NG",
                                                                  request.Version,
                                                                  request.ContractNumber,
                                                                  request.PatientId), request.UserId);

                GetCareMemberDataResponse ddResponse = client.Get <GetCareMemberDataResponse>(url);

                if (ddResponse != null && ddResponse.CareMember != null)
                {
                    pcmObjectId = ObjectId.Parse(ddResponse.CareMember.ContactId);
                }
                return(pcmObjectId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public CareMember GetCareMember(GetCareMemberRequest request)
        {
            try
            {
                CareMember result = null;
                //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/CareMember/{Id}", "GET")]
                IRestClient client = new JsonServiceClient();
                string      url    = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/CareMember/{5}",
                                                                          DDCareMemberUrl,
                                                                          "NG",
                                                                          request.Version,
                                                                          request.ContractNumber,
                                                                          request.PatientId,
                                                                          request.Id), request.UserId);

                GetCareMemberDataResponse ddResponse = client.Get <GetCareMemberDataResponse>(url);

                if (ddResponse != null && ddResponse.CareMember != null)
                {
                    CareMemberData n          = ddResponse.CareMember;
                    List <string>  contactIds = new List <string>();
                    contactIds.Add(n.ContactId);
                    List <ContactData> contactsData = getContactDetails(contactIds, request.Version, request.ContractNumber, request.UserId);
                    string             pfName       = string.Empty;
                    string             gender       = string.Empty;
                    var contact = contactsData.Find(a => a.Id == n.ContactId);
                    if (contact != null)
                    {
                        pfName = contact.PreferredName;
                        gender = contact.Gender;
                    }
                    result = new CareMember
                    {
                        Id            = n.Id,
                        PatientId     = n.PatientId,
                        ContactId     = n.ContactId,
                        PreferredName = pfName,
                        Gender        = gender,
                        Primary       = n.Primary,
                        TypeId        = n.TypeId
                    };
                }
                return(result);
            }
            catch (WebServiceException ex)
            {
                throw new WebServiceException("AD:GetCareMember()::" + ex.Message, ex.InnerException);
            }
        }
Esempio n. 3
0
        public void Post_CareMemberByID()
        {
            string      url            = "http://localhost:8888/Program";
            string      ProgramID      = "52a0da34fe7a5915485bdfd6";
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            double      version        = 1.0;
            IRestClient client         = new JsonServiceClient();

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

            GetCareMemberDataResponse response = client.Post <GetCareMemberDataResponse>(
                string.Format("{0}/{1}/{2}/{3}/CareMember/{4}", url, context, version, contractNumber, ProgramID),
                new GetCareMemberDataResponse() as object);

            Assert.AreEqual(string.Empty, string.Empty);
        }
Esempio n. 4
0
        public GetCareMemberDataResponse Get(GetCareMemberDataRequest request)
        {
            GetCareMemberDataResponse response = new GetCareMemberDataResponse();

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

                response.CareMember = Manager.GetCareMember(request);
                response.Version    = request.Version;
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);

                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Common.Helper.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }