Beispiel #1
0
        private static Dictionary <string, PatientData> getPatients(double version, string contractNumber, string userId, IRestClient client, List <string> patientIds)
        {
            Dictionary <string, PatientData> data = null;
            //[Route("/{Context}/{Version}/{ContractNumber}/Patients/Ids", "POST")]
            string patientDDURL = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patients/Ids",
                                                                       DDPatientServiceURL,
                                                                       "NG",
                                                                       version,
                                                                       contractNumber), userId);

            GetPatientsDataResponse patientDDResponse =
                client.Post <GetPatientsDataResponse>(patientDDURL, new GetPatientsDataRequest
            {
                Context        = "NG",
                ContractNumber = contractNumber,
                Version        = version,
                UserId         = userId,
                PatientIds     = patientIds
            } as object);

            if (patientDDResponse != null && patientDDResponse.Patients != null)
            {
                data = patientDDResponse.Patients;
            }
            return(data);
        }
Beispiel #2
0
 public void GetPatientDetailsListByID()
 {
     string                  contractNumber = "InHealth001";
     string                  context        = "NG";
     double                  version        = 1.0;
     string                  userId         = "5325c821072ef705080d3488";
     JsonServiceClient       client         = new JsonServiceClient();
     GetPatientsDataResponse response       = client.Post <GetPatientsDataResponse>
                                                  (string.Format("{0}/{1}/{2}/{3}/Patients", "http://localhost:8888/Patient", context, version, contractNumber),
                                                  new GetPatientsDataRequest {
         PatientIds = new string[] {
             "5325d9f2d6a4850adcbba4ca", "5325db50d6a4850adcbba8e6"
         }, UserId = userId
     } as object);
 }
Beispiel #3
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);
        }
        public DTO.GetPatientsDataResponse Select(List <string> patientIds)
        {
            GetPatientsDataResponse          response    = new GetPatientsDataResponse();
            Dictionary <string, PatientData> patientData = new Dictionary <string, PatientData>();

            patientData.Add("abc", new PatientData {
                Id = "abc", FirstName = "mark", LastName = "anderson", PreferredName = "MA", MiddleName = "jay", Gender = "M", DOB = "01/01/1945"
            });
            patientData.Add("efg", new PatientData {
                Id = "efg", FirstName = "lisa", LastName = "anderson", PreferredName = "LA", MiddleName = "olivia", Gender = "F", DOB = "02/02/1932"
            });
            patientData.Add("hij", new PatientData {
                Id = "hij", FirstName = "mark1", LastName = "anderson2", PreferredName = "MA", MiddleName = "jay", Gender = "M", DOB = "01/01/1945"
            });
            patientData.Add("xyz", new PatientData {
                Id = "xyz", FirstName = "mark2", LastName = "anderson3", PreferredName = "MA", MiddleName = "jay", Gender = "M", DOB = "01/01/1945"
            });
            response.Version  = 1;
            response.Patients = patientData;

            return(response);
        }
Beispiel #5
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 #6
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 #7
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;
     }
 }