Beispiel #1
0
        public void GetPatientsDetails()
        {
            StubDataPatientManager pm = new StubDataPatientManager {
                Factory = new StubPatientRepositoryFactory()
            };
            GetPatientsDataRequest request = new GetPatientsDataRequest
            {
                Version        = 1.0,
                UserId         = "000000000000000000000000",
                ContractNumber = "InHealth001",
                Context        = "NG"
            };
            List <PatientData> response = pm.GetPatients(request);

            Assert.IsTrue(response.Count > 0);
        }
Beispiel #2
0
        public void GetPatients()
        {
            List <string> patientIds = new List <string>();

            patientIds.Add("5325da2dd6a4850adcbba576");
            patientIds.Add("5325da31d6a4850adcbba582");
            patientIds.Add("5325da3ad6a4850adcbba59a");
            GetPatientsDataRequest request = new GetPatientsDataRequest {
                PatientIds = patientIds
            };

            IPatientDataManager pm = new PatientDataManager {
                Factory = new PatientRepositoryFactory()
            };
            GetPatientsDataResponse response = pm.GetPatients(request);

            Assert.IsNotNull(response.Patients);
        }
Beispiel #3
0
        public static List <PatientDetails> GetPatientsDetails(double version, string contractNumber, string userId, IRestClient client, List <string> patientIds)
        {
            List <PatientDetails> patients = new List <PatientDetails>();

            if (patientIds != null)
            {
                string patientUrl = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/patients/Ids", DDPatientServiceURL, "NG", version, contractNumber), userId);
                GetPatientsDataRequest request = new GetPatientsDataRequest()
                {
                    ContractNumber = contractNumber, Context = "NG", Version = version, UserId = userId, PatientIds = patientIds
                };
                GetPatientsDataResponse response = client.Post <GetPatientsDataResponse>(patientUrl, request);

                if (response != null && response.Patients != null)
                {
                    patients.AddRange(response.Patients.Select(patient => new PatientDetails
                    {
                        Id = patient.Key, FirstName = patient.Value.FirstName, LastName = patient.Value.LastName, MiddleName = patient.Value.MiddleName, PreferredName = patient.Value.PreferredName, Suffix = patient.Value.Suffix
                    }));
                }
            }
            return(patients);
        }
Beispiel #4
0
        public GetPatientsDataResponse Post(GetPatientsDataRequest request)
        {
            GetPatientsDataResponse response = new GetPatientsDataResponse();

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

                response         = PatientManager.GetPatients(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);
        }
Beispiel #5
0
 public GetPatientsDataResponse GetPatients(GetPatientsDataRequest request)
 {
     try
     {
         GetPatientsDataResponse          response = new GetPatientsDataResponse();
         Dictionary <string, PatientData> patients = null;
         IPatientRepository repo = Factory.GetRepository(request, RepositoryType.Patient);
         List <PatientData> list = repo.Select(request.PatientIds);
         if (list != null && list.Count > 0)
         {
             patients = new Dictionary <string, PatientData>();
             list.ForEach(p =>
             {
                 patients.Add(p.Id, p);
             });
         }
         response.Patients = patients;
         return(response);
     }
     catch (Exception)
     {
         throw;
     }
 }
 GetPatientsDataResponse IPatientDataManager.GetPatients(GetPatientsDataRequest request)
 {
     throw new NotImplementedException();
 }