예제 #1
0
        public GetPatientGoalDataResponse GetPatientGoal(GetPatientGoalDataRequest request)
        {
            GetPatientGoalDataResponse result = null;

            try
            {
                result = new GetPatientGoalDataResponse();
                IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientGoal);

                PatientGoalData patientGoalData = repo.FindByID(request.Id) as PatientGoalData;
                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 = patientGoalData;
                result.Version  = request.Version;
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        public GetInterventionDataResponse GetIntervention(GetInterventionDataRequest request)
        {
            GetInterventionDataResponse result = null;

            try
            {
                result = new GetInterventionDataResponse();
                IGoalRepository repo = Factory.GetRepository(request, RepositoryType.Intervention);

                var intData = repo.FindByID(request.Id) as InterventionData;

                result.InterventionsData = intData;
                result.Version           = request.Version;
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
        public PutUpdateBarrierResponse UpdatePatientBarrier(PutUpdateBarrierRequest request)
        {
            try
            {
                PutUpdateBarrierResponse result = new PutUpdateBarrierResponse();

                IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientBarrier);

                if (request.BarrierIdsList != null && request.BarrierIdsList.Count > 0)
                {
                    List <PatientBarrierData> pid             = (List <PatientBarrierData>)repo.Find(request.PatientGoalId);
                    List <string>             dbBarrierIdList = GetBarrierIds(pid);

                    // update existing barrier entries with a delete
                    List <string> excludes = dbBarrierIdList.Except(request.BarrierIdsList).ToList <string>();
                    excludes.ForEach(ex =>
                    {
                        // create delete barrier request to insert
                        DeleteBarrierDataRequest dbr = new DeleteBarrierDataRequest {
                            BarrierId = ex, UserId = request.UserId
                        };
                        repo.Delete(dbr);
                    });
                }
                if (request.Barrier != null && request.Barrier.Id != "0")
                {
                    bool status = (bool)repo.Update(request);
                    if (status)
                    {
                        PatientBarrierData data = repo.FindByID(request.Barrier.Id) as PatientBarrierData;
                        result.BarrierData = data;
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        public PutUpdateGoalDataResponse PutPatientGoal(PutUpdateGoalDataRequest request)
        {
            try
            {
                PutUpdateGoalDataResponse result = new PutUpdateGoalDataResponse();

                IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientGoal);
                if (request.Goal != null)
                {
                    bool status = (bool)repo.Update(request);
                    if (status)
                    {
                        PatientGoalData data = repo.FindByID(request.Goal.Id) as PatientGoalData;
                        result.GoalData = data;
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }