Example #1
0
        public string GetPatientsFromApi()
        {
            PatientFilter patientFilter = new PatientFilter()
            {
            };
            PatientFieldsToReturn patientFieldsToReturn = new PatientFieldsToReturn();
            GetPatientsResp       response = null;

            GetPatientsReq request = new GetPatientsReq()
            {
                RequestHeader = _requestHeader,
                Filter        = patientFilter,
                Fields        = patientFieldsToReturn
            };

            response = _kareoServices.GetPatients(request);
            if (response.ErrorResponse.IsError)
            {
                return(response.ErrorResponse.ErrorMessage);
            }
            if (response.Patients == null || response.Patients.Length == 0)
            {
                return("No results.  Check Customer Key is valid in .config file.");
            }

            List <PatientData> responseData = response.Patients.ToList();

            return(ExportPatients(responseData));
        }
Example #2
0
        public GetPatientsResp GetPatients(string firstName, string lastName, DateTime dateOfBirth, BillingAccount billingAccount)
        {
            try
            {
                var client = new KareoServicesClient();

                var requestHeader = new RequestHeader
                {
                    ClientVersion = ClientVersion,
                    CustomerKey   = billingAccount.CustomerKey,
                    User          = billingAccount.UserName,
                    Password      = billingAccount.Password
                };

                var getPatientsReq = new GetPatientsReq
                {
                    RequestHeader = requestHeader,
                    Filter        = new PatientFilter
                    {
                        FirstName       = firstName,
                        LastName        = lastName,
                        FromDateOfBirth = dateOfBirth.ToString("MM/dd/yyyy"),
                        ToDateOfBirth   = dateOfBirth.AddDays(1).ToString("MM/dd/yyyy")
                    }
                };

                var getPatientsResp = client.GetPatients(getPatientsReq);

                client.Close();
                return(getPatientsResp);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }