Move appointments to new provider

pfindan wrote on Monday, July 28, 2014:

Hi all,

We have a provider who is going on a year long leave. We want to move all of her future appointments to a new provider, but leave her on the schedule so appointments can be booked for after she returns (we commonly book appointments more than a year in advance). I haven’t seen anything in the GUI for this… Would the best way to go about this to run a SQL statement that changes the PID to the new provider?


blankev wrote on Monday, July 28, 2014:

My bet would be to make two Calendars next to each other. HolydayDokter and NewDoctor.

Only the scheduling will be a problem. Schedule in the HolydayDoctor and once the appointment is there, schedule for the NewDoctor.

There might be an option through phpMyAdmin and take the correct tables and rename the KeyID of HolydayDoctor to the ID of NewDoctor for future dates, but programmers-help would be another option with some kind of script. I never heard anything alike or seen anything within OpenEMR forums or read in the manuls.

mdsupport wrote on Monday, July 28, 2014:

You should not worry too much about appointments. In medical records and EMR what counts is the encounter. That can always be set correctly on encounter summary screen. In any case, here is what we do:

  1. Even if new md has not been hired, create a placeholder. The name can be changed later.
  2. Start assigning future appointments to new md.
  3. On the given transition date, run the following query :

UPDATE openemr_postcalendar_events SET pc_aid= {new md’s user id} WHERE pc_aid={old md’s user id} AND pc_eventDate>{Last working date of old md e.g. ‘2014-07-30’}

  1. We don’t use them but recurring appointments could be bit more complicated.
  2. Once {old} md comes back, run the same process except the id numbers would be reversed and the date will be different.

fsgl wrote on Monday, July 28, 2014:

Running a query in openemr_postcalendar_events for pc_aid (leaving physician’s user #) with pc_eventDate (actual time of the appointment) is the first step.

There needs to be a safeguard not to double book for the physician assuming the extra appointments. The Calendar does have the open slot feature (available appointment dialog). If this feature can be leveraged to structure the second query, this would very helpful.

Once it known where to put the patients, the pc_aid can be changed accordingly.

If step 2 is exceedingly difficult because we are talking about a whole year’s worth of appointments, the alternative is to randomly change the pc_aid; then while viewing the actual Calendar, make adjustments a month in advance. That should provide enough time for patient reminders.

blankev wrote on Monday, July 28, 2014:

Find the ID of HolydayDoctor, Find the ID of NewDoctor in USER Table

Locate Table: openemr_postcalendar_events

Locate: column pc-aid now comes the tricky part… be aware and know what you should do!

Learn what MD Support suggests. Do it with the correct SQL query parameters.

rpl121 wrote on Tuesday, July 29, 2014:

If you’re brave, maybe try a MySQL command something like this (don’t trust
me – test it yourself):

update openemr_postcalendar_events set c_aid = X where c_aid = Y;

X and Y are just the provider IDs you want to exchange. You can further
limit this by date of the event if you wish. You can accomplish all in a
fraction of a second command if you do it right, I think.

On Mon, Jul 28, 2014 at 7:06 PM, Pieter W wrote:

Administration => Other => Database now you are in PhpMyAdmin => Locate
table Users (last page of tables)

Locate User ID: Usually Admin is User 1 and the other doctors are
something like 6 or 18

Find the ID of HolydayDoctor, Find the ID of NewDoctor

Locate Tabel: openemr_postcalendar_events

Locate: column pc-aid now comes the tricky part…* be aware and know
what you should do!*

Change after date of entrance of NewDoctor all pc_aid for HolydayDoctor
into NewDoctorID

In demo version (the change is there till
reset of the DEMO)

All admin (pc-aid = 1) agenda appointments were transfered to pwb (pc_aid
= 4 )

Move appointments to new provider

Sent from because you indicated interest in

To unsubscribe from further messages, please visit

blankev wrote on Tuesday, July 29, 2014:

mdsupport wrote on Tuesday, July 29, 2014:

pfindan, SQL is nice but try out any advise in test / demo database with your type of data.

Sometimes saving a few keystrokes will give you power to rewrite history!!

pfindan wrote on Wednesday, July 30, 2014:

Thanks so much for all of your responses everyone! I figured a SQL query would be the easiest, but just wanted to check if there was another way. We have a test server setup that mirrors our main server, so I’ll check the query on that one first.

Thanks for your help everyone!