예제 #1
0
        //public static PutRegisterPatientObservationResponse PutNewPatientProblem(string patientId, string userId, string elementId, IAppDomainRequest request)
        //{
        //    try
        //    {
        //        //register call to remote serivce.
        //        IRestClient client = new JsonServiceClient();

        //        string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Observation/Insert",
        //                           DDPatientObservationServiceUrl,
        //                           "NG",
        //                           request.Version,
        //                           request.ContractNumber,
        //                           patientId), request.UserId);

        //        PutRegisterPatientObservationResponse dataDomainResponse =
        //           client.Put<PutRegisterPatientObservationResponse>(
        //           url, new PutRegisterPatientObservationRequest
        //           {
        //               Id = elementId,
        //               StateId = 2,
        //               DisplayId = 1,
        //               UserId = userId
        //           } as object);
        //        return dataDomainResponse;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception("AD:PlanElementEndpointUtil:PutNewPatientProblem()::" + ex.Message, ex.InnerException);
        //    }
        //}

        //public static PutUpdateObservationDataResponse UpdatePatientProblem(string patientId, string userId, string elementId, PatientObservation pod, bool _active, IAppDomainRequest request)
        //{
        //    try
        //    {
        //        //register call to remote serivce.
        //        IRestClient client = new JsonServiceClient();

        //        string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Observation/Update",
        //                           DDPatientObservationServiceUrl,
        //                           "NG",
        //                           request.Version,
        //                           request.ContractNumber,
        //                           patientId), request.UserId);

        //        PatientObservationRecordData pdata = new PatientObservationRecordData
        //        {
        //            Id = pod.Id,
        //            StateId = pod.StateId,
        //            DeleteFlag = false
        //        };

        //        PutUpdateObservationDataRequest purequest = new PutUpdateObservationDataRequest
        //        {
        //            PatientObservationData = pdata,
        //            Context = "NG",
        //            ContractNumber = request.ContractNumber,
        //            UserId = request.UserId,
        //        };

        //        PutUpdateObservationDataResponse dataDomainResponse =
        //           client.Put<PutUpdateObservationDataResponse>(
        //           url, purequest as object);

        //        return dataDomainResponse;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception("AD:PlanElementEndpointUtil:UpdatePatientProblem()::" + ex.Message, ex.InnerException);
        //    }
        //}

        internal static ProgramAttributeData GetProgramAttributes(string planElemId, IAppDomainRequest request)
        {
            ProgramAttributeData progAttr = null;

            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}/Program/Attributes/?PlanElementId={4}",
                                                                  DDProgramServiceUrl,
                                                                  context,
                                                                  version,
                                                                  contractNumber,
                                                                  planElemId), request.UserId);

                GetProgramAttributeResponse resp =
                    client.Get <GetProgramAttributeResponse>(
                        url);

                return(progAttr = resp.ProgramAttribute);
            }
            catch (Exception ex)
            {
                throw new Exception("AD:PlanElementEndpointUtil:GetProgramAttributes()::" + ex.Message, ex.InnerException);
            }
        }
예제 #2
0
        public void Select_Attribute_Test()
        {
            string url            = "http://localhost:8888/Program";
            string contractNumber = "InHealth001";
            string context        = "NG";
            double version        = 1.0;
            string planElementId  = "52ede291fe7a590728e1a382";

            IRestClient client = new JsonServiceClient();

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

            GetProgramAttributeResponse resp =
                client.Get <GetProgramAttributeResponse>(
                    string.Format("{0}/{1}/{2}/{3}/Program/Attributes/?PlanElementId={4}",
                                  url,
                                  context,
                                  version,
                                  contractNumber,
                                  planElementId));
        }
예제 #3
0
        public GetProgramAttributeResponse GetProgramAttributes(GetProgramAttributeRequest request)
        {
            try
            {
                GetProgramAttributeResponse    response          = new GetProgramAttributeResponse();
                ICollection <SelectExpression> selectExpressions = new List <SelectExpression>();

                // PlanElementId
                SelectExpression patientSelectExpression = new SelectExpression();
                patientSelectExpression.FieldName       = MEProgramAttribute.PlanElementIdProperty;
                patientSelectExpression.Type            = SelectExpressionType.EQ;
                patientSelectExpression.Value           = request.PlanElementId;
                patientSelectExpression.ExpressionOrder = 1;
                patientSelectExpression.GroupID         = 1;
                selectExpressions.Add(patientSelectExpression);

                APIExpression apiExpression = new APIExpression();
                apiExpression.Expressions = selectExpressions;

                IProgramRepository repo = Factory.GetRepository(request, RepositoryType.PatientProgramAttribute);//.GetProgramAttributesRepository(request);

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

                if (result != null)
                {
                    List <ProgramAttributeData> pds = result.Item2.Cast <ProgramAttributeData>().ToList();
                    if (pds.Count > 0)
                    {
                        response.ProgramAttribute = pds.FirstOrDefault();
                    }
                }

                return(response);
            }
            catch (Exception ex)
            {
                throw new Exception("DD:DataProgramManager:GetProgramAttributes()::" + ex.Message, ex.InnerException);
            }
        }
예제 #4
0
        public GetProgramAttributeResponse Get(GetProgramAttributeRequest request)
        {
            GetProgramAttributeResponse response = new GetProgramAttributeResponse();

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

                response         = ProgramDataManager.GetProgramAttributes(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);
        }