I was writing a form query to get data from the codes table and noticed that all fees are set to NULL. This lead to the prices table, which appears to be new. How do you enter multiple prices for a single item? I went into superbill-more and did not see an option for this. Will this be the place to look for prices and not the fee column of the codes table?
Would this be an example of a correct query to get complete data from codes, including fee? What if there were multiple prices for a CPT4 code, how would I deal with that?
$query = "SELECT t1.code_type, t1.code, t1.code_text, t1.modifier, ".
"t1.units, t2.pr_price AS fee FROM codes AS t1 JOIN prices AS t2 ".
"ON (t1.id = t2.pr_id) WHERE ".
“t1.code_text LIKE ‘$search_term’ LIMIT $limit”;
You need to go to Admin/Lists and add some price levels. Then you will be able to enter prices for those levels into services and products.
The "fee" column in the codes table is obsolete and at some point should be removed.
Your ON clause needs to include “t2.pr_selector = ‘’” as well as a test for the desired price level. Non-empty selectors are used for products. See interface/patient_file/encounter/superbill_custom_full.php for some sample SQL referencing prices.
$query = "SELECT t1.code_type, t1.code, t1.code_text, t1.modifier, ".
"t1.units, t2.pr_price AS fee FROM codes AS t1 join prices AS t2 ".
"on (t1.id = t2.pr_id AND t2.pr_selector LIKE ‘’ AND pr_level LIKE ‘standard’) WHERE ".
“t1.code_text LIKE ‘$search_term’ LIMIT $limit”;
I tried with ‘=’ and ‘LIKE’. I thought with MySQL, string equality had to be checked with LIKE, but it seemed to work either way.
I am using OpenEMR v2.8.4-dev in my office, so I thought about making the code backwards compatible with the fee being in the codes table, but it’s too much trouble, so I’ll just leave that alone for now.