Create single custom api for login [ patients , doctors, admin ]

we are creating react web app, in that we have single login for doctor , admin , patients.

How to create single custom api for login [ patients , doctors, admin ] ?

currently we have created login api for patients : login_openemr - Pastebin.com

so that using that api, all 3 user roles can login ?