internal static PatientTask PostUpdateTaskRequest(PostPatientTaskRequest request) { try { PatientTask task = null; if (request.Task == null) { throw new Exception("The Task property is null in the request."); } IRestClient client = new JsonServiceClient(); string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Goal/{5}/Task/{6}/Update", DDPatientGoalsServiceUrl, "NG", request.Version, request.ContractNumber, request.PatientId, request.PatientGoalId, request.Id), request.UserId); PutUpdateTaskResponse response = client.Put <PutUpdateTaskResponse>(url, new PutUpdateTaskRequest { Task = GoalsUtil.ConvertToPatientTaskData(request.Task), UserId = request.UserId } as object); if (response != null && response.TaskData != null) { //Make a call to AttributeLibrary to get attributes details for Goal and Task. List <CustomAttribute> taskAttributesLibrary = GoalsEndpointUtil.GetAttributesLibraryByType(request, 2); task = GoalsUtil.ConvertToTask(response.TaskData, taskAttributesLibrary); } return(task); } catch (WebServiceException ex) { throw new WebServiceException("AD:PostUpdateTaskRequest()::" + ex.Message, ex.InnerException); } }
public static List <PatientTask> GetTasks(GetTasksRequest request) { List <PatientTask> tasks = null; try { //[Route("/{Context}/{Version}/{ContractNumber}/Goal/Tasks", "POST")] IRestClient client = new JsonServiceClient(); string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Goal/Tasks", DDPatientGoalsServiceUrl, "NG", request.Version, request.ContractNumber), request.UserId); GetPatientTasksDataResponse ddResponse = client.Post <GetPatientTasksDataResponse>(url, new GetPatientTasksDataRequest { Context = "NG", ContractNumber = request.ContractNumber, Version = request.Version, UserId = request.UserId, StatusIds = request.StatusIds, PatientId = request.PatientId } as object); if (ddResponse != null && ddResponse.TasksData != null) { tasks = new List <PatientTask>(); List <PatientTaskData> dataList = ddResponse.TasksData; foreach (PatientTaskData n in dataList) { //Make a call to AttributeLibrary to get attributes details for Goal and Task. List <CustomAttribute> taskAttributesLibrary = GoalsEndpointUtil.GetAttributesLibraryByType(request, 2); PatientTask i = GoalsUtil.ConvertToTask(n, taskAttributesLibrary); tasks.Add(i); } } } catch { throw; } return(tasks); }
internal static PatientTask GetPatientTaskForInitialize(GetInitializeTaskRequest request, PatientTaskData ptd) { PatientTask pt = null; try { if (ptd != null) { pt = new PatientTask { CustomAttributes = GoalsEndpointUtil.GetAttributesLibraryByType(request, 2), Id = ptd.Id, StartDate = ptd.StartDate, StatusId = ptd.StatusId, TargetDate = ptd.TargetDate, TargetValue = ptd.TargetValue, DeleteFlag = ptd.DeleteFlag, Details = ptd.Details }; } } catch (Exception ex) { throw new Exception("AD:GetPatientTaskForInitialize()::" + ex.Message, ex.InnerException); } return(pt); }
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 PatientGoal PostUpdateGoalRequest(PostPatientGoalRequest request) { try { PatientGoal goal = null; if (request.Goal == null) { throw new Exception("The Goal property is null in the request."); } else if (string.IsNullOrEmpty(request.Goal.Name) || string.IsNullOrEmpty(request.Goal.SourceId)) { throw new Exception("The goal name and source are required fields."); } IRestClient client = new JsonServiceClient(); string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Goal/{5}/Update", DDPatientGoalsServiceUrl, "NG", request.Version, request.ContractNumber, request.PatientId, request.Goal.Id), request.UserId); PutUpdateGoalDataResponse response = client.Put <PutUpdateGoalDataResponse>( url, new PutUpdateGoalDataRequest { Goal = convertToPatientGoalData(request.Goal), UserId = request.UserId } as object); if (response != null && response.GoalData != null) { //Make a call to AttributeLibrary to get attributes details for Goal. List <CustomAttribute> goalAttributesLibrary = GoalsEndpointUtil.GetAttributesLibraryByType(request, 1); goal = GoalsUtil.ConvertToGoal(response.GoalData, goalAttributesLibrary); } return(goal); } catch (WebServiceException ex) { throw new WebServiceException("AD:PostUpdateGoalRequest()::" + ex.Message, ex.InnerException); } }
public static PatientGoal GetPatientGoal(GetPatientGoalRequest request) { try { PatientGoal result = null; //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Goal/{Id}", "GET")] IRestClient client = new JsonServiceClient(); string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Goal/{5}", DDPatientGoalsServiceUrl, "NG", request.Version, request.ContractNumber, request.PatientId, request.Id), request.UserId); GetPatientGoalDataResponse ddResponse = client.Get <GetPatientGoalDataResponse>( url); if (ddResponse != null && ddResponse.GoalData != null) { //Make a call to AttributeLibrary to get attributes details for Goal and Task. List <CustomAttribute> goalAttributesLibrary = GoalsEndpointUtil.GetAttributesLibraryByType(request, 1); List <CustomAttribute> taskAttributesLibrary = GoalsEndpointUtil.GetAttributesLibraryByType(request, 2); result = GoalsUtil.ConvertToGoal(ddResponse.GoalData, goalAttributesLibrary); result.Barriers = GoalsUtil.ConvertToBarriers(ddResponse.GoalData.BarriersData); result.Tasks = GoalsUtil.ConvertToTasks(ddResponse.GoalData.TasksData, taskAttributesLibrary); result.Interventions = GoalsUtil.ConvertToInterventions(request, client, ddResponse.GoalData.InterventionsData); } return(result); } catch (WebServiceException ex) { throw new WebServiceException("AD:GetPatientGoal()::" + ex.Message, ex.InnerException); } }