public static PatientGoalData GetInitialGoalRequest(GetInitializeGoalRequest request) { try { PatientGoalData result = null; IRestClient client = new JsonServiceClient(); string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Goal/Initialize", DDPatientGoalsServiceUrl, "NG", request.Version, request.ContractNumber, request.PatientId), request.UserId); PutInitializeGoalDataResponse dataDomainResponse = client.Put <PutInitializeGoalDataResponse>( url, new PutInitializeGoalDataRequest() as object); if (dataDomainResponse != null) { result = dataDomainResponse.Goal; } return(result); } catch (WebServiceException ex) { throw new WebServiceException("AD:GetInitialGoalRequest()::" + ex.Message, ex.InnerException); } }
internal static PatientGoal GetPatientGoalForInitialize(GetInitializeGoalRequest request, PatientGoalData pgd) { PatientGoal pg = null; try { if (pgd != null) { pg = new PatientGoal { CustomAttributes = GoalsEndpointUtil.GetAttributesLibraryByType(request, 1), //GetAttributesForInitialize(pgd.Attributes), // change this call when attributes are ready EndDate = pgd.EndDate, Id = pgd.Id, Name = pgd.Name, PatientId = pgd.PatientId, SourceId = pgd.SourceId, StartDate = pgd.StartDate, StatusId = pgd.StatusId, TargetDate = pgd.TargetDate, TargetValue = pgd.TargetValue, TypeId = pgd.TypeId }; } } catch (Exception ex) { throw new Exception("AD:GetPatientGoalForInitialize()::" + ex.Message, ex.InnerException); } return(pg); }
public PatientGoalData GetInitialGoalRequest(GetInitializeGoalRequest request) { var pgd = new PatientGoalData { Id = "233336745678235647821232", Name = "Example Patient Goal Data", StartDate = DateTime.UtcNow }; return(pgd); }
public void UpdatePatient_Test() { GetInitializeGoalRequest request = new GetInitializeGoalRequest(); request.ContractNumber = "InHealth001"; request.UserId = "531f2df4072ef727c4d2a3b2"; request.Version = 1; request.PatientId = "52f55874072ef709f84e68c5"; GoalsManager gManager = new GoalsManager(); GetInitializeGoalResponse response = gManager.GetInitialGoalRequest(request); Assert.IsNotNull(response); }
public void InitializePatientGoal_Test() { GetInitializeGoalRequest request = new GetInitializeGoalRequest(); request.ContractNumber = "InHealth001"; request.UserId = "AD_TestHarness"; request.Version = 1; request.PatientId = "531f2dcd072ef727c4d29fb0"; request.UserId = "531f2df5072ef727c4d2a3bc"; GoalsManager gManager = new GoalsManager(); GetInitializeGoalResponse response = gManager.GetInitialGoalRequest(request); Assert.IsNotNull(response); }
public GetInitializeGoalResponse GetInitialGoalRequest(GetInitializeGoalRequest request) { try { GetInitializeGoalResponse response = new GetInitializeGoalResponse(); PatientGoalData pg = (PatientGoalData)GoalsEndpointUtil.GetInitialGoalRequest(request); response.Goal = GoalsUtil.GetPatientGoalForInitialize(request, pg); response.Version = request.Version; return(response); } catch (Exception ex) { throw new Exception("AD:GetInitialGoalRequest()::" + ex.Message, ex.InnerException); } }
public GetInitializeGoalResponse Get(GetInitializeGoalRequest request) { GetInitializeGoalResponse response = new GetInitializeGoalResponse(); 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.GetInitialGoalRequest(request); } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { gm.LogException(ex); } } finally { List <string> patientIds = null; if (response.Goal != null) { patientIds = new List <string>(); patientIds.Add(response.Goal.PatientId); } if (result != null) { AuditHelper.LogAuditData(request, result.SQLUserId, patientIds, System.Web.HttpContext.Current.Request, request.GetType().Name); } } return(response); }