private static void getPatient(double version, string contractNumber, string userId, IRestClient client, ToDo toDo) { if (!string.IsNullOrEmpty(toDo.PatientId)) { string patientUrl = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/patient/{4}", DDPatientServiceURL, "NG", version, contractNumber, toDo.PatientId), userId); GetPatientDataResponse response = client.Get <GetPatientDataResponse>(patientUrl); if (response != null && response.Patient != null) { toDo.PatientDetails = new PatientDetails { Id = response.Patient.Id, FirstName = response.Patient.FirstName, LastName = response.Patient.LastName, MiddleName = response.Patient.MiddleName, PreferredName = response.Patient.PreferredName, Suffix = response.Patient.Suffix }; } } }
private bool IsValidPatientId(PutProgramToPatientRequest request) { bool result = false; try { string path = ConfigurationManager.AppSettings["DDPatientServiceUrl"]; string contractNumber = request.ContractNumber; string context = request.Context; double version = request.Version; IRestClient client = new JsonServiceClient(); string url = Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/patient/{4}", path, context, version, contractNumber, request.PatientId), request.UserId); GetPatientDataResponse response = client.Get <GetPatientDataResponse>(url); if (response.Patient != null) { result = true; } return(result); } catch (Exception ex) { throw new Exception("DD:DataProgramManager:IsValidPatientId()::" + ex.Message, ex.InnerException); } }
internal List <PatientData> getAllPatientsById(List <string> PatientIds, string ddUrl, string contract) { LoggerDomainEvent.Raise(new LogStatus { Message = "1) Sending get all Patient DD request.", Type = LogType.Debug }); List <PatientData> patients = new List <PatientData>(); var userid = ProcConstants.UserId; // need to find a valid session id. try { PatientIds.ForEach(pid => { IRestClient client = new JsonServiceClient { Timeout = TimeSpan.FromMinutes(50) }; //new TimeSpan( 28000000000) }; //"/{Context}/{Version}/{ContractNumber}/patient/{PatientID} var url = Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}", ddUrl, "NG", 1, contract, pid), userid); GetPatientDataResponse response = client.Get <GetPatientDataResponse>(url); patients.Add(response.Patient); }); LoggerDomainEvent.Raise(new LogStatus { Message = "1) Success", Type = LogType.Debug }); return(patients); } catch (Exception ex) { LoggerDomainEvent.Raise(new LogStatus { Message = "PatientDataDomain:Save(): " + ex.Message, Type = LogType.Error }); throw new ArgumentException("PatientDataDomain:Save(): " + ex.Message); } }
public GetPatientDataResponse GetPatientDataByNameDOB(GetPatientDataByNameDOBRequest request) { GetPatientDataResponse result = new GetPatientDataResponse(); IPatientRepository repo = Factory.GetRepository(request, RepositoryType.Patient); result.Patient = repo.FindByNameDOB(request.FirstName, request.LastName, request.DOB) as DTO.PatientData; return(result); }
public void GetPatientByID() { GetPatientDataRequest request = new GetPatientDataRequest { PatientID = "531f2dcc072ef727c4d29e1a" }; IPatientDataManager pm = new PatientDataManager(); GetPatientDataResponse response = pm.GetPatientByID(request); Assert.IsTrue(response.Patient.FirstName == "Phyliss"); }
public void GetPatientData() { GetPatientDataByNameDOBRequest patientDataRequest = new GetPatientDataByNameDOBRequest { FirstName = "Wendell_01", LastName = "Pickering", DOB = "03/11/1960" }; GetPatientDataResponse patientDataResponse = import.GetPatientData(patientDataRequest); Assert.IsNotNull(patientDataResponse.Patient); }
public void Get_PatientByID() { string controlValue = "Tony"; string sampleValue; string patientID = "528f6dc2072ef708ecd91040"; string contractNumber = "InHealth001"; string context = "NG"; IRestClient client = new JsonServiceClient(); JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("{0}: {1}", "x-Phytel-UserID", "531f2df9072ef727c4d2a3df")); GetPatientDataResponse response = client.Get <GetPatientDataResponse>("http://localhost:8888/Patient/NG/1.0/InHealth001/patient/" + patientID); sampleValue = response.Patient.FirstName; Assert.AreEqual(controlValue, sampleValue); }
public void Update_Patient_Flagged_By_PatientID_Remove_User() { // http://localhost:8888/Patient/NG/1.0/InHealth001/patient/999/flagged/2?UserId=12345 string patientID = "528f6dc2072ef708ecd90e3a"; string userId = "BB241C64-A0FF-4E01-BA5F-4246EF50780E"; string contractNumber = "InHealth001"; string context = "NG"; string flagged = "0"; double version = 1.0; IRestClient client = new JsonServiceClient(); JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("{0}: {1}", "x-Phytel-UserID", "531f2df9072ef727c4d2a3df")); GetPatientDataResponse response = client.Put <GetPatientDataResponse>( string.Format(@"http://localhost:8888/Patient/{0}/{1}/{2}/patient/{3}/flagged/{4}?UserId={5}", context, version, contractNumber, patientID, flagged, userId), new GetPatientDataRequest { } as object); }
public void GetPatientByID() { string controlValue = "Tony"; string sampleValue; string patientID = "52781cd8fe7a5925fcee5bf3"; string contractNumber = "InHealth001"; string context = "NG"; IRestClient client = new JsonServiceClient(); JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("{0}: {1}", "x-Phytel-UserID", "531f2df9072ef727c4d2a3df")); GetPatientDataResponse response = client.Post <GetPatientDataResponse>("http://localhost:8888/Patient/NG/data/patient", new GetPatientDataRequest { PatientID = patientID, ContractNumber = contractNumber, Context = context } as object); sampleValue = response.Patient.FirstName; Assert.AreEqual(controlValue, sampleValue); }
public void Get_Patient_with_Flag_ByID_and_UserID() { string controlValue = "Tony"; string sampleValue; string patientId = "528f6dc2072ef708ecd90e87"; string userId = "BB241C64-A0FF-4E01-BA5F-4246EF50780E"; string contractNumber = "InHealth001"; string context = "NG"; IRestClient client = new JsonServiceClient(); JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("{0}: {1}", "x-Phytel-UserID", "531f2df9072ef727c4d2a3df")); GetPatientDataResponse response = client.Get <GetPatientDataResponse>(string.Format ("http://localhost:8888/Patient/NG/1.0/InHealth001/patient/{0}?UserId={1}", patientId, userId)); sampleValue = response.Patient.FirstName; Assert.AreEqual(controlValue, sampleValue); }
public GetPatientDataResponse GetPatientData(GetPatientDataByNameDOBRequest request) { //[Route("/{Context}/{Version}/{ContractNumber}/Patient/PatientData", "GET")] Uri theUriPS = new Uri(string.Format("{0}/Patient/{1}/{2}/{3}/Patient/PatientData?UserId={4}&FirstName={5}&LastName={6}&DOB={7}", Url, Context, Version, ContractNumber, HeaderUserId, request.FirstName, request.LastName, request.DOB)); HttpClient client = GetHttpClient(theUriPS); DataContractJsonSerializer modesJsonSer = new DataContractJsonSerializer(typeof(GetPatientDataByNameDOBRequest)); MemoryStream ms = new MemoryStream(); modesJsonSer.WriteObject(ms, request); ms.Position = 0; //use a Stream reader to construct the StringContent (Json) StreamReader modesSr = new StreamReader(ms); StringContent modesContent = new StringContent(modesSr.ReadToEnd(), System.Text.Encoding.UTF8, "application/json"); ms.Dispose(); //Post the data var response = client.GetStringAsync(theUriPS); var responseContent = response.Result; string modesResponseString = responseContent; GetPatientDataResponse getPatientDataResponse = null; using (var memStream = new MemoryStream(Encoding.Unicode.GetBytes(modesResponseString))) { var modesSerializer = new DataContractJsonSerializer(typeof(GetPatientDataResponse)); getPatientDataResponse = (GetPatientDataResponse)modesSerializer.ReadObject(memStream); } return(getPatientDataResponse); }
public GetPatientDataResponse Get(GetPatientDataByNameDOBRequest request) { GetPatientDataResponse response = new GetPatientDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientDD:Get()::Unauthorized Access"); } response = PatientManager.GetPatientDataByNameDOB(request); response.Version = request.Version; } catch (Exception ex) { CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex); string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Helpers.LogException(int.Parse(aseProcessID), ex); } return(response); }
public GetPatientDataResponse GetPatientByID(GetPatientDataRequest request) { try { GetPatientDataResponse result = new GetPatientDataResponse(); IPatientRepository repo = Factory.GetRepository(request, RepositoryType.Patient); if (string.IsNullOrEmpty(request.UserId)) { result.Patient = repo.FindByID(request.PatientID) as DTO.PatientData; } else { result.Patient = repo.FindByID(request.PatientID, request.UserId) as DTO.PatientData; } return(result != null ? result : new GetPatientDataResponse()); } catch (Exception) { throw; } }