public void GetPatientAllergies_Test() { GetPatientAllergiesRequest request = new GetPatientAllergiesRequest { ContractNumber = contractNumber, PatientId = "534685c160e4b90f8c8966a8", StatusIds = new List <int> { 1 }, TypeIds = new List <string> { "5447d6ddfe7a59146485b512", "5446db5efe7a591e74013b6b" }, UserId = userId, Version = version }; JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("{0}: {1}", "Token", token)); //[Route("/{Version}/{ContractNumber}/PatientAllergy/{PatientId}", "GET")] GetPatientAllergiesResponse response = client.Post <GetPatientAllergiesResponse>( string.Format("{0}/{1}/{2}/PatientAllergy/{3}", url, version, contractNumber, request.PatientId), request); Assert.IsNotNull(response); }
public List <PatientAllergy> GetPatientAllergies(GetPatientAllergiesRequest request) { List <PatientAllergy> patientAllergies = null; try { List <PatientAllergyData> data = EndpointUtil.GetPatientAllergies(request); if (data != null && data.Count > 0) { patientAllergies = new List <PatientAllergy>(); data.ForEach(a => patientAllergies.Add(Mapper.Map <PatientAllergy>(a))); } return(patientAllergies); } catch (Exception ex) { throw ex; } }
public GetPatientAllergiesResponse Post(GetPatientAllergiesRequest request) { GetPatientAllergiesResponse response = new GetPatientAllergiesResponse(); ValidateTokenResponse result = null; try { if (base.Request != null) { 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.PatientAllergies = AllergyManager.GetPatientAllergies(request); } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { AllergyManager.LogException(ex); } } finally { List <string> patientIds = new List <string>(); patientIds.Add(request.PatientId); if (result != null) { string browser = (base.Request != null) ? base.Request.UserAgent : unknownBrowserType; string hostAddress = (base.Request != null) ? base.Request.UserHostAddress : unknownUserHostAddress; AuditUtil.LogAuditData(request, result.SQLUserId, patientIds, browser, hostAddress, request.GetType().Name); } } return(response); }
public List <PatientAllergyData> GetPatientAllergies(GetPatientAllergiesRequest request) { try { List <PatientAllergyData> result = null; IRestClient client = new JsonServiceClient(); //[Route("/{Context}/{Version}/{ContractNumber}/PatientAllergy/{PatientId}", "GET")] var url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/PatientAllergy/{4}", DDAllergyUrl, "NG", request.Version, request.ContractNumber, request.PatientId), request.UserId); GetPatientAllergiesDataResponse dataDomainResponse = client.Post <GetPatientAllergiesDataResponse>(url, new GetPatientAllergiesDataRequest { Context = "NG", ContractNumber = request.ContractNumber, StatusIds = request.StatusIds, TypeIds = request.TypeIds, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version } as object); if (dataDomainResponse != null) { result = dataDomainResponse.PatientAllergiesData; } return(result); } catch (WebServiceException ex) { throw new WebServiceException("AD:GetPatientAllergies()::" + ex.Message, ex.InnerException); } }