Different access based on Companies

I am building an app for different hospitals that could be used by many doctors and many patients. The problem I am having is how to give doctors access because a doctor can be employed by more than one hospital in the system and I am also having issues on how to transfer patients registered to one hospital to another hospital without losing the patient records and which hospital the record came from.

Please anyone out there

In my app i created different verification before login. A user can be a doctor or an admin person, the doctors can be employed by more than one hospital but the admin can only work for one hospital. I gave access code to each hospital and based on the code, you get access to the hospital you want. The issue I ran into now is that, when a user logs in the current hospital is not available on home screen