Adding Referring Doctors

tmccormi wrote on Monday, October 24, 2011:

The field called “Provider” on the Demographics page is the Referring Provider.  I typically change the description to say that.  You can put referring providers in the Address Book along with their NPI and they will show up in the pick list.

Tony
www.mi-squared.com / @tonymi2
oemr.org / @OEMR_org

uhsarp wrote on Tuesday, October 25, 2011:

Thanks for the info Tony!

Also, pieces of information like these are very valuable (at least for our clinic). I’m not sure if this info is provided in the manual. Is there any other place/forum/wiki that information like this is documented? This sound more like FAQ of OpenEMR’s workflow and I’m sure that there’s a lot of value to the users like me.

Thanks!

tmccormi wrote on Tuesday, October 25, 2011:

The users guide is now published on the oemr.org wiki and is therefore editable by any registered user.
http://www.oemr.org/wiki/OpenEMR_4.1_Users_Guide  Feel free to enhance it, add FAQs and supplimental guides.   Brady may have copied this over to the sw project wiki as well, but since OEMR produced it, please do original edits to this document on the oemr.org site and Brady can refresh his copy or link back to the oemr wiki if desired.

Thanks!

Tony
www.mi-squared.com / @tonymi2
oemr.org / @OEMR_org

bradymiller wrote on Wednesday, October 26, 2011:

Hi,

Two issues:
1. I’m a bit confused on this demographics Provider setting. Are some also using this to store the patient’s assigned physician at their facility (seems like in the codebase it is getting used as both, which is confusing).

2. The OpenEMR Project Wiki is here:
http://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page
OpenEMR Project Users Guide wiki page is here:
http://www.open-emr.org/wiki/index.php/OpenEMR_4.1_Users_Guide
(At this point the oemr wiki (and website) are becoming very outdated (as a courtesy for oemr, I have been keeping the vital wiki pages, such as download/patches/demo/install/upgrade stuff updated, but I will not be able to do this much longer)
That being said, any content specific towards the OpenEMR project and placed on the oemr wiki will get copied to the OpenEMR project wiki. So, please feel free to contribute any documentation on either wiki.

thanks,
-brady

jenjhall wrote on Wednesday, October 26, 2011:

The way the provider field works is that it allows you to pick providers listed in your address book if they have an NPI number.  So when you are first setting up OpenEMR only your onsite providers are being accessed since the address book is not populated.  That gives the impression that the field is designed for referencing onsite providers only.  Perhaps it would be good not only for the field to be labeled “Referring Provider” as stated by Tony above but to have the pick function filter out “local” providers as can the search function in the address book. - Jen

bradymiller wrote on Wednesday, October 26, 2011:

Hi,

Still confused here since the patient_data mysql table also has the following columns:
‘referrer’
‘referrerID’

The above are not included in the demographics layout while the ‘providerID’ sql column is filled by the ‘Provider’ label, which has ‘Referring Provider’ in the details.

A grep (grep is a search method) for referrerID in the codebase, it really isn’t used anywhere.

A grep for providerID in the codebase pulls out a lot of stuff:

/var/www/openemr/contrib/util/import_mi2xml.php:      '',                           // providerID
/var/www/openemr/library/clinical_rules.php:        "WHERE providerID=?", array($provider) );
/var/www/openemr/library/amc.php:      "WHERE providerID=?", array($provider) );
/var/www/openemr/library/freeb/Procedure.class.php:                             $pkey = $results->fields['providerID'];
/var/www/openemr/library/patient.inc:function getProviderInfo($providerID = "%", $providers_only = true, $facility = '' ) {
/var/www/openemr/library/patient.inc:    if ($providerID == "%") {
/var/www/openemr/library/patient.inc:        mysql_real_escape_string($providerID) . "' " . $param1 . $param2;
/var/www/openemr/library/patient.inc:function getCalendarProviderInfo($providerID = "%", $providers_only = true) {
/var/www/openemr/library/patient.inc:    if ($providerID == "%") {
/var/www/openemr/library/patient.inc:        mysql_real_escape_string($providerID) . "' " . $param1;
/var/www/openemr/library/patient.inc:function getProviderName($providerID) {
/var/www/openemr/library/patient.inc:    $pi = getProviderInfo($providerID, 'any');
/var/www/openemr/library/patient.inc:function getPatientLnames($lname = "%", $given = "pid, id, lname, fname, mname, providerID, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS", $orderby = "lname ASC, fname ASC", $limit="all", $start="0")
/var/www/openemr/library/patient.inc:function getPatientId($pid = "%", $given = "pid, id, lname, fname, mname, providerID, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS", $orderby = "lname ASC, fname ASC", $limit="all", $start="0")
/var/www/openemr/library/patient.inc:function getByPatientDemographics($searchTerm = "%", $given = "pid, id, lname, fname, mname, providerID, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS", $orderby = "lname ASC, fname ASC", $limit="all", $start="0")
/var/www/openemr/library/patient.inc:  $given = "pid, id, lname, fname, mname, providerID, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS",
/var/www/openemr/library/patient.inc:// orig function getPatientPID($pid = "%", $given = "pid, id, lname, fname, mname, providerID, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS", $orderby = "lname ASC, fname ASC", $limit="all", $start="0")
/var/www/openemr/library/patient.inc:    $given = "pid, id, lname, fname, mname, providerID, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS";
/var/www/openemr/library/patient.inc:function getPatientSSN($ss = "%", $given = "pid, id, lname, fname, mname, providerID", $orderby = "lname ASC, fname ASC", $limit="all", $start="0")
/var/www/openemr/library/patient.inc:function getPatientPhone($phone = "%", $given = "pid, id, lname, fname, mname, providerID", $orderby = "lname ASC, fname ASC", $limit="all", $start="0")
/var/www/openemr/library/patient.inc:                $providerID = "",
/var/www/openemr/library/patient.inc:        providerID = '$providerID',
/var/www/openemr/library/custom_template/custom_template.php:                                            if($row['providerID']){
/var/www/openemr/library/custom_template/custom_template.php:                                                $val=sqlQuery("SELECT CONCAT(lname,',',fname) AS name FROM users WHERE id='".$row['providerID']."'");
/var/www/openemr/library/classes/Patient.class.php:                     $res = sqlQuery("SELECT providerID,fname,lname,mname ".
/var/www/openemr/library/classes/Patient.class.php:                             $this->provider = new Provider($res['providerID']);
/var/www/openemr/library/Claim.class.php:      $this->patient_data['providerID'] : $provider_id;
/var/www/openemr/custom/export_labworks.php:  "p.pubpid, p.fname, p.mname, p.lname, p.DOB, p.providerID, " .
/var/www/openemr/custom/export_labworks.php: if ($row['providerID']) {
/var/www/openemr/custom/export_labworks.php:  $query .= " AND id = " . $row['providerID'];
/var/www/openemr/custom/import_xml.php:   $olddata['providerID'],
/var/www/openemr/custom/export_xml.php:  "p.pubpid, p.fname, p.mname, p.lname, p.DOB, p.providerID, " .
/var/www/openemr/custom/export_xml.php: if ($row['providerID']) {
/var/www/openemr/custom/export_xml.php:  $query .= " AND id = " . $row['providerID'];
/var/www/openemr/interface/new/new_patient_save.php:    "", // providerID
/var/www/openemr/interface/reports/collections_report.php:      "LEFT OUTER JOIN users AS u ON u.id = p.providerID " .
/var/www/openemr/interface/reports/collections_report.php:        "LEFT OUTER JOIN users AS u ON u.id = pd.providerID " .
/var/www/openemr/interface/patient_file/pos_checkout.php:  $patdata = getPatientData($patient_id, 'fname,mname,lname,pubpid,street,city,state,postal_code,providerID');
/var/www/openemr/interface/patient_file/pos_checkout.php:      } else if (isset($patdata['providerID'])){
/var/www/openemr/interface/patient_file/pos_checkout.php:        $encprovider = $patdata['providerID'];
/var/www/openemr/interface/patient_file/encounter/cash_receipt.php: $titleres = getPatientData($pid, "fname,lname,providerID");
/var/www/openemr/interface/patient_file/encounter/cash_receipt.php: //$provider = getProviderName($titleres['providerID']);
/var/www/openemr/interface/patient_file/report/print_custom_report.php: $titleres = getPatientData($pid, "fname,lname,providerID");
/var/www/openemr/interface/patient_file/report/print_custom_report.php: //$provider = getProviderName($titleres['providerID']);
/var/www/openemr/interface/patient_file/report/custom_report.php:  $titleres = getPatientData($pid, "fname,lname,providerID");
/var/www/openemr/interface/patient_file/report/custom_report.php:  $titleres = getPatientData($pid, "fname,lname,providerID,DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS");
/var/www/openemr/interface/main/calendar/find_patient.php:    $iterproviderid = $iter['providerID'];
/var/www/openemr/interface/main/calendar/modules/PostCalendar/pnuserapi.php:  if(!empty($providerID)) { $ruserid = $providerID; }
/var/www/openemr/interface/main/calendar/modules/PostCalendar/pnuserapi.php:        $a = array('start'=>$start_date,'end'=>$end_date,'s_keywords'=>$s_keywords,'s_category'=>$s_category,'s_topic'=>$s_topic,'viewtype'=>$viewtype, "sort" => "pc_startTime ASC, a.pc_duration ASC ",'providerID' => $providerID, 'provider_id' => $provider_id);
/var/www/openemr/interface/main/calendar/modules/PostCalendar/pnuser.php:                'end'=>$sdate, 'stime' => $stime, 'etime' => $etime,'providerID'=>$event_userid,
/var/www/openemr/interface/main/authorizations/authorizations.php:    $providerID = sqlFetchArray(sqlStatement(
/var/www/openemr/interface/main/authorizations/authorizations.php:      "select providerID from patient_data where pid=?", array($ppid) ));
/var/www/openemr/interface/main/authorizations/authorizations.php:    $userID=$providerID{"providerID"};
/var/www/openemr/interface/main/authorizations/authorizations.php:      "select lname from users where id = ?", array($name['providerID']) ));

It appears on first glance that this is also being used in cases as the primary clinic provider ID. Note the CDR (Clinical Decision Rule Engine) does this, which is hopefully gonna be fixed soon for other reasons:
http://www.open-emr.org/wiki/index.php/Description_AMC#Potential_Issues

Is anybody else confused here??

-brady

bradymiller wrote on Wednesday, October 26, 2011:

Also,

To continue above discussion (note the email sent out was truncated). If no place to store the local facility primary care provider, then in a multi-physician facility how sort out whom to contact when a patient calls in for issues? How print/sort/track a providers patient panel?

-brady

tmccormi wrote on Wednesday, October 26, 2011:

Looks like someone in the past only did a partial job of the assigned Provider -vs- Referring Provider.   Sounds like a nice contained project for someone that wants to get their feet wet with OpenEMR development.
Tony
www.mi-squared.com / @tonymi2
oemr.org / @OEMR_org

jenjhall wrote on Wednesday, October 26, 2011:

So: I tried adding a “dummy” referring provider to the address book and found that the only place it showed up in the database was in the user table.  So: I cleaned my referring provider data to match that table and uploaded it using mysql.  The data is there now but it does not show up in the address book nor in the pick list for the referring provider under demographics.  What did I miss?

bradymiller wrote on Wednesday, October 26, 2011:

Hi,

Regarding the Referring Provider vs Assigned Provider bug, placed this issue in the Active Projects wiki page:
http://www.open-emr.org/wiki/index.php/Active_Projects#Assigned_Provider_ID_and_Referring_Provider_ID_conflict_bug

Also put a simple proposed solution there, which is:
-Create a new ‘referrer_providerID’ sql column
-Fix codebase for referral code to use the new ‘referrer_providerID’ sql column
-On upgrade, simply copy over the data from the providerID sql field to the referrer_providerID field (note, the same data will then be in both for the upgraders, which is the safest way to implement in upgrades)

I agree with Tony; this would be a nice, simple project for anyone that wants to get their feet wet with OpenEMR development.

-brady

bradymiller wrote on Wednesday, October 26, 2011:

Hi jenjhall,

Can you list which fields you are populating.

-brady

jenjhall wrote on Wednesday, October 26, 2011:

I loaded all of them using null characters when there were empty cells as listed in the table description.  I used zeros in the ‘authorized’, facility_id’, ‘see_auth’ and ‘calendar’ fields and ones in the ‘active’ and ‘cal_ui’ fields.  I did not put anything in the ‘id’ field.  My data included fname, mname, lname, federaltaxid, upin, npi, title, speciality, street, streetb, city, state, zip, fax, phonew1, phonew2, phonecell, taxonomy, and state_license_number. Thanks - jen

dave-d wrote on Thursday, October 27, 2011:

I have recently had the same experience as jenjhall.  I have been transferring records from our existing system (Medical Manager - Dos based)  into the OpenEMR database.

The address book list appears to only list records from the table user where the field ‘authorized’ is set to one, although I have not tested this extensively.  Our secretary’s user name etc were entered using the OpenEMR program but for some reason ‘authorized’ is set to ‘0’ for her record.  She can log on but she does not appear in the address book listing.  The other local users appear in the address book.  I loaded our list of referring physicians into the users table leaving most of the fields NULL- including the ‘authorized’ field, and they don’t show up in the address book either.

(My data was limited to name, address, NPI  and an occasional phone number, but I populated the id field with the numbers from our old database as they relate to the patient_data records.)

Our list of referring physicians has an id number field which relates to a field in the patient demographic record.  I had placed that number in the referrerID field in the patient_data table, not recognizing the intended purpose for it.  ( I now presume that it is filled in some proportion to the “referral source” ie. newspaper, radio, … Perhaps that is a silly assumption to make…)

So I have it on my list of things to do to find out what it takes to populate the electronic billing equivalent of fields 17. NAME OF REFFERING PROVIDER OR OTHER SOURCE  & 17b. NPI on the CMS-1500 claim form.

I had hoped to have this done by some time next week, but that is probably not very realistic, as my knowledge and skilla are pretty limited.  The billing engine of Medical Manager is a black box to me.  As for OpenEMR, I have developed a crude idea of how it works, and can write code in PHP and javascript.  (I have written several custom forms for OpenEMR that work satisfactorily.)   But the smartie templating business and the newer object oriented code are currently beyond me.  I expect that it will take the better part of a weekend just to learn to read the newer code and ferret out the relevant files to make any alterations.  I am hoping that if any changes need to be made that FreeB has the needed code already and that it would just be a matter of feeding the right data?

I was planning on doing a test run on billing tomorrow but I have been diverted to diesel engine repair for at least a day or so.

-David

dave-d wrote on Thursday, October 27, 2011:

I just altered one record in TABLE user setting ‘authorized’ = ‘1’ and that doctor popped up in the drop down list just as Tony promised.

Doesn’t really help much though, as we need to keep track of both the patients provider in our office and also the referring physician.

-D

jenjhall wrote on Thursday, October 27, 2011:

Ok, I set the authorized field to 1 and the data showed up correctly both in the address book and the pick list.  I hope everything will be correct as far as the billing batch file.  Thanks - Jen