Ejemplo n.º 1
0
        internal static PatientIntervention PostUpdateInterventionRequest(PostPatientInterventionRequest request)
        {
            try
            {
                PatientIntervention intervention = null;

                if (request.Intervention == null)
                {
                    throw new Exception("The Intervention 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}/Intervention/{6}/Update", DDPatientGoalsServiceUrl, "NG", request.Version, request.ContractNumber, request.PatientId, request.PatientGoalId, request.Id), request.UserId);

                PutUpdateInterventionResponse response = client.Put <PutUpdateInterventionResponse>(url, new PutUpdateInterventionRequest {
                    Intervention = GoalsUtil.ConvertToInterventionData(request.Intervention), UserId = request.UserId
                } as object);

                if (response != null && response.InterventionData != null)
                {
                    intervention = GoalsUtil.ConvertToIntervention(response.InterventionData);
                    // Call Patient DD to get patient details.
                    intervention.PatientDetails = GetPatientDetails(request.Version, request.ContractNumber, request.UserId, client, response.InterventionData.PatientId);
                    intervention.PatientId      = response.InterventionData.PatientId;
                }
                return(intervention);
            }
            catch (WebServiceException ex)
            {
                throw new WebServiceException("AD:PostUpdateInterventionRequest()::" + ex.Message, ex.InnerException);
            }
        }
Ejemplo n.º 2
0
        internal static bool PostUpdateInterventionRequest(PostPatientGoalRequest request, PatientInterventionData pi)
        {
            try
            {
                bool result = false;

                List <string> interventionsIds = GetInterventionIdsForRequest(request.Goal.Interventions);

                IRestClient client = new JsonServiceClient();

                string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Goal/{5}/Intervention/{6}/Update", DDPatientGoalsServiceUrl, "NG", request.Version, request.ContractNumber, request.PatientId, request.Goal.Id, pi.Id), request.UserId);

                PutUpdateInterventionResponse response = client.Put <PutUpdateInterventionResponse>(url, new PutUpdateInterventionRequest {
                    Intervention = pi, UserId = request.UserId, InterventionIdsList = interventionsIds
                } as object);

                if (response != null)
                {
                    result = true;
                }

                return(result);
            }
            catch (WebServiceException ex)
            {
                throw new WebServiceException("AD:PostUpdateInterventionRequest()::" + ex.Message, ex.InnerException);
            }
        }
Ejemplo n.º 3
0
        public PutUpdateInterventionResponse UpdatePatientIntervention(PutUpdateInterventionRequest request)
        {
            try
            {
                PutUpdateInterventionResponse result = new PutUpdateInterventionResponse();

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

                if (request.InterventionIdsList != null && request.InterventionIdsList.Count > 0)
                {
                    List <PatientInterventionData> pid = (List <PatientInterventionData>)repo.Find(request.PatientGoalId);
                    List <string> dbTaskIdList         = GetInterventionIds(pid);

                    // update existing intervention entries with a delete
                    List <string> excludes = dbTaskIdList.Except(request.InterventionIdsList).ToList <string>();
                    excludes.ForEach(ex =>
                    {
                        // create delete intervention request to insert
                        DeleteInterventionDataRequest dtr = new DeleteInterventionDataRequest {
                            InterventionId = ex, UserId = request.UserId
                        };
                        repo.Delete(dtr);
                    });
                }
                if (request.Intervention != null && request.Intervention.Id != "0")
                {
                    bool status = (bool)repo.Update(request);
                    if (status)
                    {
                        PatientInterventionData data = repo.FindByID(request.Intervention.Id) as PatientInterventionData;
                        result.InterventionData = data;
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
        public PutUpdateInterventionResponse Put(PutUpdateInterventionRequest request)
        {
            PutUpdateInterventionResponse response = new PutUpdateInterventionResponse();

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

                response         = Manager.UpdatePatientIntervention(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);
        }
        public void Update_Patient_Intervention()
        {
            string      url            = "http://localhost:8888/PatientGoal";
            string      patientId      = "52a0da34fe7a5915485bdfd6";
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            string      version        = "v1";
            string      patientGoalId  = "12341cf8fe7a592d046c548f";
            string      id             = "52fd3fcefe7a5912b0149acd";
            IRestClient client         = new JsonServiceClient();

            PutUpdateInterventionResponse response = client.Put <PutUpdateInterventionResponse>(
                string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Goal/{5}/Intervention/{6}/Update",
                              url,
                              context,
                              version,
                              contractNumber,
                              patientId,
                              patientGoalId,
                              id),
                new PutUpdateInterventionRequest
            {
                Intervention = new PatientInterventionData
                {
                    Id            = "52fd3fcefe7a5912b0149acd",
                    PatientGoalId = "12341cf8fe7a592d046c548f",
                    Description   = "This is an example update",
                    StartDate     = System.DateTime.UtcNow,
                    StatusId      = 1,
                    StatusDate    = System.DateTime.UtcNow,
                    BarrierIds    = GetBarriers(),
                    AssignedToId  = "Test",
                    CategoryId    = "12341cf8fe7a592d046c548f"
                }
            } as object);
        }