Customizing Encounters

Hi,
I want to customize the encounter form to track patients’ pregnancy. I created a table for weeks pregnant, and added a column for weeks pregnant to the forms_encounter table. Editing common.php I am able to create a drop down menu, but I can’t get the menu to edit the column in forms_encounter.
I don’t really have much coding experience, so I’m trying to use the “visit category” field as a template. My question is why does the visit category PHP edit the cat_id field, but I can’t pregnancy field to save changes?
Here’s the code:

<?php echo xlt('Visit Category:'); ?> -- <?php echo xlt('Select One'); ?> -- <?php $cres = sqlStatement("SELECT pc_catid, pc_catname " . "FROM openemr_postcalendar_categories where pc_active = 1 ORDER BY pc_seq "); while ($crow = sqlFetchArray($cres)) { $catid = $crow['pc_catid']; if ($catid < 9 && $catid != 5) continue; echo " <option value="" . attr($catid) . "" ";="" if="" ($viewmode="" &&="" $crow['pc_catid'] == $result['pc_catid']) echo " selected"; echo ">" . text(xl_appt_category($crow['pc_catname'])) . "\n"; } ?> <?php echo xlt('Pregnancy:'); ?> <?php $pres = sqlStatement("SELECT preg_id, preg_weeks_name " . "FROM preg_weeks ORDER BY preg_id "); while ($prow = sqlFetchArray($pres)) { $pregid = $prow['preg_id']; if ($pregid > 10 && $pregid != 20) continue; echo " <option value="" . attr($pregid) . "" ";="" if="" ($viewmode="" &&="" $prow['preg_id'] == $result['preg_id']) echo " selected"; echo ">" . text(xl($prow['preg_weeks_name'])) . "\n"; } ?> Thanks!

Hi,

Are you able to get your changes on github? This makes it much easier for us to review the code and even test it out.
It looks like you are missing the part where the choice is written to the sql table. For example, here is the code for visit category:



Also not seeing the select tag code for the selectors.

-brady

That was exactly what I was missing, and I was able to solve it.

Thanks so much,
Dan