Assign patient to provider

HI,
i’m new to OPENEMR and trying to find a way so that when adding a new patient i get a suggestion of which provider to assign that patient to based on:

  1. pathology (i added a new field to demographics that is a list-box of my pathology list )

  2. number of provider’s assigned patients (or just say a certain logic or calculations)

i have made other list-box fields, each of them contains providers of a specific pathology (lists i made) and is hidden if the pathology field is not equal to the right value

what i need now is to update the default value of a provider field based on 2.number of provider’s assigned…

also : i need to know what is the use of the ‘Provider’ field in ‘choices’ section witch is there by default

thank youuuu

@Nemdil,
We assume that you have
Pathology list – You should have maintained pathology id and name.
Pathology-providers list – You should have maintained pathology id and provider id.
Now on selecting a particular pathology, make a query to get list of providers under it and assign the same to patient.

Thanks,
ViSolve

@visolveemr
Thank you for your reply, now i see that what i did was absurd, but it was just a workaround since i have never worked with PHP or SQL and i didnt and still dont know where to make that query (what file to write it in).
thanks a lot for your help

as for default value of the provider field i’m thinking of changing is_default value in Pathology-providers list every time a new patient is saved (in openemr\interface\new\new_comprehensive_save.phpp)

something like this (i got the query from phpmyadmin):
“sqlQuery(“UPDATE list_options SET is_default = ‘1’ WHERE list_options.list_id = ‘Pathology-providers list’ AND list_options.option_id = ‘provider id’”);”

it is probably ridiculous to do it this way, but this is my first time with web development so any help or guidance is appreciated.
thanks