Forms Table Relations Question

Can someone help me explain how are form_vitals, form_soap, etc relate to form_encounter. I am trying query all duplicate encounters where two or more encounters are created for the same patient on the same day having one encounter with vitals information and the other with soap information.
Thank you.

forms table is the container for all forms created for an encounter id with a pointer to the specific record in related tables. form_encounter is like other encounter forms except it is the summary - mainly for billing.

So you have 2 forms records for encounter 1 (form_encounter and form_vitals) with common encounter id 1.
You also have 2 additional forms records for encounter 2 with form_soap instead of vitals.

To fix the error manually make sure data from encounter 2 form_encounter records is merged. Then delete extra form_encounter record in forms table and change encounter id for form_soap to encounter 1.

In the end you should have 3 records with encounter id 1 in the forms table.


Many thanks for the help.