nickcheek/brightree

Brightree API Wrapper

v3.5.1 2022-04-19 19:28 UTC

README

Latest Version on Packagist Total Downloads

PHP wrapper for the Brightree API.

Installation

You can install the package via composer:

composer require nickcheek/brightree

Usage

Reference Class in your controller

use \Nickcheek\Brightree\Brightree;

Create a new instance of the service and the API Call you're looking for, for instance, if you wanted to get a note by it's key

$bt = new Brightree($username,$password);
$note = $bt->Patient()->GetNoteByKey('141508');
return $note;

##ArrayHelper Since Brightree has so many different ways to build arrays depending on the method you're using, I've tried to make it a bit easier by including a helper. You can use it like so:

$bt = new Brightree($username,$password);

//setup the search part
$orderSearch = ['SearchParams' => ['Branch'=>['Value'=>102]]];

//and since Brightree decided to change up the sort definition depending on what api you're using instead of keeping it all the same, we have to use...
$orderSort = ['SortParams'=>[]];

//now we build it using the arrayHelper, we can specify page and pageSize also, but by omitting, it will insert the default values of pageSize of 10 and page of 1.  You can chain page(2) or pageSize(25) or both.

$search = $bt->search($orderSearch)->sort($sort)->build();

$order = $bt->SalesOrder()->SalesOrderSearch($search);

return $order;

#API's

Patient Class

Usage

$bt = new Brightree($username,$password);
$note = $bt->Patient()->GetNoteByKey(141508);
return $note;

Methods

PatientCreate($patient);
PatientSearch($patient);
PatientUpdate($patient);
PatientFetchByExternalID($externalId);
PatientFetchByPatientID($patientId);
PatientFetchByBrightreeID($brightreeId);
PatientFetchByPatientID($patientId);
PatientPhoneNumberSearch($patient);
PatientNoteCreate($note);
PatientNoteFetchByKey($key);
PatientNoteFetchByPatient($brightreeId);
PatientNoteSearch($search);
PatientNoteUpdate($update);
GetNotesByPatient($id);
GetNoteByKey($NoteKey);
PatientPayorAdd($payor);
PatientPayorFetch($payor);
PatientPayorFetchAll($patientKey);
PatientPayorRemove($brightreeid);
PatientPayorUpdate($payor);
PatientAddMarketingReferral($brightreeid,$referralid);
PatientRemoveMarketingReferral($id);
FacilityMasterInfoFetchAll();
FacilityResidentCreate($resident);
PharmacyPatientClinicalInfoFetchByBrightreeID($query);
PharmacyPatientLabResultsFetchByBrightreeIDAndPatientBrightreeID($patientID, $brightreeID);
PharmacyPatientMedicationHistoryFetchByBrightreeIDAndPatientBrightreeID($patientID, $brightreeID);
PharmacyPatientMostRecentLabResultsFetchByPatientBrightreeID($patientID);

Document Management Class

Usage

$bt = new Brightree($username,$password);
$document = $bt->Document()->DocumentTypesFetchAll();
return $document;

Methods

DocumentTypesFetchAll();
DocumentBatchCreate($batch);
DocumentBatchSearch($search);
DocumentSearch($search);
DocumentPropertyUpdate($query);
FetchDocumentContent($key);
GenerateDocumentID($query);
StoreDocument($document);

Custom Field Class

Usage

$bt = new Brightree($username,$password);
//If you need to return the inactive records, pass the number 1 as the second variable
$cf = $bt->CustomField()->CustomFieldFetchAllByCategory('Patient',1);
return $cf;

Methods

CustomFieldFetchAllByCategory($category,$includeInactive);
CustomFieldValueFetchAllByBrightreeID($brightreeID,$category);
CustomFieldValueSaveMultiple($query);

Doctor Class

Usage

$bt = new Brightree($username,$password);
$doctor = $bt->Doctor()->DoctorFetchByBrightreeID(123);
return $doctor;

Methods

AddDoctorReferralContact($doctorBrightreeID,$referralContactBrightreeID);
DoctorCreate($query);
DoctorFetchByBrightreeID($brightreeID);
DoctorFetchByExternalID($externalID);
DoctorGroupFetchAll();
DoctorReferralContactsFetchByDoctorKey($doctorBrightreeID);
DoctorSearch($query);
DoctorUpdate($query);
DoctorNoteCreate($query);
DoctorNoteUpdate($query);
DoctorNoteFetchByKey($brightreeID);
DoctorNoteFetchByDoctor($brightreeID);
FacilityFetchAll();
FacilityGroupFetchAll();
MarketingRepFetchAll();
RemoveDoctorReferralContact($doctorBrightreeID,$referralContactBrightreeID);

Insurance Class

Use the INSURANCE Readme to see available definitions.

Usage

$bt = new Brightree($username,$password);
$insurance = $bt->Insurance()->InsuranceFetchByBrightreeID(['BrightreeID'=>123]);
return $insurance;

Methods

InsuranceFetchByBrightreeID($BrightreeID);
InsuranceFetchByExternalID($ExternalID);
InsuranceSearch($query);
InsuranceUpdate($query);
InsuranceCreate($query);
BranchOfficeInsuranceFetchByBranchBrightreeIDAndInsuranceBrightreeID($branchID,$insuranceID);
BranchOfficeInsuranceUpdate($InsuranceCarrierCodeUpdate);
BundleBillingRuleSetFetchAll();
ClaimFormFetchAll();
CommercialEligibilityPayerSearch($InsuranceCarrierCodeUpdate);
CommercialPayerSearch($InsuranceCarrierCodeUpdate);
CoverageLimitFetchAll();
CustomAppealFormFetchAll();
FetchPmtSubTypeByPmtTypeBrightreeID($paymentTypeBrightreeID);
InsuranceCarrierCodeCreate($query);
InsuranceCarrierCodeUpdate($query);
InsuranceCarrierCodeDelete($brightreeID);
InsuranceCompanyFetchAll();
InsuranceCreate($query);
InsuranceGroupFetchAll();
InsurancePlanTypeFetchAll();
InsurancePrintedFormsClaimFieldsFetch();
InsurancePrintedFormsPARFieldsFetch();
InsuranceSpanDateHoldInclusionCreate($query);
InsuranceSpanDateHoldInclusionDelete($brightreeID);
InsuranceSpanDateOverrideCreate($query);
InsuranceSpanDateOverrideDelete($brightreeID);
InsuranceSpanDateOverrideUpdate($query);
InsuranceValidationRuleSetCreate($validationRuleSetBrightreeID,$insuranceBrightreeID);
InsuranceValidationRuleSetDelete($insuranceBrightreeID);
ItemGroupFetchAll();
ItemGroupFetchByInsuranceBrightreeID($insuranceBrightreeID);
PARFormFetchAll();
Ping();
PriceTableSearch($query);
SpanDateSplit($query);

Inventory Class

Usage

$bt = new Brightree($username,$password);
$inventory = $bt->Inventory()->ClaimNoteTypeFetchAll();
return $inventory;

Methods

ClaimNoteTypeFetchAll();
CoverageTypeFetchAll();
FetchItemLocations($query);
FetchItemQuantitiesAtLocation($query);
InventoryItemAddLots($query);
InventoryItemAddSerialNumbers($query);
InventoryItemAdjustment($query);
InventoryItemTransfer($query);
ItemAddToLocation($query);
ItemAddToLocations($query);
ItemCreate($query);
ItemFetchByBrightreeID($query);
ItemFetchByExternalID($query);
ItemFetchByItemID($query);
ItemFetchReplacementItemsByBrightreeID($query);
ItemFetchReplacementItemsByItemID($query);
ItemLocationsUpdate($query);
ItemLocationUpdate($query);
ItemSearch($query);
ItemUpdate($query);
KitTypeFetchAll();
NDCFetchAll();
StockingUOMFetchAll();

Pickup/Exchange Class

Usage

$bt = new Brightree($username,$password);
$params = array(
    'searchParams'=> array(
        'Branch'=> array(
            'ID' => '102'
        )
    ),
    'sortParams' => '',
    'pageSize' => '100',
    'page' => 1
);
$puex = $bt->Pickup()->PickupExchangeSearch($params);
return $puex;

Methods

PickupExchangeAddAllRentalItems($query);
PickupExchangeAddDeliveryException($query);
PickupExchangeAddPickupItem($query);
PickupExchangeCancelPOD($query);
PickupExchangeConfirm($query);
PickupExchangeCreate($query);
PickupExchangeDelete($query);
PickupExchangeFetchByBrightreeID($query);
PickupExchangeFetchByExternalID($query);
PickupExchangeItemAddDeliveryException($query);
PickupExchangeItemSpecifyExchangeItem($query);
PickupExchangeMessagesFetchByBrightreeID($query);
PickupExchangePayorSearch($query);
PickupExchangeRemoveItem($query);
PickupExchangeSearch($query);
PickupExchangeSendPOD($query);
PickupExchangeUpdate($query);
PickupExchangeUpdateItem($query);
PickupExchangeUpdatePODStatus($query);

Reference Class

Usage

$bt = new Brightree($username,$password);
$reference = $bt->Reference()->AccountGroupFetchAll();
return $reference;

Methods

AccountGroupFetchAll();
AddFacilityReferralContact($query);
BranchInfoFetchAll();
BranchInfoFetchByBrightreeID($query);
ClaimNoteTypeFetchAll();
ContactTypeCreate($query);
ContactTypeDelete($query);
ContactTypeFetchAll();
ContactTypeFetchByBrightreeID($query);
ContactTypeUpdate($query);
DelivryTechnicianFetchAll();
DepreciationTypesFetchAll();
EPSDTConditionCodeFetchAll();
FacilityCreate($query);
FacilityDelete($query);
FacilityFetchByBrightreeID($query);
FacilityFetchByExternalID($query);
FacilityInfoFetchAll();
FacilityReferralContactsFetchByFacilityKey($query);
FacilityUpdate($query);
FetchCurrentSecUser();
FunctionalAssessmentFetchAll();
GLAccountGroupsFetchAll();
ItemGroupFetchAll();
ItemManufacturerFetchAll();
ItemStatusFetchAll();
ItemTypesFetchAll();
LocationInfoFetchAll();
MarketingRepFetchAll();
MarketingRepFetchByBrightreeID($query);
MarketingRepFetchByExternalID($query);
MarketingRepUpdateExternalID($query);
MSPInsTypeFetchAll();
PatientNoteReasonFetchAll();
PlaceOfServiceFetchAll();
PolicyClaimCodeFetchAll();
PolicyTypeCodeFetchAll();
PractitionerInfoFetchAll();
ReferralContactCreate($query);
ReferralContactFetchByBrightreeID($query);
ReferralContactFetchByExternalID($query);
ReferralContactSearch($query);
ReferralContactUpdate($query);
ReferralFetchByBrightreeID($query);
ReferralSearch($query);
RemoveFacilityReferralContact($query);
SalesOrderClassificationFetchAll();
SalesOrderManualHoldReasonFetchAll();
SalesOrderVoidReasonFetchAll();
SalesTypesFetchAll();
SecUsersFetchAll();
ShippingCarriersFetchAll();
SiteInfoFetch($query);
TaxZoneFetchAll();
VendorFetchByBrightreeID($query);
VendorsFetchAll();
WIPStatesFetchAll();

SalesOrder Class

Usage

$bt = new Brightree($username,$password);
$salesorder = $bt->SalesOrder()->BrightSHIPSalesOrderAck(['soKey'=> 12345]);
return $salesorder;

Methods

BrightSHIPSalesOrderAck($query);
BrightShipSalesOrderFetch($query);
OrderImport($query);
SalesOrderAddDeliveryException($query); 
SalesOrderAddMarketingReferral($query);
SalesOrderConfirm($query);
SalesOrderCreate($query);
SalesOrderFetchByBrightreeID($query);
SalesOrderFetchByExternalID($query);
SalesOrderFetchByPurchaseOrderID($query);
SalesOrderFetchPendingByShippingCarrierKey($query);
SalesOrderFetchReadyforShipping($query);
SalesOrderFulfillmentVendorsFetchAll();
SalesOrderItemAddDeliveryException($query);
SalesOrderItemPriceOptionFetchByBrightreeID($query);
SalesOrderItemReplaceGeneric($query); 
SalesOrderItemUpdateLotNumbers($query); 
SalesOrderItemUpdatePriceOption($query); 
SalesOrderItemUpdateSerialNumbers($query);
SalesOrderMessagesFetchByBrightreeID($query);
SalesOrderOverrideValidationDetailMessage($query);
SalesOrderOverrideValidationHeaderMessage($query);
SalesOrderPayorSearch($query);
SalesOrderQuickAddItem($query);
SalesOrderRemoveItem($query);
SalesOrderRemoveMarketingReferral($query); 
SalesOrderSearch($query); 
SalesOrderSendPOD($query); 
SalesOrderTemplateCreate($query);
SalesOrderTemplateCreateSalesOrder($query);
SalesOrderTemplateDelete($query); 
SalesOrderTemplateFetchByBrightreeID($query);
SalesOrderTemplateFetchByExternalID($query);
SalesOrderTemplateItemFrequencyFetchByBrightreeID($brightreeID);
SalesOrderTemplateItemFrequencyUpdate($query);
SalesOrderTemplateItemPriceOptionFetchByBrightreeID($query);
SalesOrderTemplateItemUpdatePriceOption($query);
SalesOrderTemplateQuickAddItem($query);
SalesOrderTemplateRemoveItem($query); 
SalesOrderTemplateScheduleFetchBySOTemplateKey($query);
SalesOrderTemplateScheduleLogSearch($query);
SalesOrderTemplateScheduleSearch($query);
SalesOrderTemplateScheduleUpdate($query);
SalesOrderTemplateSearch($query);
SalesOrderTemplateUpdate($query);
SalesOrderTemplateUpdateInsurance($query);
SalesOrderTemplateUpdateItem($query);
SalesOrderTemplateUpdateItemsWithDefaultPriceOption($query);
SalesOrderTemplateUpdateWIPState($query);
SalesOrderUpdate($query);
SalesOrderUpdateInsurance($query);
SalesOrderUpdateItem($query);
SalesOrderUpdateItemGeneric($query);
SalesOrderUpdateItemNextBilling($query);
SalesOrderUpdateItemPayor($query);
SalesOrderUpdateItemsWithDefaultPriceOption($query);
SalesOrderUpdatePODStatus($query);
SalesOrderUpdateTracking($query);
SalesOrderUpdateWIPState($query);
SalesOrderVoid($query);
SalesOrderVoidSearch($query);
SearchWIPStatusWithUpdate($query);
StopReasonFetchAll();
StopReasonSalesOrderFetchByBrightreeID($brightreeID);
StopReasonSalesOrderTemplateFetchByBrightreeID($brightreeID);
StopReasonSalesOrderTemplateUpdate($query);
StopReasonSalesOrderUpdate($query);

Documentation Class

Usage

$bt = new Brightree($username,$password);
$documentation = $bt->Documentation()->CMNFetchByBrightreeID(['BrightreeID'=>12345]);
return $documentation;

Methods

CMNCreateFromPatient($query);
CMNDetailCreate($query);
CMNDetailDelete($query);
CMNDetailUpdate($query);
CMNFetchByBrightreeID($query);
CMNFetchByExternalID($query);
CMNFetchByPatientBrightreeID($query);
CMNFetchBySalesOrderBrightreeID($query);
CMNLog($query);
CMNPreview($query);
CMNPrint($query);
CMNQuestionAnswerConfiguration($query);
CMNReasonFetchAll($query);
CMNRenew($query);
CMNRevise($query);
CMNSearch($query);
CMNTaskCreate($query);
CMNTaskUpdate($query);
CMNUpdate($query);
PARAddPurchaseLimit($query);
PARCreateFromPatient($query);
PARDelete($query);
PARFetchByBrightreeID($query);
PARFetchByExternalID($query);
PARFetchByPatientBrightreeID($query);
PARFetchBySalesOrderBrightreeID($query);
PARFetchBySalesOrderTemplateBrightreeID($query);
PARLog($query);
PARRenew($query);
PARSearch($query);
PARTaskCreate($query);
PARTaskFetchByPARBrightreeID($brightreeID);
PARTaskReasonFetchAll();
PARTaskUpdate($query);
PARUpdate($query);
PARUpdatePurchaseLimit($query);
SalesOrderItemLinkCMN($query);
SalesOrderItemLinkNewCMN($query);
SalesOrderItemLinkToNewPAR($query);
SalesOrderItemLinkToPAR($query);
SalesOrderItemsLinkCMN($query);
SalesOrderItemsLinkNewCMN($query);
SalesOrderItemsLinkToNewPAR($query);
SalesOrderItemsLinkToPAR($query);
SalesOrderItemsUnlinkCMN($query);
SalesOrderItemsUnlinkPAR($query);
SalesOrderItemUnlinkCMN($query);
SalesOrderItemUnlinkPAR($query);
SalesOrderTemplateItemLinkToPAR($query);
SalesOrderTemplateItemsLinkToPAR($query);
SalesOrderTemplateItemsUnlinkPAR($query);
SalesOrderTemplateItemUnlinkPAR($query);
SetParticipantComplianceDate($query);

Pricing Class

Usage

$bt = new Brightree($username,$password);
$pricing = $bt->Pricing()->NonTaxReasonFetchAll($query);
return $pricing;

Methods

CMNFormFetchAll($query);
NonTaxReasonFetchAll($query);
PriceCreateItem($query);
PriceCreateStandard($query);
PriceDetailCreate($query);
PriceDetailFetchByBrightreeDetailID($query);
PriceDetailUpdate($query);
PriceFetch($query);
PriceOptionLetterTypeFetchAll($query);
PriceTableFetchAll($query);

Security Class

Usage

$bt = new Brightree($username,$password);
$security = $bt->Security()->UserFetchByBrightreeID($query);
return $security;

Methods

UserFetchByBrightreeID($query);
UserSearch($query);
UserUpdate($query);
UserGroupCreate($query);
UserGroupUpdate($query);
UserGroupFetchByBrightreeID($query);
UserGroupFetchAll($query);
UserGroupPermissionsFetchByUserGroupBrightreeID($query);
UserGroupPermissionsUpdate($query);

Invoice Class

Usage

$bt = new Brightree($username,$password);
$security = $bt->Security()->UserFetchByBrightreeID($query);
return $security;

Methods

InvoiceCreatePrintActivity($brightreeID);
InvoiceFetchByBrightreeID($brightreeID);
InvoiceFetchByInvoiceID($invoiceID);
InvoiceItemUpdate($query);
InvoiceUpdate($query);
OpenInvoiceAgedBalanceFetchByPatient($id);
OpenInvoiceBalanceFetchByPatient($id);
Resubmitinvoices($query);

Custom

(new as of 11/16/20)

Any function that may not be defined can now be used in a custom query inside any service.

$bt = new Brightree($username,$password);
$patient = $bt->Patient()->Custom('PatientFetchByPatientID', array('PatientID' => $id));
return $patient;

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email nick@nicholascheek.com.

Credits

License

The MIT License (MIT). Please see License File for more information.