예제 #1
0
        public GetPatientInterventionsDataResponse GetPatientInterventions(GetPatientInterventionsDataRequest request)
        {
            try
            {
                var result = new GetPatientInterventionsDataResponse();

                IGoalRepository intRepo  = Factory.GetRepository(request, RepositoryType.PatientIntervention);
                IGoalRepository goalRepo = Factory.GetRepository(request, RepositoryType.PatientGoal);
                intRepo.UserId = request.UserId;
                // Get all the goals associated to the patient in the request object.
                if (!string.IsNullOrEmpty(request.PatientId))
                {
                    List <PatientGoalViewData> goalViewDataList = goalRepo.Find(request.PatientId) as List <PatientGoalViewData>;
                    List <string> patientGoalIds = goalViewDataList.Select(a => a.Id).ToList();
                    if (patientGoalIds != null && patientGoalIds.Count > 0)
                    {
                        result.InterventionsData = (List <PatientInterventionData>)intRepo.Search(request, patientGoalIds);
                    }
                }
                else
                {
                    result.InterventionsData = (List <PatientInterventionData>)intRepo.Search(request, null);
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        public static List <PatientIntervention> GetInterventions(GetInterventionsRequest request)
        {
            List <PatientIntervention> interventions = null;

            try
            {
                //[Route("/{Context}/{Version}/{ContractNumber}/Goal/Interventions", "POST")]
                IRestClient client = new JsonServiceClient();
                string      url    = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Goal/Interventions",
                                                                          DDPatientGoalsServiceUrl,
                                                                          "NG",
                                                                          request.Version,
                                                                          request.ContractNumber), request.UserId);

                GetPatientInterventionsDataResponse ddResponse =
                    client.Post <GetPatientInterventionsDataResponse>(url, new GetPatientInterventionsDataRequest
                {
                    Context        = "NG",
                    ContractNumber = request.ContractNumber,
                    Version        = request.Version,
                    UserId         = request.UserId,
                    AssignedToId   = request.AssignedToId,
                    CreatedById    = request.CreatedById,
                    PatientId      = request.PatientId,
                    StatusIds      = request.StatusIds
                } as object);

                if (ddResponse != null && ddResponse.InterventionsData != null)
                {
                    var filteredInterventions = ddResponse.InterventionsData;
                    if (request.InterventionFilterType != 0)
                    {
                        filteredInterventions = GetFilteredInterventions(ddResponse.InterventionsData, request);
                    }
                    interventions = new List <PatientIntervention>();
                    var patientIds      = filteredInterventions.Select(x => x.PatientId).ToList();
                    var patientsDetails = GetPatientsDetails(request.Version, request.ContractNumber, request.UserId, client, patientIds);

                    foreach (PatientInterventionData n in filteredInterventions)
                    {
                        PatientIntervention i = GoalsUtil.ConvertToIntervention(n);
                        i.PatientDetails = patientsDetails.FirstOrDefault(x => x.Id == n.PatientId);
                        i.PatientId      = n.PatientId;
                        interventions.Add(i);
                    }
                }
            }
            catch
            {
                throw;
            }
            return(interventions);
        }
예제 #3
0
        public List <PatientIntervention> GetInterventions(GetInterventionsRequest request)
        {
            List <PatientIntervention> interventions = null;

            try
            {
                //[Route("/{Context}/{Version}/{ContractNumber}/Goal/Interventions", "POST")]
                IRestClient client = new JsonServiceClient();
                string      url    = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Goal/Interventions",
                                                                          DDPatientGoalsServiceUrl,
                                                                          "NG",
                                                                          request.Version,
                                                                          request.ContractNumber), request.UserId);

                GetPatientInterventionsDataResponse ddResponse =
                    client.Post <GetPatientInterventionsDataResponse>(url, new GetPatientInterventionsDataRequest
                {
                    Context        = "NG",
                    ContractNumber = request.ContractNumber,
                    Version        = request.Version,
                    UserId         = request.UserId,
                    AssignedToId   = request.AssignedToId,
                    CreatedById    = request.CreatedById,
                    PatientId      = request.PatientId,
                    StatusIds      = request.StatusIds
                } as object);

                if (ddResponse != null && ddResponse.InterventionsData != null)
                {
                    interventions = new List <PatientIntervention>();
                    List <PatientInterventionData> dataList = ddResponse.InterventionsData;
                    foreach (PatientInterventionData n in dataList)
                    {
                        PatientIntervention i = GoalsUtil.ConvertToIntervention(n);
                        // Call Patient DD to get patient details.
                        i.PatientDetails = GetPatientDetails(request.Version, request.ContractNumber, request.UserId, client, n.PatientId);
                        i.PatientId      = n.PatientId;
                        interventions.Add(i);
                    }
                }
            }
            catch
            {
                throw;
            }
            return(interventions);
        }
예제 #4
0
        public GetPatientInterventionsDataResponse Post(GetPatientInterventionsDataRequest request)
        {
            GetPatientInterventionsDataResponse response = new GetPatientInterventionsDataResponse();

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

                response         = Manager.GetPatientInterventions(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);
        }