public GetGoalDataResponse GetGoal(GetGoalDataRequest request) { GetGoalDataResponse result = null; try { result = new GetGoalDataResponse(); IGoalRepository repo = Factory.GetRepository(request, RepositoryType.Goal); GoalData goalData = repo.FindByID(request.Id) as GoalData; //if (patientGoalData != null) //{ // //Get all barriers for a given goal // patientGoalData.BarriersData = getBarriersByPatientGoalId(request, patientGoalData.Id); // //Get all tasks for a given goal // patientGoalData.TasksData = getTasksByPatientGoalId(request, patientGoalData.Id); // //Get all interventions for a given goal // patientGoalData.InterventionsData = getInterventionsByPatientGoalId(request, patientGoalData.Id); //} result.GoalData = goalData; result.Version = request.Version; return(result); } catch (Exception ex) { throw ex; } }
public Goal GetGoalById(string sid, string userId, IAppDomainRequest req) { try { var request = new GetGoalDataRequest(); IRestClient client = new JsonServiceClient(); //"/{Context}/{Version}/{ContractNumber}/Goal/{Id}" var url = Common.Helper.BuildURL(string.Format(@"{0}/{1}/{2}/{3}/Goal/{4}", DDPatientGoalsServiceUrl, "NG", req.Version, req.ContractNumber, sid), userId); var response = client.Get <GetGoalDataResponse>(url); if (response == null) { throw new Exception("Goal template was not found or initialized."); } var goal = Mapper.Map <Goal>(response.GoalData); goal.StatusId = response.GoalData.StatusId; return(goal); } catch (Exception ex) { throw new Exception("AD:EndpointUtils:GetGoalById()::" + ex.Message, ex.InnerException); } }
public Goal GetGoalById(string sid, string userId, IAppDomainRequest req) { //var goal = new Goal //{ // Id = "123456789012345678901234", // EndDate = DateTime.UtcNow, // Name = "sample goal name", // UtilizationSourceId = "5325db9cd6a4850adcbba9ca", // StartDate = DateTime.UtcNow, // StatusId = 1, // TargetDate = DateTime.UtcNow, // TargetValue = "12", // TypeId = 2, // CustomAttributes = new List<CustomAttribute> {new CustomAttribute {Id = "1234", Name = "testing value"}}, // FocusAreaIds = new List<string> {"123456789098676745763"} //}; //return goal; try { var request = new GetGoalDataRequest(); IRestClient client = new JsonServiceClient(); //"/{Context}/{Version}/{ContractNumber}/Goal/{Id}" var url = Helper.BuildURL(string.Format(@"{0}/{1}/{2}/{3}/Goal/{4}", "http://localhost:8888/PatientGoal", "NG", req.Version, req.ContractNumber, sid), userId); var response = client.Get <GetGoalDataResponse>(url); if (response == null) { throw new Exception("Schedule template was not found or initialized."); } var goal = Mapper.Map <Goal>(response.GoalData); //new Goal(); return(goal); } catch (Exception ex) { throw new Exception("AD:PlanElementEndpointUtil:GetGoalById()::" + ex.Message, ex.InnerException); } }
public PatientGoal GetOpenNotMetPatientGoalByTemplateId(string sid, string patientId, string userId, IAppDomainRequest req) { //PatientGoal pg = new PatientGoal //{ // StatusId = 1, // Name = "test patient goal", // Id = "123456789012345612345678", // PatientId = "5325da9ed6a4850adcbba6ce" //}; //return pg; try { var request = new GetGoalDataRequest(); IRestClient client = new JsonServiceClient(); //"/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Goal/" var url = Helper.BuildURL(string.Format(@"{0}/{1}/{2}/{3}/Patient/{4}/Goal/?TemplateId={5}", "http://localhost:8888/PatientGoal", "NG", req.Version, req.ContractNumber, "5424628084ac050e3806e8e2", "545a91a1fe7a59218cef2d6d"), userId); var response = client.Get <GetPatientGoalByTemplateIdResponse>(url); if (response == null) { throw new Exception("Patient goal was not found."); } var goal = Mapper.Map <PatientGoal>(response.GoalData); //var patientGoal = Mapper.Map<Goal>(response.GoalData); //new Goal(); return(goal); } catch (Exception ex) { throw new Exception("AD:PlanElementEndpointUtil:GetGoalById()::" + ex.Message, ex.InnerException); } }
public GetGoalDataResponse Get(GetGoalDataRequest request) { GetGoalDataResponse response = new GetGoalDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientGoalDD:Get()::Unauthorized Access"); } response = Manager.GetGoal(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); }