예제 #1
0
        public GetPatientUtilizationsResponse GetPatientUtilizations(GetPatientUtilizationsRequest request)
        {
            try
            {
                var result = new GetPatientUtilizationsResponse();

                //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Notes/", "GET")]
                IRestClient client = new JsonServiceClient();
                var         url    = Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Notes/Utilizations/",
                                                                   DdPatientNoteUrl,
                                                                   "NG",
                                                                   request.Version,
                                                                   request.ContractNumber,
                                                                   request.PatientId), request.UserId);

                GetAllPatientUtilizationDataResponse ddResponse = client.Get <GetAllPatientUtilizationDataResponse>(url);

                if (ddResponse == null || ddResponse.Utilizations == null)
                {
                    return(result);
                }
                var ulist = ddResponse.Utilizations.Select(Mapper.Map <PatientUtilization>).ToList();

                result.Utilizations = request.Count > 0 ? ulist.Take(request.Count).ToList() : ulist;

                return(result);
            }
            catch (WebServiceException ex)
            {
                throw ex;
            }
        }
예제 #2
0
        public GetPatientUtilizationsResponse Get(GetPatientUtilizationsRequest request)
        {
            GetPatientUtilizationsResponse response = null;
            ValidateTokenResponse result = null;

            try
            {
                request.Token = base.Request.Headers["Token"] as string;
                result = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber);
                if (result.UserId.Trim() != string.Empty)
                {
                    request.UserId = result.UserId;
                    response = UtilManager.GetPatientUtilizations(request);
                }
                else
                    throw new UnauthorizedAccessException();
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);
                if ((ex is WebServiceException) == false)
                    UtilManager.LogException(ex);
            }
            finally
            {
                List<string> patientIds = new List<string>();

                if (response.Utilizations != null)
                {
                    response.Utilizations.ForEach(u => patientIds.Add(u.PatientId));
                }

                if (result != null)
                    AuditHelper.LogAuditData(request, result.SQLUserId, patientIds, HttpContext.Current.Request, request.GetType().Name);
            }
            return response;
        }