예제 #1
0
        public void SavePatientGoal_Test()
        {
            PostPatientGoalRequest request = new PostPatientGoalRequest();

            request.ContractNumber = "InHealth001";
            request.Version        = 1;
            request.UserId         = "531f2df5072ef727c4d2a3bc";
            request.PatientId      = "5325db62d6a4850adcbba91e";
            request.PatientGoalId  = "5438563484ac050d1cb15617";
            request.Goal           = new PatientGoal
            {
                Id = "5438563484ac050d1cb15617",
                //FocusAreaIds = new List<string> { "532be4771e60150ce42f8a30" },
                Name      = "Snehal 3",
                PatientId = "5325db62d6a4850adcbba91e",
                SourceId  = "52fa57c9d433231dd0775011",
                StatusId  = 2,
                StartDate = DateTime.UtcNow,
            };

            GoalsManager            gManager = new GoalsManager();
            PostPatientGoalResponse response = gManager.SavePatientGoal(request);

            Assert.IsNotNull(response);
        }
예제 #2
0
 public PostPatientGoalResponse SavePatientGoal(PostPatientGoalRequest request)
 {
     try
     {
         PostPatientGoalResponse pgr = new PostPatientGoalResponse();
         pgr.Goal    = GoalsEndpointUtil.PostUpdateGoalRequest(request);
         pgr.Version = request.Version;
         return(pgr);
     }
     catch (Exception ex)
     {
         throw new Exception("AD:SavePatientGoal()::" + ex.Message, ex.InnerException);
     }
 }
예제 #3
0
        public void Post_PatientGoal_Update_Test()
        {
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            double      version        = 1.0;
            string      token          = "5303ddbdd6a4850f14a7a83c";
            string      patientId      = "52e26f0b072ef7191c111c4d";
            string      patientGoalId  = "53011f1ed4332316c093952b";
            IRestClient client         = new JsonServiceClient();

            PostPatientGoalResponse response = client.Post <PostPatientGoalResponse>(
                string.Format(@"http://localhost:888/Nightingale/{0}/{1}/Patient/{2}/Goal/{3}/Update/?Token={4}",
                              version,
                              contractNumber,
                              patientId,
                              patientGoalId,
                              token), new PostPatientGoalRequest
            {
                Goal = PostInitializeGoalRequest()
            } as object);
        }
예제 #4
0
        public PostPatientGoalResponse Post(PostPatientGoalRequest request)
        {
            PostPatientGoalResponse response = new PostPatientGoalResponse();
            GoalsManager            gm       = new GoalsManager();
            ValidateTokenResponse   result   = null;

            try
            {
                request.Token = base.Request.Headers["Token"] as string;
                result        = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber);
                if (result.UserId.Trim() != string.Empty)
                {
                    request.UserId = result.UserId;
                    response       = gm.SavePatientGoal(request);
                }
                else
                {
                    throw new UnauthorizedAccessException();
                }
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);
                if ((ex is WebServiceException) == false)
                {
                    gm.LogException(ex);
                }
            }
            finally
            {
                if (result != null)
                {
                    AuditHelper.LogAuditData(request, result.SQLUserId, null, System.Web.HttpContext.Current.Request, request.GetType().Name);
                }
            }
            return(response);
        }