﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="OpenDentalDocumentation.xsl"?>
<database version="11.1.9">
    <table name="account">
        <summary>Used in the accounting section in chart of accounts.  Not related to patient accounts in any way.</summary>
        <column order="0" name="AccountNum" type="bigint(20)">
            <summary>Primary key..</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="AcctType" type="tinyint">
            <summary>Enum:AccountType Asset, Liability, Equity,Revenue, Expense</summary>
            <Enumeration name="AccountType">
                <summary>Used in accounting for chart of accounts.</summary>
                <EnumValue name="Asset">0</EnumValue>
                <EnumValue name="Liability">1</EnumValue>
                <EnumValue name="Equity">2</EnumValue>
                <EnumValue name="Income">3</EnumValue>
                <EnumValue name="Expense">4</EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="BankNumber" type="varchar(255)">
            <summary>For asset accounts, this would be the bank account number for deposit slips.</summary>
        </column>
        <column order="4" name="Inactive" type="tinyint">
            <summary>Set to true to not normally view this account in the list.</summary>
        </column>
        <column order="5" name="AccountColor" type="int(11)">
            <summary>.</summary>
        </column>
    </table>
    <table name="accountingautopay">
        <summary>In the accounting section, this automates entries into the database when user enters a payment into a patient account.  This table presents the user with a picklist specific to that payment type.  For example, a cash payment would create a picklist of cashboxes for user to put the cash into.</summary>
        <column order="0" name="AccountingAutoPayNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PayType" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.</summary>
        </column>
        <column order="2" name="PickList" type="varchar(255)" fk="account">
            <summary>FK to account.AccountNum.  AccountNums separated by commas.  No spaces.</summary>
        </column>
    </table>
    <table name="adjustment">
        <summary>An adjustment in the patient account.  Usually, adjustments are very simple, just being assigned to one patient and provider.  But they can also be attached to a procedure to represent a discount on that procedure.  Attaching adjustments to procedures is not automated, so it is not very common.</summary>
        <column order="0" name="AdjNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="AdjDate" type="date">
            <summary>The date that the adjustment shows in the patient account.</summary>
        </column>
        <column order="2" name="AdjAmt" type="double">
            <summary>Amount of adjustment.  Can be pos or neg.</summary>
        </column>
        <column order="3" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="4" name="AdjType" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.</summary>
        </column>
        <column order="5" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="6" name="AdjNote" type="text">
            <summary>Note for this adjustment.</summary>
        </column>
        <column order="7" name="ProcDate" type="date">
            <summary>Procedure date.  Not when the adjustment was entered.  This is what the aging will be based on in a future version.</summary>
        </column>
        <column order="8" name="ProcNum" type="bigint(20)" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum.  Only used if attached to a procedure.  Otherwise, 0.</summary>
        </column>
        <column order="9" name="DateEntry" type="date">
            <summary>Timestamp automatically generated and user not allowed to change.  The actual date of entry.</summary>
        </column>
        <column order="10" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum.</summary>
        </column>
    </table>
    <table name="aggpath">
        <summary></summary>
        <column order="0" name="AggPathNum" type="bigint(20)">
            <summary></summary>
        </column>
        <column order="1" name="RemoteURI" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="2" name="RemoteUserName" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="3" name="RemotePassword" type="varchar(255)">
            <summary></summary>
        </column>
    </table>
    <table name="allergy">
        <summary>An allergy attached to a patient and linked to an AllergyDef.</summary>
        <column order="0" name="AllergyNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="AllergyDefNum" type="bigint(20)" fk="allergydef">
            <summary>FK to allergydef.AllergyDefNum</summary>
        </column>
        <column order="2" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="3" name="Reaction" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="4" name="StatusIsActive" type="tinyint(4)">
            <summary></summary>
        </column>
        <column order="5" name="DateTStamp" type="timestamp">
            <summary>To be used for synch with web server for CertTimelyAccess.</summary>
        </column>
        <column order="6" name="DateAdverseReaction" type="date">
            <summary>The historical date that the patient had the adverse reaction to this agent.</summary>
        </column>
    </table>
    <table name="allergydef">
        <summary>An allergy definition.  Gets linked to an allergy and patient.</summary>
        <column order="0" name="AllergyDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Name of the drug.  User can change this.  If an RxCui is present, the RxNorm string can be pulled from the in-memory table for UI display in addition to the Description.</summary>
        </column>
        <column order="2" name="IsHidden" type="tinyint(4)">
            <summary>Because user can't delete.</summary>
        </column>
        <column order="3" name="DateTStamp" type="timestamp">
            <summary>The last date and time this row was altered.  Not user editable.</summary>
        </column>
        <column order="4" name="Snomed" type="tinyint(4)">
            <summary>Enum:SnomedAllergy SNOMED Allergy Type Code.</summary>
        </column>
        <column order="5" name="MedicationNum" type="bigint(20)" fk="Medication">
            <summary>FK to Medication.MedicationNum. Optional.</summary>
        </column>
    </table>
    <table name="anestheticrecord">
        <summary></summary>
        <column order="0" name="AnestheticRecordNum" type="int(11)">
            <summary></summary>
        </column>
        <column order="1" name="PatNum" type="int(11)">
            <summary></summary>
        </column>
        <column order="2" name="AnestheticDate" type="datetime">
            <summary></summary>
        </column>
        <column order="3" name="ProvNum" type="smallint(5)">
            <summary></summary>
        </column>
    </table>
    <table name="appointment">
        <summary>Appointments can show in the Appointments module, or they can be on the unscheduled list.  An appointment object is also used to store the Planned appointment.  The planned appointment never gets scheduled, but instead gets copied.</summary>
        <column order="0" name="AptNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  The patient that the appointment is for.</summary>
        </column>
        <column order="2" name="AptStatus" type="tinyint">
            <summary>Enum:ApptStatus .</summary>
            <Enumeration name="ApptStatus">
                <summary>Appointment status.</summary>
                <EnumValue name="None">0- No appointment should ever have this status.</EnumValue>
                <EnumValue name="Scheduled">1- Shows as a regularly scheduled appointment.</EnumValue>
                <EnumValue name="Complete">2- Shows greyed out.</EnumValue>
                <EnumValue name="UnschedList">3- Only shows on unscheduled list.</EnumValue>
                <EnumValue name="ASAP">4- Functions almost the same as Scheduled, but also causes the appointment to show on the ASAP list.</EnumValue>
                <EnumValue name="Broken">5- Shows with a big X on it.</EnumValue>
                <EnumValue name="Planned">6- Planned appointment.  Only shows in Chart module. User not allowed to change this status, and it does not display as one of the options.</EnumValue>
                <EnumValue name="PtNote">7- Patient "post-it" note on the schedule. Shows light yellow. Shows on day scheduled just like appt, as well as in prog notes, etc.</EnumValue>
                <EnumValue name="PtNoteCompleted">8- Patient "post-it" note completed</EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="Pattern" type="varchar(255)">
            <summary>Time pattern, X for Dr time, / for assist time. Stored in 5 minute increments.  Converted as needed to 10 or 15 minute representations for display.</summary>
        </column>
        <column order="4" name="Confirmed" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.  This field can also be used to show patient arrived, in chair, etc.  The Category column in the definition table is DefCat.ApptConfirmed.</summary>
        </column>
        <column order="5" name="TimeLocked" type="tinyint(1)">
            <summary>If true, then the program will not attempt to reset the user's time pattern and length when adding or removing procedures.</summary>
        </column>
        <column order="6" name="Op" type="bigint(20)" fk="operatory">
            <summary>FK to operatory.OperatoryNum.</summary>
        </column>
        <column order="7" name="Note" type="text">
            <summary>Note.</summary>
        </column>
        <column order="8" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="9" name="ProvHyg" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  Optional.  Only used if a hygienist is assigned to this appt.</summary>
        </column>
        <column order="10" name="AptDateTime" type="datetime">
            <summary>Appointment Date and time.  If you need just the date or time for an SQL query, you can use DATE(AptDateTime) and TIME(AptDateTime) in your query.</summary>
        </column>
        <column order="11" name="NextAptNum" type="bigint(20)" fk="appointment">
            <summary>FK to appointment.AptNum.  A better description of this field would be PlannedAptNum.  Only used to show that this apt is derived from specified planned apt. Otherwise, 0.</summary>
        </column>
        <column order="12" name="UnschedStatus" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.  The definition.Category in the definition table is DefCat.RecallUnschedStatus.  Only used if this is an Unsched or Planned appt.</summary>
        </column>
        <column order="13" name="IsNewPatient" type="tinyint">
            <summary>This is the first appoinment this patient has had at this office.  Somewhat automated.</summary>
        </column>
        <column order="14" name="ProcDescript" type="varchar(255)">
            <summary>A one line summary of all procedures.  Can be used in various reports, Unscheduled list, and Planned appointment tracker.  Not user editable right now, so it doesn't show on the screen.</summary>
        </column>
        <column order="15" name="Assistant" type="bigint(20)" fk="employee">
            <summary>FK to employee.EmployeeNum.  You can assign an assistant to the appointment.</summary>
        </column>
        <column order="16" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  0 if no clinic.</summary>
        </column>
        <column order="17" name="IsHygiene" type="tinyint">
            <summary>Set true if this is a hygiene appt.  The hygiene provider's color will show.</summary>
        </column>
        <column order="18" name="DateTStamp" type="timestamp">
            <summary>Automatically updated by MySQL every time a row is added or changed.</summary>
        </column>
        <column order="19" name="DateTimeArrived" type="datetime">
            <summary>The date and time that the patient checked in.  Date is largely ignored since it should be the same as the appt.</summary>
        </column>
        <column order="20" name="DateTimeSeated" type="datetime">
            <summary>The date and time that the patient was seated in the chair in the operatory.</summary>
        </column>
        <column order="21" name="DateTimeDismissed" type="datetime">
            <summary>The date and time that the patient got up out of the chair</summary>
        </column>
        <column order="22" name="InsPlan1" type="bigint(20)" fk="insplan">
            <summary>FK to insplan.PlanNum for the primary insurance plan at the time the appointment is set complete. May be 0. We can't tell later which subscriber is involved; only the plan.</summary>
        </column>
        <column order="23" name="InsPlan2" type="bigint(20)" fk="insplan">
            <summary>FK to insplan.PlanNum for the secoondary insurance plan at the time the appointment is set complete. May be 0. We can't tell later which subscriber is involved; only the plan.</summary>
        </column>
        <column order="24" name="DateTimeAskedToArrive" type="datetime">
            <summary>Date and time patient asked to arrive, or minval if patient not asked to arrive at a different time than appt.</summary>
        </column>
        <column order="25" name="ProcsColored" type="text">
            <summary>Stores XML for the procs colors</summary>
        </column>
    </table>
    <table name="appointmentrule">
        <summary>For now, the rule is simple. It simply blocks all double booking of the specified code range.  The double booking would have to be for the same provider.  This can later be extended to provide more complex rules, such as partial double booking, time limitations, etc.</summary>
        <column order="0" name="AppointmentRuleNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="RuleDesc" type="varchar(255)">
            <summary>The description of the rule which will be displayed to the user.</summary>
        </column>
        <column order="2" name="CodeStart" type="varchar(15)">
            <summary>The procedure code of the start of the range.</summary>
        </column>
        <column order="3" name="CodeEnd" type="varchar(15)">
            <summary>The procedure code of the end of the range.</summary>
        </column>
        <column order="4" name="IsEnabled" type="tinyint">
            <summary>Usually true.  But this does allow you to turn off a rule temporarily without losing the settings.</summary>
        </column>
    </table>
    <table name="apptfield">
        <summary>These are custom fields added to appointments and managed by the user.</summary>
        <column order="0" name="ApptFieldNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="AptNum" type="bigint(20)" fk="appointment">
            <summary>FK to appointment.AptNum</summary>
        </column>
        <column order="2" name="FieldName" type="varchar(255)" fk="apptfielddef">
            <summary>FK to apptfielddef.FieldName.  The full name is shown here for ease of use when running queries.  But the user is only allowed to change fieldNames in the patFieldDef setup window.</summary>
        </column>
        <column order="3" name="FieldValue" type="text">
            <summary>Any text that the user types in.  Will later allow some automation.</summary>
        </column>
    </table>
    <table name="apptfielddef">
        <summary>These are the definitions for the custom patient fields added and managed by the user.</summary>
        <column order="0" name="ApptFieldDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="FieldName" type="varchar(255)">
            <summary>The name of the field that the user will be allowed to fill in the appt edit window.  Duplicates are prevented.</summary>
        </column>
    </table>
    <table name="apptview">
        <summary>Enables viewing a variety of operatories or providers.  This table holds the views that the user picks between.  The apptviewitem table holds the items attached to each view.</summary>
        <column order="0" name="ApptViewNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of this view.  Gets displayed in Appt module.</summary>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>0-based order to display in lists. Every view must have a unique itemorder, but it is acceptable to have some missing itemorders in the sequence.</summary>
        </column>
        <column order="3" name="RowsPerIncr" type="tinyint">
            <summary>Number of rows per time increment.  Usually 1 or 2.  Programming note: Value updated to ApptDrawing.RowsPerIncr to track current state.</summary>
        </column>
        <column order="4" name="OnlyScheduledProvs" type="tinyint">
            <summary>If set to true, then the only operatories that will show will be for providers that have schedules for the day, ops with no provs assigned.</summary>
        </column>
        <column order="5" name="OnlySchedBeforeTime" type="time">
            <summary>If OnlyScheduledProvs is set to true, and this time is not 0:00, then only provider schedules with start or stop time before this time will be included.</summary>
        </column>
        <column order="6" name="OnlySchedAfterTime" type="time">
            <summary>If OnlyScheduledProvs is set to true, and this time is not 0:00, then only provider schedules with start or stop time after this time will be included.</summary>
        </column>
        <column order="7" name="StackBehavUR" type="tinyint(4)">
            <summary>Enum:ApptViewStackBehavior </summary>
            <Enumeration name="ApptViewStackBehavior">
                <summary />
                <EnumValue name="Vertical"></EnumValue>
                <EnumValue name="Horizontal"></EnumValue>
            </Enumeration>
        </column>
        <column order="8" name="StackBehavLR" type="tinyint(4)">
            <summary>Enum:ApptViewStackBehavior </summary>
            <Enumeration name="ApptViewStackBehavior">
                <summary />
                <EnumValue name="Vertical"></EnumValue>
                <EnumValue name="Horizontal"></EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="apptviewitem">
        <summary>Each item is attached to a row in the apptview table.  Each item specifies ONE of: OpNum, ProvNum, ElementDesc, or ApptFieldDefNum.  The other three will be 0 or "".</summary>
        <column order="0" name="ApptViewItemNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ApptViewNum" type="bigint(20)" fk="apptview">
            <summary>FK to apptview.</summary>
        </column>
        <column order="2" name="OpNum" type="bigint(20)" fk="operatory">
            <summary>FK to operatory.OperatoryNum.</summary>
        </column>
        <column order="3" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="4" name="ElementDesc" type="varchar(255)">
            <summary>Must be one of the hard coded strings picked from the available list.</summary>
        </column>
        <column order="5" name="ElementOrder" type="tinyint">
            <summary>If this is a row Element, then this is the 0-based order within its area.  For example, UR starts over with 0 ordering.</summary>
        </column>
        <column order="6" name="ElementColor" type="int(11)">
            <summary>If this is an element, then this is the color.</summary>
        </column>
        <column order="7" name="ElementAlignment" type="tinyint(4)">
            <summary>Enum:ApptViewAlignment. If this is an element, then this is the alignment of the element within the appointment.</summary>
        </column>
        <column order="8" name="ApptFieldDefNum" type="bigint(20)" fk="apptfielddef">
            <summary>FK to apptfielddef.ApptFieldDefNum.  If this is an element, and the element is an appt field, then this tells us which one.</summary>
        </column>
        <column order="9" name="PatFieldDefNum" type="bigint(20)" fk="patfielddef">
            <summary>FK to patfielddef.PatFieldDefNum.  If this is an element, and the element is an appt field, then this tells us which one.  Not implemented yet.</summary>
        </column>
    </table>
    <table name="autocode">
        <summary>An autocode automates entering procedures.  The user only has to pick composite, for instance, and the autocode figures out the code based on the number of surfaces, and posterior vs. anterior.  Autocodes also enforce and suggest changes to a procedure code if the number of surfaces or other properties change.</summary>
        <column order="0" name="AutoCodeNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Displays meaningful decription, like "Amalgam".</summary>
        </column>
        <column order="2" name="IsHidden" type="tinyint">
            <summary>User can hide autocodes</summary>
        </column>
        <column order="3" name="LessIntrusive" type="tinyint">
            <summary>This will be true if user no longer wants to see this autocode message when closing a procedure. This makes it less intrusive, but it can still be used in procedure buttons.</summary>
        </column>
    </table>
    <table name="autocodecond">
        <summary>AutoCode condition.  Always attached to an AutoCodeItem, which is then, in turn, attached to an autocode.  There is usually only one or two conditions for a given AutoCodeItem.</summary>
        <column order="0" name="AutoCodeCondNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="AutoCodeItemNum" type="bigint(20)" fk="autocodeitem">
            <summary>FK to autocodeitem.AutoCodeItemNum.</summary>
        </column>
        <column order="2" name="Cond" type="tinyint">
            <summary>Enum:AutoCondition </summary>
            <Enumeration name="AutoCondition">
                <summary />
                <EnumValue name="Anterior">0</EnumValue>
                <EnumValue name="Posterior">1</EnumValue>
                <EnumValue name="Premolar">2</EnumValue>
                <EnumValue name="Molar">3</EnumValue>
                <EnumValue name="One_Surf">4</EnumValue>
                <EnumValue name="Two_Surf">5</EnumValue>
                <EnumValue name="Three_Surf">6</EnumValue>
                <EnumValue name="Four_Surf">7</EnumValue>
                <EnumValue name="Five_Surf">8</EnumValue>
                <EnumValue name="First">9</EnumValue>
                <EnumValue name="EachAdditional">10</EnumValue>
                <EnumValue name="Maxillary">11</EnumValue>
                <EnumValue name="Mandibular">12</EnumValue>
                <EnumValue name="Primary">13</EnumValue>
                <EnumValue name="Permanent">14</EnumValue>
                <EnumValue name="Pontic">15</EnumValue>
                <EnumValue name="Retainer">16</EnumValue>
                <EnumValue name="AgeOver18">17</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="autocodeitem">
        <summary>Corresponds to the autocodeitem table in the database.  There are multiple AutoCodeItems for a given AutoCode.  Each Item has one ADA code.</summary>
        <column order="0" name="AutoCodeItemNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="AutoCodeNum" type="bigint(20)" fk="autocode">
            <summary>FK to autocode.AutoCodeNum</summary>
        </column>
        <column order="2" name="OldCode" type="varchar(15)">
            <summary>Do not use</summary>
        </column>
        <column order="3" name="CodeNum" type="bigint(20)" fk="procedurecode">
            <summary>FK to procedurecode.CodeNum</summary>
        </column>
    </table>
    <table name="automation">
        <summary>A trigger event causes one or more actions.</summary>
        <column order="0" name="AutomationNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="text">
            <summary>.</summary>
        </column>
        <column order="2" name="Autotrigger" type="tinyint(4)">
            <summary>Enum:AutomationTrigger What triggers this automation</summary>
            <Enumeration name="AutomationTrigger">
                <summary />
                <EnumValue name="CompleteProcedure"></EnumValue>
                <EnumValue name="BreakAppointment"></EnumValue>
                <EnumValue name="CreateApptNewPat"></EnumValue>
                <EnumValue name="OpenPatient">Regardless of module.  Usually only used with conditions.</EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="ProcCodes" type="text">
            <summary>If this has a CompleteProcedure trigger, this is a comma-delimited list of codes that will trigger the action.</summary>
        </column>
        <column order="4" name="AutoAction" type="tinyint(4)">
            <summary>The action taken as a result of the trigger.  To get more than one action, create multiple automation entries.</summary>
        </column>
        <column order="5" name="SheetDefNum" type="bigint(20)" fk="sheetdef">
            <summary>FK to sheetdef.SheetDefNum.  If the action is to print a sheet, then this tells which sheet to print.  So it must be a custom sheet.  Also, not that this organization does not allow passing parameters to the sheet such as which procedures were completed, or which appt was broken.</summary>
        </column>
        <column order="6" name="CommType" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum. Only used if action is CreateCommlog.</summary>
        </column>
        <column order="7" name="MessageContent" type="text">
            <summary>If a commlog action, then this is the text that goes in the commlog.  If this is a ShowStatementNoteBold action, then this is the NoteBold. Might later be expanded to work with email or to use variables.</summary>
        </column>
    </table>
    <table name="automationcondition">
        <summary>Each condition evaluates to true or false.  A series of conditions for a single automation is ANDed together.</summary>
        <column order="0" name="AutomationConditionNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="AutomationNum" type="bigint(20)" fk="automation">
            <summary>FK to automation.AutomationNum. </summary>
        </column>
        <column order="2" name="CompareField" type="tinyint(4)">
            <summary>Enum:AutoCondField </summary>
        </column>
        <column order="3" name="Comparison" type="tinyint(4)">
            <summary>Enum:AutoCondComparison Not all comparisons are allowed with all data types.</summary>
        </column>
        <column order="4" name="CompareString" type="varchar(255)">
            <summary>.</summary>
        </column>
    </table>
    <table name="autonote">
        <summary>A single autonote template.</summary>
        <column order="0" name="AutoNoteNum" type="bigint(20)">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="AutoNoteName" type="varchar(50)">
            <summary>Name of AutoNote</summary>
        </column>
        <column order="2" name="MainText" type="text">
            <summary>Was 'ControlsToInc' in previous versions.</summary>
        </column>
    </table>
    <table name="autonotecontrol">
        <summary>In the program, this is now called an autonote prompt.</summary>
        <column order="0" name="AutoNoteControlNum" type="bigint(20)">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="Descript" type="varchar(50)">
            <summary>The description of the prompt as it will be referred to from other windows.</summary>
        </column>
        <column order="2" name="ControlType" type="varchar(50)">
            <summary>'Text', 'OneResponse', or 'MultiResponse'.  More types to be added later.</summary>
        </column>
        <column order="3" name="ControlLabel" type="varchar(50)">
            <summary>The prompt text.</summary>
        </column>
        <column order="4" name="ControlOptions" type="text">
            <summary>For TextBox, this is the default text.  For a ComboBox, this is the list of possible responses, one per line.</summary>
        </column>
    </table>
    <table name="benefit">
        <summary>Corresponds to the benefit table in the database which replaces the old covpat table.  A benefit is usually a percentage, deductible, limitation, max, or similar. Each row represents a single benefit.  A benefit can have a value in EITHER PlanNum OR PatPlanNum.  If it is for a PlanNum, the most common, then the benefit is attached to an insurance plan.  If it is for a PatPlanNum, then it overrides the plan benefit, usually a percentage, for a single patient.  Benefits we can't handle yet include posterior composites, COB duplication, amounts used, in/out of plan network, authorization required, missing tooth exclusion, and any date related limitations like waiting periods.
            Here are examples of typical usage which parallel X12 usage.
            Example fields shown in this order:
            CovCat, ProcCode(- indicates blank), BenefitType, Percent, MonetaryAmt, TimePeriod, QuantityQualifier, Quantity, CoverageLevel
            Annual Max Indiv $1000: None/General,-,Limitations,-1,1000,CalendarYear,None,0,Individual
            Restorative 80%: Restorative,-,CoInsurance,80,-1,CalendarYear,None,0,None
            $50 deductible: None/General,-,Deductible,-1,50,CalendarYear,None,0,Individual
            Deductible waived on preventive: Preventive,-,Deductible,-1,0,CalendarYear,None,0,Individual
            1 pano every 5 years: None,D0330,Limitations,-1,-1,Years?,Years,5,None
            2 exams per year: Preventive(or Diagnostic),-,Limitations,-1,-1,BenefitYear,NumberOfServices,2,None
            Fluoride limit 18yo: None, D1204, Limitations, -1, -1, CalendarYear/None, AgeLimit, 18,None (might require a second identical entry for D1205)
            4BW every 6 months: None, D0274, Limitations, -1, -1, None, Months, 6,None.
            The text above might be difficult to read.  We are trying to improve the white spacing.</summary>
        <column order="0" name="BenefitNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PlanNum" type="bigint(20)" fk="insplan">
            <summary>FK to insplan.PlanNum.  Most benefits should be attached using PlanNum.  The exception would be if each patient has a different percentage.  If PlanNum is used, then PatPlanNum should be 0.</summary>
        </column>
        <column order="2" name="PatPlanNum" type="bigint(20)" fk="patplan">
            <summary>FK to patplan.PatPlanNum.  It is rare to attach benefits this way.  Usually only used to override percentages for patients.   In this case, PlanNum should be 0.</summary>
        </column>
        <column order="3" name="CovCatNum" type="bigint(20)" fk="covcat">
            <summary>FK to covcat.CovCatNum.  Corresponds to X12 EB03- Service Type code.  Situational, so it can be 0.  Will probably be 0 for general deductible and annual max.  There are very specific categories covered by X12. Users should set their InsCovCats to the defaults we provide.</summary>
        </column>
        <column order="4" name="BenefitType" type="tinyint">
            <summary>Enum:InsBenefitType Corresponds to X12 EB01. Examples: 0=ActiveCoverage, 1=CoInsurance, 2=Deductible, 3=CoPayment, 4=Exclusions, 5=Limitations. ActiveCoverage doesn't really provide meaningful information.</summary>
            <Enumeration name="InsBenefitType">
                <summary>Used in the benefit table.  Corresponds to X12 EB01.</summary>
                <EnumValue name="ActiveCoverage">0- Not usually used.  Would only be used if you are just indicating that the patient is covered, but without any specifics.</EnumValue>
                <EnumValue name="CoInsurance">1- Used for percentages to indicate portion that insurance will cover.  When interpreting electronic benefit information, this is the opposite percentage, the percentage that the patient will pay after deductible.</EnumValue>
                <EnumValue name="Deductible">2- The deductible amount.  Might be two entries if, for instance, deductible is waived on preventive.</EnumValue>
                <EnumValue name="CoPayment">3- A dollar amount.</EnumValue>
                <EnumValue name="Exclusions">4- Services that are simply not covered at all.</EnumValue>
                <EnumValue name="Limitations">5- Covers a variety of limitations, including Max, frequency, fee reductions, etc.</EnumValue>
            </Enumeration>
        </column>
        <column order="5" name="Percent" type="tinyint(4)">
            <summary>Only used if BenefitType=CoInsurance.  Valid values are 0 to 100.  -1 indicates empty, which is almost always true if not CoInsurance.  The percentage that insurance will pay on the procedure.  Note that benefits coming from carriers are usually backwards, indicating the percetage that the patient is responsible for.</summary>
        </column>
        <column order="6" name="MonetaryAmt" type="double">
            <summary>Used for CoPayment, Limitations, and Deductible.  -1 indicates empty</summary>
        </column>
        <column order="7" name="TimePeriod" type="tinyint">
            <summary>Enum:BenefitTimePeriod Corresponds to X12 EB06, Time Period Qualifier.  Examples: 0=None,1=ServiceYear,2=CalendarYear,3=Lifetime,4=Years. Might add Visit and Remaining.</summary>
            <Enumeration name="BenefitTimePeriod">
                <summary>Used in the benefit table.  Corresponds to X12 EB06.</summary>
                <EnumValue name="None">0- A timeperiod is frequenly not needed.  For example, percentages.</EnumValue>
                <EnumValue name="ServiceYear">1- The renewal month is not Jan.  In this case, we need to know the effective date so that we know which month the benefits start over in.</EnumValue>
                <EnumValue name="CalendarYear">2- Renewal month is Jan.</EnumValue>
                <EnumValue name="Lifetime">3- Usually used for ortho max.</EnumValue>
                <EnumValue name="Years">4- Wouldn't be used alone.  Years would again be specified in the quantity field along with a number.</EnumValue>
            </Enumeration>
        </column>
        <column order="8" name="QuantityQualifier" type="tinyint">
            <summary>Enum:BenefitQuantity Corresponds to X12 EB09. Not used very much. Examples: 0=None,1=NumberOfServices,2=AgeLimit,3=Visits,4=Years,5=Months</summary>
            <Enumeration name="BenefitQuantity">
                <summary>Used in the benefit table in conjunction with an integer quantity.</summary>
                <EnumValue name="None">0- This is used a lot. Most benefits do not need any sort of quantity.</EnumValue>
                <EnumValue name="NumberOfServices">1- For example, two exams per year</EnumValue>
                <EnumValue name="AgeLimit">2- For example, 18 when flouride only covered to 18 y.o.</EnumValue>
                <EnumValue name="Visits">3- For example, copay per 1 visit.</EnumValue>
                <EnumValue name="Years">4- For example, pano every 5 years.</EnumValue>
                <EnumValue name="Months">5- For example, BWs every 6 months.</EnumValue>
            </Enumeration>
        </column>
        <column order="9" name="Quantity" type="tinyint">
            <summary>Corresponds to X12 EB10. Qualify the quantity using QuantityQualifier.</summary>
        </column>
        <column order="10" name="CodeNum" type="bigint(20)" fk="procedurecode">
            <summary>FK to procedurecode.CodeNum.  Typical uses include fluoride, sealants, etc.  If a specific code is used here, then the CovCat should be None.</summary>
        </column>
        <column order="11" name="CoverageLevel" type="int(11)">
            <summary>Enum:BenefitCoverageLevel Corresponds to X12 EB02.  None, Individual, or Family.  Individual and Family are commonly used for deductibles and maximums.  None is commonly used for percentages and copays.</summary>
            <Enumeration name="BenefitCoverageLevel">
                <summary>Used in the benefit table.</summary>
                <EnumValue name="None">0- Since this is a situational X12 field, we can also have none.  Typical for percentages and copayments.</EnumValue>
                <EnumValue name="Individual">1- The default for deductibles and maximums.</EnumValue>
                <EnumValue name="Family">2- For example, family deductible or family maximum.</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="canadiannetwork">
        <summary>Not user-editable.</summary>
        <column order="0" name="CanadianNetworkNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Abbrev" type="varchar(20)">
            <summary>This will also be the folder name</summary>
        </column>
        <column order="2" name="Descript" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="3" name="CanadianTransactionPrefix" type="varchar(255)">
            <summary>A01.  Up to 12 char.</summary>
        </column>
        <column order="4" name="CanadianIsRprHandler" type="tinyint(4)">
            <summary>Set to true if this network is in charge of handling all Request for Payment Reconciliation (RPR) transactions for all carriers within this network, as opposed to the individual carriers wihtin the network processing the RPR transactions themselves.</summary>
        </column>
    </table>
    <table name="carrier">
        <summary>Every InsPlan has a Carrier.  The carrier stores the name and address.</summary>
        <column order="0" name="CarrierNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="CarrierName" type="varchar(255)">
            <summary>Name of the carrier.</summary>
        </column>
        <column order="2" name="Address" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="3" name="Address2" type="varchar(255)">
            <summary>Second line of address.</summary>
        </column>
        <column order="4" name="City" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="5" name="State" type="varchar(255)">
            <summary>2 char in the US.</summary>
        </column>
        <column order="6" name="Zip" type="varchar(255)">
            <summary>Postal code.</summary>
        </column>
        <column order="7" name="Phone" type="varchar(255)">
            <summary>Includes any punctuation.</summary>
        </column>
        <column order="8" name="ElectID" type="varchar(255)">
            <summary>E-claims electronic payer id.  5 char in USA.  6 digits in Canada.  I've seen an ID this long before: "LA-DHH-MEDICAID".  The user interface currently limits length to 20, although db limits length to 255.  X12 requires length between 2 and 80.</summary>
        </column>
        <column order="9" name="NoSendElect" type="tinyint">
            <summary>Do not send electronically.  It's just a default; you can still send electronically.</summary>
        </column>
        <column order="10" name="IsCDA" type="tinyint">
            <summary>Canada: True if a CDAnet carrier.  This has significant implications:  1. It can be filtered for in the list of carriers.  2. An ElectID is required.  3. The ElectID can never be used by another carrier.  4. If the carrier is attached to any etrans, then the ElectID cannot be changed (and, of course, the carrier cannot be deleted or combined).</summary>
        </column>
        <column order="11" name="CDAnetVersion" type="varchar(100)">
            <summary>The version of CDAnet supported.  Either 02 or 04.</summary>
        </column>
        <column order="12" name="CanadianNetworkNum" type="bigint(20)" fk="canadiannetwork">
            <summary>FK to canadiannetwork.CanadianNetworkNum.  Only used in Canada.  Right now, there is no UI to the canadiannetwork table in our db.</summary>
        </column>
        <column order="13" name="IsHidden" type="tinyint(4)">
            <summary></summary>
        </column>
        <column order="14" name="CanadianEncryptionMethod" type="tinyint(4)">
            <summary>1=No Encryption, 2=CDAnet standard #1, 3=CDAnet standard #2.  Field A10.</summary>
        </column>
        <column order="15" name="CanadianSupportedTypes" type="int(11)">
            <summary>Bit flags.</summary>
        </column>
    </table>
    <table name="chartview">
        <summary>Enables viewing a variety of views in chart module.</summary>
        <column order="0" name="ChartViewNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of this view.  Gets displayed at top of Progress Notes grid.</summary>
        </column>
        <column order="2" name="ItemOrder" type="int(11)">
            <summary>0-based order to display in lists.</summary>
        </column>
        <column order="3" name="ProcStatuses" type="tinyint(4)">
            <summary>Enum:ChartViewProcStat None=0,TP=1,Complete=2,Existing Cur Prov=4,Existing Other Prov=8,Referred=16,Deleted=32,Condition=64,All=127.</summary>
        </column>
        <column order="4" name="ObjectTypes" type="smallint(6)">
            <summary>Enum:ChartViewObjs None=0,Appointments=1,Comm Log=2,Comm Log Family=4,Tasks=8,Email=16,LabCases=32,Rx=64,Sheets=128,All=255.</summary>
        </column>
        <column order="5" name="ShowProcNotes" type="tinyint(4)">
            <summary>Set true to show procedure notes.</summary>
        </column>
        <column order="6" name="IsAudit" type="tinyint(4)">
            <summary>Set true to enable audit mode.</summary>
        </column>
        <column order="7" name="SelectedTeethOnly" type="tinyint(4)">
            <summary>Set true to only show information regarding the selected teeth.</summary>
        </column>
        <column order="8" name="OrionStatusFlags" type="int(11)">
            <summary>Enum:OrionStatus Which orion statuses to show. Will be zero if not orion.</summary>
            <Enumeration name="OrionStatus">
                <summary />
                <EnumValue name="None">0- None.  While a normal orion proc would never have this status2, it is still needed for flags in ChartViews.  And it's also possible that a status2 slipped through the cracks and was not assigned, leaving it with this value.</EnumValue>
                <EnumValue name="TP">1– Treatment planned</EnumValue>
                <EnumValue name="C">2– Completed</EnumValue>
                <EnumValue name="E">4– Existing prior to incarceration</EnumValue>
                <EnumValue name="R">8– Refused treatment</EnumValue>
                <EnumValue name="RO">16– Referred out to specialist</EnumValue>
                <EnumValue name="CS">32– Completed by specialist</EnumValue>
                <EnumValue name="CR">64– Completed by registry</EnumValue>
                <EnumValue name="CA_Tx">128- Cancelled, tx plan changed</EnumValue>
                <EnumValue name="CA_EPRD">256- Cancelled, eligible parole</EnumValue>
                <EnumValue name="CA_PD">512- Cancelled, parole/discharge</EnumValue>
                <EnumValue name="S">1024– Suspended, unacceptable plaque</EnumValue>
                <EnumValue name="ST">2048- Stop clock, multi visit</EnumValue>
                <EnumValue name="W">4096– Watch</EnumValue>
                <EnumValue name="A">8192– Alternative</EnumValue>
            </Enumeration>
        </column>
        <column order="9" name="DatesShowing" type="tinyint(4)">
            <summary>Enum:ChartViewDates </summary>
        </column>
    </table>
    <table name="claim">
        <summary>The claim table holds information about individual claims.  Each row represents one claim.</summary>
        <column order="0" name="ClaimNum" type="bigint(20)">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="DateService" type="date">
            <summary>Usually the same date as the procedures, but it can be changed if you wish.</summary>
        </column>
        <column order="3" name="DateSent" type="date">
            <summary>Usually the date it was created.  It might be sent a few days later if you don't send your e-claims every day.</summary>
        </column>
        <column order="4" name="ClaimStatus" type="char(1)">
            <summary>Single char: U,H,W,P,S,or R.  U=Unsent, H=Hold until pri received, W=Waiting in queue, S=Sent, R=Received.  A(adj) is no longer used.  P(prob sent) is no longer used.</summary>
        </column>
        <column order="5" name="DateReceived" type="date">
            <summary>Date the claim was received.</summary>
        </column>
        <column order="6" name="PlanNum" type="bigint(20)" fk="insplan">
            <summary>FK to insplan.PlanNum.  Every claim is attached to one plan.</summary>
        </column>
        <column order="7" name="ProvTreat" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  Treating provider for dental claims.  For institutional claims, this is called the attending provider.</summary>
        </column>
        <column order="8" name="ClaimFee" type="double">
            <summary>Total fee of claim.</summary>
        </column>
        <column order="9" name="InsPayEst" type="double">
            <summary>Amount insurance is estimated to pay on this claim.</summary>
        </column>
        <column order="10" name="InsPayAmt" type="double">
            <summary>Amount insurance actually paid.</summary>
        </column>
        <column order="11" name="DedApplied" type="double">
            <summary>Deductible applied to this claim.</summary>
        </column>
        <column order="12" name="PreAuthString" type="varchar(40)">
            <summary>The predetermination of benefits number received from ins.  In X12, REF G3.</summary>
        </column>
        <column order="13" name="IsProsthesis" type="char(1)">
            <summary>Single char for No, Initial, or Replacement.</summary>
        </column>
        <column order="14" name="PriorDate" type="date">
            <summary>Date prior prosthesis was placed.  Note that this is only for paper claims.  E-claims have a date field on each individual procedure.</summary>
        </column>
        <column order="15" name="ReasonUnderPaid" type="varchar(255)">
            <summary>Note for patient for why insurance didn't pay as expected.</summary>
        </column>
        <column order="16" name="ClaimNote" type="varchar(255)">
            <summary>Note to be sent to insurance. Max 255 char.  E-claims also have notes on each procedure.</summary>
        </column>
        <column order="17" name="ClaimType" type="varchar(255)">
            <summary>"P"=primary, "S"=secondary, "PreAuth"=preauth, "Other"=other, "Cap"=capitation.  Not allowed to be blank. Might need to add "Med"=medical claim.</summary>
        </column>
        <column order="18" name="ProvBill" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  Billing provider.  Assignment can be automated from the setup section.</summary>
        </column>
        <column order="19" name="ReferringProv" type="bigint(20)" fk="referral">
            <summary>FK to referral.ReferralNum.</summary>
        </column>
        <column order="20" name="RefNumString" type="varchar(40)">
            <summary>Referral number for this claim.</summary>
        </column>
        <column order="21" name="PlaceService" type="tinyint">
            <summary>Enum:PlaceOfService .</summary>
            <Enumeration name="PlaceOfService">
                <summary />
                <EnumValue name="Office">0. CPT code 11</EnumValue>
                <EnumValue name="PatientsHome">1. CPT code 12</EnumValue>
                <EnumValue name="InpatHospital">2. CPT code 21</EnumValue>
                <EnumValue name="OutpatHospital">3. CPT code 22</EnumValue>
                <EnumValue name="SkilledNursFac">4. CPT code 31</EnumValue>
                <EnumValue name="CustodialCareFacility">5. CPT code 33.  In X12, a similar code AdultLivCareFac 35 is mentioned.</EnumValue>
                <EnumValue name="OtherLocation">6. CPT code ?.  We use 11 for office.</EnumValue>
                <EnumValue name="MobileUnit">7. CPT code 15</EnumValue>
                <EnumValue name="School">8. CPT code 03</EnumValue>
                <EnumValue name="MilitaryTreatFac">9. CPT code 26</EnumValue>
                <EnumValue name="FederalHealthCenter">10. CPT code 50</EnumValue>
                <EnumValue name="PublicHealthClinic">11. CPT code 71</EnumValue>
                <EnumValue name="RuralHealthClinic">12. CPT code 72</EnumValue>
                <EnumValue name="EmergencyRoomHospital">13. CPT code 23</EnumValue>
                <EnumValue name="AmbulatorySurgicalCenter">14. CPT code 24</EnumValue>
            </Enumeration>
        </column>
        <column order="22" name="AccidentRelated" type="char(1)">
            <summary>blank or A=Auto, E=Employment, O=Other.</summary>
        </column>
        <column order="23" name="AccidentDate" type="date">
            <summary>Date of accident, if applicable.</summary>
        </column>
        <column order="24" name="AccidentST" type="varchar(2)">
            <summary>Accident state.</summary>
        </column>
        <column order="25" name="EmployRelated" type="tinyint">
            <summary>Enum:YN .</summary>
            <Enumeration name="YN">
                <summary>Unknown,Yes, or No.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Yes">1</EnumValue>
                <EnumValue name="No">2</EnumValue>
            </Enumeration>
        </column>
        <column order="26" name="IsOrtho" type="tinyint">
            <summary>True if is ortho.</summary>
        </column>
        <column order="27" name="OrthoRemainM" type="tinyint">
            <summary>Remaining months of ortho. Valid values are 1-36.</summary>
        </column>
        <column order="28" name="OrthoDate" type="date">
            <summary>Date ortho appliance placed.</summary>
        </column>
        <column order="29" name="PatRelat" type="tinyint">
            <summary>Enum:Relat  Relationship to subscriber.  The relationship is copied from InsPlan when the claim is created.  It might need to be changed in both places.</summary>
            <Enumeration name="Relat">
                <summary>Relationship to subscriber for insurance.</summary>
                <EnumValue name="Self">0</EnumValue>
                <EnumValue name="Spouse">1</EnumValue>
                <EnumValue name="Child">2</EnumValue>
                <EnumValue name="Employee">3</EnumValue>
                <EnumValue name="HandicapDep">4</EnumValue>
                <EnumValue name="SignifOther">5</EnumValue>
                <EnumValue name="InjuredPlaintiff">6</EnumValue>
                <EnumValue name="LifePartner">7</EnumValue>
                <EnumValue name="Dependent">8</EnumValue>
            </Enumeration>
        </column>
        <column order="30" name="PlanNum2" type="bigint(20)" fk="insplan">
            <summary>FK to insplan.PlanNum.  Other coverage plan number.  0 if none.  This provides the user with total control over what other coverage shows. This obviously limits the coverage on a single claim to two insurance companies.</summary>
        </column>
        <column order="31" name="PatRelat2" type="tinyint">
            <summary>Enum:Relat  The relationship to the subscriber for other coverage on this claim.</summary>
            <Enumeration name="Relat">
                <summary>Relationship to subscriber for insurance.</summary>
                <EnumValue name="Self">0</EnumValue>
                <EnumValue name="Spouse">1</EnumValue>
                <EnumValue name="Child">2</EnumValue>
                <EnumValue name="Employee">3</EnumValue>
                <EnumValue name="HandicapDep">4</EnumValue>
                <EnumValue name="SignifOther">5</EnumValue>
                <EnumValue name="InjuredPlaintiff">6</EnumValue>
                <EnumValue name="LifePartner">7</EnumValue>
                <EnumValue name="Dependent">8</EnumValue>
            </Enumeration>
        </column>
        <column order="32" name="WriteOff" type="double">
            <summary>Sum of ClaimProc.Writeoff for this claim.</summary>
        </column>
        <column order="33" name="Radiographs" type="tinyint">
            <summary>The number of x-rays enclosed.</summary>
        </column>
        <column order="34" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  0 if no clinic.  Since one claim cannot have procs from multiple clinics, the clinicNum is set when creating the claim and then cannot be changed.  The claim would have to be deleted and recreated.  Otherwise, if changing at the claim level, a feature would have to be added that synched all procs, claimprocs, and probably some other tables.</summary>
        </column>
        <column order="35" name="ClaimForm" type="bigint(20)" fk="claimform">
            <summary>FK to claimform.ClaimFormNum.  0 if not assigned to use the claimform for the insplan.</summary>
        </column>
        <column order="36" name="AttachedImages" type="int(11)">
            <summary>The number of intraoral images attached.  Not the number of files attached.  This is the value that goes on the 2006 claimform.</summary>
        </column>
        <column order="37" name="AttachedModels" type="int(11)">
            <summary>The number of models attached.</summary>
        </column>
        <column order="38" name="AttachedFlags" type="varchar(255)">
            <summary>A comma-delimited set of flag keywords.  Can have one or more of the following: EoB,Note,Perio,Misc.  Must also contain one of these: Mail or Elect.</summary>
        </column>
        <column order="39" name="AttachmentID" type="varchar(255)">
            <summary>Example: NEA#1234567.  If present, and if the claim note does not already start with this Id, then it will be prepended to the claim note for both e-claims and mail.  If using e-claims, this same ID will be used for all PWK segements.</summary>
        </column>
        <column order="40" name="CanadianMaterialsForwarded" type="varchar(10)">
            <summary>A08.  Any combination of E(email), C(correspondence), M(models), X(x-rays), and I(images).  So up to 5 char.  Gets converted to a single char A-Z for e-claims.</summary>
        </column>
        <column order="41" name="CanadianReferralProviderNum" type="varchar(20)">
            <summary>B05.  Optional. The 9-digit CDA number of the referring provider, or identifier of referring party up to 10 characters in length.</summary>
        </column>
        <column order="42" name="CanadianReferralReason" type="tinyint(4)">
            <summary>B06.  A number 0(none) through 13.</summary>
        </column>
        <column order="43" name="CanadianIsInitialLower" type="varchar(5)">
            <summary>F18.  Y, N, or X(not a lower denture, crown, or bridge).</summary>
        </column>
        <column order="44" name="CanadianDateInitialLower" type="date">
            <summary>F19.  Mandatory if F18 is N.</summary>
        </column>
        <column order="45" name="CanadianMandProsthMaterial" type="tinyint(4)">
            <summary>F21.  If crown, not required.  If denture or bridge, required if F18 is N.  Single digit number code, 0-6.  We added type 7, which is crown.</summary>
        </column>
        <column order="46" name="CanadianIsInitialUpper" type="varchar(5)">
            <summary>F15.  Y, N, or X(not an upper denture, crown, or bridge).</summary>
        </column>
        <column order="47" name="CanadianDateInitialUpper" type="date">
            <summary>F04.  Mandatory if F15 is N.</summary>
        </column>
        <column order="48" name="CanadianMaxProsthMaterial" type="tinyint(4)">
            <summary>F20.  If crown, not required.  If denture or bridge, required if F15 is N.  0 indicates empty response.  Single digit number code, 1-6.  We added type 7, which is crown.</summary>
        </column>
        <column order="49" name="InsSubNum" type="bigint(20)" fk="inssub">
            <summary>FK to inssub.InsSubNum.</summary>
        </column>
        <column order="50" name="InsSubNum2" type="bigint(20)" fk="inssub">
            <summary>FK to inssub.InsSubNum.</summary>
        </column>
        <column order="51" name="CanadaTransRefNum" type="varchar(255)">
            <summary>G01 assigned by carrier/network and returned in acks.  Used for claim reversal.</summary>
        </column>
        <column order="52" name="CanadaEstTreatStartDate" type="date">
            <summary>F37 Used for predeterminations.</summary>
        </column>
        <column order="53" name="CanadaInitialPayment" type="double">
            <summary>F28 Used for predeterminations.</summary>
        </column>
        <column order="54" name="CanadaPaymentMode" type="tinyint">
            <summary>F29 Used for predeterminations.</summary>
        </column>
        <column order="55" name="CanadaTreatDuration" type="tinyint">
            <summary>F30 Used for predeterminations.</summary>
        </column>
        <column order="56" name="CanadaNumAnticipatedPayments" type="tinyint">
            <summary>F31 Used for predeterminations.</summary>
        </column>
        <column order="57" name="CanadaAnticipatedPayAmount" type="double">
            <summary>F32 Used for predeterminations.</summary>
        </column>
        <column order="58" name="PriorAuthorizationNumber" type="varchar(255)">
            <summary>This is NOT the predetermination of benefits number.  In X12, this is REF G1.</summary>
        </column>
        <column order="59" name="SpecialProgramCode" type="tinyint(4)">
            <summary>Enum:EnumClaimSpecialProgram  This is used to track EPSDT.</summary>
            <Enumeration name="EnumClaimSpecialProgram">
                <summary>0=None, 1=EPSDT_1, 2=Handicapped_2, 3=SpecialFederal_3, (no 4), 5=Disability_5</summary>
            </Enumeration>
        </column>
        <column order="60" name="UniformBillType" type="varchar(255)">
            <summary>A three digit number used on 837I.  Aka Bill Code.</summary>
        </column>
        <column order="61" name="MedType" type="tinyint(4)">
            <summary>Enum:EnumClaimMedType 0=Dental, 1=Medical, 2=Institutional</summary>
        </column>
        <column order="62" name="AdmissionTypeCode" type="varchar(255)">
            <summary>Used for inst claims. Single digit.  X12 2300 CL101.  UB04 14.  Should only be required for IP, but X12 clearly states required for all.</summary>
        </column>
        <column order="63" name="AdmissionSourceCode" type="varchar(255)">
            <summary>Used for inst claims. Single char.  X12 2300 CL102.  UB04 15.  Should only be required for IP, but X12 clearly states required for all.</summary>
        </column>
        <column order="64" name="PatientStatusCode" type="varchar(255)">
            <summary>Used for inst claims. Two digit.  X12 2300 CL103.  UB04 17.  Should only be required for IP, but X12 clearly states required for all.</summary>
        </column>
    </table>
    <table name="claimattach">
        <summary>Keeps track of one image file attached to a claim.  Multiple files can be attached to a claim using this method.</summary>
        <column order="0" name="ClaimAttachNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ClaimNum" type="bigint(20)" fk="claim">
            <summary>FK to claim.ClaimNum</summary>
        </column>
        <column order="2" name="DisplayedFileName" type="varchar(255)">
            <summary>The name of the file that shows on the claim.  For example: tooth2.jpg.</summary>
        </column>
        <column order="3" name="ActualFileName" type="varchar(255)">
            <summary>The actual file is stored in the A-Z folder in EmailAttachments.  (yes, even though it's not actually an email attachment)  The files are named automatically based on Date/time along with a random number.  This ensures that they will be sequential as well as unique.</summary>
        </column>
    </table>
    <table name="claimcondcodelog">
        <summary></summary>
        <column order="0" name="ClaimCondCodeLogNum" type="bigint(20)">
            <summary></summary>
        </column>
        <column order="1" name="ClaimNum" type="bigint(20)">
            <summary></summary>
        </column>
        <column order="2" name="Code0" type="varchar(2)">
            <summary></summary>
        </column>
        <column order="3" name="Code1" type="varchar(2)">
            <summary></summary>
        </column>
        <column order="4" name="Code2" type="varchar(2)">
            <summary></summary>
        </column>
        <column order="5" name="Code3" type="varchar(2)">
            <summary></summary>
        </column>
        <column order="6" name="Code4" type="varchar(2)">
            <summary></summary>
        </column>
        <column order="7" name="Code5" type="varchar(2)">
            <summary></summary>
        </column>
        <column order="8" name="Code6" type="varchar(2)">
            <summary></summary>
        </column>
        <column order="9" name="Code7" type="varchar(2)">
            <summary></summary>
        </column>
        <column order="10" name="Code8" type="varchar(2)">
            <summary></summary>
        </column>
        <column order="11" name="Code9" type="varchar(2)">
            <summary></summary>
        </column>
        <column order="12" name="Code10" type="varchar(2)">
            <summary></summary>
        </column>
    </table>
    <table name="claimform">
        <summary>Stores the information for printing different types of claim forms.  Each claimform has many claimformitems attached to it, one for each field on the claimform.  This table has nothing to do with the actual claims.  It just describes how to print them.</summary>
        <column order="0" name="ClaimFormNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(50)">
            <summary>eg. ADA2002 or CA Medicaid</summary>
        </column>
        <column order="2" name="IsHidden" type="tinyint">
            <summary>If true, then it will not be displayed in various claim form lists as a choice.</summary>
        </column>
        <column order="3" name="FontName" type="varchar(255)">
            <summary>Valid font name for all text on the form.</summary>
        </column>
        <column order="4" name="FontSize" type="float">
            <summary>Font size for all text on the form.</summary>
        </column>
        <column order="5" name="UniqueID" type="varchar(255)">
            <summary>For instance OD12 or JoeDeveloper9.  If you are a developer releasing claimforms, then this should be your name or company followed by a unique number.  This will later make it easier for you to maintain your claimforms for your customers.  All claimforms that we release will be of the form OD##.  Forms that the user creates will have this field blank, protecting them from being changed by us.  So far, we have built the following claimforms: ADA2002=OD1, Denti-Cal=OD2, ADA2000=OD3, HCFA1500=OD4, HCFA1500preprinted=OD5, Canadian=OD6, Belgian=OD7, ADA2006=OD8, 1500=OD9</summary>
        </column>
        <column order="6" name="PrintImages" type="tinyint">
            <summary>Set to false to not print images.  This removes the background for printing on premade forms.</summary>
        </column>
        <column order="7" name="OffsetX" type="smallint(5)">
            <summary>Shifts all items by x/100th's of an inch to compensate for printer, typically less than 1/4 inch.</summary>
        </column>
        <column order="8" name="OffsetY" type="smallint(5)">
            <summary>Shifts all items by y/100th's of an inch to compensate for printer, typically less than 1/4 inch.</summary>
        </column>
    </table>
    <table name="claimformitem">
        <summary>One item is needed for each field on a claimform.</summary>
        <column order="0" name="ClaimFormItemNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ClaimFormNum" type="bigint(20)" fk="claimform">
            <summary>FK to claimform.ClaimFormNum</summary>
        </column>
        <column order="2" name="ImageFileName" type="varchar(255)">
            <summary>If this item is an image.  Usually only one per claimform.  eg ADA2002.emf.  Otherwise it MUST be left blank, or it will trigger an error that the image cannot be found.</summary>
        </column>
        <column order="3" name="FieldName" type="varchar(255)">
            <summary>Must be one of the hardcoded available fieldnames for claims.</summary>
        </column>
        <column order="4" name="FormatString" type="varchar(255)">
            <summary>For dates, the format string. ie MM/dd/yyyy or M d y among many other possibilities.</summary>
        </column>
        <column order="5" name="XPos" type="float">
            <summary>The x position of the item on the claim form.  In pixels. 100 pixels per inch.</summary>
        </column>
        <column order="6" name="YPos" type="float">
            <summary>The y position of the item.</summary>
        </column>
        <column order="7" name="Width" type="float">
            <summary>Limits the printable area of the item. Set to zero to not limit.</summary>
        </column>
        <column order="8" name="Height" type="float">
            <summary>Limits the printable area of the item. Set to zero to not limit.</summary>
        </column>
    </table>
    <table name="claimpayment">
        <summary>Each row represents a single check from the insurance company.  The amount may be split between patients using claimprocs.  The amount of the check must always exactly equal the sum of all the claimprocs attached to it.  There might be only one claimproc.</summary>
        <column order="0" name="ClaimPaymentNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="CheckDate" type="date">
            <summary>Date the check was entered into this system, not the date on the check.</summary>
        </column>
        <column order="2" name="CheckAmt" type="double">
            <summary>The amount of the check.</summary>
        </column>
        <column order="3" name="CheckNum" type="varchar(25)">
            <summary>The check number.</summary>
        </column>
        <column order="4" name="BankBranch" type="varchar(25)">
            <summary>Bank and branch.</summary>
        </column>
        <column order="5" name="Note" type="varchar(255)">
            <summary>Note for this check if needed.</summary>
        </column>
        <column order="6" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  0 if no clinic.</summary>
        </column>
        <column order="7" name="DepositNum" type="bigint(20)" fk="deposit">
            <summary>FK to deposit.DepositNum.  0 if not attached to any deposits.</summary>
        </column>
        <column order="8" name="CarrierName" type="varchar(255)">
            <summary>Descriptive name of the carrier just for reporting purposes.  We use this because the CarrierNums could conceivably be different for the different claimprocs attached.</summary>
        </column>
        <column order="9" name="DateIssued" type="date">
            <summary>Date that the carrier issued the check. Date on the check.</summary>
        </column>
        <column order="10" name="IsPartial" type="tinyint(4)">
            <summary></summary>
        </column>
    </table>
    <table name="claimproc">
        <summary>Links procedures to claims.  Also links ins payments to procedures or claims.  Also used for estimating procedures even if no claim yet.  Warning: One proc might be linked twice to a given claim if insurance made two payments.  Many of the important fields are actually optional.  For instance, ProcNum is only required if itemizing ins payment, and ClaimNum is blank if Status=adjustment,cap,or estimate.</summary>
        <column order="0" name="ClaimProcNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ProcNum" type="bigint(20)" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum.</summary>
        </column>
        <column order="2" name="ClaimNum" type="bigint(20)" fk="claim">
            <summary>FK to claim.ClaimNum.</summary>
        </column>
        <column order="3" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="4" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  At least one office has been manually setting their claimproc provider to a different provider when entering payments as a means to track provider income.  So we can't force this to always be the same as the procedure.  We also don't want to change any historical data, so only synched when setting appt complete or if an estimate.</summary>
        </column>
        <column order="5" name="FeeBilled" type="double">
            <summary>Fee billed to insurance. Might not be the same as the actual fee.  The fee billed can be different than the actual procedure.  For instance, if you have set the insurance plan to bill insurance using UCR fees, then this field will contain the UCR fee instead of the fee that the patient was charged.</summary>
        </column>
        <column order="6" name="InsPayEst" type="double">
            <summary>Only if attached to a claim.  Actual amount this carrier is expected to pay, after taking everything else into account. Considers annual max, override, percentAmt, copayAmt, deductible, etc. This estimate is computed automatically when sent to ins.</summary>
        </column>
        <column order="7" name="DedApplied" type="double">
            <summary>0 if blank.  Deductible applied to this procedure only. Only for procedures attached to claims.  Otherwise, the DedEst and DedEstOverride are used.</summary>
        </column>
        <column order="8" name="Status" type="tinyint">
            <summary>Enum:ClaimProcStatus .</summary>
            <Enumeration name="ClaimProcStatus">
                <summary>Claimproc Status.  The status must generally be the same as the claim, although it is sometimes not strictly enforced.</summary>
                <EnumValue name="NotReceived">0: For claims that have been created or sent, but have not been received.</EnumValue>
                <EnumValue name="Received">1: For claims that have been received.</EnumValue>
                <EnumValue name="Preauth">2: For preauthorizations.</EnumValue>
                <EnumValue name="Adjustment">3: The only place that this status is used is to make adjustments to benefits from the coverage window.  It is never attached to a claim.</EnumValue>
                <EnumValue name="Supplemental">4:This differs from Received only slightly.  It's for additional payments on procedures already received.  Most fields are blank.</EnumValue>
                <EnumValue name="CapClaim">5: CapClaim is used when you want to send a claim to a capitation insurance company.  These are similar to Supplemental in that there will always be a duplicate claimproc for a procedure. The first claimproc tracks the copay and writeoff, has a status of CapComplete, and is never attached to a claim. The second claimproc has status of CapClaim.</EnumValue>
                <EnumValue name="Estimate">6: Estimates have replaced the fields that were in the procedure table.  Once a procedure is complete, the claimprocstatus will still be Estimate.  An Estimate can be attached to a claim and status gets changed to NotReceived.</EnumValue>
                <EnumValue name="CapComplete">7: For capitation procedures that are complete.  This replaces the old procedurelog.CapCoPay field. This stores the copay and writeoff amounts.  The copay is only there for reference, while it is the writeoff that actually affects the balance. Never attached to a claim. If procedure is TP, then status will be CapEstimate.  Only set to CapComplete if procedure is Complete.</EnumValue>
                <EnumValue name="CapEstimate">8: For capitation procedures that are still estimates rather than complete.  When procedure is completed, this can be changed to CapComplete, but never to anything else.</EnumValue>
            </Enumeration>
        </column>
        <column order="9" name="InsPayAmt" type="double">
            <summary>Amount insurance actually paid.</summary>
        </column>
        <column order="10" name="Remarks" type="varchar(255)">
            <summary>The remarks that insurance sends in the EOB about procedures.</summary>
        </column>
        <column order="11" name="ClaimPaymentNum" type="bigint(20)" fk="claimpayment">
            <summary>FK to claimpayment.ClaimPaymentNum(the insurance check).</summary>
        </column>
        <column order="12" name="PlanNum" type="bigint(20)" fk="insplan">
            <summary>FK to insplan.PlanNum</summary>
        </column>
        <column order="13" name="DateCP" type="date">
            <summary>This is the date that is used for payment reports and tracks the payment date.  Always exactly matches the date of the ClaimPayment it's attached to.  See the note under Ledgers.ComputePayments.  This will eventually not be used for aging. The ProcDate will instead be used. See ProcDate.</summary>
        </column>
        <column order="14" name="WriteOff" type="double">
            <summary>Amount not covered by ins which is written off.  The writeoff estimate goes in a different column.</summary>
        </column>
        <column order="15" name="CodeSent" type="varchar(15)">
            <summary>The procedure code that was sent to insurance. This is not necessarily the usual procedure code.  It will already have been trimmed to 5 char if it started with "D", or it could be the alternate code.  Not allowed to be blank if it is procedure.</summary>
        </column>
        <column order="16" name="AllowedOverride" type="double">
            <summary>The allowed fee (not the override) is a complex calculation which is performed on the fly in Procedure.ComputeEstimates/ClaimProc.ComputeBaseEst.  It is the amount that the percentage is based on.  If this carrier has a lower UCR than the office, then the allowed fee is where that is handled.  It can be pulled from an allowed fee schedule.  It is also where substitutions for posterior composites are handled.  The AllowedOverride allows the user to override the calculation.  -1 indicates blank.  A new use of this field is for when entering insurance payments.  On the eob, it will tell you what the allowed/UCR fee is.  The user will now be able to enter this information into the AllowedOverride field.  They will simultaneously pass the info to the allowed fee schedule.  AllowedOverride is never changed automatically by the program except to sometimes set it to -1 if NoBillIns.</summary>
        </column>
        <column order="17" name="Percentage" type="tinyint(4)">
            <summary>-1 if blank.  Otherwise a number between 0 and 100.  The percentage that insurance pays on this procedure, as determined from insurance categories. Not user editable.</summary>
        </column>
        <column order="18" name="PercentOverride" type="tinyint(4)">
            <summary>-1 if blank.  Otherwise a number between 0 and 100.  Can only be changed by user.</summary>
        </column>
        <column order="19" name="CopayAmt" type="double">
            <summary>-1 if blank. Calculated automatically. User cannot edit but can use CopayOverride instead.  Opposite of InsEst, because this is the patient portion estimate.  Two different uses: 1. For capitation, this automates calculation of writeoff. 2. For any other insurance, it gets deducted during calculation as shown in the edit window. Neither use directly affects patient balance.</summary>
        </column>
        <column order="20" name="NoBillIns" type="tinyint">
            <summary>Set to true to not bill to this insurance plan.</summary>
        </column>
        <column order="21" name="PaidOtherIns" type="double">
            <summary>-1 if blank. The amount paid or estimated to be paid by another insurance.  This amount is then subtracted from what the current insurance would pay.  When running the calculation and considering other claimprocs, it will ignore any patPlan with a higher ordinal.  So, always blank for primary claims.  User cannot edit, but can use PaidOtherInsOverride.</summary>
        </column>
        <column order="22" name="BaseEst" type="double">
            <summary>Always has a value. Used in TP, etc. The base estimate is the ((fee or allowedOverride)-Copay) x (percentage or percentOverride). Does not include all the extras like ded, annualMax,and paidOtherIns that InsEstTotal holds.  BaseEst cannot be overridden by the user.  Instead, the following fields can be manipulated: allowedOverride, CopayOverride, PercentOverride.</summary>
        </column>
        <column order="23" name="CopayOverride" type="double">
            <summary>-1 if blank.  See description of CopayAmt.  This lets the user set a copay that will never be overwritten by automatic calculations.</summary>
        </column>
        <column order="24" name="ProcDate" type="date">
            <summary>Date of the procedure.  Currently only used for tracking annual insurance benefits remaining. Important in Adjustments to benefits.  For total claim payments, MUST be the date of the procedures to correctly figure benefits.  Will eventually transition to use this field to actually calculate aging.  See the note under Ledgers.ComputePayments.</summary>
        </column>
        <column order="25" name="DateEntry" type="date">
            <summary>Date that it was changed to status received or supplemental.  It is usually attached to a claimPayment at that point, but not if user forgets.  This is still the date that it becomes important financial data.  Only applies if Received or Supplemental.  Otherwise, the date is disregarded.  User may never edit. Important in audit trail.</summary>
        </column>
        <column order="26" name="LineNumber" type="tinyint">
            <summary>Assigned when claim is created as a way to order the procs showing on a claim.  Really only used in Canadian claims for now as F07.</summary>
        </column>
        <column order="27" name="DedEst" type="double">
            <summary>-1 if blank.  Not sure why we need to allow -1.  Calculated automatically.  User cannot edit, but can use DedEstOverride instead.</summary>
        </column>
        <column order="28" name="DedEstOverride" type="double">
            <summary>-1 if blank.  Overrides the DedEst value.</summary>
        </column>
        <column order="29" name="InsEstTotal" type="double">
            <summary>Always has a value.  BaseEst-(DedEst or DedEstOverride)-PaidOtherIns-OverAnnualMax.  User cannot edit, but can instead use InsEstTotalOverride.</summary>
        </column>
        <column order="30" name="InsEstTotalOverride" type="double">
            <summary>-1 if blank.  Overrides the InsEstTotal value.</summary>
        </column>
        <column order="31" name="PaidOtherInsOverride" type="double">
            <summary>-1 if blank.  Overrides the PaidOtherIns value.</summary>
        </column>
        <column order="32" name="EstimateNote" type="varchar(255)">
            <summary>An automatically generated note that displays information about over max, exclusions, and other limitations for which there are no fields.  Only applies to estimate.  Once it's attached to a claim, similar information can go in the remarks field.</summary>
        </column>
        <column order="33" name="WriteOffEst" type="double">
            <summary>-1 if blank.  The estimated writeoff as calculated by OD.  Usually only used for PPOs. </summary>
        </column>
        <column order="34" name="WriteOffEstOverride" type="double">
            <summary>-1 if blank.  Overrides WriteOffEst.  Usually only used for PPOs.</summary>
        </column>
        <column order="35" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  Can be zero.  No user interface for editing.  Forced to always be the same as the procedure, or if no procedure, then the claim.</summary>
        </column>
        <column order="36" name="InsSubNum" type="bigint(20)" fk="inssub">
            <summary>FK to inssub.InsSubNum.</summary>
        </column>
        <column order="37" name="PaymentRow" type="int(11)">
            <summary>1-indexed.  Allows user to sort the order of payments on an EOB.  All claimprocs for a payment will have the same PaymentRow value.</summary>
        </column>
    </table>
    <table name="claimvalcodelog">
        <summary>Value codes for institutional 'claims'.  Can have up to 12 per claim.</summary>
        <column order="0" name="ClaimValCodeLogNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ClaimNum" type="bigint(20)" fk="claim">
            <summary>FK to claim.ClaimNum.</summary>
        </column>
        <column order="2" name="ClaimField" type="varchar(5)">
            <summary>Descriptive abbreviation to help place field on form (Ex: "FL55" for field 55).</summary>
        </column>
        <column order="3" name="ValCode" type="char(2)">
            <summary>Value Code. 2 char.</summary>
        </column>
        <column order="4" name="ValAmount" type="double">
            <summary>Value Code Amount.</summary>
        </column>
        <column order="5" name="Ordinal" type="int(10)">
            <summary>Order of Value Code</summary>
        </column>
    </table>
    <table name="clearinghouse">
        <summary>Since we can send e-claims to multiple clearinghouses, this table keeps track of each clearinghouse.  Will eventually be used for individual carriers as well if they accept </summary>
        <column order="0" name="ClearinghouseNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of this clearinghouse</summary>
        </column>
        <column order="2" name="ExportPath" type="text">
            <summary>The path to export the X12 file to. \ is now optional.</summary>
        </column>
        <column order="3" name="Payors" type="text">
            <summary>A list of all payors which should have claims sent to this clearinghouse. Comma delimited with no spaces.  Not necessary if IsDefault.</summary>
        </column>
        <column order="4" name="Eformat" type="tinyint">
            <summary>Enum:ElectronicClaimFormat The format of the file that gets sent electronically.</summary>
            <Enumeration name="ElectronicClaimFormat">
                <summary>For every type of electronic claim format that Open Dental can create, there will be an item in this enumeration.  All e-claim formats are hard coded due to complexity.</summary>
                <EnumValue name="None">0-Not in database, but used in various places in program.</EnumValue>
                <EnumValue name="x837D_4010">1-The American standard through 12/31/11.</EnumValue>
                <EnumValue name="Renaissance">2-Proprietary format for Renaissance.</EnumValue>
                <EnumValue name="Canadian">3-CDAnet format version 4.</EnumValue>
                <EnumValue name="Dutch">4-CSV file adaptable for use in Netherlands.</EnumValue>
                <EnumValue name="x837D_5010_dental">5-The American standard starting on 1/1/12.</EnumValue>
                <EnumValue name="x837_5010_med_inst">6-Either professional or medical.  The distiction is stored at the claim level.</EnumValue>
            </Enumeration>
        </column>
        <column order="5" name="ISA05" type="varchar(255)">
            <summary>Sender ID Qualifier. Usually ZZ, sometimes 30. Seven other values are allowed as specified in X12 document, but probably never used.</summary>
        </column>
        <column order="6" name="SenderTIN" type="varchar(255)">
            <summary>Used in ISA06, GS02, 1000A NM1, and 1000A PER.  If blank, then 810624427 is used to indicate Open Dental.</summary>
        </column>
        <column order="7" name="ISA07" type="varchar(255)">
            <summary>Receiver ID Qualifier.  Usually ZZ, sometimes 30. Seven other values are allowed as specified in X12 document, but probably never used.</summary>
        </column>
        <column order="8" name="ISA08" type="varchar(255)">
            <summary>Receiver ID. Also used in GS03. Provided by clearinghouse. Examples: BCBSGA or 0135WCH00(webMD)</summary>
        </column>
        <column order="9" name="ISA15" type="varchar(255)">
            <summary>"P" for Production or "T" for Test.</summary>
        </column>
        <column order="10" name="Password" type="varchar(255)">
            <summary>Password is usually combined with the login ID for user validation.</summary>
        </column>
        <column order="11" name="ResponsePath" type="varchar(255)">
            <summary>The path that all incoming response files will be saved to. \ is now optional.</summary>
        </column>
        <column order="12" name="CommBridge" type="tinyint">
            <summary>Enum:EclaimsCommBridge  One of the included hard-coded communications briges.  Or none to just create the claim files without uploading.</summary>
            <Enumeration name="EclaimsCommBridge">
                <summary>Each clearinghouse can have a hard-coded comm bridge which handles all the communications of transfering the claim files to the clearinghouse/carrier.  Does not just include X12, but can include any format at all.</summary>
                <EnumValue name="None">0-No comm bridge will be activated. The claim files will be created to the specified path, but they will not be uploaded.</EnumValue>
                <EnumValue name="WebMD">1</EnumValue>
                <EnumValue name="BCBSGA">2</EnumValue>
                <EnumValue name="Renaissance">3</EnumValue>
                <EnumValue name="ClaimConnect">4</EnumValue>
                <EnumValue name="RECS">5</EnumValue>
                <EnumValue name="Inmediata">6</EnumValue>
                <EnumValue name="AOS">7</EnumValue>
                <EnumValue name="PostnTrack">8</EnumValue>
                <EnumValue name="CDAnet">9 Canada</EnumValue>
                <EnumValue name="Tesia">10</EnumValue>
                <EnumValue name="MercuryDE">11</EnumValue>
                <EnumValue name="ClaimX">12</EnumValue>
            </Enumeration>
        </column>
        <column order="13" name="ClientProgram" type="varchar(255)">
            <summary>If applicable, this is the name of the client program to launch.  It is even used by the hard-coded comm bridges, because the user may have changed the installation directory or exe name.</summary>
        </column>
        <column order="14" name="LastBatchNumber" type="smallint">
            <summary>Each clearinghouse increments their batch numbers by one each time a claim file is sent.  User never sees this number.  Maxes out at 999, then loops back to 1.  This field must NOT be cached and must be ignored in the code except where it explicitly retrieves it from the db.  Defaults to 0 for brand new clearinghouses, which causes the first batch to go out as #1.</summary>
        </column>
        <column order="15" name="ModemPort" type="tinyint">
            <summary>Was not used.  1,2,3,or 4. The port that the modem is connected to if applicable. Always uses 9600 baud and standard settings. Will crash if port or modem not valid.</summary>
        </column>
        <column order="16" name="LoginID" type="varchar(255)">
            <summary>A clearinghouse usually has a login ID that is used with the password in order to access the remote server.  This value is not usualy used within the actual claim.</summary>
        </column>
        <column order="17" name="SenderName" type="varchar(255)">
            <summary>Used in 1000A NM1 and 1000A PER.  But if SenderTIN is blank, then OPEN DENTAL SOFTWARE is used instead.</summary>
        </column>
        <column order="18" name="SenderTelephone" type="varchar(255)">
            <summary>Used in 1000A PER.  But if SenderTIN is blank, then 8776861248 is used instead.  10 digit phone is required by WebMD and is universally assumed, so for now, this must be either blank or 10 digits.</summary>
        </column>
        <column order="19" name="GS03" type="varchar(255)">
            <summary>Usually the same as ISA08, but at least one clearinghouse uses a different number here.</summary>
        </column>
    </table>
    <table name="clinic">
        <summary>A clinic is usually a separate physical office location.  If multiple clinics are sharing one database, then this is used.  Patients, Operatories, Claims, and many other types of objects can be assigned to a clinic.</summary>
        <column order="0" name="ClinicNum" type="bigint(20)">
            <summary>Primary key.  Used in patient,payment,claimpayment,appointment,procedurelog, etc.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="Address" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="3" name="Address2" type="varchar(255)">
            <summary>Second line of address.</summary>
        </column>
        <column order="4" name="City" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="5" name="State" type="varchar(255)">
            <summary>2 char in the US.</summary>
        </column>
        <column order="6" name="Zip" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="7" name="Phone" type="varchar(255)">
            <summary>Does not include any punctuation.  Should be exactly 10 digits</summary>
        </column>
        <column order="8" name="BankNumber" type="varchar(255)">
            <summary>The account number for deposits.</summary>
        </column>
        <column order="9" name="DefaultPlaceService" type="tinyint">
            <summary>Enum:PlaceOfService Usually 0 unless a mobile clinic for instance.</summary>
            <Enumeration name="PlaceOfService">
                <summary />
                <EnumValue name="Office">0. CPT code 11</EnumValue>
                <EnumValue name="PatientsHome">1. CPT code 12</EnumValue>
                <EnumValue name="InpatHospital">2. CPT code 21</EnumValue>
                <EnumValue name="OutpatHospital">3. CPT code 22</EnumValue>
                <EnumValue name="SkilledNursFac">4. CPT code 31</EnumValue>
                <EnumValue name="CustodialCareFacility">5. CPT code 33.  In X12, a similar code AdultLivCareFac 35 is mentioned.</EnumValue>
                <EnumValue name="OtherLocation">6. CPT code ?.  We use 11 for office.</EnumValue>
                <EnumValue name="MobileUnit">7. CPT code 15</EnumValue>
                <EnumValue name="School">8. CPT code 03</EnumValue>
                <EnumValue name="MilitaryTreatFac">9. CPT code 26</EnumValue>
                <EnumValue name="FederalHealthCenter">10. CPT code 50</EnumValue>
                <EnumValue name="PublicHealthClinic">11. CPT code 71</EnumValue>
                <EnumValue name="RuralHealthClinic">12. CPT code 72</EnumValue>
                <EnumValue name="EmergencyRoomHospital">13. CPT code 23</EnumValue>
                <EnumValue name="AmbulatorySurgicalCenter">14. CPT code 24</EnumValue>
            </Enumeration>
        </column>
        <column order="10" name="InsBillingProv" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  0=Default practice provider, -1=Treating provider.</summary>
        </column>
    </table>
    <table name="clockevent">
        <summary>One clock-in / clock-out pair.  Of, if the pair is a break, then it's an out/in pair.  With normal clock in/out pairs, we want to know how long the employee was working.  It's the opposite with breaks.  We want to know how long they were not working, so the pair is backwards.  This means that a normal clock in is left incomplete when the clock out for break is created.  And once both are finished, the regular in/out will surround the break.  Breaks cannot be viewed easily on the same grid as regular clock events for this reason.  And since breaks do not affect pay, they should not clutter the normal grid.</summary>
        <column order="0" name="ClockEventNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="EmployeeNum" type="bigint(20)" fk="employee">
            <summary>FK to employee.EmployeeNum</summary>
        </column>
        <column order="2" name="TimeEntered1" type="datetime">
            <summary>The actual time that this entry was entered.  Cannot be 01-01-0001.</summary>
        </column>
        <column order="3" name="TimeDisplayed1" type="datetime">
            <summary>The time to display and to use in all calculations.  Cannot be 01-01-0001.</summary>
        </column>
        <column order="4" name="ClockStatus" type="tinyint">
            <summary>Enum:TimeClockStatus  Home, Lunch, or Break.  The status really only applies to the clock out.  Except the Break status applies to both out and in.</summary>
            <Enumeration name="TimeClockStatus">
                <summary />
                <EnumValue name="Home">0</EnumValue>
                <EnumValue name="Lunch">1</EnumValue>
                <EnumValue name="Break">2</EnumValue>
            </Enumeration>
        </column>
        <column order="5" name="Note" type="text">
            <summary>.</summary>
        </column>
        <column order="6" name="TimeEntered2" type="datetime">
            <summary>The user can never edit this, but the program has to be able to edit this when user clocks out.  Can be 01-01-0001 if not clocked out yet.</summary>
        </column>
        <column order="7" name="TimeDisplayed2" type="datetime">
            <summary>User can edit. Can be 01-01-0001 if not clocked out yet.</summary>
        </column>
        <column order="8" name="OTimeHours" type="time">
            <summary>This is a manual override for OTimeAuto.  Typically -1 hour (-01:00:00) to indicate no override.  When used as override, allowed values are zero or positive.  This is an alternative to using a TimeAdjust row.</summary>
        </column>
        <column order="9" name="OTimeAuto" type="time">
            <summary>Automatically calculated OT.  Will be zero if none.</summary>
        </column>
        <column order="10" name="Adjust" type="time">
            <summary>This is a manual override of AdjustAuto.  Ignored unless AdjustIsOverridden set to true.  When used as override, it's typically negative, although zero and positive are also allowed.</summary>
        </column>
        <column order="11" name="AdjustAuto" type="time">
            <summary>Automatically calculated Adjust.  Will be zero if none.</summary>
        </column>
        <column order="12" name="AdjustIsOverridden" type="tinyint(4)">
            <summary>True if AdjustAuto is overridden by Adjust.</summary>
        </column>
    </table>
    <table name="commlog">
        <summary>Tracks all forms of communications with patients, including emails, phonecalls, postcards, etc.</summary>
        <column order="0" name="CommlogNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="CommDateTime" type="datetime">
            <summary>Date and time of entry</summary>
        </column>
        <column order="3" name="CommType" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum. This will be 0 if IsStatementSent.  Used to be an enumeration in previous versions.</summary>
        </column>
        <column order="4" name="Note" type="text">
            <summary>Note for this commlog entry.</summary>
        </column>
        <column order="5" name="Mode_" type="tinyint">
            <summary>Enum:CommItemMode Phone, email, etc.</summary>
            <Enumeration name="CommItemMode">
                <summary />
                <EnumValue name="None">0- </EnumValue>
                <EnumValue name="Email">1- </EnumValue>
                <EnumValue name="Mail">2</EnumValue>
                <EnumValue name="Phone">3</EnumValue>
                <EnumValue name="InPerson">4</EnumValue>
                <EnumValue name="AutoItem">5</EnumValue>
            </Enumeration>
        </column>
        <column order="6" name="SentOrReceived" type="tinyint">
            <summary>Enum:CommSentOrReceived Neither=0,Sent=1,Received=2.</summary>
            <Enumeration name="CommSentOrReceived">
                <summary>0=neither, 1=sent, 2=received.</summary>
                <EnumValue name="Neither">0</EnumValue>
                <EnumValue name="Sent">1</EnumValue>
                <EnumValue name="Received">2</EnumValue>
            </Enumeration>
        </column>
        <column order="7" name="IsStatementSent" type="tinyint(1)">
            <summary></summary>
        </column>
        <column order="8" name="UserNum" type="bigint(20)" fk="userod">
            <summary>FK to userod.UserNum.</summary>
        </column>
        <column order="9" name="Signature" type="text">
            <summary>Signature.  For details, see procedurelog.Signature.</summary>
        </column>
        <column order="10" name="SigIsTopaz" type="tinyint(4)">
            <summary>True if signed using the Topaz signature pad, false otherwise.</summary>
        </column>
        <column order="11" name="DateTStamp" type="timestamp">
            <summary>Automatically updated by MySQL every time a row is added or changed.</summary>
        </column>
    </table>
    <table name="computer">
        <summary>Keeps track of the computers in an office.  The list will eventually become cluttered with the names of old computers that are no longer in service.  The old rows can be safely deleted.  Although the primary key is used in at least one table, this will probably be changed, and the computername will become the primary key.</summary>
        <column order="0" name="ComputerNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="CompName" type="varchar(100)">
            <summary>Name of the computer.</summary>
        </column>
        <column order="2" name="LastHeartBeat" type="datetime">
            <summary>Allows use to tell which computers are running.  All workstations record a heartbeat here at an interval of 3 minutes.  And when they shut down, they set this value to min.  So if the heartbeat is fairly fresh, then that's an accurate indicator of whether Open Dental is running on that computer.</summary>
        </column>
    </table>
    <table name="computerpref">
        <summary>Enables preference specification for individual computers on a customer network.</summary>
        <column order="0" name="ComputerPrefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ComputerName" type="varchar(64)">
            <summary>The human-readable name of the computer on the network (not the IP address).</summary>
        </column>
        <column order="2" name="GraphicsUseHardware" type="tinyint(1)">
            <summary>Set to true if the tooth chart is to use a hardware accelerated OpenGL window when available. Set to false to use software rendering when available. Of course, the final pixel format on the customer machine depends on the list of available formats. Best match pixel format is always used. This option only applies if GraphicsSimple is set to false.</summary>
        </column>
        <column order="3" name="GraphicsSimple" type="tinyint(1)">
            <summary>Enum:DrawingMode Set to 1 to use the low-quality 2D tooth chart in the chart module. Set to 0 to use a 3D DirectX based tooth chart in the chart module. This option helps the program run even when the local graphics hardware is buggy or unavailable.</summary>
        </column>
        <column order="4" name="SensorType" type="varchar(255)">
            <summary>Indicates the type of Suni sensor connected to the local computer (if any). This can be a value of A, B, C, or D.</summary>
        </column>
        <column order="5" name="SensorBinned" type="tinyint(4)">
            <summary>Indicates wether or not the Suni sensor uses binned operation.</summary>
        </column>
        <column order="6" name="SensorPort" type="int(11)">
            <summary>Indicates which Suni box port to connect with. There are 2 ports on a box (ports 0 and 1).</summary>
        </column>
        <column order="7" name="SensorExposure" type="int(11)">
            <summary>Indicates the exposure level to use when capturing from a Suni sensor. Values can be 1 through 7.</summary>
        </column>
        <column order="8" name="GraphicsDoubleBuffering" type="tinyint(4)">
            <summary>Indicates if the user prefers double-buffered 3D tooth-chart (where applicable).</summary>
        </column>
        <column order="9" name="PreferredPixelFormatNum" type="int(11)">
            <summary>Indicates the current pixel format by number which the user prefers.</summary>
        </column>
        <column order="10" name="AtoZpath" type="varchar(255)">
            <summary>The path of the A-Z folder for the specified computer.  Overrides the officewide default.  Used when multiple locations are on a single virtual database and they each want to look to the local data folder for images.</summary>
        </column>
        <column order="11" name="TaskKeepListHidden" type="tinyint(1)">
            <summary>If the global setting for showing the Task List is on, this controls if it should be hidden on this specified computer</summary>
        </column>
        <column order="12" name="TaskDock" type="int(11)">
            <summary>Dock task bar on bottom (0) or right (1).</summary>
        </column>
        <column order="13" name="TaskX" type="int(11)">
            <summary>X pos for right docked task list.</summary>
        </column>
        <column order="14" name="TaskY" type="int(11)">
            <summary>Y pos for bottom docked task list.</summary>
        </column>
        <column order="15" name="DirectXFormat" type="varchar(255)">
            <summary>Holds a semi-colon separated list of enumeration names and values representing a DirectX format. If blank, then
            no format is currently set and the best theoretical foramt will be chosen at program startup. If this value is set to
            'opengl' then this computer is using OpenGL and a DirectX format will not be picked.</summary>
        </column>
        <column order="16" name="RecentApptView" type="tinyint(4)">
            <summary>The index of the most recent appt view for this computer.  Uses it when opening.</summary>
        </column>
    </table>
    <table name="contact">
        <summary>Like a rolodex for businesses that the office interacts with.  Used to store pharmacies, etc.</summary>
        <column order="0" name="ContactNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LName" type="varchar(255)">
            <summary>Last name or, frequently, the entire name.</summary>
        </column>
        <column order="2" name="FName" type="varchar(255)">
            <summary>First name is optional.</summary>
        </column>
        <column order="3" name="WkPhone" type="varchar(255)">
            <summary>Work phone.</summary>
        </column>
        <column order="4" name="Fax" type="varchar(255)">
            <summary>Fax number.</summary>
        </column>
        <column order="5" name="Category" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum</summary>
        </column>
        <column order="6" name="Notes" type="text">
            <summary>Note for this contact.</summary>
        </column>
    </table>
    <table name="county">
        <summary>Used in public health.</summary>
        <column order="0" name="CountyNum" type="bigint(20)">
            <summary>Primary Key.</summary>
        </column>
        <column order="1" name="CountyName" type="varchar(255)">
            <summary>Frequently used as the primary key of this table.  But it's allowed to change.  Change is programmatically synchronized.</summary>
        </column>
        <column order="2" name="CountyCode" type="varchar(255)">
            <summary>Optional. Usage varies.</summary>
        </column>
    </table>
    <table name="covcat">
        <summary>Insurance coverage categories.  They need to look like in the manual for the American calculations to work properly.</summary>
        <column order="0" name="CovCatNum" type="bigint(20)">
            <summary>Primary key.  Only used in Benefit and CovSpan tables.</summary>
        </column>
        <column order="1" name="Description" type="varchar(50)">
            <summary>Description of this category.</summary>
        </column>
        <column order="2" name="DefaultPercent" type="smallint(6)">
            <summary>Default percent for this category. -1 to skip this category and not apply a percentage.</summary>
        </column>
        <column order="3" name="CovOrder" type="tinyint">
            <summary>The order in which the categories are displayed.  Includes hidden categories. 0-based.</summary>
        </column>
        <column order="4" name="IsHidden" type="tinyint">
            <summary>If true, this category will be hidden.</summary>
        </column>
        <column order="5" name="EbenefitCat" type="tinyint">
            <summary>Enum:EbenefitCategory  The X12 benefit categories.  Each CovCat can link to one X12 category.  Default is 0 (unlinked).</summary>
            <Enumeration name="EbenefitCategory">
                <summary>The X12 benefit categories.  Used to link the user-defined CovCats to the corresponding X12 category.</summary>
                <EnumValue name="None">0- Default.  Applies to all codes.</EnumValue>
                <EnumValue name="General">1- X12: 30 and 35. All ADA codes except ortho.  D0000-D7999 and D9000-D9999</EnumValue>
                <EnumValue name="Diagnostic">2- X12: 23. ADA D0000-D0999.  This includes DiagnosticXray.</EnumValue>
                <EnumValue name="Periodontics">3- X12: 24. ADA D4000</EnumValue>
                <EnumValue name="Restorative">4- X12: 25. ADA D2000-D2699, and D2800-D2999.</EnumValue>
                <EnumValue name="Endodontics">5- X12: 26. ADA D3000</EnumValue>
                <EnumValue name="MaxillofacialProsth">6- X12: 27. ADA D5900-D5999</EnumValue>
                <EnumValue name="Crowns">7- X12: 36. Exclusive subcategory of restorative.  D2700-D2799</EnumValue>
                <EnumValue name="Accident">8- X12: 37. ADA range?</EnumValue>
                <EnumValue name="Orthodontics">9- X12: 38. ADA D8000-D8999</EnumValue>
                <EnumValue name="Prosthodontics">10- X12: 39. ADA D5000-D5899 (removable), and D6200-D6899 (fixed)</EnumValue>
                <EnumValue name="OralSurgery">11- X12: 40. ADA D7000</EnumValue>
                <EnumValue name="RoutinePreventive">12- X12: 41. ADA D1000</EnumValue>
                <EnumValue name="DiagnosticXRay">13- X12: 4. ADA D0200-D0399.  So this is like an optional category which is otherwise considered to be diagnosic.</EnumValue>
                <EnumValue name="Adjunctive">14- X12: 28. ADA D9000-D9999</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="covspan">
        <summary>Always attached to covcats, this describes the span of procedure codes to which the category applies.</summary>
        <column order="0" name="CovSpanNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="CovCatNum" type="bigint(20)" fk="covcat">
            <summary>FK to covcat.CovCatNum.</summary>
        </column>
        <column order="2" name="FromCode" type="varchar(15)">
            <summary>Lower range of the span.  Does not need to be a valid code.</summary>
        </column>
        <column order="3" name="ToCode" type="varchar(15)">
            <summary>Upper range of the span.  Does not need to be a valid code.</summary>
        </column>
    </table>
    <table name="creditcard">
        <summary>One credit card along with any recurring charge information.</summary>
        <column order="0" name="CreditCardNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="Address" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="3" name="Zip" type="varchar(255)">
            <summary>Postal code.</summary>
        </column>
        <column order="4" name="XChargeToken" type="varchar(255)">
            <summary>Token for X-Charge. Alphanumeric, upper and lower case, about 15 char long.  Passed into Xcharge instead of the actual card number.</summary>
        </column>
        <column order="5" name="CCNumberMasked" type="varchar(255)">
            <summary>Credit Card Number.  Will be stored masked: XXXXXXXXXXXX1234.</summary>
        </column>
        <column order="6" name="CCExpiration" type="date">
            <summary>Only month and year are used, the day will usually be 1.</summary>
        </column>
        <column order="7" name="ItemOrder" type="int(11)">
            <summary>The order that multiple cards will show.  Zero-based.  First one will be default.</summary>
        </column>
        <column order="8" name="ChargeAmt" type="double">
            <summary>Amount set for recurring charges.</summary>
        </column>
        <column order="9" name="DateStart" type="date">
            <summary>Start date for recurring charges.</summary>
        </column>
        <column order="10" name="DateStop" type="date">
            <summary>Stop date for recurring charges.</summary>
        </column>
        <column order="11" name="Note" type="varchar(255)">
            <summary></summary>
        </column>
    </table>
    <table name="dashboardar">
        <summary>A table just used by the dashboard to store historical AR because it never changes and it takes too long (1 second for each of the 12 dates) to compute on the fly.  One entry per month going back at least 12 months.  This table gets automatically filled the first time that the dashboard is used.  The most recent month also gets added by using the dashboard.</summary>
        <column order="0" name="DashboardARNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="DateCalc" type="date">
            <summary>This date will always be the last day of a month.</summary>
        </column>
        <column order="2" name="BalTotal" type="double">
            <summary>Bal_0_30+Bal_31_60+Bal_61_90+BalOver90 for all patients.  This should also exactly equal BalTotal for all patients with positive amounts.  Negative BalTotals are credits, not A/R.</summary>
        </column>
        <column order="3" name="InsEst" type="double">
            <summary>Sum of all InsEst for all patients for the month.</summary>
        </column>
    </table>
    <table name="definition">
        <summary>The info in the definition table is used by other tables extensively.  Almost every table in the database links to definition.  Almost all links to this table will be to a DefNum.  Using the DefNum, you can find any of the other fields of interest, usually the ItemName.  Make sure to look at the Defs class to see how the definitions are used.  Loaded into memory ahead of time for speed.  Some types of info such as operatories started out life in this table, but then got moved to their own table when more complexity was needed.</summary>
        <column order="0" name="DefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Category" type="tinyint">
            <summary>Enum:DefCat</summary>
            <Enumeration name="DefCat">
                <summary>Definition Category. Go to the definition setup window in the program to see how each of these categories is used.</summary>
                <EnumValue name="AccountColors">0- Colors to display in Account module.</EnumValue>
                <EnumValue name="AdjTypes">1- Adjustment types.</EnumValue>
                <EnumValue name="ApptConfirmed">2- Appointment confirmed types.</EnumValue>
                <EnumValue name="ApptProcsQuickAdd">3- Procedure quick add list for appointments.</EnumValue>
                <EnumValue name="BillingTypes">4- Billing types.</EnumValue>
                <EnumValue name="ClaimFormats">5- Not used.</EnumValue>
                <EnumValue name="DunningMessages">6- Not used.</EnumValue>
                <EnumValue name="FeeSchedNamesOld">7- Not used.</EnumValue>
                <EnumValue name="MedicalNotes">8- Medical notes for quick paste.</EnumValue>
                <EnumValue name="OperatoriesOld">9- No longer used</EnumValue>
                <EnumValue name="PaymentTypes">10- Payment types.</EnumValue>
                <EnumValue name="ProcCodeCats">11- Procedure code categories.</EnumValue>
                <EnumValue name="ProgNoteColors">12- Progress note colors.</EnumValue>
                <EnumValue name="RecallUnschedStatus">13- Statuses for recall, unscheduled, and next appointments.</EnumValue>
                <EnumValue name="ServiceNotes">14- Service notes for quick paste.</EnumValue>
                <EnumValue name="DiscountTypes">15- Discount types.</EnumValue>
                <EnumValue name="Diagnosis">16- Diagnosis types.</EnumValue>
                <EnumValue name="AppointmentColors">17- Colors to display in the Appointments module.</EnumValue>
                <EnumValue name="ImageCats">18- Image categories.</EnumValue>
                <EnumValue name="ApptPhoneNotes">19- Quick add notes for the ApptPhoneNotes, which is getting phased out.</EnumValue>
                <EnumValue name="TxPriorities">20- Treatment plan priority names.</EnumValue>
                <EnumValue name="MiscColors">21- Miscellaneous color options.</EnumValue>
                <EnumValue name="ChartGraphicColors">22- Colors for the graphical tooth chart.</EnumValue>
                <EnumValue name="ContactCategories">23- Categories for the Contact list.</EnumValue>
                <EnumValue name="LetterMergeCats">24- Categories for Letter Merge.</EnumValue>
                <EnumValue name="BlockoutTypes">25- Types of Schedule Blockouts.</EnumValue>
                <EnumValue name="ProcButtonCats">26- Categories of procedure buttons in Chart module</EnumValue>
                <EnumValue name="CommLogTypes">27- Types of commlog entries.</EnumValue>
                <EnumValue name="SupplyCats">28- Categories of Supplies</EnumValue>
                <EnumValue name="PaySplitUnearnedType">29- Types of unearned income used in accrual accounting.</EnumValue>
                <EnumValue name="Prognosis">30- Prognosis types.</EnumValue>
            </Enumeration>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>Order that each item shows on various lists. 0-indexed.</summary>
        </column>
        <column order="3" name="ItemName" type="varchar(255)">
            <summary>Each category is a little different.  This field is usually the common name of the item.</summary>
        </column>
        <column order="4" name="ItemValue" type="varchar(255)">
            <summary>This field can be used to store extra info about the item.</summary>
        </column>
        <column order="5" name="ItemColor" type="int(11)">
            <summary>Some categories include a color option.</summary>
        </column>
        <column order="6" name="IsHidden" type="tinyint">
            <summary>If hidden, the item will not show on any list, but can still be referenced.</summary>
        </column>
    </table>
    <table name="deletedobject">
        <summary>When some objects are deleted, we sometimes need a way to track them for synching purposes.  Other objects already have fields for IsHidden or PatStatus which track deletions just fine.  Those types of objects will not use this table.</summary>
        <column order="0" name="DeletedObjectNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ObjectNum" type="bigint(20)">
            <summary>Foreign key to a number of different tables, depending on which type it is.</summary>
        </column>
        <column order="2" name="ObjectType" type="int(11)">
            <summary>Enum:DeletedObjectType </summary>
        </column>
        <column order="3" name="DateTStamp" type="timestamp">
            <summary>Updated any time the row is altered in any way.</summary>
        </column>
    </table>
    <table name="deposit">
        <summary>A deposit slip.  Contains multiple insurance and patient checks.</summary>
        <column order="0" name="DepositNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="DateDeposit" type="date">
            <summary>The date of the deposit.</summary>
        </column>
        <column order="2" name="BankAccountInfo" type="text">
            <summary>User editable.  Usually includes name on the account and account number.  Possibly the bank name as well.</summary>
        </column>
        <column order="3" name="Amount" type="double">
            <summary>Total amount of the deposit. User not allowed to directly edit.</summary>
        </column>
    </table>
    <table name="disease">
        <summary>Each row is one disease that one patient has.  Now called a problem in the UI.  Must have either a DiseaseDefNum or an ICD9Num.</summary>
        <column order="0" name="DiseaseNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="DiseaseDefNum" type="bigint(20)" fk="diseasedef">
            <summary>FK to diseasedef.DiseaseDefNum.  The disease description is in that table.  Will be zero if ICD9Num has a value.</summary>
        </column>
        <column order="3" name="PatNote" type="text">
            <summary>Any note about this disease that is specific to this patient.</summary>
        </column>
        <column order="4" name="DateTStamp" type="timestamp">
            <summary>The last date and time this row was altered.  Not user editable.  Will be set to NOW by OD if this patient gets an OnlinePassword assigned.</summary>
        </column>
        <column order="5" name="ICD9Num" type="bigint(20)" fk="icd9">
            <summary>FK to icd9.ICD9Num.  Will be zero if DiseaseDefNum has a value.</summary>
        </column>
        <column order="6" name="ProbStatus" type="tinyint(4)">
            <summary>Enum:ProblemStatus Active=0, Resolved=1, Inactive=2.</summary>
            <Enumeration name="ProblemStatus">
                <summary>0=Active, 1=Resolved, 2=Inactive</summary>
                <EnumValue name="Active">0</EnumValue>
                <EnumValue name="Resolved">1</EnumValue>
                <EnumValue name="Inactive">2</EnumValue>
            </Enumeration>
        </column>
        <column order="7" name="DateStart" type="date">
            <summary>Date that the disease was diagnosed.  Can be minval if unknown.</summary>
        </column>
        <column order="8" name="DateStop" type="date">
            <summary>Date that the disease was set resolved or inactive.  Will be minval if still active.  ProbStatus should be used to determine if it is active or not.</summary>
        </column>
    </table>
    <table name="diseasedef">
        <summary>A list of diseases that can be assigned to patients.  Cannot be deleted if in use by any patients.</summary>
        <column order="0" name="DiseaseDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="DiseaseName" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>The order that the diseases will show in various lists.</summary>
        </column>
        <column order="3" name="IsHidden" type="tinyint">
            <summary>If hidden, the disease will still show on any patient that it was previously attached to, but it will not be available for future patients.</summary>
        </column>
        <column order="4" name="DateTStamp" type="timestamp">
            <summary>The last date and time this row was altered.  Not user editable.</summary>
        </column>
    </table>
    <table name="displayfield">
        <summary>Allows customization of which fields display in various lists and grids.  For now, the only grid is ProgressNotes.  Will also eventually let users set column widths and translate titles.  For now, the selections are the same for all computers.</summary>
        <column order="0" name="DisplayFieldNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="InternalName" type="varchar(255)">
            <summary>This is the internal name that OD uses to identify the field within this category.  This will be the default description if the user doesn't specify an alternate.</summary>
        </column>
        <column order="2" name="ItemOrder" type="int(11)">
            <summary>Order to display in the grid or list. Every entry must have a unique itemorder.</summary>
        </column>
        <column order="3" name="Description" type="varchar(255)">
            <summary>Optional alternate description to display for field.  Can be in another language.  For the ortho category, this is the 'key', since InternalName is blank.</summary>
        </column>
        <column order="4" name="ColumnWidth" type="int(11)">
            <summary>For grid columns, this lets user override the column width.  Especially useful for foreign languages.</summary>
        </column>
        <column order="5" name="Category" type="int(11)">
            <summary>Enum:DisplayFieldCategory.  If category is 0, then this is attached to a ChartView.</summary>
        </column>
        <column order="6" name="ChartViewNum" type="bigint(20)" fk="chartview">
            <summary>FK to chartview.ChartViewNum. 0 if attached to a category.</summary>
        </column>
    </table>
    <table name="document">
        <summary>Represents a single document in the images module.</summary>
        <column order="0" name="DocNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of the document.</summary>
        </column>
        <column order="2" name="DateCreated" type="date">
            <summary>Date created.</summary>
        </column>
        <column order="3" name="DocCategory" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum. Categories for documents.</summary>
        </column>
        <column order="4" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  Patient folder that document is in.(for sharing situations later)</summary>
        </column>
        <column order="5" name="FileName" type="varchar(255)">
            <summary>The name of the file. Does not include any directory info.</summary>
        </column>
        <column order="6" name="ImgType" type="tinyint">
            <summary>Enum:ImageType eg. document, radiograph, photo, file</summary>
            <Enumeration name="ImageType">
                <summary>The type of image for images module.</summary>
                <EnumValue name="Document">0- Includes scanned documents and screenshots.</EnumValue>
                <EnumValue name="Radiograph">1</EnumValue>
                <EnumValue name="Photo">2</EnumValue>
                <EnumValue name="File">3- For instance a Word document or a spreadsheet. Not an image.</EnumValue>
                <EnumValue name="Mount">4- For xray mount sets.</EnumValue>
            </Enumeration>
        </column>
        <column order="7" name="IsFlipped" type="tinyint">
            <summary>True if flipped horizontally. A vertical flip would be stored as a horizontal flip plus a 180 rotation.</summary>
        </column>
        <column order="8" name="DegreesRotated" type="smallint(6)">
            <summary>Only allowed 0,90,180, and 270.</summary>
        </column>
        <column order="9" name="ToothNumbers" type="varchar(255)">
            <summary>Incomplete.  An optional list of tooth numbers separated by commas.  The tooth numbers will be in American format and must be processed for display.  When displayed, dashes will be used for sequences of 3 or more tooth numbers.</summary>
        </column>
        <column order="10" name="Note" type="text">
            <summary></summary>
        </column>
        <column order="11" name="SigIsTopaz" type="tinyint">
            <summary>True if the signature is in Topaz format rather than OD format.</summary>
        </column>
        <column order="12" name="Signature" type="text">
            <summary>The encrypted and bound signature in base64 format.  The signature is bound to the byte sequence of the original image.</summary>
        </column>
        <column order="13" name="CropX" type="int(11)">
            <summary>Crop rectangle X in original image pixel coordinates.  May be negative.</summary>
        </column>
        <column order="14" name="CropY" type="int(11)">
            <summary>Crop rectangle Y in original image pixel coordinates.  May be negative.</summary>
        </column>
        <column order="15" name="CropW" type="int(11)">
            <summary>Crop rectangle Width in original image pixel coordinates.  May be zero if no cropping.  May be greater than original image width.</summary>
        </column>
        <column order="16" name="CropH" type="int(11)">
            <summary>Crop rectangle Height in original image pixel coordinates.  May be zero if no cropping.  May be greater than original image height.</summary>
        </column>
        <column order="17" name="WindowingMin" type="int(11)">
            <summary>The lower value of the "windowing" (contrast/brightness) for radiographs.  Default is 0.  Max is 255.</summary>
        </column>
        <column order="18" name="WindowingMax" type="int(11)">
            <summary>The upper value of the "windowing" (contrast/brightness) for radiographs.  Default is 0(no windowing).  Max is 255.</summary>
        </column>
        <column order="19" name="MountItemNum" type="bigint(20)" fk="mountitem">
            <summary>FK to mountitem.MountItemNum. If set to 0, then no mount item is associated with this document.</summary>
        </column>
        <column order="20" name="DateTStamp" type="timestamp">
            <summary>Date/time last altered.</summary>
        </column>
        <column order="21" name="RawBase64" type="mediumtext">
            <summary>The raw file data encoded as base64.  Only used if there is no AtoZ folder.</summary>
        </column>
        <column order="22" name="Thumbnail" type="text">
            <summary>Thumbnail encoded as base64.  Only present if not using AtoZ folder. 100x100 pixels, jpg, takes around 5.5k.</summary>
        </column>
    </table>
    <table name="drugmanufacturer">
        <summary>Manufacturer of a vaccine.</summary>
        <column order="0" name="DrugManufacturerNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ManufacturerName" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="ManufacturerCode" type="varchar(20)">
            <summary>An abbreviation of the manufacturer name.</summary>
        </column>
    </table>
    <table name="drugunit">
        <summary>And other kinds of units.  We will only prefill this list with units needed for the tests.  Users would have to manually add any other units.</summary>
        <column order="0" name="DrugUnitNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="UnitIdentifier" type="varchar(20)">
            <summary>Example ml, capitalization not critical. Usually entered as lowercase except for L.</summary>
        </column>
        <column order="2" name="UnitText" type="varchar(255)">
            <summary>Example milliliter.</summary>
        </column>
    </table>
    <table name="dunning">
        <summary>A message that will show on certain patient statements when printing bills.  Criteria must be met in order for the dunning message to show.</summary>
        <column order="0" name="DunningNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="DunMessage" type="text">
            <summary>The actual dunning message that will go on the patient bill.</summary>
        </column>
        <column order="2" name="BillingType" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.</summary>
        </column>
        <column order="3" name="AgeAccount" type="tinyint">
            <summary>Program forces only 0,30,60,or 90.</summary>
        </column>
        <column order="4" name="InsIsPending" type="tinyint">
            <summary>Enum:YN Set Y to only show if insurance is pending.</summary>
            <Enumeration name="YN">
                <summary>Unknown,Yes, or No.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Yes">1</EnumValue>
                <EnumValue name="No">2</EnumValue>
            </Enumeration>
        </column>
        <column order="5" name="MessageBold" type="text">
            <summary>A message that will be copied to the NoteBold field of the Statement.</summary>
        </column>
    </table>
    <table name="eduresource">
        <summary>EHR education resource.  Only one of the 4 FK fields will be used at a time.  The other two will be blank.   Displays a clickable URL if the patient meets certain criteria.  </summary>
        <column order="0" name="EduResourceNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Icd9Num" type="bigint(20)" fk="icd9">
            <summary>FK to icd9.ICD9Num.</summary>
        </column>
        <column order="2" name="DiseaseDefNum" type="bigint(20)" fk="diseasedef">
            <summary>FK to diseasedef.DiseaseDefNum. </summary>
        </column>
        <column order="3" name="MedicationNum" type="bigint(20)" fk="medication">
            <summary>FK to medication.MedicationNum. </summary>
        </column>
        <column order="4" name="LabResultID" type="varchar(255)" fk="labresult">
            <summary>FK to labresult.TestID. </summary>
        </column>
        <column order="5" name="LabResultName" type="varchar(255)">
            <summary>Used for display in the grid.</summary>
        </column>
        <column order="6" name="LabResultCompare" type="varchar(255)">
            <summary>String, example &lt;43. Must start with &lt; or &gt; followed by int.  Only used if FK LabResultID is used.</summary>
        </column>
        <column order="7" name="ResourceUrl" type="varchar(255)">
            <summary></summary>
        </column>
    </table>
    <table name="ehrmeasure">
        <summary>For EHR module, automate measure calculation.</summary>
        <column order="0" name="EhrMeasureNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="MeasureType" type="tinyint(4)">
            <summary>Enum:EhrMeasureType</summary>
        </column>
        <column order="2" name="Numerator" type="smallint(6)">
            <summary>0-100, -1 indicates not entered yet.</summary>
        </column>
        <column order="3" name="Denominator" type="smallint(6)">
            <summary>0-100, -1 indicates not entered yet.</summary>
        </column>
    </table>
    <table name="ehrmeasureevent">
        <summary>Stores events for EHR that are needed for reporting purposes.</summary>
        <column order="0" name="EhrMeasureEventNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="DateTEvent" type="datetime">
            <summary>Date and time of measure event.</summary>
        </column>
        <column order="2" name="EventType" type="tinyint(4)">
            <summary>Enum: EhrMeasureEventType. </summary>
        </column>
        <column order="3" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="4" name="MoreInfo" type="varchar(255)">
            <summary>Only used for some types: EducationProvided, TobaccoCessation.</summary>
        </column>
    </table>
    <table name="ehrprovkey">
        <summary>Only used by OD customer support to store and track Ehr Provider Keys for customers.</summary>
        <column order="0" name="EhrProvKeyNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum. There can be multiple EhrProvKeys per patient/customer.</summary>
        </column>
        <column order="2" name="LName" type="varchar(255)">
            <summary>The provider LName.</summary>
        </column>
        <column order="3" name="FName" type="varchar(255)">
            <summary>The provider FName.</summary>
        </column>
        <column order="4" name="ProvKey" type="varchar(255)">
            <summary>The key assigned to the provider</summary>
        </column>
        <column order="5" name="FullTimeEquiv" type="float">
            <summary>Usually 1.  Can be less, like .5 or .25 to indicate possible discount is justified.</summary>
        </column>
        <column order="6" name="Notes" type="text">
            <summary>Any notes that the tech wishes to include regarding this situation.</summary>
        </column>
        <column order="7" name="HasReportAccess" type="tinyint(4)">
            <summary>True if the provider has access to the reports needed to show MU.  Changing this will require a new provider key.</summary>
        </column>
    </table>
    <table name="ehrquarterlykey">
        <summary>Also used by OD customer support to store and track Ehr Quarterly Keys for customers.</summary>
        <column order="0" name="EhrQuarterlyKeyNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="YearValue" type="int(11)">
            <summary>Example 11</summary>
        </column>
        <column order="2" name="QuarterValue" type="int(11)">
            <summary>Example 2</summary>
        </column>
        <column order="3" name="PracticeName" type="varchar(255)">
            <summary>The customer must have this exact practice name entered in practice setup.</summary>
        </column>
        <column order="4" name="KeyValue" type="varchar(255)">
            <summary>The calculated key value, tied to year, quarter, and practice name.</summary>
        </column>
        <column order="5" name="PatNum" type="bigint(20)">
            <summary>Always zero for customer databases.  When used by OD customer support, this is the customer num.</summary>
        </column>
        <column order="6" name="Notes" type="text">
            <summary>Any notes that the tech wishes to include regarding this situation.</summary>
        </column>
    </table>
    <table name="ehrsummaryccd">
        <summary>Can also be a CCR.  Sent CCDs are not saved here, only received CCDs/CCRs.  To display a saved Ccd, it is combined with an internal stylesheet.</summary>
        <column order="0" name="EhrSummaryCcdNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="DateSummary" type="date">
            <summary>Date that this Ccd was received.</summary>
        </column>
        <column order="3" name="ContentSummary" type="text">
            <summary>The xml content of the received text file.</summary>
        </column>
    </table>
    <table name="electid">
        <summary>Corresponds to the electid table in the database. Helps with entering elecronic/payor id's as well as keeping track of the specific carrier requirements. Only used by the X12 format.</summary>
        <column order="0" name="ElectIDNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PayorID" type="varchar(255)">
            <summary>aka Electronic ID.  A simple string.</summary>
        </column>
        <column order="2" name="CarrierName" type="varchar(255)">
            <summary>Used when doing a search.</summary>
        </column>
        <column order="3" name="IsMedicaid" type="tinyint">
            <summary>True if medicaid. Then, the billing and treating providers will have their Medicaid ID's attached.</summary>
        </column>
        <column order="4" name="ProviderTypes" type="varchar(255)">
            <summary>Integers separated by commas. Each long represents a ProviderSupplementalID type that is required by this insurance. Usually only used for BCBS or other carriers that require supplemental provider id's.  Even if we don't put the supplemental types in here, the user can still add them.  This just helps by doing an additional check for known required types.</summary>
        </column>
        <column order="5" name="Comments" type="text">
            <summary>Any comments. Usually includes enrollment requirements and descriptions of how to use the provider id's supplied by the carrier because they might call them by different names.</summary>
        </column>
    </table>
    <table name="emailattach">
        <summary>Keeps track of one file attached to an email.  Multiple files can be attached to an email using this method.</summary>
        <column order="0" name="EmailAttachNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="EmailMessageNum" type="bigint(20)" fk="emailmessage">
            <summary>FK to emailmessage.EmailMessageNum</summary>
        </column>
        <column order="2" name="DisplayedFileName" type="varchar(255)">
            <summary>The name of the file that shows on the email.  For example: tooth2.jpg.</summary>
        </column>
        <column order="3" name="ActualFileName" type="varchar(255)">
            <summary>The actual file is stored in the A-Z folder in EmailAttachments.  This field stores the name of the file.  The files are named automatically based on Date/time along with a random number.  This ensures that they will be sequential as well as unique.</summary>
        </column>
    </table>
    <table name="emailmessage">
        <summary>An outgoing email message is stored here.</summary>
        <column order="0" name="EmailMessageNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="ToAddress" type="text">
            <summary>Single valid email address. Bcc field might be added later, although it won't be very useful.  We will never allow visible cc for privacy reasons.</summary>
        </column>
        <column order="3" name="FromAddress" type="text">
            <summary>Valid email address.</summary>
        </column>
        <column order="4" name="Subject" type="text">
            <summary>Subject line.</summary>
        </column>
        <column order="5" name="BodyText" type="text">
            <summary>Body of the email</summary>
        </column>
        <column order="6" name="MsgDateTime" type="datetime">
            <summary>Date and time the message was sent. Automated at the UI level.</summary>
        </column>
        <column order="7" name="SentOrReceived" type="tinyint">
            <summary>0=neither, 1=sent, 2=received.</summary>
        </column>
    </table>
    <table name="emailtemplate">
        <summary>A template email which can be used as the basis for a new email.</summary>
        <column order="0" name="EmailTemplateNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Subject" type="text">
            <summary>Default subject line.</summary>
        </column>
        <column order="2" name="BodyText" type="text">
            <summary>Body of the email</summary>
        </column>
    </table>
    <table name="employee">
        <summary>An employee at the dental office.</summary>
        <column order="0" name="EmployeeNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LName" type="varchar(255)">
            <summary>Employee's last name.</summary>
        </column>
        <column order="2" name="FName" type="varchar(255)">
            <summary>First name.</summary>
        </column>
        <column order="3" name="MiddleI" type="varchar(255)">
            <summary>Middle initial or name.</summary>
        </column>
        <column order="4" name="IsHidden" type="tinyint">
            <summary>If hidden, the employee will not show on the list.</summary>
        </column>
        <column order="5" name="ClockStatus" type="varchar(255)">
            <summary>This is just text used to quickly display the clockstatus.  eg Working,Break,Lunch,Home, etc.</summary>
        </column>
        <column order="6" name="PhoneExt" type="int(11)">
            <summary>The phone extension for the employee.  e.g. 101,102,etc.  This field is only visible for user editing if the pref DockPhonePanelShow is true (1).</summary>
        </column>
    </table>
    <table name="employer">
        <summary>Most insurance plans are organized by employer.  This table keeps track of the list of employers.  The address fields were added at one point, but I don't know why they don't show in the program in order to edit.  Nobody has noticed their absence even though it's been a few years, so for now we are just using the EmpName and not the address.</summary>
        <column order="0" name="EmployerNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="EmpName" type="varchar(255)">
            <summary>Name of the employer.</summary>
        </column>
        <column order="2" name="Address" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="3" name="Address2" type="varchar(255)">
            <summary>Second line of address.</summary>
        </column>
        <column order="4" name="City" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="5" name="State" type="varchar(255)">
            <summary>2 char in the US.</summary>
        </column>
        <column order="6" name="Zip" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="7" name="Phone" type="varchar(255)">
            <summary>Includes any punctuation.</summary>
        </column>
    </table>
    <table name="equipment">
        <summary>Used for property tax tracking.</summary>
        <column order="0" name="EquipmentNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="text">
            <summary>Short description, need not be very unique.</summary>
        </column>
        <column order="2" name="SerialNumber" type="varchar(255)">
            <summary>Must be unique among all pieces of equipment.  Auto-generated 3 char alpha numeric gives 1.5M unique serial numbers.  Zero never part of autogenerated serial number.</summary>
        </column>
        <column order="3" name="ModelYear" type="varchar(2)">
            <summary>Limit 2 char.</summary>
        </column>
        <column order="4" name="DatePurchased" type="date">
            <summary>Date when this corporation obtained the equipment.  Always has a valid value.</summary>
        </column>
        <column order="5" name="DateSold" type="date">
            <summary>Normally 01-01-0001 if equipment still in possession.  Once sold, a date will be present.</summary>
        </column>
        <column order="6" name="PurchaseCost" type="double">
            <summary>.</summary>
        </column>
        <column order="7" name="MarketValue" type="double">
            <summary>.</summary>
        </column>
        <column order="8" name="Location" type="text">
            <summary>.</summary>
        </column>
        <column order="9" name="DateEntry" type="date">
            <summary>Security uses this date to lock older entries from accidental deletion.  Date, no time.</summary>
        </column>
    </table>
    <table name="etrans">
        <summary>One electronic transaction.  Typically, one claim or response.  Or one benefit request or response.  Is constantly being expanded to include more types of transactions with clearinghouses.  Also stores printing of paper claims.  Sometimes stores a copy of what was sent.</summary>
        <column order="0" name="EtransNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="DateTimeTrans" type="datetime">
            <summary>The date and time of the transaction.</summary>
        </column>
        <column order="2" name="ClearingHouseNum" type="bigint(20)" fk="clearinghouse">
            <summary>FK to clearinghouse.ClearinghouseNum .  Can be 0 if no clearinghouse was involved.</summary>
        </column>
        <column order="3" name="Etype" type="tinyint">
            <summary>Enum:EtransType</summary>
            <Enumeration name="EtransType">
                <summary>The _CA of some types should get stripped off when displaying to users.</summary>
                <EnumValue name="ClaimSent">0 X12-837.  Should we differenitate between different kinds of 837s and 4010 vs 5010?</EnumValue>
                <EnumValue name="ClaimPrinted">1 claim</EnumValue>
                <EnumValue name="Claim_CA">2 Canada. Type 01</EnumValue>
                <EnumValue name="Claim_Ren">3 Renaissance</EnumValue>
                <EnumValue name="ClaimAck_CA">4 Canada. Type 11</EnumValue>
                <EnumValue name="ClaimEOB_CA">5 Canada. Type 21</EnumValue>
                <EnumValue name="Eligibility_CA">6 Canada. Type 08</EnumValue>
                <EnumValue name="EligResponse_CA">7 Canada. Type 18. V02 type 10.</EnumValue>
                <EnumValue name="ClaimReversal_CA">8 Canada. Type 02</EnumValue>
                <EnumValue name="Predeterm_CA">9 Canada. Type 03</EnumValue>
                <EnumValue name="RequestOutstand_CA">10 Canada. Type 04</EnumValue>
                <EnumValue name="RequestSumm_CA">11 Canada. Type 05</EnumValue>
                <EnumValue name="RequestPay_CA">12 Canada. Type 06</EnumValue>
                <EnumValue name="ClaimCOB_CA">13 Canada. Type 07</EnumValue>
                <EnumValue name="ReverseResponse_CA">14 Canada. Type 12</EnumValue>
                <EnumValue name="PredetermAck_CA">15 Canada. Type 13</EnumValue>
                <EnumValue name="PredetermEOB_CA">16 Canada. Type 23</EnumValue>
                <EnumValue name="OutstandingAck_CA">17 Canada. Type 14</EnumValue>
                <EnumValue name="EmailResponse_CA">18 Canada. Type 24</EnumValue>
                <EnumValue name="PaymentResponse_CA">19 Canada. Type 16</EnumValue>
                <EnumValue name="SummaryResponse_CA">20 Canada. Type 15</EnumValue>
                <EnumValue name="Acknowledge_997">21 Ack from clearinghouse. X12-997.</EnumValue>
                <EnumValue name="StatusNotify_277">22 X12-277. Unsolicited claim status notification.</EnumValue>
                <EnumValue name="TextReport">23 Text report from clearinghouse in human readable format.</EnumValue>
                <EnumValue name="BenefitInquiry270">24 X12-270.</EnumValue>
                <EnumValue name="BenefitResponse271">25 X12-271</EnumValue>
                <EnumValue name="AckError">26 When a Canadian message is sent, and an error comes back instead of a message.  This stores information about the error.  The etrans with this type is attached it to the original etrans as an ack.</EnumValue>
                <EnumValue name="ERA_835">27 X12-835. Not used yet.</EnumValue>
            </Enumeration>
        </column>
        <column order="4" name="ClaimNum" type="bigint(20)" fk="claim">
            <summary>FK to claim.ClaimNum if a claim. Otherwise 0.  Warning.  Original claim might have been deleted.  But if Canadian claim was successfully sent, then deletion will be blocked.</summary>
        </column>
        <column order="5" name="OfficeSequenceNumber" type="int(11)">
            <summary>For Canada.  Unique for every transaction sent.  Increments by one until 999999, then resets to 1.</summary>
        </column>
        <column order="6" name="CarrierTransCounter" type="int(11)">
            <summary>For Canada.  Separate counter for each carrier.  Increments by one until 99999, then resets to 1.</summary>
        </column>
        <column order="7" name="CarrierTransCounter2" type="int(11)">
            <summary>For Canada.  If this claim includes secondary, then this is the counter for the secondary carrier.</summary>
        </column>
        <column order="8" name="CarrierNum" type="bigint(20)" fk="carrier">
            <summary>FK to carrier.CarrierNum.</summary>
        </column>
        <column order="9" name="CarrierNum2" type="bigint(20)" fk="carrier">
            <summary>FK to carrier.CarrierNum Only used if secondary insurance info is provided on a claim.  Necessary for Canada.</summary>
        </column>
        <column order="10" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum This is useful in case the original claim has been deleted.  Now, we can still tell who the patient was.</summary>
        </column>
        <column order="11" name="BatchNumber" type="int(11)">
            <summary>Maxes out at 999, then loops back to 1.  This is not a good key, but is a restriction of (canadian?).  So dates must also be used to isolate the correct BatchNumber key.  Specific to one clearinghouse.  Only used with e-claims.  Claim will have BatchNumber, and 997 will have matching BatchNumber. (In X12 lingo, it's a functional group number)</summary>
        </column>
        <column order="12" name="AckCode" type="varchar(255)">
            <summary>A=Accepted, R=Rejected, blank if not able to parse.  More options will be added later.  The incoming 997 sets this flag automatically.  To find the 997, look for a matching BatchNumber with a similar date, since both the claims and the 997 will both have the same batch number.  The 997 does not have this flag set on itself.</summary>
        </column>
        <column order="13" name="TransSetNum" type="int(11)">
            <summary>For sent e-claims, within each batch (functional group), each carrier gets it's own transaction set.  Since 997s acknowledge transaction sets rather than batches, we need to keep track of which transaction set each claim is part of as well as which batch it's part of.  This field can't be set as part of 997, because one 997 refers to multiple trans sets.</summary>
        </column>
        <column order="14" name="Note" type="text">
            <summary>Typical uses include indicating that the report was printed, the claim was resent, reason for rejection, etc.  For a 270, this contains the automatically generated short summary of the response.  The response could include the reason for failure, or it could be a short summary of the 271.</summary>
        </column>
        <column order="15" name="EtransMessageTextNum" type="bigint(20)" fk="etransmessagetext">
            <summary>FK to etransmessagetext.EtransMessageTextNum.  Can be 0 if there is no message text.  Multiple Etrans objects can refer to the same message text, very common in a batch.</summary>
        </column>
        <column order="16" name="AckEtransNum" type="bigint(20)" fk="etrans">
            <summary>FK to etrans.EtransNum.  Only has a non-zero value if there exists an ack etrans, like a 997, 271, or ackError.  There can be only one ack for any given etrans, but one ack can apply to multiple etran's that were sent as one batch.</summary>
        </column>
        <column order="17" name="PlanNum" type="bigint(20)" fk="insplan">
            <summary>FK to insplan.PlanNum.  Used if EtransType.BenefitInquiry270 and BenefitResponse271 and Eligibility_CA.</summary>
        </column>
        <column order="18" name="InsSubNum" type="bigint(20)" fk="inssub">
            <summary>FK to inssub.InsSubNum.  Used if EtransType.BenefitInquiry270 and BenefitResponse271 and Eligibility_CA.</summary>
        </column>
    </table>
    <table name="etransmessagetext">
        <summary>Each row is big.  The entire X12 message text is stored here, since it can be the same for multiple etrans objects, and since the messages can be so big.</summary>
        <column order="0" name="EtransMessageTextNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="MessageText" type="mediumtext">
            <summary>The entire message text, including carriage returns.</summary>
        </column>
    </table>
    <table name="fee">
        <summary>There is one entry in this table for each fee for a single procedurecode.  So if there are 5 different fees stored for one procedurecode, then there will be five entries here.</summary>
        <column order="0" name="FeeNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Amount" type="double">
            <summary>The amount usually charged.  If an amount is unknown, then the entire Fee entry is deleted from the database.  The absence of a fee is sometimes shown in the user interface as a blank entry, and sometimes as 0.00.</summary>
        </column>
        <column order="2" name="OldCode" type="varchar(15)">
            <summary>Do not use.</summary>
        </column>
        <column order="3" name="FeeSched" type="bigint(20)" fk="feesched">
            <summary>FK to feesched.FeeSchedNum.</summary>
        </column>
        <column order="4" name="UseDefaultFee" type="tinyint">
            <summary>Not used.</summary>
        </column>
        <column order="5" name="UseDefaultCov" type="tinyint">
            <summary>Not used.</summary>
        </column>
        <column order="6" name="CodeNum" type="bigint(20)" fk="procedurecode">
            <summary>FK to procedurecode.CodeNum.</summary>
        </column>
    </table>
    <table name="feesched">
        <summary>Fee schedule names used to be in the definition table, but now they have their own table.  We are about to have many many more fee schedules as we start automating allowed fees.</summary>
        <column order="0" name="FeeSchedNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>The name of the fee schedule.</summary>
        </column>
        <column order="2" name="FeeSchedType" type="int(11)">
            <summary>Enum:FeeScheduleType</summary>
        </column>
        <column order="3" name="ItemOrder" type="int(11)">
            <summary>Unlike with the old definition table, this ItemOrder is not as critical in the caching of data.  The item order is only for fee schedules of the same type.</summary>
        </column>
        <column order="4" name="IsHidden" type="tinyint(1)">
            <summary>True if the fee schedule is hidden.  Can't delete fee schedules or change their type once created.</summary>
        </column>
    </table>
    <table name="files">
        <summary></summary>
        <column order="0" name="DocNum" type="bigint(20)">
            <summary></summary>
        </column>
        <column order="1" name="Data" type="longblob">
            <summary></summary>
        </column>
        <column order="2" name="Thumbnail" type="longblob">
            <summary></summary>
        </column>
    </table>
    <table name="formpat">
        <summary>One form or questionnaire filled out by a patient.  Each patient can have multiple forms.</summary>
        <column order="0" name="FormPatNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="FormDateTime" type="datetime">
            <summary>The date and time that this questionnaire was filled out.</summary>
        </column>
    </table>
    <table name="formulary">
        <summary>A list of medications that are preferred by an insurance or Medicaid.</summary>
        <column order="0" name="FormularyNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description.</summary>
        </column>
    </table>
    <table name="formularymed">
        <summary>A medication on a formulary.</summary>
        <column order="0" name="FormularyMedNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="FormularyNum" type="bigint(20)" fk="Formulary">
            <summary>FK to Formulary.</summary>
        </column>
        <column order="2" name="MedicationNum" type="bigint(20)" fk="Medication">
            <summary>FK to Medication.</summary>
        </column>
    </table>
    <table name="grouppermission">
        <summary>Every user group has certain permissions.  This defines a permission for a group.  The absense of permission would cause that row to be deleted from this table.</summary>
        <column order="0" name="GroupPermNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="NewerDate" type="date">
            <summary>Only granted permission if newer than this date.  Can be Minimum (01-01-0001) to always grant permission.</summary>
        </column>
        <column order="2" name="NewerDays" type="int(11)">
            <summary>Can be 0 to always grant permission.  Otherwise, only granted permission if item is newer than the given number of days.  1 would mean only if entered today.</summary>
        </column>
        <column order="3" name="UserGroupNum" type="bigint(20)" fk="usergroup">
            <summary>FK to usergroup.UserGroupNum.  The user group for which this permission is granted.  If not authorized, then this groupPermission will have been deleted.</summary>
        </column>
        <column order="4" name="PermType" type="tinyint">
            <summary>Enum:Permissions</summary>
            <Enumeration name="Permissions">
                <summary>A hard-coded list of permissions which may be granted to usergroups.</summary>
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="AppointmentsModule">1</EnumValue>
                <EnumValue name="FamilyModule">2</EnumValue>
                <EnumValue name="AccountModule">3</EnumValue>
                <EnumValue name="TPModule">4</EnumValue>
                <EnumValue name="ChartModule">5</EnumValue>
                <EnumValue name="ImagesModule">6</EnumValue>
                <EnumValue name="ManageModule">7</EnumValue>
                <EnumValue name="Setup">8. Currently covers a wide variety of setup functions. </EnumValue>
                <EnumValue name="RxCreate">9</EnumValue>
                <EnumValue name="ProcComplEdit">10. Uses date restrictions.</EnumValue>
                <EnumValue name="ChooseDatabase">11</EnumValue>
                <EnumValue name="Schedules">12</EnumValue>
                <EnumValue name="Blockouts">13</EnumValue>
                <EnumValue name="ClaimSentEdit">14. Uses date restrictions.</EnumValue>
                <EnumValue name="PaymentCreate">15</EnumValue>
                <EnumValue name="PaymentEdit">16. Uses date restrictions.</EnumValue>
                <EnumValue name="AdjustmentCreate">17</EnumValue>
                <EnumValue name="AdjustmentEdit">18. Uses date restrictions.</EnumValue>
                <EnumValue name="UserQuery">19</EnumValue>
                <EnumValue name="StartupSingleUserOld">20.  Not used anymore.</EnumValue>
                <EnumValue name="StartupMultiUserOld">21 Not used anymore.</EnumValue>
                <EnumValue name="Reports">22</EnumValue>
                <EnumValue name="ProcComplCreate">23. Includes setting procedures complete.</EnumValue>
                <EnumValue name="SecurityAdmin">24. At least one user must have this permission.</EnumValue>
                <EnumValue name="AppointmentCreate">25. </EnumValue>
                <EnumValue name="AppointmentMove">26</EnumValue>
                <EnumValue name="AppointmentEdit">27</EnumValue>
                <EnumValue name="Backup">28</EnumValue>
                <EnumValue name="TimecardsEditAll">29</EnumValue>
                <EnumValue name="DepositSlips">30</EnumValue>
                <EnumValue name="AccountingEdit">31. Uses date restrictions.</EnumValue>
                <EnumValue name="AccountingCreate">32. Uses date restrictions.</EnumValue>
                <EnumValue name="Accounting">33</EnumValue>
                <EnumValue name="AnesthesiaIntakeMeds">34</EnumValue>
                <EnumValue name="AnesthesiaControlMeds">35</EnumValue>
                <EnumValue name="InsPayCreate">36</EnumValue>
                <EnumValue name="InsPayEdit">37. Uses date restrictions. Also includes completed claimprocs even if unattached to an insurance check.  However, it's not actually enforced when creating a check because it would be very complex.</EnumValue>
                <EnumValue name="TreatPlanEdit">38. Uses date restrictions.</EnumValue>
                <EnumValue name="ReportProdInc">39</EnumValue>
                <EnumValue name="TimecardDeleteEntry">40. Uses date restrictions.</EnumValue>
                <EnumValue name="EquipmentDelete">41. Uses date restrictions. All other equipment functions are covered by .Setup.</EnumValue>
                <EnumValue name="SheetEdit">42. Uses date restrictions.</EnumValue>
                <EnumValue name="CommlogEdit">43. Uses date restrictions.</EnumValue>
                <EnumValue name="ImageDelete">44. Uses date restrictions.</EnumValue>
                <EnumValue name="PerioEdit">45. Uses date restrictions.</EnumValue>
                <EnumValue name="ProcEditShowFee">46</EnumValue>
                <EnumValue name="AdjustmentEditZero">47</EnumValue>
                <EnumValue name="EhrEmergencyAccess">48</EnumValue>
                <EnumValue name="ProcDelete">49. Uses date restrictions.</EnumValue>
                <EnumValue name="EhrKeyAdd">50 - Only used at OD HQ.  No user interface.</EnumValue>
                <EnumValue name="Providers">51</EnumValue>
                <EnumValue name="EcwAppointmentRevise">52</EnumValue>
                <EnumValue name="ProcedureNote">53</EnumValue>
                <EnumValue name="ReferralAdd">54</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="guardian">
        <summary>Links patient to patient in an n-n relationship.  A guardian need not be in the same family.</summary>
        <column order="0" name="GuardianNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNumChild" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="PatNumGuardian" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="3" name="Relationship" type="tinyint(4)">
            <summary>Enum:GuardianRelationship Father, Mother, Stepfather, Stepmother, Grandfather, Grandmother, Sitter.</summary>
            <Enumeration name="GuardianRelationship">
                <summary>Relationship of a child to a parent/guardian.</summary>
                <EnumValue name="Father">0</EnumValue>
                <EnumValue name="Mother">1</EnumValue>
                <EnumValue name="Stepfather">2</EnumValue>
                <EnumValue name="Stepmother">3</EnumValue>
                <EnumValue name="Grandfather">4</EnumValue>
                <EnumValue name="Grandmother">5</EnumValue>
                <EnumValue name="Sitter">6</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="hl7msg">
        <summary>HL7 messages sent and received.</summary>
        <column order="0" name="HL7MsgNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="HL7Status" type="int(11)">
            <summary>Enum:HL7MessageStatus  OutPending, OutSent, InReceived, InProcessed.</summary>
        </column>
        <column order="2" name="MsgText" type="mediumtext">
            <summary>The actual HL7 message in its entirity.</summary>
        </column>
        <column order="3" name="AptNum" type="bigint(20)" fk="appointment">
            <summary>FK to appointment.AptNum.  Many of the messages contain "Visit ID" which is equivalent to the our AptNum.</summary>
        </column>
    </table>
    <table name="icd9">
        <summary>Primary key is an arbitrary number, allowing code to change if needed, although that should generally be prohibited.  Currently synched to mobile server in a very inefficient manner.</summary>
        <column order="0" name="ICD9Num" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ICD9Code" type="varchar(255)">
            <summary>Not allowed to edit this column once saved in the database.</summary>
        </column>
        <column order="2" name="Description" type="varchar(255)">
            <summary>Description.</summary>
        </column>
        <column order="3" name="DateTStamp" type="timestamp">
            <summary>The last date and time this row was altered.  Not user editable.</summary>
        </column>
    </table>
    <table name="insfilingcode">
        <summary>An optional field on insplan and claims.  This lets user customize so that they can track insurance types.</summary>
        <column order="0" name="InsFilingCodeNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Descript" type="varchar(255)">
            <summary>Description of the insurance filing code.</summary>
        </column>
        <column order="2" name="EclaimCode" type="varchar(100)">
            <summary>Code for electronic claim.</summary>
        </column>
        <column order="3" name="ItemOrder" type="int(11)">
            <summary>Display order for this filing code within the UI.  0-indexed.</summary>
        </column>
    </table>
    <table name="insfilingcodesubtype">
        <summary>Stores the list of insurance filing code subtypes.</summary>
        <column order="0" name="InsFilingCodeSubtypeNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="InsFilingCodeNum" type="bigint(20)" fk="insfilingcode">
            <summary>FK to insfilingcode.insfilingcodenum</summary>
        </column>
        <column order="2" name="Descript" type="varchar(255)">
            <summary>The description of the insurance filing code subtype.</summary>
        </column>
    </table>
    <table name="insplan">
        <summary>Subscribers can share insplans by using the InsSub table.  The patplan table determines coverage for individual patients.  InsPlans can also exist without any subscriber.</summary>
        <column order="0" name="PlanNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="GroupName" type="varchar(50)">
            <summary>Optional</summary>
        </column>
        <column order="2" name="GroupNum" type="varchar(20)">
            <summary>Optional.  In Canada, this is called the Plan Number.</summary>
        </column>
        <column order="3" name="PlanNote" type="text">
            <summary>Note for this plan.  Same for all subscribers.</summary>
        </column>
        <column order="4" name="FeeSched" type="bigint(20)" fk="feesched">
            <summary>FK to feesched.FeeSchedNum.</summary>
        </column>
        <column order="5" name="PlanType" type="char(1)">
            <summary>""=percentage(the default),"p"=ppo_percentage,"f"=flatCopay,"c"=capitation.</summary>
        </column>
        <column order="6" name="ClaimFormNum" type="bigint(20)" fk="claimform">
            <summary>FK to claimform.ClaimFormNum. eg. "1" for ADA2002.  For ADA2006, it varies by office.</summary>
        </column>
        <column order="7" name="UseAltCode" type="tinyint">
            <summary>0=no,1=yes.  could later be extended if more alternates required</summary>
        </column>
        <column order="8" name="ClaimsUseUCR" type="tinyint">
            <summary>Fee billed on claim should be the UCR fee for the patient's provider.</summary>
        </column>
        <column order="9" name="CopayFeeSched" type="bigint(20)" fk="feesched">
            <summary>FK to feesched.FeeSchedNum. Not usually used. This fee schedule holds only co-pays(patient portions).  Only used for Capitation or for fixed copay plans.</summary>
        </column>
        <column order="10" name="EmployerNum" type="bigint(20)" fk="employer">
            <summary>FK to employer.EmployerNum.</summary>
        </column>
        <column order="11" name="CarrierNum" type="bigint(20)" fk="carrier">
            <summary>FK to carrier.CarrierNum.</summary>
        </column>
        <column order="12" name="AllowedFeeSched" type="bigint(20)" fk="feesched">
            <summary>FK to feesched.FeeSchedNum. Not usually used.  This fee schedule holds amounts allowed by carriers.</summary>
        </column>
        <column order="13" name="TrojanID" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="14" name="DivisionNo" type="varchar(255)">
            <summary>Only used in Canada. It's a suffix to the plan number (group number).</summary>
        </column>
        <column order="15" name="IsMedical" type="tinyint">
            <summary>True if this is medical insurance rather than dental insurance.  When creating a claim, this, along with pref.</summary>
        </column>
        <column order="16" name="FilingCode" type="bigint(20)" fk="insfilingcode">
            <summary>FK to insfilingcode.InsFilingCodeNum.  Used for e-claims.  Also used for some complex reports in public health.  The e-claim usage might become obsolete when PlanID implemented by HIPAA.  Can be 0 to indicate none.  Then 'CI' will go out on claims.</summary>
        </column>
        <column order="17" name="DentaideCardSequence" type="tinyint">
            <summary>Canadian e-claim field. D11 and E07.  Zero indicates empty.  Mandatory value for Dentaide.  Not used for all others.  2 digit.</summary>
        </column>
        <column order="18" name="ShowBaseUnits" type="tinyint(1)">
            <summary>If checked, the units Qty will show the base units assigned to a procedure on the claim form.</summary>
        </column>
        <column order="19" name="CodeSubstNone" type="tinyint(1)">
            <summary>Set to true to not allow procedure code downgrade substitution on this insurance plan.</summary>
        </column>
        <column order="20" name="IsHidden" type="tinyint(4)">
            <summary>Set to true to hide it from the pick list and from the main list.</summary>
        </column>
        <column order="21" name="MonthRenew" type="tinyint(4)">
            <summary>The month, 1 through 12 when the insurance plan renews.  It will renew on the first of the month.  To indicate calendar year, set renew month to 0.</summary>
        </column>
        <column order="22" name="FilingCodeSubtype" type="bigint(20)" fk="insfilingcodesubtype">
            <summary>FK to insfilingcodesubtype.insfilingcodesubtypenum</summary>
        </column>
        <column order="23" name="CanadianPlanFlag" type="varchar(5)">
            <summary>Canadian C12.  Single char, usually blank.  If non-blank, then it's one of three kinds of Provincial Medical Plans.  A=Newfoundland MCP Plan.  V=Veteran's Affairs Plan.  N=NIHB.  N and V are not yet in use, so they will result in blank being sent instead.  See Elig5.</summary>
        </column>
        <column order="24" name="CanadianDiagnosticCode" type="varchar(255)">
            <summary>Canadian C39. Required when CanadianPlanFlag is 'A'.</summary>
        </column>
        <column order="25" name="CanadianInstitutionCode" type="varchar(255)">
            <summary>Canadian C40. Required when CanadianPlanFlag is 'A'.</summary>
        </column>
        <column order="26" name="RxBIN" type="varchar(255)">
            <summary>BIN location number.  Only used with EHR.</summary>
        </column>
    </table>
    <table name="inssub">
        <summary>Multiple subscribers can have the same insurance plan.  But the patplan table is still what determines coverage for individual patients.</summary>
        <column order="0" name="InsSubNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PlanNum" type="bigint(20)" fk="insplan">
            <summary>FK to insplan.PlanNum.</summary>
        </column>
        <column order="2" name="Subscriber" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="3" name="DateEffective" type="date">
            <summary>Date plan became effective.</summary>
        </column>
        <column order="4" name="DateTerm" type="date">
            <summary>Date plan was terminated</summary>
        </column>
        <column order="5" name="ReleaseInfo" type="tinyint(4)">
            <summary>Release of information signature is on file.</summary>
        </column>
        <column order="6" name="AssignBen" type="tinyint(4)">
            <summary>Assignment of benefits signature is on file.  For Canada, this handles Payee Code, F01.  Option to pay other third party is not included.</summary>
        </column>
        <column order="7" name="SubscriberID" type="varchar(255)">
            <summary>Usually SSN, but can also be changed by user.  No dashes. Not allowed to be blank.</summary>
        </column>
        <column order="8" name="BenefitNotes" type="text">
            <summary>User doesn't usually put these in.  Only used when automatically requesting benefits, such as with Trojan.  All the benefits get stored here in text form for later reference.  Not at plan level because might be specific to subscriber.  If blank, we try to display a benefitNote for another subscriber to the plan.</summary>
        </column>
        <column order="9" name="SubscNote" type="text">
            <summary>Use to store any other info that affects coverage.</summary>
        </column>
    </table>
    <table name="instructor">
        <summary></summary>
        <column order="0" name="InstructorNum" type="int(11)">
            <summary></summary>
        </column>
        <column order="1" name="LName" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="2" name="FName" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="3" name="Suffix" type="varchar(100)">
            <summary></summary>
        </column>
    </table>
    <table name="journalentry">
        <summary>Used in accounting to represent a single credit or debit entry.  There will always be at least 2 journal enties attached to every transaction.  All transactions balance to 0.</summary>
        <column order="0" name="JournalEntryNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="TransactionNum" type="bigint(20)" fk="transaction">
            <summary>FK to transaction.TransactionNum</summary>
        </column>
        <column order="2" name="AccountNum" type="bigint(20)" fk="account">
            <summary>FK to account.AccountNum</summary>
        </column>
        <column order="3" name="DateDisplayed" type="date">
            <summary>Always the same for all journal entries within one transaction.</summary>
        </column>
        <column order="4" name="DebitAmt" type="double">
            <summary>Negative numbers never allowed.</summary>
        </column>
        <column order="5" name="CreditAmt" type="double">
            <summary>Negative numbers never allowed.</summary>
        </column>
        <column order="6" name="Memo" type="text">
            <summary>.</summary>
        </column>
        <column order="7" name="Splits" type="text">
            <summary>A human-readable description of the splits.  Used only for display purposes.</summary>
        </column>
        <column order="8" name="CheckNumber" type="varchar(255)">
            <summary>Any user-defined string.  Usually a check number, but can also be D for deposit, Adj, etc.</summary>
        </column>
        <column order="9" name="ReconcileNum" type="bigint(20)" fk="reconcile">
            <summary>FK to reconcile.ReconcileNum. 0 if not attached to a reconcile. Not allowed to alter amounts if attached.</summary>
        </column>
    </table>
    <table name="labcase">
        <summary>A lab case.</summary>
        <column order="0" name="LabCaseNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="LaboratoryNum" type="bigint(20)" fk="laboratory">
            <summary>FK to laboratory.LaboratoryNum. The lab that the case gets sent to.</summary>
        </column>
        <column order="3" name="AptNum" type="bigint(20)" fk="appointment">
            <summary>FK to appointment.AptNum.  This is how a lab case is attached to a scheduled appointment. 1:1 relationship for now.  Only one labcase per appointment, and (obviously) only one appointment per labcase.  Labcase can exist without being attached to any appointments at all, making this zero.</summary>
        </column>
        <column order="4" name="PlannedAptNum" type="bigint(20)" fk="appointment">
            <summary>FK to appointment.AptNum.  This is how a lab case is attached to a planned appointment in addition to the scheduled appointment.</summary>
        </column>
        <column order="5" name="DateTimeDue" type="datetime">
            <summary>The due date that is put on the labslip.  NOT when you really need the labcase back, which is usually a day or two later and is the date of the appointment this case is attached to.</summary>
        </column>
        <column order="6" name="DateTimeCreated" type="datetime">
            <summary>When this lab case was created. User can edit.</summary>
        </column>
        <column order="7" name="DateTimeSent" type="datetime">
            <summary>Time that it actually went out to the lab.</summary>
        </column>
        <column order="8" name="DateTimeRecd" type="datetime">
            <summary>Date/time received back from the lab.  If this is filled, then the case is considered received.</summary>
        </column>
        <column order="9" name="DateTimeChecked" type="datetime">
            <summary>Date/time that quality was checked.  It is now completely ready for the patient.</summary>
        </column>
        <column order="10" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="11" name="Instructions" type="text">
            <summary>The text instructions for this labcase.</summary>
        </column>
        <column order="12" name="LabFee" type="double">
            <summary>There is no UI built yet for this field.  Plugins might be making use of this field.</summary>
        </column>
    </table>
    <table name="laboratory">
        <summary>A dental laboratory. Will be attached to lab cases.</summary>
        <column order="0" name="LaboratoryNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of lab.</summary>
        </column>
        <column order="2" name="Phone" type="varchar(255)">
            <summary>Freeform text includes punctuation.</summary>
        </column>
        <column order="3" name="Notes" type="text">
            <summary>Any notes.  No practical limit to amount of text.</summary>
        </column>
        <column order="4" name="Slip" type="bigint(20)" fk="sheetdef">
            <summary>FK to sheetdef.SheetDefNum.  Lab slips can be set for individual laboratories.  If zero, then the default internal lab slip will be used instead of a custom lab slip.</summary>
        </column>
        <column order="5" name="Address" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="6" name="City" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="7" name="State" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="8" name="Zip" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="9" name="Email" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="10" name="WirelessPhone" type="varchar(255)">
            <summary>.</summary>
        </column>
    </table>
    <table name="labpanel">
        <summary>One lab panel comes back from the lab with multiple lab results.  Multiple panels can come back in one HL7 message.  This table loosely corresponds to the OBR segment.</summary>
        <column order="0" name="LabPanelNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="RawMessage" type="text">
            <summary>The entire raw HL7 message.  Can contain other labpanels in addition to this one.</summary>
        </column>
        <column order="3" name="LabNameAddress" type="varchar(255)">
            <summary>Both name and address in a single field.  OBR-20.</summary>
        </column>
        <column order="4" name="DateTStamp" type="timestamp">
            <summary>To be used for synch with web server.</summary>
        </column>
        <column order="5" name="SpecimenCondition" type="varchar(255)">
            <summary>OBR-13.  Usually blank.  Example: hemolyzed.</summary>
        </column>
        <column order="6" name="SpecimenSource" type="varchar(255)">
            <summary>OBR-15.  Usually blank.  Example: LNA&amp;Arterial Catheter&amp;HL70070.</summary>
        </column>
        <column order="7" name="ServiceId" type="varchar(255)">
            <summary>OBR-4-0, Service performed, id portion, LOINC.  For example, 24331-1.</summary>
        </column>
        <column order="8" name="ServiceName" type="varchar(255)">
            <summary>OBR-4-1, Service performed description.  Example, Lipid Panel.</summary>
        </column>
        <column order="9" name="MedicalOrderNum" type="bigint(20)" fk="medicalorder">
            <summary>FK to medicalorder.MedicalOrderNum.  Used to attach in imported lab panel to a lab order.  Multiple panels may be attached to an order.</summary>
        </column>
    </table>
    <table name="labresult">
        <summary>Medical labs, not dental labs.  Multiple labresults are attached to a labpanel.  Loosely corresponds to the OBX segment in HL7.</summary>
        <column order="0" name="LabResultNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LabPanelNum" type="bigint(20)" fk="labpanel">
            <summary>FK to labpanel.LabPanelNum.</summary>
        </column>
        <column order="2" name="DateTimeTest" type="datetime">
            <summary>OBX-14.</summary>
        </column>
        <column order="3" name="TestName" type="varchar(255)">
            <summary>OBX-3-1, text portion.</summary>
        </column>
        <column order="4" name="DateTStamp" type="timestamp">
            <summary>To be used for synch with web server.</summary>
        </column>
        <column order="5" name="TestID" type="varchar(255)">
            <summary>OBX-3-0, id portion, LOINC.  For example, 10676-5.</summary>
        </column>
        <column order="6" name="ObsValue" type="varchar(255)">
            <summary>OBX-5. Value always stored as a string because the type might vary in the future.</summary>
        </column>
        <column order="7" name="ObsUnits" type="varchar(255)">
            <summary>OBX-6  For example, mL.  Was FK to drugunit.DrugUnitNum, but that would make reliable import problematic, so now it's just text.</summary>
        </column>
        <column order="8" name="ObsRange" type="varchar(255)">
            <summary>OBX-7  For example, &lt;200 or &gt;=40.</summary>
        </column>
        <column order="9" name="AbnormalFlag" type="tinyint(4)">
            <summary>Enum:LabAbnormalFlag 0-None, 1-Below, 2-Normal, 3-Above.</summary>
        </column>
    </table>
    <table name="labturnaround">
        <summary>The amount of time it takes for a lab case to be processed at the lab.  Used to compute due dates.</summary>
        <column order="0" name="LabTurnaroundNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LaboratoryNum" type="bigint(20)" fk="laboratory">
            <summary>FK to laboratory.LaboratoryNum. The lab that this item is attached to.</summary>
        </column>
        <column order="2" name="Description" type="varchar(255)">
            <summary>The description of the service that the lab is performing.</summary>
        </column>
        <column order="3" name="DaysPublished" type="smallint(6)">
            <summary>The number of days that the lab publishes as the turnaround time for the service.</summary>
        </column>
        <column order="4" name="DaysActual" type="smallint(6)">
            <summary>The actual number of days.  Might be longer than DaysPublished due to travel time.  This is what the actual calculations will be done on.</summary>
        </column>
    </table>
    <table name="language">
        <summary>This is a list of phrases that need to be translated.  The primary key is a combination of the ClassType and the English phrase.  This table is currently filled dynmically at run time, but the plan is to fill it using a tool that parses the code.</summary>
        <column order="0" name="LanguageNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="EnglishComments" type="text">
            <summary>No longer used.</summary>
        </column>
        <column order="2" name="ClassType" type="text">
            <summary>A string representing the class where the translation is used. Maximum length is 25 characters.</summary>
        </column>
        <column order="3" name="English" type="text">
            <summary>The English version of the phrase, case sensitive.</summary>
        </column>
        <column order="4" name="IsObsolete" type="tinyint">
            <summary>As this gets more sophisticated, we will use this field to mark some phrases obsolete instead of just deleting them outright.  That way, translators will still have access to them.  For now, this is not used at all.</summary>
        </column>
    </table>
    <table name="languageforeign">
        <summary>Will usually only contain translations for a single foreign language, although more are allowed.  The primary key is a combination of the ClassType and the English phrase and the culture.</summary>
        <column order="0" name="LanguageForeignNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ClassType" type="text">
            <summary>A string representing the class where the translation is used.</summary>
        </column>
        <column order="2" name="English" type="text">
            <summary>The English version of the phrase.  Case sensitive.</summary>
        </column>
        <column order="3" name="Culture" type="varchar(255)">
            <summary>The specific culture name.  Almost always in 5 digit format like this: en-US.</summary>
        </column>
        <column order="4" name="Translation" type="text">
            <summary>The foreign translation.  Remember we use Unicode-8, so this translation can be in any language, including Russian, Hebrew, and Chinese.</summary>
        </column>
        <column order="5" name="Comments" type="text">
            <summary>Comments for other translators for the foreign language.</summary>
        </column>
    </table>
    <table name="letter">
        <summary>These are templates that are used to send simple letters to patients.</summary>
        <column order="0" name="LetterNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of the Letter.</summary>
        </column>
        <column order="2" name="BodyText" type="text">
            <summary>Text of the letter</summary>
        </column>
    </table>
    <table name="lettermerge">
        <summary>Describes the templates for letter merges to Word.</summary>
        <column order="0" name="LetterMergeNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of this letter.</summary>
        </column>
        <column order="2" name="TemplateName" type="varchar(255)">
            <summary>The filename of the Word template. eg MyTemplate.doc.</summary>
        </column>
        <column order="3" name="DataFileName" type="varchar(255)">
            <summary>The name of the data file. eg MyTemplate.txt.</summary>
        </column>
        <column order="4" name="Category" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.</summary>
        </column>
    </table>
    <table name="lettermergefield">
        <summary>When doing a lettermerge, a data file is created with certain fields.  This is a list of those fields for each lettermerge.</summary>
        <column order="0" name="FieldNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LetterMergeNum" type="bigint(20)" fk="lettermerge">
            <summary>FK to lettermerge.LetterMergeNum.</summary>
        </column>
        <column order="2" name="FieldName" type="varchar(255)">
            <summary>One of the preset available field names.</summary>
        </column>
    </table>
    <table name="medicalorder">
        <summary>Ehr. Lab and radiology orders.  Medication orders are simply fields in medicationPat.</summary>
        <column order="0" name="MedicalOrderNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="MedOrderType" type="tinyint(4)">
            <summary>Enum:MedicalOrderType Laboratory=0,Radiology=1.</summary>
        </column>
        <column order="2" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="3" name="DateTimeOrder" type="datetime">
            <summary>Date and time of order.</summary>
        </column>
        <column order="4" name="Description" type="varchar(255)">
            <summary>User will be required to type entire order out from scratch.</summary>
        </column>
        <column order="5" name="IsDiscontinued" type="tinyint(4)">
            <summary>EHR requires Active/Discontinued status. 0=Active, 1=Discontinued.</summary>
        </column>
        <column order="6" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
    </table>
    <table name="medication">
        <summary>A list of medications, not attached to any particular patient.  Not allowed to delete if in use by a patient.  Not allowed to edit name once created due to possibility of damage to patient record.</summary>
        <column order="0" name="MedicationNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="MedName" type="varchar(255)">
            <summary>Name of the medication.  User can change this.  If an RxCui is present, the RxNorm string can be pulled from the in-memory table for UI display in addition to the MedName.</summary>
        </column>
        <column order="2" name="GenericNum" type="bigint(20)" fk="medication">
            <summary>FK to medication.MedicationNum.  If this is a generic drug, then the GenericNum will be the same as the MedicationNum.</summary>
        </column>
        <column order="3" name="Notes" type="text">
            <summary>Notes.</summary>
        </column>
        <column order="4" name="DateTStamp" type="timestamp">
            <summary>The last date and time this row was altered.  Not user editable.</summary>
        </column>
        <column order="5" name="RxCui" type="bigint(20)">
            <summary>RxNorm Code identifier.</summary>
        </column>
    </table>
    <table name="medicationpat">
        <summary>Links medications to patients.  For ehr, some of these can be considered 'medication orders', but only if they contain a PatNote (instructions), a ProvNum, and a DateStart.</summary>
        <column order="0" name="MedicationPatNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="MedicationNum" type="bigint(20)" fk="medication">
            <summary>FK to medication.MedicationNum.</summary>
        </column>
        <column order="3" name="PatNote" type="text">
            <summary>Medication notes specific to this patient.</summary>
        </column>
        <column order="4" name="DateTStamp" type="timestamp">
            <summary>The last date and time this row was altered.  Not user editable.  Will be set to NOW by OD if this patient gets an OnlinePassword assigned.</summary>
        </column>
        <column order="5" name="DateStart" type="date">
            <summary>Date that the medication was started.  Can be minval if unknown.</summary>
        </column>
        <column order="6" name="DateStop" type="date">
            <summary>Date that the medication was stopped.  Can be minval if unknown.  If not minval, then this medication is "discontinued".</summary>
        </column>
        <column order="7" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
    </table>
    <table name="mount">
        <summary>A mount shows in the images module just like other images in the tree.  But it is just a container for images within it rather than an actual image itself.</summary>
        <column order="0" name="MountNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="DocCategory" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum. Categories for documents.</summary>
        </column>
        <column order="3" name="DateCreated" type="date">
            <summary>The date at which the mount itself was created. Has no bearing on the creation date of the images the mount houses.</summary>
        </column>
        <column order="4" name="Description" type="varchar(255)">
            <summary>Used to provide a document description in the image module tree-view.</summary>
        </column>
        <column order="5" name="ImgType" type="tinyint">
            <summary>Enum:ImageType This is so that an image can be properly associated with the mount in the image module tree-view.</summary>
            <Enumeration name="ImageType">
                <summary>The type of image for images module.</summary>
                <EnumValue name="Document">0- Includes scanned documents and screenshots.</EnumValue>
                <EnumValue name="Radiograph">1</EnumValue>
                <EnumValue name="Photo">2</EnumValue>
                <EnumValue name="File">3- For instance a Word document or a spreadsheet. Not an image.</EnumValue>
                <EnumValue name="Mount">4- For xray mount sets.</EnumValue>
            </Enumeration>
        </column>
        <column order="6" name="Note" type="text">
            <summary>To allow the user to enter specific information regarding the exam and tooth numbers, as well as points on interest in the xray images.</summary>
        </column>
        <column order="7" name="Width" type="int(11)">
            <summary>The static width of the mount, in pixels.</summary>
        </column>
        <column order="8" name="Height" type="int(11)">
            <summary>The static height of the mount, in pixels.</summary>
        </column>
    </table>
    <table name="mountdef">
        <summary>THIS TABLE IS NOT BEING USED.  These can be freely deleted, renamed, moved, etc. without affecting any patient info.  mountitemdef</summary>
        <column order="0" name="MountDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="ItemOrder" type="int(11)">
            <summary>The order that the mount defs will show in various lists.</summary>
        </column>
        <column order="3" name="IsRadiograph" type="tinyint">
            <summary>Set to true if this is just xrays.  If true, this prevents image from being scaled to fit inside the mount.  If false (composite photographs for example) then the images will be scaled to fit inside the mount. Later, the basic appearance or background color might be set based on this flag as well.</summary>
        </column>
        <column order="4" name="Width" type="int(11)">
            <summary>The width of the mount, in pixels.  For radiograph mounts, this could be very large.  It must be large enough for the radiographs to fit in the mount without scaling.  For photos, it should also be large so that the scaling won't be too noticeable.  Shrinking to view or print will always produce nicer results than enlarging to view or print.</summary>
        </column>
        <column order="5" name="Height" type="int(11)">
            <summary>Height of the mount in pixels.</summary>
        </column>
    </table>
    <table name="mountitem">
        <summary>These are always attached to a mount and are constant. Should not be deleted, but rather updated if geometry changes.</summary>
        <column order="0" name="MountItemNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="MountNum" type="bigint(20)" fk="mount">
            <summary>FK to mount.MountNum.</summary>
        </column>
        <column order="2" name="Xpos" type="int(11)">
            <summary>The x position, in pixels, of the item on the mount.</summary>
        </column>
        <column order="3" name="Ypos" type="int(11)">
            <summary>The y position, in pixels, of the item on the mount.</summary>
        </column>
        <column order="4" name="OrdinalPos" type="int(11)">
            <summary>The ordinal position of the item on the mount.</summary>
        </column>
        <column order="5" name="Width" type="int(11)">
            <summary>The scaled or unscaled width of the mount item in pixels.</summary>
        </column>
        <column order="6" name="Height" type="int(11)">
            <summary>The scaled or unscaled height of the mount item in pixels.</summary>
        </column>
    </table>
    <table name="mountitemdef">
        <summary>THIS TABLE IS NOT BEING USED.  These are always attached to mountdefs.  Can be deleted without any problems.</summary>
        <column order="0" name="MountItemDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="MountDefNum" type="bigint(20)" fk="mountdef">
            <summary>FK to mountdef.MountDefNum.</summary>
        </column>
        <column order="2" name="Xpos" type="int(11)">
            <summary>The x position, in pixels, of the item on the mount.</summary>
        </column>
        <column order="3" name="Ypos" type="int(11)">
            <summary>The y position, in pixels, of the item on the mount.</summary>
        </column>
        <column order="4" name="Width" type="int(11)">
            <summary>Ignored if mount IsRadiograph.  For other mounts, the image will be scaled to fit within this space.  Any cropping, rotating, etc, will all be defined in the original image itself.</summary>
        </column>
        <column order="5" name="Height" type="int(11)">
            <summary>Ignored if mount IsRadiograph.  For other mounts, the image will be scaled to fit within this space.  Any cropping, rotating, etc, will all be defined in the original image itself.</summary>
        </column>
    </table>
    <table name="operatory">
        <summary>Each row is a single operatory or column in the appts module.</summary>
        <column order="0" name="OperatoryNum" type="bigint(20)">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="OpName" type="varchar(255)">
            <summary>The full name to show in the column.</summary>
        </column>
        <column order="2" name="Abbrev" type="varchar(255)">
            <summary>5 char or less. Not used much.</summary>
        </column>
        <column order="3" name="ItemOrder" type="smallint">
            <summary>The order that this op column will show.  Changing views only hides some ops; it does not change their order.</summary>
        </column>
        <column order="4" name="IsHidden" type="tinyint">
            <summary>Used instead of deleting to hide an op that is no longer used.</summary>
        </column>
        <column order="5" name="ProvDentist" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  The dentist assigned to this op.  If more than one dentist might be assigned to an op, then create a second op and use one for each dentist. If 0, then no dentist is assigned.</summary>
        </column>
        <column order="6" name="ProvHygienist" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  The hygienist assigned to this op.  If 0, then no hygienist is assigned.</summary>
        </column>
        <column order="7" name="IsHygiene" type="tinyint">
            <summary>Set true if this is a hygiene operatory.  The hygienist will then be considered the main provider for this op.</summary>
        </column>
        <column order="8" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  0 if no clinic.</summary>
        </column>
        <column order="9" name="DateTStamp" type="timestamp">
            <summary></summary>
        </column>
        <column order="10" name="SetProspective" type="tinyint(4)">
            <summary>If true patients put into this operatory will have status set to prospective.</summary>
        </column>
    </table>
    <table name="orionproc">
        <summary>This table is only used by one customer.  1:1 relationship to procedurelog table.</summary>
        <column order="0" name="OrionProcNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ProcNum" type="bigint(20)" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum</summary>
        </column>
        <column order="2" name="DPC" type="tinyint(4)">
            <summary>Enum:OrionDPC NotSpecified=0,None=1,_1A=2,_1B=3,_1C=4,_2=5,_3=6,_4=7,_5=8.</summary>
            <Enumeration name="OrionDPC">
                <summary />
                <EnumValue name="NotSpecified">0- Not Specified</EnumValue>
                <EnumValue name="None">1- None</EnumValue>
                <EnumValue name="_1A">2- Treatment to be scheduled within 1 calendar day</EnumValue>
                <EnumValue name="_1B">3- Treatment to be scheduled within 30 calendar days</EnumValue>
                <EnumValue name="_1C">4- Treatment to be scheduled within 60 calendar days</EnumValue>
                <EnumValue name="_2">5– Treatment to be scheduled within 120 calendar days</EnumValue>
                <EnumValue name="_3">6– Treatment to be scheduled within 1 year</EnumValue>
                <EnumValue name="_4">7– No further treatment is needed, no appointment needed</EnumValue>
                <EnumValue name="_5">8– No appointment needed </EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="DateScheduleBy" type="date">
            <summary>System adds days to the diagnosis date based upon the DPC entered for that procedure. If DPC = none the system will return “No Schedule by Date”. </summary>
        </column>
        <column order="4" name="DateStopClock" type="date">
            <summary> Default to current date.  Provider shall have to ability to edit with a previous date, but not a future date.</summary>
        </column>
        <column order="5" name="Status2" type="int(11)">
            <summary>Enum:OrionStatus None=0,TP=1,C=2,E=4,R=8,RO=16,CS=32,CR=64,CA-Tx=128,CA-ERPD=256,CA-P/D=512,S=1024,ST=2048,W=4096,A=8192</summary>
            <Enumeration name="OrionStatus">
                <summary />
                <EnumValue name="None">0- None.  While a normal orion proc would never have this status2, it is still needed for flags in ChartViews.  And it's also possible that a status2 slipped through the cracks and was not assigned, leaving it with this value.</EnumValue>
                <EnumValue name="TP">1– Treatment planned</EnumValue>
                <EnumValue name="C">2– Completed</EnumValue>
                <EnumValue name="E">4– Existing prior to incarceration</EnumValue>
                <EnumValue name="R">8– Refused treatment</EnumValue>
                <EnumValue name="RO">16– Referred out to specialist</EnumValue>
                <EnumValue name="CS">32– Completed by specialist</EnumValue>
                <EnumValue name="CR">64– Completed by registry</EnumValue>
                <EnumValue name="CA_Tx">128- Cancelled, tx plan changed</EnumValue>
                <EnumValue name="CA_EPRD">256- Cancelled, eligible parole</EnumValue>
                <EnumValue name="CA_PD">512- Cancelled, parole/discharge</EnumValue>
                <EnumValue name="S">1024– Suspended, unacceptable plaque</EnumValue>
                <EnumValue name="ST">2048- Stop clock, multi visit</EnumValue>
                <EnumValue name="W">4096– Watch</EnumValue>
                <EnumValue name="A">8192– Alternative</EnumValue>
            </Enumeration>
        </column>
        <column order="6" name="IsOnCall" type="tinyint(4)">
            <summary>.</summary>
        </column>
        <column order="7" name="IsEffectiveComm" type="tinyint(4)">
            <summary>Indicates in the clinical note that effective communication was used for this encounter.</summary>
        </column>
        <column order="8" name="IsRepair" type="tinyint(4)">
            <summary>.</summary>
        </column>
        <column order="9" name="DPCpost" type="tinyint(4)">
            <summary>Enum:OrionDPC None=0,1A=1,1B=2,1C=3,2=4,3=5,4=6,5=7</summary>
            <Enumeration name="OrionDPC">
                <summary />
                <EnumValue name="NotSpecified">0- Not Specified</EnumValue>
                <EnumValue name="None">1- None</EnumValue>
                <EnumValue name="_1A">2- Treatment to be scheduled within 1 calendar day</EnumValue>
                <EnumValue name="_1B">3- Treatment to be scheduled within 30 calendar days</EnumValue>
                <EnumValue name="_1C">4- Treatment to be scheduled within 60 calendar days</EnumValue>
                <EnumValue name="_2">5– Treatment to be scheduled within 120 calendar days</EnumValue>
                <EnumValue name="_3">6– Treatment to be scheduled within 1 year</EnumValue>
                <EnumValue name="_4">7– No further treatment is needed, no appointment needed</EnumValue>
                <EnumValue name="_5">8– No appointment needed </EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="orthochart">
        <summary>For the orthochart feature, each row in this table is one cell in that grid.  An empty cell corresponds to a missing db table row.</summary>
        <column order="0" name="OrthoChartNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="DateService" type="date">
            <summary>Date of service.</summary>
        </column>
        <column order="3" name="FieldName" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="4" name="FieldValue" type="text">
            <summary>.</summary>
        </column>
    </table>
    <table name="patfield">
        <summary>These are custom fields added and managed by the user.</summary>
        <column order="0" name="PatFieldNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="FieldName" type="varchar(255)" fk="patfielddef">
            <summary>FK to patfielddef.FieldName.  The full name is shown here for ease of use when running queries.  But the user is only allowed to change fieldNames in the patFieldDef setup window.</summary>
        </column>
        <column order="3" name="FieldValue" type="text">
            <summary>Any text that the user types in.  For picklists, this will contain the picked text.  For dates, this is stored as the user typed it, after validating that it could be parsed.  So queries that involve dates won't work very well.  If we want better handling of date fields, we should add a column to this table.  Checkbox will either have a value of 1, or else the row will be deleted from the db.  Currency is handled in a culture neutral way, just like other currency in the db.</summary>
        </column>
    </table>
    <table name="patfielddef">
        <summary>These are the definitions for the custom patient fields added and managed by the user.</summary>
        <column order="0" name="PatFieldDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="FieldName" type="varchar(255)">
            <summary>The name of the field that the user will be allowed to fill in the patient info window.</summary>
        </column>
        <column order="2" name="FieldType" type="tinyint(4)">
            <summary>Enum:PatFieldType Text=0,PickList=1,Date=2,Checkbox=3,Currency=4</summary>
        </column>
        <column order="3" name="PickList" type="text">
            <summary>The text that contains pick list values.</summary>
        </column>
    </table>
    <table name="patient">
        <summary>One row for each patient.  Includes deleted patients.</summary>
        <column order="0" name="PatNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LName" type="varchar(100)">
            <summary>Last name.</summary>
        </column>
        <column order="2" name="FName" type="varchar(100)">
            <summary>First name.</summary>
        </column>
        <column order="3" name="MiddleI" type="varchar(100)">
            <summary>Middle initial or name.</summary>
        </column>
        <column order="4" name="Preferred" type="varchar(100)">
            <summary>Preferred name, aka nickname.</summary>
        </column>
        <column order="5" name="PatStatus" type="tinyint">
            <summary>Enum:PatientStatus</summary>
            <Enumeration name="PatientStatus">
                <summary />
                <EnumValue name="Patient">0</EnumValue>
                <EnumValue name="NonPatient">1</EnumValue>
                <EnumValue name="Inactive">2</EnumValue>
                <EnumValue name="Archived">3</EnumValue>
                <EnumValue name="Deleted">4</EnumValue>
                <EnumValue name="Deceased">5</EnumValue>
                <EnumValue name="Prospective">6- Not an actual patient yet.</EnumValue>
            </Enumeration>
        </column>
        <column order="6" name="Gender" type="tinyint">
            <summary>Enum:PatientGender</summary>
            <Enumeration name="PatientGender">
                <summary />
                <EnumValue name="Male">0</EnumValue>
                <EnumValue name="Female">1</EnumValue>
                <EnumValue name="Unknown">2- This is not a joke. Required by HIPAA for privacy.  Required by ehr to track missing entries.</EnumValue>
            </Enumeration>
        </column>
        <column order="7" name="Position" type="tinyint">
            <summary>Enum:PatientPosition Marital status would probably be a better name for this column.</summary>
            <Enumeration name="PatientPosition">
                <summary />
                <EnumValue name="Single">0</EnumValue>
                <EnumValue name="Married">1</EnumValue>
                <EnumValue name="Child">2</EnumValue>
                <EnumValue name="Widowed">3</EnumValue>
                <EnumValue name="Divorced">4</EnumValue>
            </Enumeration>
        </column>
        <column order="8" name="Birthdate" type="date">
            <summary>Age is not stored in the database.  Age is always calculated as needed from birthdate.</summary>
        </column>
        <column order="9" name="SSN" type="varchar(100)">
            <summary>In the US, this is 9 digits, no dashes. For all other countries, any punctuation or format is allowed.</summary>
        </column>
        <column order="10" name="Address" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="11" name="Address2" type="varchar(100)">
            <summary>Optional second address line.</summary>
        </column>
        <column order="12" name="City" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="13" name="State" type="varchar(100)">
            <summary>2 Char in USA</summary>
        </column>
        <column order="14" name="Zip" type="varchar(100)">
            <summary>Postal code.  For Canadian claims, it must be ANANAN.  No validation gets done except there.</summary>
        </column>
        <column order="15" name="HmPhone" type="varchar(30)">
            <summary>Home phone. Includes any punctuation</summary>
        </column>
        <column order="16" name="WkPhone" type="varchar(30)">
            <summary>.</summary>
        </column>
        <column order="17" name="WirelessPhone" type="varchar(30)">
            <summary>.</summary>
        </column>
        <column order="18" name="Guarantor" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  Head of household.</summary>
        </column>
        <column order="19" name="CreditType" type="char(1)">
            <summary>Single char. Shows at upper right corner of appointments.  Suggested use is A,B,or C to designate creditworthiness, but it can actually be used for any purpose.</summary>
        </column>
        <column order="20" name="Email" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="21" name="Salutation" type="varchar(100)">
            <summary>Dear __.  This field does not include the "Dear" or a trailing comma.  If this field is blank, then the typical salutation is FName.  Or, if a Preferred name is present, that is used instead of FName.</summary>
        </column>
        <column order="22" name="EstBalance" type="double">
            <summary>Current patient balance.(not family). Never subtracts insurance estimates.</summary>
        </column>
        <column order="23" name="PriProv" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  The patient's primary provider.  Required.  The database maintenance tool ensures that every patient always has this number set, so the program no longer has to handle 0.</summary>
        </column>
        <column order="24" name="SecProv" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  Secondary provider (hygienist). Optional.</summary>
        </column>
        <column order="25" name="FeeSched" type="bigint(20)" fk="feesched">
            <summary>FK to feesched.FeeSchedNum.  Fee schedule for this patient.  Usually not used.  If missing, the practice default fee schedule is used. If patient has insurance, then the fee schedule for the insplan is used.</summary>
        </column>
        <column order="26" name="BillingType" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.  Must have a value, or the patient will not show on some reports.</summary>
        </column>
        <column order="27" name="ImageFolder" type="varchar(100)">
            <summary>Name of folder where images will be stored. Not editable for now.</summary>
        </column>
        <column order="28" name="AddrNote" type="text">
            <summary>Address or phone note.  Unlimited length in order to handle data from other programs during a conversion.</summary>
        </column>
        <column order="29" name="FamFinUrgNote" type="text">
            <summary>Family financial urgent note.  Only stored with guarantor, and shared for family.</summary>
        </column>
        <column order="30" name="MedUrgNote" type="varchar(255)">
            <summary>Individual patient note for Urgent medical.</summary>
        </column>
        <column order="31" name="ApptModNote" type="varchar(255)">
            <summary>Individual patient note for Appointment module note.</summary>
        </column>
        <column order="32" name="StudentStatus" type="char(1)">
            <summary>Single char for Nonstudent, Parttime, or Fulltime.  Blank also=Nonstudent</summary>
        </column>
        <column order="33" name="SchoolName" type="varchar(255)">
            <summary>College name.  If Canadian, then this is field C10 and must be filled if C9 (patient.CanadianEligibilityCode) is 1 and patient is 18 or older.</summary>
        </column>
        <column order="34" name="ChartNumber" type="varchar(20)">
            <summary>Max 15 char.  Used for reference to previous programs.</summary>
        </column>
        <column order="35" name="MedicaidID" type="varchar(20)">
            <summary>Optional. The Medicaid ID for this patient.</summary>
        </column>
        <column order="36" name="Bal_0_30" type="double">
            <summary>Aged balance from 0 to 30 days old. Aging numbers are for entire family.  Only stored with guarantor.</summary>
        </column>
        <column order="37" name="Bal_31_60" type="double">
            <summary>Aged balance from 31 to 60 days old. Aging numbers are for entire family.  Only stored with guarantor.</summary>
        </column>
        <column order="38" name="Bal_61_90" type="double">
            <summary>Aged balance from 61 to 90 days old. Aging numbers are for entire family.  Only stored with guarantor.</summary>
        </column>
        <column order="39" name="BalOver90" type="double">
            <summary>Aged balance over 90 days old. Aging numbers are for entire family.  Only stored with guarantor.</summary>
        </column>
        <column order="40" name="InsEst" type="double">
            <summary>Insurance Estimate for entire family.</summary>
        </column>
        <column order="41" name="BalTotal" type="double">
            <summary>Total balance for entire family before insurance estimate.  Not the same as the sum of the 4 aging balances because this can be negative.  Only stored with guarantor.</summary>
        </column>
        <column order="42" name="EmployerNum" type="bigint(20)" fk="employer">
            <summary>FK to employer.EmployerNum.</summary>
        </column>
        <column order="43" name="EmploymentNote" type="varchar(255)">
            <summary>Not used since version 2.8.</summary>
        </column>
        <column order="44" name="Race" type="tinyint(4)">
            <summary>Enum:PatientRace Race and ethnicity.</summary>
            <Enumeration name="PatientRace">
                <summary>Race and ethnicity for patient. Used by public health.  The problem is that everyone seems to want different choices.  If we give these choices their own table, then we also need to include mapping functions.  These are currently used in ArizonaReports, HL7 w ECW, and EHR.  Foreign users would like their own mappings.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Multiracial">1</EnumValue>
                <EnumValue name="HispanicLatino">2</EnumValue>
                <EnumValue name="AfricanAmerican">3</EnumValue>
                <EnumValue name="White">4</EnumValue>
                <EnumValue name="HawaiiOrPacIsland">5</EnumValue>
                <EnumValue name="AmericanIndian">6</EnumValue>
                <EnumValue name="Asian">7</EnumValue>
                <EnumValue name="Other">8</EnumValue>
                <EnumValue name="Aboriginal">9</EnumValue>
                <EnumValue name="BlackHispanic">10 - Required by EHR.</EnumValue>
            </Enumeration>
        </column>
        <column order="45" name="County" type="varchar(255)" fk="county">
            <summary>FK to county.CountyName, although it will not crash if key absent.</summary>
        </column>
        <column order="46" name="GradeLevel" type="tinyint(4)">
            <summary>Enum:PatientGrade Gradelevel.</summary>
            <Enumeration name="PatientGrade">
                <summary>Grade level used in public health.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="First">1</EnumValue>
                <EnumValue name="Second">2</EnumValue>
                <EnumValue name="Third">3</EnumValue>
                <EnumValue name="Fourth">4</EnumValue>
                <EnumValue name="Fifth">5</EnumValue>
                <EnumValue name="Sixth">6</EnumValue>
                <EnumValue name="Seventh">7</EnumValue>
                <EnumValue name="Eighth">8</EnumValue>
                <EnumValue name="Ninth">9</EnumValue>
                <EnumValue name="Tenth">10</EnumValue>
                <EnumValue name="Eleventh">11</EnumValue>
                <EnumValue name="Twelfth">12</EnumValue>
                <EnumValue name="PrenatalWIC">13</EnumValue>
                <EnumValue name="PreK">14</EnumValue>
                <EnumValue name="Kindergarten">15</EnumValue>
                <EnumValue name="Other">16</EnumValue>
            </Enumeration>
        </column>
        <column order="47" name="Urgency" type="tinyint(4)">
            <summary>Enum:TreatmentUrgency Used in public health screenings.</summary>
            <Enumeration name="TreatmentUrgency">
                <summary>For public health.  Unknown, NoProblems, NeedsCarE, or Urgent.</summary>
                <EnumValue name="Unknown"></EnumValue>
                <EnumValue name="NoProblems"></EnumValue>
                <EnumValue name="NeedsCare"></EnumValue>
                <EnumValue name="Urgent"></EnumValue>
            </Enumeration>
        </column>
        <column order="48" name="DateFirstVisit" type="date">
            <summary>The date that the patient first visited the office.  Automated.</summary>
        </column>
        <column order="49" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum. Can be zero if not attached to a clinic or no clinics set up.</summary>
        </column>
        <column order="50" name="HasIns" type="varchar(255)">
            <summary>For now, an 'I' indicates that the patient has insurance.  This is only used when displaying appointments.  It will later be expanded.  User can't edit.</summary>
        </column>
        <column order="51" name="TrophyFolder" type="varchar(255)">
            <summary>The Trophy bridge is inadequate.  This is an attempt to make it usable for offices that have already invested in Trophy hardware.</summary>
        </column>
        <column order="52" name="PlannedIsDone" type="tinyint">
            <summary>This simply indicates whether the 'done' box is checked in the chart module.  Used to be handled as a -1 in the NextAptNum field, but now that field is unsigned.</summary>
        </column>
        <column order="53" name="Premed" type="tinyint">
            <summary>Set to true if patient needs to be premedicated for appointments, includes PAC, halcion, etc.</summary>
        </column>
        <column order="54" name="Ward" type="varchar(255)">
            <summary>Only used in hospitals.</summary>
        </column>
        <column order="55" name="PreferConfirmMethod" type="tinyint">
            <summary>Enum:ContactMethod</summary>
            <Enumeration name="ContactMethod">
                <summary />
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="DoNotCall">1</EnumValue>
                <EnumValue name="HmPhone">2</EnumValue>
                <EnumValue name="WkPhone">3</EnumValue>
                <EnumValue name="WirelessPh">4</EnumValue>
                <EnumValue name="Email">5</EnumValue>
                <EnumValue name="SeeNotes">6</EnumValue>
                <EnumValue name="Mail">7</EnumValue>
                <EnumValue name="TextMessage">8</EnumValue>
            </Enumeration>
        </column>
        <column order="56" name="PreferContactMethod" type="tinyint">
            <summary>Enum:ContactMethod</summary>
            <Enumeration name="ContactMethod">
                <summary />
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="DoNotCall">1</EnumValue>
                <EnumValue name="HmPhone">2</EnumValue>
                <EnumValue name="WkPhone">3</EnumValue>
                <EnumValue name="WirelessPh">4</EnumValue>
                <EnumValue name="Email">5</EnumValue>
                <EnumValue name="SeeNotes">6</EnumValue>
                <EnumValue name="Mail">7</EnumValue>
                <EnumValue name="TextMessage">8</EnumValue>
            </Enumeration>
        </column>
        <column order="57" name="PreferRecallMethod" type="tinyint">
            <summary>Enum:ContactMethod</summary>
            <Enumeration name="ContactMethod">
                <summary />
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="DoNotCall">1</EnumValue>
                <EnumValue name="HmPhone">2</EnumValue>
                <EnumValue name="WkPhone">3</EnumValue>
                <EnumValue name="WirelessPh">4</EnumValue>
                <EnumValue name="Email">5</EnumValue>
                <EnumValue name="SeeNotes">6</EnumValue>
                <EnumValue name="Mail">7</EnumValue>
                <EnumValue name="TextMessage">8</EnumValue>
            </Enumeration>
        </column>
        <column order="58" name="SchedBeforeTime" type="time">
            <summary>.</summary>
        </column>
        <column order="59" name="SchedAfterTime" type="time">
            <summary>.</summary>
        </column>
        <column order="60" name="SchedDayOfWeek" type="tinyint">
            <summary>We do not use this, but some users do, so here it is. 0=none. Otherwise, 1-7 for day.</summary>
        </column>
        <column order="61" name="Language" type="varchar(100)">
            <summary>The primary language of the patient.  Typically en, fr, es, or similar.  We might later also allow cultures and user-defined languages.</summary>
        </column>
        <column order="62" name="AdmitDate" type="date">
            <summary>Used in hospitals.  It can be before the first visit date.  It typically gets set automatically by the hospital system.</summary>
        </column>
        <column order="63" name="Title" type="varchar(15)">
            <summary>Includes any punctuation.  For example, Mr., Mrs., Miss, Dr., etc.  There is no selection mechanism yet for user; they must simply type it in.</summary>
        </column>
        <column order="64" name="PayPlanDue" type="double">
            <summary>.</summary>
        </column>
        <column order="65" name="SiteNum" type="bigint(20)" fk="site">
            <summary>FK to site.SiteNum. Can be zero. Replaces the old GradeSchool field with a proper foreign key.</summary>
        </column>
        <column order="66" name="DateTStamp" type="timestamp">
            <summary>The last date and time this row was altered.  Not user editable.</summary>
        </column>
        <column order="67" name="ResponsParty" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum. Can be zero.  Person responsible for medical decisions rather than finances.  Guarantor is still responsible for finances.  This is useful for nursing home residents.  Part of public health.</summary>
        </column>
        <column order="68" name="CanadianEligibilityCode" type="tinyint(4)">
            <summary>C09.  Eligibility Exception Code.  A single digit 1-4.  0 is not acceptable for e-claims. 1=FT student, 2=disabled, 3=disabled student, 4=code not applicable.  Warning.  4 is a 0 if using CDAnet version 02.</summary>
        </column>
        <column order="69" name="AskToArriveEarly" type="int(11)">
            <summary>Number of minutes patient is asked to come early to appointments.</summary>
        </column>
        <column order="70" name="OnlinePassword" type="varchar(255)">
            <summary>If this is blank, then the chart info for this patient will not be uploaded.  If this has a value, then this is the password that a patient must use to access their info online.</summary>
        </column>
        <column order="71" name="SmokeStatus" type="tinyint(4)">
            <summary>Enum:SmokingStatus  0=UnknownIfEver,1=SmokerUnkownCurrent,2=NeverSmoked,3=FormerSmoker,4=CurrentSomeDay,5=CurrentEveryDay</summary>
            <Enumeration name="SmokingStatus">
                <summary>0=UnknownIfEver,1=SmokerUnkownCurrent,2=NeverSmoked,3=FormerSmoker,4=CurrentSomeDay,5=CurrentEveryDay</summary>
                <EnumValue name="UnknownIfEver_Recode9">0</EnumValue>
                <EnumValue name="SmokerUnknownCurrent_Recode5">1</EnumValue>
                <EnumValue name="NeverSmoked_Recode4">2</EnumValue>
                <EnumValue name="FormerSmoker_Recode3">3</EnumValue>
                <EnumValue name="CurrentSomeDay_Recode2">4</EnumValue>
                <EnumValue name="CurrentEveryDay_Recode1">5</EnumValue>
            </Enumeration>
        </column>
        <column order="72" name="PreferContactConfidential" type="tinyint(4)">
            <summary>Enum:ContactMethod  Used for EHR.</summary>
            <Enumeration name="ContactMethod">
                <summary />
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="DoNotCall">1</EnumValue>
                <EnumValue name="HmPhone">2</EnumValue>
                <EnumValue name="WkPhone">3</EnumValue>
                <EnumValue name="WirelessPh">4</EnumValue>
                <EnumValue name="Email">5</EnumValue>
                <EnumValue name="SeeNotes">6</EnumValue>
                <EnumValue name="Mail">7</EnumValue>
                <EnumValue name="TextMessage">8</EnumValue>
            </Enumeration>
        </column>
        <column order="73" name="SuperFamily" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  If this is the same as PatNum, then this is a SuperHead.  If zero, then not part of a superfamily.  Synched for entire family.  If family is part of a superfamily, then the guarantor for this family will show in the superfamily list in the Family module for anyone else who is in the superfamily.  Only a guarantor can be a superfamily head.</summary>
        </column>
    </table>
    <table name="patientnote">
        <summary>Essentially more columns in the patient table.  They are stored here because these fields can contain a lot of information, and we want to try to keep the size of the patient table a bit smaller.</summary>
        <column order="0" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  Also the primary key for this table. Always one to one relationship with patient table.  A new patient might not have an entry here until needed.</summary>
        </column>
        <column order="1" name="FamFinancial" type="text">
            <summary>Only one note per family stored with guarantor.</summary>
        </column>
        <column order="2" name="ApptPhone" type="text">
            <summary>No longer used.</summary>
        </column>
        <column order="3" name="Medical" type="text">
            <summary>Medical Summary</summary>
        </column>
        <column order="4" name="Service" type="text">
            <summary>Service notes</summary>
        </column>
        <column order="5" name="MedicalComp" type="text">
            <summary>Complete current Medical History</summary>
        </column>
        <column order="6" name="Treatment" type="text">
            <summary>Shows in the Chart module just below the graphical tooth chart.</summary>
        </column>
    </table>
    <table name="patplan">
        <summary>Each row represents the linking of one insplan to one patient for current coverage.  Dropping a plan will delete the entry in this table.  Deleting a plan will delete the actual insplan (if no dependencies).</summary>
        <column order="0" name="PatPlanNum" type="bigint(20)">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk=" patient">
            <summary>FK to  patient.PatNum.  The patient who currently has the insurance.  Not the same as the subscriber.</summary>
        </column>
        <column order="2" name="Ordinal" type="tinyint">
            <summary>Number like 1, 2, 3, etc.  Represents primary ins, secondary ins, tertiary ins, etc. 0 is not used</summary>
        </column>
        <column order="3" name="IsPending" type="tinyint">
            <summary>For informational purposes only. For now, we lose the previous feature which let us set isPending without entering a plan.  Now, you have to enter the plan in order to check this box.</summary>
        </column>
        <column order="4" name="Relationship" type="tinyint">
            <summary>Enum:Relat Remember that this may need to be changed in the Claim also, if already created.</summary>
            <Enumeration name="Relat">
                <summary>Relationship to subscriber for insurance.</summary>
                <EnumValue name="Self">0</EnumValue>
                <EnumValue name="Spouse">1</EnumValue>
                <EnumValue name="Child">2</EnumValue>
                <EnumValue name="Employee">3</EnumValue>
                <EnumValue name="HandicapDep">4</EnumValue>
                <EnumValue name="SignifOther">5</EnumValue>
                <EnumValue name="InjuredPlaintiff">6</EnumValue>
                <EnumValue name="LifePartner">7</EnumValue>
                <EnumValue name="Dependent">8</EnumValue>
            </Enumeration>
        </column>
        <column order="5" name="PatID" type="varchar(100)">
            <summary>An optional patient ID which will override the insplan.SubscriberID on eclaims.  For Canada, this holds the Dependent Code, C17 and E17, and in that use it doesn't override subscriber id, but instead supplements it.</summary>
        </column>
        <column order="6" name="InsSubNum" type="bigint(20)" fk="inssub">
            <summary>FK to inssub.InsSubNum.  Gives info about the subscriber.</summary>
        </column>
    </table>
    <table name="payment">
        <summary>A patient payment.  Always has at least one split.</summary>
        <column order="0" name="PayNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PayType" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.  This will be 0 if this is an income transfer to another provider.</summary>
        </column>
        <column order="2" name="PayDate" type="date">
            <summary>The date that the payment displays on the patient account.</summary>
        </column>
        <column order="3" name="PayAmt" type="double">
            <summary>Amount of the payment.  Must equal the sum of the splits.</summary>
        </column>
        <column order="4" name="CheckNum" type="varchar(25)">
            <summary>Check number is optional.</summary>
        </column>
        <column order="5" name="BankBranch" type="varchar(25)">
            <summary>Bank-branch for checks.</summary>
        </column>
        <column order="6" name="PayNote" type="varchar(255)">
            <summary>Any admin note.  Not for patient to see.</summary>
        </column>
        <column order="7" name="IsSplit" type="tinyint">
            <summary>Set to true to indicate that a payment is split.  Just makes a few functions easier.  Might be eliminated.</summary>
        </column>
        <column order="8" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  The patient where the payment entry will show.  But only the splits affect account balances.  This has a value even if the 'payment' is actually an income transfer to another provider.</summary>
        </column>
        <column order="9" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  Can be 0. Copied from patient.ClinicNum when creating payment, but user can override.  Not used in provider income transfers.  Cannot be used in financial reporting when grouping by clinic, because payments may be split between clinics.</summary>
        </column>
        <column order="10" name="DateEntry" type="date">
            <summary>The date that this payment was entered.  Not user editable.</summary>
        </column>
        <column order="11" name="DepositNum" type="bigint(20)" fk="deposit">
            <summary>FK to deposit.DepositNum.  0 if not attached to any deposits.  Cash does not usually get attached to a deposit; only checks.</summary>
        </column>
        <column order="12" name="Receipt" type="text">
            <summary>Text of printed receipt if the payment was done electronically. Allows reprinting if needed. Only used for PayConnect at the moment, but plans to use for XCharge as well.</summary>
        </column>
        <column order="13" name="IsRecurringCC" type="tinyint(4)">
            <summary>True if this was an automatically added recurring CC charge rather then one entered by the user.  This was set to true for all historical entries before version 11.1, but will be accurate after that.</summary>
        </column>
    </table>
    <table name="payperiod">
        <summary>Used to view employee timecards.  Timecard entries are not linked to a pay period.  Instead, payperiods are setup, and the user can only view specific pay periods.  So it feels like they are linked, but it's date based.</summary>
        <column order="0" name="PayPeriodNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="DateStart" type="date">
            <summary>The first day of the payperiod</summary>
        </column>
        <column order="2" name="DateStop" type="date">
            <summary>The last day of the payperiod.</summary>
        </column>
        <column order="3" name="DatePaycheck" type="date">
            <summary>The date that paychecks will be dated.  A few days after the dateStop.  Optional.</summary>
        </column>
    </table>
    <table name="payplan">
        <summary>Each row represents one signed agreement to make payments. </summary>
        <column order="0" name="PayPlanNum" type="bigint(20)">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  The patient who had the treatment done.</summary>
        </column>
        <column order="2" name="Guarantor" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  The person responsible for the payments.  Does not need to be in the same family as the patient.  Will be 0 if planNum has a value.</summary>
        </column>
        <column order="3" name="PayPlanDate" type="date">
            <summary>Date that the payment plan will display in the account.</summary>
        </column>
        <column order="4" name="APR" type="double">
            <summary>Annual percentage rate.  eg 18.  This does not take into consideration any late payments, but only the percentage used to calculate the amortization schedule.</summary>
        </column>
        <column order="5" name="Note" type="text">
            <summary>Generally used to archive the terms when the amortization schedule is created.</summary>
        </column>
        <column order="6" name="PlanNum" type="bigint(20)" fk="insplan">
            <summary>FK to insplan.PlanNum.  Will be 0 if standard payment plan.  But if this is being used to track expected insurance payments, then this will be the foreign key to insplan.PlanNum and Guarantor will be 0.</summary>
        </column>
        <column order="7" name="CompletedAmt" type="double">
            <summary>The amount of the treatment that has already been completed.  This should match the sum of the principal amounts for most situations.  But if the procedures have not yet been completed, and the payment plan is to make any sense, then this number must be changed.</summary>
        </column>
        <column order="8" name="InsSubNum" type="bigint(20)" fk="inssub">
            <summary>FK to inssub.InsSubNum.</summary>
        </column>
    </table>
    <table name="payplancharge">
        <summary>One of the dated charges attached to a payment plan.  This has nothing to do with payments, but rather just causes the amount due to increase on the date of the charge.  The amount of the charge is the sum of the principal and the interest.</summary>
        <column order="0" name="PayPlanChargeNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PayPlanNum" type="bigint(20)" fk="payplan">
            <summary>FK to payplan.PayPlanNum.</summary>
        </column>
        <column order="2" name="Guarantor" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  The guarantor account that each charge will affect.</summary>
        </column>
        <column order="3" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  The patient account that the principal gets removed from.</summary>
        </column>
        <column order="4" name="ChargeDate" type="date">
            <summary>The date that the charge will show on the patient account.  Any charge with a future date will not show on the account yet and will not affect the balance.</summary>
        </column>
        <column order="5" name="Principal" type="double">
            <summary>The principal portion of this payment.</summary>
        </column>
        <column order="6" name="Interest" type="double">
            <summary>The interest portion of this payment.</summary>
        </column>
        <column order="7" name="Note" type="text">
            <summary>Any note about this particular payment plan charge</summary>
        </column>
        <column order="8" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  Since there is no ProvNum field at the payplan level, the provider must be the same for all payplancharges.  It's initially assigned as the patient priProv.  Payments applied should be to this provnum, although the current user interface does not help with this.</summary>
        </column>
        <column order="9" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  Since there is no ClincNum field at the payplan level, the clinic must be the same for all payplancharges.  It's initially assigned using the patient clinic.  Payments applied should be to this clinic, although the current user interface does not help with this.</summary>
        </column>
    </table>
    <table name="paysplit">
        <summary>Always attached to a payment.  Always affects exactly one patient account and one provider.</summary>
        <column order="0" name="SplitNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="SplitAmt" type="double">
            <summary>Amount of split.</summary>
        </column>
        <column order="2" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="3" name="ProcDate" type="date">
            <summary>Procedure date.  Typically only used if tied to a procedure.  In older versions (before 7.0), this was the date that showed on the account.  Frequently the same as the date of the payment, but not necessarily.  Not when the payment was made.  This is what the aging will be based on in a future version.</summary>
        </column>
        <column order="4" name="PayNum" type="bigint(20)" fk="payment">
            <summary>FK to payment.PayNum.  Every paysplit must be linked to a payment.</summary>
        </column>
        <column order="5" name="IsDiscount" type="tinyint">
            <summary>No longer used.</summary>
        </column>
        <column order="6" name="DiscountType" type="tinyint">
            <summary>No longer used</summary>
        </column>
        <column order="7" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="8" name="PayPlanNum" type="bigint(20)" fk="payplan">
            <summary>FK to payplan.PayPlanNum.  0 if not attached to a payplan.</summary>
        </column>
        <column order="9" name="DatePay" type="date">
            <summary>Date always in perfect synch with Payment date.</summary>
        </column>
        <column order="10" name="ProcNum" type="bigint(20)" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum.  0 if not attached to a procedure.</summary>
        </column>
        <column order="11" name="DateEntry" type="date">
            <summary>Date this paysplit was created.  User not allowed to edit.</summary>
        </column>
        <column order="12" name="UnearnedType" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.  Usually 0 unless this is a special unearned split.</summary>
        </column>
        <column order="13" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  Can be 0.  Need not match the ClinicNum of the Payment, because a payment can be split between clinics.</summary>
        </column>
    </table>
    <table name="perioexam">
        <summary>One perio exam for one patient on one date.  Has lots of periomeasures attached to it.</summary>
        <column order="0" name="PerioExamNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="ExamDate" type="date">
            <summary>.</summary>
        </column>
        <column order="3" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
    </table>
    <table name="periomeasure">
        <summary>One row can hold up to six measurements for one tooth, all of the same type.  Always attached to a perioexam.</summary>
        <column order="0" name="PerioMeasureNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PerioExamNum" type="bigint(20)" fk="perioexam">
            <summary>FK to perioexam.PerioExamNum.</summary>
        </column>
        <column order="2" name="SequenceType" type="tinyint">
            <summary>Enum:PerioSequenceType  eg probing, mobility, recession, etc.</summary>
            <Enumeration name="PerioSequenceType">
                <summary>In perio, the type of measurements for a given row.</summary>
                <EnumValue name="Mobility">0</EnumValue>
                <EnumValue name="Furcation">1</EnumValue>
                <EnumValue name="GingMargin">2-AKA recession.</EnumValue>
                <EnumValue name="MGJ">3-MucoGingivalJunction- the division between attached and unattached mucosa.</EnumValue>
                <EnumValue name="Probing">4</EnumValue>
                <EnumValue name="SkipTooth">5-For the skiptooth type, set surf to none, and ToothValue to 1.</EnumValue>
                <EnumValue name="Bleeding">6. Sum of flags for bleeding(1), suppuration(2), plaque(4), and calculus(8).</EnumValue>
                <EnumValue name="CAL">7. But this type is never saved to the db. It is always calculated on the fly.</EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="IntTooth" type="smallint(6)">
            <summary>Valid values are 1-32. Every measurement must be associated with a tooth.</summary>
        </column>
        <column order="4" name="ToothValue" type="smallint(6)">
            <summary>This is used when the measurement does not apply to a surface(mobility and skiptooth).  Valid values for all surfaces are 0 through 19, or -1 to represent no measurement taken.</summary>
        </column>
        <column order="5" name="MBvalue" type="smallint(6)">
            <summary>.</summary>
        </column>
        <column order="6" name="Bvalue" type="smallint(6)">
            <summary>.</summary>
        </column>
        <column order="7" name="DBvalue" type="smallint(6)">
            <summary>.</summary>
        </column>
        <column order="8" name="MLvalue" type="smallint(6)">
            <summary>.</summary>
        </column>
        <column order="9" name="Lvalue" type="smallint(6)">
            <summary>.</summary>
        </column>
        <column order="10" name="DLvalue" type="smallint(6)">
            <summary>.</summary>
        </column>
    </table>
    <table name="pharmacy">
        <summary>An individual pharmacy store.</summary>
        <column order="0" name="PharmacyNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PharmID" type="varchar(255)">
            <summary>NCPDPID assigned by NCPDP.  Not used yet.</summary>
        </column>
        <column order="2" name="StoreName" type="varchar(255)">
            <summary>For now, it can just be a common description.  Later, it might have to be an official designation.</summary>
        </column>
        <column order="3" name="Phone" type="varchar(255)">
            <summary>Includes all punctuation.</summary>
        </column>
        <column order="4" name="Fax" type="varchar(255)">
            <summary>Includes all punctuation.</summary>
        </column>
        <column order="5" name="Address" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="6" name="Address2" type="varchar(255)">
            <summary>Optional.</summary>
        </column>
        <column order="7" name="City" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="8" name="State" type="varchar(255)">
            <summary>Two char, uppercase.</summary>
        </column>
        <column order="9" name="Zip" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="10" name="Note" type="text">
            <summary>A freeform note for any info that is needed about the pharmacy, such as hours.</summary>
        </column>
        <column order="11" name="DateTStamp" type="timestamp">
            <summary>The last date and time this row was altered.  Not user editable.</summary>
        </column>
    </table>
    <table name="phonenumber">
        <summary>Only used internally by OpenDental, Inc.  Not used by anyone else.</summary>
        <column order="0" name="PhoneNumberNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="PhoneNumberVal" type="varchar(255)">
            <summary>The actual phone number for the patient.  Includes any punctuation.  No leading 1 or plus, so almost always 10 digits.</summary>
        </column>
    </table>
    <table name="plannedappt">
        <summary>Links one planned appointment to one patient.  Allows multiple planned appointments per patient.  Also see the PlannedIsDone field. A planned appointment is an appointment that will show in the Chart module and in the Planned appointment tracker. It will never show in the Appointments module. In other words, it is the suggested next appoinment rather than an appointment that has already been scheduled.</summary>
        <column order="0" name="PlannedApptNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="AptNum" type="bigint(20)" fk="appointment">
            <summary>FK to appointment.AptNum.</summary>
        </column>
        <column order="3" name="ItemOrder" type="int(11)">
            <summary>One-indexed order of item in group of planned appts.</summary>
        </column>
    </table>
    <table name="popup">
        <summary>Only one popup per patient is currently supported.</summary>
        <column order="0" name="PopupNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="Description" type="text">
            <summary>The text of the popup.</summary>
        </column>
        <column order="3" name="IsDisabled" type="tinyint(1)">
            <summary>If true, then the popup won't ever automatically show.</summary>
        </column>
    </table>
    <table name="preference">
        <summary>Stores small bits of data for a wide variety of purposes.  Any data that's too small to warrant its own table will usually end up here.</summary>
        <column order="0" name="PrefName" type="varchar(255)">
            <summary>The text 'key' in the key/value pairing.</summary>
        </column>
        <column order="1" name="ValueString" type="text">
            <summary>The stored value.</summary>
        </column>
        <column order="2" name="PrefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="3" name="Comments" type="text">
            <summary>Documentation on usage and values of each pref.  Mostly deprecated now in favor of using XML comments in the code.</summary>
        </column>
    </table>
    <table name="printer">
        <summary>One printer selection for one situation for one computer.</summary>
        <column order="0" name="PrinterNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ComputerNum" type="bigint(20)" fk="computer">
            <summary>FK to computer.ComputerNum.  This will be changed some day to refer to the computername, because it would make more sense as a key than a cryptic number.</summary>
        </column>
        <column order="2" name="PrintSit" type="tinyint">
            <summary>Enum:PrintSituation One of about 10 different situations where printing takes place.  If no printer object exists for a situation, then a default is used and a prompt is displayed.</summary>
            <Enumeration name="PrintSituation">
                <summary />
                <EnumValue name="Default">0- Covers any printing situation not listed separately.</EnumValue>
                <EnumValue name="Statement"></EnumValue>
                <EnumValue name="LabelSingle"></EnumValue>
                <EnumValue name="Claim"></EnumValue>
                <EnumValue name="TPPerio">TP and perio</EnumValue>
                <EnumValue name="Rx"></EnumValue>
                <EnumValue name="LabelSheet"></EnumValue>
                <EnumValue name="Postcard"></EnumValue>
                <EnumValue name="Appointments"></EnumValue>
                <EnumValue name="RxControlled"></EnumValue>
                <EnumValue name="Receipt"></EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="PrinterName" type="varchar(255)">
            <summary>The name of the printer as set from the specified computer.</summary>
        </column>
        <column order="4" name="DisplayPrompt" type="tinyint">
            <summary>If true, then user will be prompted for printer.  Otherwise, print directly with little user interaction.</summary>
        </column>
    </table>
    <table name="procapptcolor">
        <summary>An individual procedure code color range.</summary>
        <column order="0" name="ProcApptColorNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="CodeRange" type="varchar(255)">
            <summary>Procedure code range defined by user.  Includes commas and dashes, but no spaces.  The codes need not be valid since they are ranges.</summary>
        </column>
        <column order="2" name="ColorText" type="int(11)">
            <summary>Color that shows in appointments</summary>
        </column>
        <column order="3" name="ShowPreviousDate" type="tinyint(4)">
            <summary>Adds most recent completed date to ProcsColored</summary>
        </column>
    </table>
    <table name="procbutton">
        <summary>The 'buttons' to show in the Chart module.  They must have items attached in order to do anything.</summary>
        <column order="0" name="ProcButtonNum" type="bigint(20)">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>The text to show on the button.</summary>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>Order that they will show in the Chart module.</summary>
        </column>
        <column order="3" name="Category" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.</summary>
        </column>
        <column order="4" name="ButtonImage" type="text">
            <summary>If no image, then the clob will be an empty string.  In this case, the bitmap will be null when loaded from the database.</summary>
        </column>
    </table>
    <table name="procbuttonitem">
        <summary>Attached to procbuttons.  These tell the program what to do when a user clicks on a button.  There are two types: proccodes or autocodes.</summary>
        <column order="0" name="ProcButtonItemNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ProcButtonNum" type="bigint(20)" fk="procbutton">
            <summary>FK to procbutton.ProcButtonNum.</summary>
        </column>
        <column order="2" name="OldCode" type="varchar(15)">
            <summary>Do not use.</summary>
        </column>
        <column order="3" name="AutoCodeNum" type="bigint(20)" fk="autocode">
            <summary>FK to autocode.AutoCodeNum.  0 if this is a procedure code.</summary>
        </column>
        <column order="4" name="CodeNum" type="bigint(20)" fk="procedurecode">
            <summary>FK to procedurecode.CodeNum.  0 if this is an autocode.</summary>
        </column>
    </table>
    <table name="proccodenote">
        <summary>Stores the default note and time increments for one procedure code for one provider.  That way, an unlimited number of providers can each have different notes and times.  These notes and times override the defaults which are part of the procedurecode table.  So, for single provider offices, there will be no change to the current interface.</summary>
        <column order="0" name="ProcCodeNoteNum" type="bigint(20)">
            <summary>Primary Key.</summary>
        </column>
        <column order="1" name="CodeNum" type="bigint(20)" fk="procedurecode">
            <summary>FK to procedurecode.CodeNum.</summary>
        </column>
        <column order="2" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="3" name="Note" type="text">
            <summary>The note.</summary>
        </column>
        <column order="4" name="ProcTime" type="varchar(255)">
            <summary>X's and /'s describe Dr's time and assistant's time in the same increments as the user has set.</summary>
        </column>
    </table>
    <table name="procedurecode">
        <summary>A list setup ahead of time with all the procedure codes used by the office.  Every procedurelog entry which is attached to a patient is also linked to this table.</summary>
        <column order="0" name="CodeNum" type="bigint(20)">
            <summary>Primary Key.  This happened in version 4.8.7.</summary>
        </column>
        <column order="1" name="ProcCode" type="varchar(15)">
            <summary>Was Primary key, but now CodeNum is primary key.  Can hold dental codes, medical codes, custom codes, etc.</summary>
        </column>
        <column order="2" name="Descript" type="varchar(255)">
            <summary>The main description.</summary>
        </column>
        <column order="3" name="AbbrDesc" type="varchar(50)">
            <summary>Abbreviated description.</summary>
        </column>
        <column order="4" name="ProcTime" type="varchar(24)">
            <summary>X's and /'s describe Dr's time and assistant's time in the same increments as the user has set.</summary>
        </column>
        <column order="5" name="ProcCat" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.  The category that this code will be found under in the search window.  Has nothing to do with insurance categories.</summary>
        </column>
        <column order="6" name="TreatArea" type="tinyint">
            <summary>Enum:TreatmentArea </summary>
            <Enumeration name="TreatmentArea">
                <summary>Used in procedurecode setup to specify the treatment area for a procedure.  This determines what fields are available when editing an appointment.</summary>
                <EnumValue name="None">0-never used</EnumValue>
                <EnumValue name="Surf">1</EnumValue>
                <EnumValue name="Tooth">2</EnumValue>
                <EnumValue name="Mouth">3</EnumValue>
                <EnumValue name="Quad">4</EnumValue>
                <EnumValue name="Sextant">5</EnumValue>
                <EnumValue name="Arch">6</EnumValue>
                <EnumValue name="ToothRange">7</EnumValue>
            </Enumeration>
        </column>
        <column order="7" name="NoBillIns" type="tinyint">
            <summary>If true, do not usually bill this procedure to insurance.</summary>
        </column>
        <column order="8" name="IsProsth" type="tinyint">
            <summary>True if Crown,Bridge,Denture, or RPD. Forces user to enter Initial or Replacement and Date.</summary>
        </column>
        <column order="9" name="DefaultNote" type="text">
            <summary>The default procedure note to copy when marking complete.</summary>
        </column>
        <column order="10" name="IsHygiene" type="tinyint">
            <summary>Identifies hygiene procedures so that the correct provider can be selected.</summary>
        </column>
        <column order="11" name="GTypeNum" type="smallint">
            <summary>No longer used.</summary>
        </column>
        <column order="12" name="AlternateCode1" type="varchar(15)">
            <summary>For Medicaid.  There may be more later.</summary>
        </column>
        <column order="13" name="MedicalCode" type="varchar(15)" fk="procedurecode">
            <summary>FK to procedurecode.ProcCode.  The actual medical code that is being referenced must be setup first.  Anytime a procedure it added, this medical code will also be added to that procedure.  The user can change it in procedurelog.</summary>
        </column>
        <column order="14" name="IsTaxed" type="tinyint">
            <summary>Used by some offices even though no user interface built yet.  SalesTaxPercentage has been added to the preference table to store the amount of sales tax to apply as an adjustment attached to a procedurelog entry.</summary>
        </column>
        <column order="15" name="PaintType" type="tinyint(4)">
            <summary>Enum:ToothPaintingType </summary>
            <Enumeration name="ToothPaintingType">
                <summary />
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="Extraction">1</EnumValue>
                <EnumValue name="Implant">2</EnumValue>
                <EnumValue name="RCT">3</EnumValue>
                <EnumValue name="PostBU">4</EnumValue>
                <EnumValue name="FillingDark">5</EnumValue>
                <EnumValue name="FillingLight">6</EnumValue>
                <EnumValue name="CrownDark">7</EnumValue>
                <EnumValue name="CrownLight">8</EnumValue>
                <EnumValue name="BridgeDark">9</EnumValue>
                <EnumValue name="BridgeLight">10</EnumValue>
                <EnumValue name="DentureDark">11</EnumValue>
                <EnumValue name="DentureLight">12</EnumValue>
                <EnumValue name="Sealant">13</EnumValue>
                <EnumValue name="Veneer">14</EnumValue>
                <EnumValue name="Watch">15</EnumValue>
            </Enumeration>
        </column>
        <column order="16" name="GraphicColor" type="int(11)">
            <summary>If set to anything but 0, then this will override the graphic color for all procedures of this code, regardless of the status.</summary>
        </column>
        <column order="17" name="LaymanTerm" type="varchar(255)">
            <summary>When creating treatment plans, this description will be used instead of the technical description.</summary>
        </column>
        <column order="18" name="IsCanadianLab" type="tinyint">
            <summary>Only used in Canada.  Set to true if this procedure code is only used as an adjunct to track the lab fee.</summary>
        </column>
        <column order="19" name="PreExisting" type="tinyint(1)">
            <summary>This is true if this procedure code existed before ADA code distribution changed at version 4.8, false otherwise.</summary>
        </column>
        <column order="20" name="BaseUnits" type="int(11)">
            <summary>Support for Base Units for a Code (like anesthesia).  Should normally be zero.</summary>
        </column>
        <column order="21" name="SubstitutionCode" type="varchar(25)" fk="procedurecode">
            <summary>FK to procedurecode.ProcCode.  Used for posterior composites because insurance substitutes the amalgam code when figuring the coverage.</summary>
        </column>
        <column order="22" name="SubstOnlyIf" type="int(11)">
            <summary>Enum:SubstitutionCondition Used so that posterior composites only substitute if tooth is molar.  Ins usually pays for premolar composites.</summary>
            <Enumeration name="SubstitutionCondition">
                <summary>Used for insurance substitutions conditions of procedurecodes.  Mostly for posterior composites.</summary>
                <EnumValue name="Always">0</EnumValue>
                <EnumValue name="Molar">1</EnumValue>
                <EnumValue name="SecondMolar">2</EnumValue>
            </Enumeration>
        </column>
        <column order="23" name="DateTStamp" type="timestamp">
            <summary>Last datetime that this row was inserted or updated.</summary>
        </column>
        <column order="24" name="IsMultiVisit" type="tinyint(4)">
            <summary>Set to true if the procedure takes more than one appointment to complete.</summary>
        </column>
        <column order="25" name="DrugNDC" type="varchar(255)">
            <summary>11 digits or blank, enforced.  For 837I</summary>
        </column>
        <column order="26" name="RevenueCodeDefault" type="varchar(255)">
            <summary>Gets copied to procedure.RevCode.  For 837I</summary>
        </column>
    </table>
    <table name="procedurelog">
        <summary>Database table is procedurelog.  A procedure for a patient.  Can be treatment planned or completed.  Once it's completed, it gets tracked more closely be the security portion of the program.  A procedure can NEVER be deleted.  Status can just be changed to "deleted".</summary>
        <column order="0" name="ProcNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="AptNum" type="bigint(20)" fk="appointment">
            <summary>FK to appointment.AptNum.  Only allowed to attach proc to one appt(not counting planned appt)</summary>
        </column>
        <column order="3" name="OldCode" type="varchar(15)">
            <summary>No longer used.</summary>
        </column>
        <column order="4" name="ProcDate" type="date">
            <summary>Procedure date that will show in the account as the date performed.  If just treatment planned, the date can be the date it was tp'd, or the date can be min val if we don't care.  Also see ProcTime column.</summary>
        </column>
        <column order="5" name="ProcFee" type="double">
            <summary>Procedure fee.</summary>
        </column>
        <column order="6" name="Surf" type="varchar(10)">
            <summary>Surfaces, or use "UL" etc for quadrant, "2" etc for sextant, "U","L" for arches.</summary>
        </column>
        <column order="7" name="ToothNum" type="varchar(2)">
            <summary>May be blank, otherwise 1-32, 51-82, A-T, or AS-TS, 1 or 2 char.</summary>
        </column>
        <column order="8" name="ToothRange" type="varchar(100)">
            <summary>May be blank, otherwise is series of toothnumbers separated by commas.</summary>
        </column>
        <column order="9" name="Priority" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum, which contains the text of the priority.</summary>
        </column>
        <column order="10" name="ProcStatus" type="tinyint">
            <summary>Enum:ProcStat TP=1,Complete=2,Existing Cur Prov=3,Existing Other Prov=4,Referred=5,Deleted=6,Condition=7.</summary>
            <Enumeration name="ProcStat">
                <summary>Procedure Status.</summary>
                <EnumValue name="TP">1- Treatment Plan.</EnumValue>
                <EnumValue name="C">2- Complete.</EnumValue>
                <EnumValue name="EC">3- Existing Current Provider.</EnumValue>
                <EnumValue name="EO">4- Existing Other Provider.</EnumValue>
                <EnumValue name="R">5- Referred Out.</EnumValue>
                <EnumValue name="D">6- Deleted.</EnumValue>
                <EnumValue name="Cn">7- Condition.</EnumValue>
            </Enumeration>
        </column>
        <column order="11" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="12" name="Dx" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum, which contains text of the Diagnosis.</summary>
        </column>
        <column order="13" name="PlannedAptNum" type="bigint(20)" fk="appointment">
            <summary>FK to appointment.AptNum.  Was called NextAptNum in older versions.  Allows this procedure to be attached to a Planned appointment as well as a standard appointment.</summary>
        </column>
        <column order="14" name="PlaceService" type="tinyint">
            <summary>Enum:PlaceOfService  Only used in Public Health. Zero(Office) until procedure set complete. Then it's set to the value of the DefaultProcedurePlaceService preference.</summary>
            <Enumeration name="PlaceOfService">
                <summary />
                <EnumValue name="Office">0. CPT code 11</EnumValue>
                <EnumValue name="PatientsHome">1. CPT code 12</EnumValue>
                <EnumValue name="InpatHospital">2. CPT code 21</EnumValue>
                <EnumValue name="OutpatHospital">3. CPT code 22</EnumValue>
                <EnumValue name="SkilledNursFac">4. CPT code 31</EnumValue>
                <EnumValue name="CustodialCareFacility">5. CPT code 33.  In X12, a similar code AdultLivCareFac 35 is mentioned.</EnumValue>
                <EnumValue name="OtherLocation">6. CPT code ?.  We use 11 for office.</EnumValue>
                <EnumValue name="MobileUnit">7. CPT code 15</EnumValue>
                <EnumValue name="School">8. CPT code 03</EnumValue>
                <EnumValue name="MilitaryTreatFac">9. CPT code 26</EnumValue>
                <EnumValue name="FederalHealthCenter">10. CPT code 50</EnumValue>
                <EnumValue name="PublicHealthClinic">11. CPT code 71</EnumValue>
                <EnumValue name="RuralHealthClinic">12. CPT code 72</EnumValue>
                <EnumValue name="EmergencyRoomHospital">13. CPT code 23</EnumValue>
                <EnumValue name="AmbulatorySurgicalCenter">14. CPT code 24</EnumValue>
            </Enumeration>
        </column>
        <column order="15" name="Prosthesis" type="char(1)">
            <summary>Single char. Blank=no, I=Initial, R=Replacement.</summary>
        </column>
        <column order="16" name="DateOriginalProsth" type="date">
            <summary>For a prosthesis Replacement, this is the original date.</summary>
        </column>
        <column order="17" name="ClaimNote" type="varchar(80)">
            <summary>This note used to go out on e-claims, but the new format does not allow it.  So we removed the UI for this field.  We will probably drop this field completely soon.</summary>
        </column>
        <column order="18" name="DateEntryC" type="date">
            <summary>This is the date this procedure was entered or set complete.  If not status C, then the value is ignored.  This date is set automatically when Insert, but older data or converted data might not have this value set.  It gets updated when set complete.  User never allowed to edit.  This will be enhanced later.</summary>
        </column>
        <column order="19" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  0 if no clinic.</summary>
        </column>
        <column order="20" name="MedicalCode" type="varchar(15)" fk="procedurecode">
            <summary>FK to procedurecode.ProcCode. Optional.</summary>
        </column>
        <column order="21" name="DiagnosticCode" type="varchar(255)">
            <summary>Simple text for ICD-9 code. Gets sent with medical claims.</summary>
        </column>
        <column order="22" name="IsPrincDiag" type="tinyint">
            <summary>Set true if this medical diagnostic code is the principal diagnosis for the visit.  If no principal diagnosis is marked for any procedures on a medical e-claim, then it won't be allowed to be sent.  If more than one is marked, then it will just use one at random.</summary>
        </column>
        <column order="23" name="ProcNumLab" type="bigint(20)" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum. Only used in Canada. If not zero, then this proc is a lab fee and this indicates to which actual procedure the lab fee is attached.  For ordinary use, they are treated like two separate procedures.  It's only for insurance claims that we need to know which lab fee belongs to which procedure.  Two lab fees may be attached to one procedure.</summary>
        </column>
        <column order="24" name="BillingTypeOne" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum. Lets some users track charges for certain types of reports.  For example, a Medicaid billing type could be assigned to a procedure, flagging it for inclusion in a report mandated by goverment.  Would be more useful if it was automated to flow down based on insurance plan type, but that can be added later.  Not visible if prefs.EasyHideMedicaid is true.</summary>
        </column>
        <column order="25" name="BillingTypeTwo" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.  Same as BillingTypeOne, but used when there is a secondary billing type to account for.</summary>
        </column>
        <column order="26" name="CodeNum" type="bigint(20)" fk="procedurecode">
            <summary>FK to procedurecode.CodeNum</summary>
        </column>
        <column order="27" name="CodeMod1" type="char(2)">
            <summary>Modifier for certain CPT codes.</summary>
        </column>
        <column order="28" name="CodeMod2" type="char(2)">
            <summary>Modifier for certain CPT codes.</summary>
        </column>
        <column order="29" name="CodeMod3" type="char(2)">
            <summary>Modifier for certain CPT codes.</summary>
        </column>
        <column order="30" name="CodeMod4" type="char(2)">
            <summary>Modifier for certain CPT codes.</summary>
        </column>
        <column order="31" name="RevCode" type="varchar(45)">
            <summary>NUBC Revenue Code for medical/inst billing. Used on UB04 and 837I.</summary>
        </column>
        <column order="32" name="UnitQty" type="int(11)">
            <summary>Default is 1.  Becomes Service Unit Count on UB claimforms.  Becomes procedure count on dental claims.  Gets multiplied by fee in all accounting calculations.</summary>
        </column>
        <column order="33" name="BaseUnits" type="int(11)">
            <summary>Base units used for some billing codes.  Default is 0.  No UI for this field.  It is only edited in the ProcedureCode window.  The database maint tool changes BaseUnits of all procedures to match that of the procCode.  Not sure yet what it's for.</summary>
        </column>
        <column order="34" name="StartTime" type="int(11)">
            <summary>Start time in military.  No longer used, but not deleting just in case someone has critical information stored here.</summary>
        </column>
        <column order="35" name="StopTime" type="int(11)">
            <summary>Stop time in military.  No longer used, but not deleting just in case someone has critical information stored here.</summary>
        </column>
        <column order="36" name="DateTP" type="date">
            <summary>The date that the procedure was originally treatment planned.  Does not change when marked complete.</summary>
        </column>
        <column order="37" name="SiteNum" type="bigint(20)" fk="site">
            <summary>FK to site.SiteNum.</summary>
        </column>
        <column order="38" name="HideGraphics" type="tinyint(4)">
            <summary>Set to true to hide the chart graphics for this procedure.  For example, a crown was done, but then tooth extracted.</summary>
        </column>
        <column order="39" name="CanadianTypeCodes" type="varchar(20)">
            <summary>F16, up to 5 char. One or more of the following: A=Repair of a prior service, B=Temporary placement, C=TMJ, E=Implant, L=Appliance lost, S=Appliance stolen, X=none of the above.  Blank is equivalent to X for claim output, but one value will not be automatically converted to the other in this table.  That will allow us to track user entry for procedurecode.IsProsth.</summary>
        </column>
        <column order="40" name="ProcTime" type="time">
            <summary>Used to be part of the ProcDate, but that was causing reporting issues.</summary>
        </column>
        <column order="41" name="ProcTimeEnd" type="time">
            <summary>Marks the time a procedure was finished.</summary>
        </column>
        <column order="42" name="DateTStamp" type="timestamp">
            <summary>Automatically updated by MySQL every time a row is added or changed.</summary>
        </column>
        <column order="43" name="Prognosis" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum, which contains text of the Prognosis.</summary>
        </column>
        <column order="44" name="DrugUnit" type="tinyint(4)">
            <summary>Enum:EnumProcDrugUnit For 837I</summary>
        </column>
        <column order="45" name="DrugQty" type="float">
            <summary>Includes fractions. For 837I</summary>
        </column>
    </table>
    <table name="procgroupitem">
        <summary>Links Procedures(groupnotes) to Procedures in a 1-n relationship.</summary>
        <column order="0" name="ProcGroupItemNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ProcNum" type="bigint(20)" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum.</summary>
        </column>
        <column order="2" name="GroupNum" type="bigint(20)" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum.</summary>
        </column>
    </table>
    <table name="procnote">
        <summary>A procedure note for one procedure.  User does not have any direct control over this table at all.  It's handled automatically.  When user "edits" a procedure note, the program actually just adds another note.  No note can EVER be edited or deleted.</summary>
        <column order="0" name="ProcNoteNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="ProcNum" type="bigint(20)" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum</summary>
        </column>
        <column order="3" name="EntryDateTime" type="datetime">
            <summary>The server time that this note was entered. Essentially a timestamp.</summary>
        </column>
        <column order="4" name="UserNum" type="bigint(20)" fk="userod">
            <summary>FK to userod.UserNum.</summary>
        </column>
        <column order="5" name="Note" type="text">
            <summary>The actual note.</summary>
        </column>
        <column order="6" name="SigIsTopaz" type="tinyint">
            <summary>There are two kinds of signatures.  Topaz signatures use hardware manufactured by that company, and the signature is created by their library.  OD signatures work exactly the same way, but are only for on-screen signing.</summary>
        </column>
        <column order="7" name="Signature" type="text">
            <summary>The encrypted signature.  A signature starts as a collection of vectors.  The Topaz .sig file format is proprietary.  The OD signature format looks like this: 45,68;48,70;49,72;0,0;55,88;etc.  It's simply a sequence of points, separated by semicolons.  0,0 represents pen up.  Then, a hash is created from the Note, concatenated directly with the userNum.  For example, "This is a note3" gets turned into a hash of 2849283940385391 (16 bytes).  The hash is used to encrypt the signature data string using symmetric encryption.  Therefore, the actual signature cannot be retrieved from the database by ordinary means.  Also, the signature info cannot even be retrieved by Open Dental at all unless it supplies the same hash as before, proving that the data has not changed since signed.  If OD supplies the correct hash, then it will be able to extract the sequence of vectors which it will then use to display the signature.  The OD sigs are not compressed, and the Topaz sigs are.  But there is very little difference in their sizes.  It would be very rare for a signature to be larger than 1000 bytes.</summary>
        </column>
    </table>
    <table name="proctp">
        <summary>These are copies of procedures that are attached to treatment plans.</summary>
        <column order="0" name="ProcTPNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="TreatPlanNum" type="bigint(20)" fk="treatplan">
            <summary>FK to treatplan.TreatPlanNum.  The treatment plan to which this proc is attached.</summary>
        </column>
        <column order="2" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="3" name="ProcNumOrig" type="bigint(20)" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum.  It is very common for the referenced procedure to be missing.  This procNum is only here to compare and test the existence of the referenced procedure.  If present, it will check to see whether the procedure is still status TP.</summary>
        </column>
        <column order="4" name="ItemOrder" type="smallint">
            <summary>The order of this proc within its tp.  This is set when the tp is first created and can't be changed.  Drastically simplifies loading the tp.</summary>
        </column>
        <column order="5" name="Priority" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum which contains the text of the priority.</summary>
        </column>
        <column order="6" name="ToothNumTP" type="varchar(255)">
            <summary>A simple string displaying the tooth number.  If international tooth numbers are used, then this will be in international format already.</summary>
        </column>
        <column order="7" name="Surf" type="varchar(255)">
            <summary>Tooth surfaces or area.  This is already converted for international use.  If arch or quad, then it will have U,LR, etc.</summary>
        </column>
        <column order="8" name="ProcCode" type="varchar(15)">
            <summary>Not a foreign key.  Simply display text.  Can be changed by user at any time.</summary>
        </column>
        <column order="9" name="Descript" type="varchar(255)">
            <summary>Description is originally copied from procedurecode.Descript, but user can change it.</summary>
        </column>
        <column order="10" name="FeeAmt" type="double">
            <summary>The fee charged to the patient. Never gets automatically updated.</summary>
        </column>
        <column order="11" name="PriInsAmt" type="double">
            <summary>The amount primary insurance is expected to pay. Never gets automatically updated.</summary>
        </column>
        <column order="12" name="SecInsAmt" type="double">
            <summary>The amount secondary insurance is expected to pay. Never gets automatically updated.</summary>
        </column>
        <column order="13" name="PatAmt" type="double">
            <summary>The amount the patient is expected to pay. Never gets automatically updated.</summary>
        </column>
        <column order="14" name="Discount" type="double">
            <summary>The amount of discount.  Currently only used for PPOs.</summary>
        </column>
        <column order="15" name="Prognosis" type="varchar(255)">
            <summary>Text from prognosis definition.  Can be changed by user at any time.</summary>
        </column>
        <column order="16" name="Dx" type="varchar(255)">
            <summary>Text from diagnosis definition.  Can be changed by user at any time.</summary>
        </column>
    </table>
    <table name="program">
        <summary>Each row is a bridge to an outside program, frequently an imaging program.  Most of the bridges are hard coded, and simply need to be enabled.  But user can also add their own custom bridge.</summary>
        <column order="0" name="ProgramNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ProgName" type="varchar(100)">
            <summary>Unique name for built-in program bridges. Not user-editable. enum ProgramName</summary>
        </column>
        <column order="2" name="ProgDesc" type="varchar(100)">
            <summary>Description that shows.</summary>
        </column>
        <column order="3" name="Enabled" type="tinyint">
            <summary>True if enabled.</summary>
        </column>
        <column order="4" name="Path" type="varchar(255)">
            <summary>The path of the executable to run or file to open.</summary>
        </column>
        <column order="5" name="CommandLine" type="varchar(255)">
            <summary>Some programs will accept command line arguments.</summary>
        </column>
        <column order="6" name="Note" type="text">
            <summary>Notes about this program link. Peculiarities, etc.</summary>
        </column>
        <column order="7" name="PluginDllName" type="varchar(255)">
            <summary>If this is a Plugin, then this is the filename of the dll.  The dll must be located in the application directory.</summary>
        </column>
    </table>
    <table name="programproperty">
        <summary>Some program links (bridges), have properties that need to be set.  The property names are always hard coded.  User can change the value.  The property is usually retrieved based on its name.</summary>
        <column order="0" name="ProgramPropertyNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ProgramNum" type="bigint(20)" fk="program">
            <summary>FK to program.ProgramNum</summary>
        </column>
        <column order="2" name="PropertyDesc" type="varchar(255)">
            <summary>The description or prompt for this property.</summary>
        </column>
        <column order="3" name="PropertyValue" type="varchar(255)">
            <summary>The value.</summary>
        </column>
    </table>
    <table name="provider">
        <summary>A provider is usually a dentist or a hygienist.  But a provider might also be a denturist, a dental student, or a dental hygiene student.  A provider might also be a 'dummy', used only for billing purposes or for notes in the Appointments module.  There is no limit to the number of providers that can be added.</summary>
        <column order="0" name="ProvNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Abbr" type="varchar(255)">
            <summary>Abbreviation.  There was a limit of 5 char before version 5.4.  The new limit is 255 char.  This will allow more elegant solutions to various problems.  Providers will no longer be referred to by FName and LName.  Abbr is used as a human readable primary key.</summary>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>Order that provider will show in lists. Was 1-based, now 0-based.</summary>
        </column>
        <column order="3" name="LName" type="varchar(100)">
            <summary>Last name.</summary>
        </column>
        <column order="4" name="FName" type="varchar(100)">
            <summary>First name.</summary>
        </column>
        <column order="5" name="MI" type="varchar(100)">
            <summary>Middle inital or name.</summary>
        </column>
        <column order="6" name="Suffix" type="varchar(100)">
            <summary>eg. DMD or DDS. Was 'title' in previous versions.</summary>
        </column>
        <column order="7" name="FeeSched" type="bigint(20)" fk="feesched">
            <summary>FK to feesched.FeeSchedNum.</summary>
        </column>
        <column order="8" name="Specialty" type="tinyint">
            <summary>Enum:DentalSpecialty</summary>
            <Enumeration name="DentalSpecialty">
                <summary />
                <EnumValue name="General">0</EnumValue>
                <EnumValue name="Hygienist">1</EnumValue>
                <EnumValue name="Endodontics">2</EnumValue>
                <EnumValue name="Pediatric">3</EnumValue>
                <EnumValue name="Perio">4</EnumValue>
                <EnumValue name="Prosth">5</EnumValue>
                <EnumValue name="Ortho">6</EnumValue>
                <EnumValue name="Denturist">7</EnumValue>
                <EnumValue name="Surgery">8</EnumValue>
                <EnumValue name="Assistant">9</EnumValue>
                <EnumValue name="LabTech">10</EnumValue>
                <EnumValue name="Pathology">11</EnumValue>
                <EnumValue name="PublicHealth">12</EnumValue>
                <EnumValue name="Radiology">13</EnumValue>
            </Enumeration>
        </column>
        <column order="9" name="SSN" type="varchar(12)">
            <summary>or TIN.  No punctuation</summary>
        </column>
        <column order="10" name="StateLicense" type="varchar(15)">
            <summary>can include punctuation</summary>
        </column>
        <column order="11" name="DEANum" type="varchar(15)">
            <summary>.</summary>
        </column>
        <column order="12" name="IsSecondary" type="tinyint">
            <summary>True if hygienist.</summary>
        </column>
        <column order="13" name="ProvColor" type="int(11)">
            <summary>Color that shows in appointments</summary>
        </column>
        <column order="14" name="IsHidden" type="tinyint">
            <summary>If true, provider will not show on any lists</summary>
        </column>
        <column order="15" name="UsingTIN" type="tinyint">
            <summary>True if the SSN field is actually a Tax ID Num</summary>
        </column>
        <column order="16" name="BlueCrossID" type="varchar(25)">
            <summary>No longer used since each state assigns a different ID.  Use the providerident instead which allows you to assign a different BCBS ID for each Payor ID.</summary>
        </column>
        <column order="17" name="SigOnFile" type="tinyint">
            <summary>Signature on file.</summary>
        </column>
        <column order="18" name="MedicaidID" type="varchar(20)">
            <summary>.</summary>
        </column>
        <column order="19" name="OutlineColor" type="int(11)">
            <summary>Color that shows in appointments as outline when highlighted.</summary>
        </column>
        <column order="20" name="SchoolClassNum" type="bigint(20)" fk="schoolclass">
            <summary>FK to schoolclass.SchoolClassNum Used in dental schools.  Each student is a provider.  This keeps track of which class they are in.</summary>
        </column>
        <column order="21" name="NationalProvID" type="varchar(255)">
            <summary>US NPI, and Canadian CDA provider number.</summary>
        </column>
        <column order="22" name="CanadianOfficeNum" type="varchar(100)">
            <summary>Canadian field required for e-claims.  Assigned by CDA.  It's OK to have multiple providers with the same OfficeNum.  Max length should be 4.</summary>
        </column>
        <column order="23" name="DateTStamp" type="timestamp">
            <summary></summary>
        </column>
        <column order="24" name="AnesthProvType" type="bigint(20)">
            <summary> FK to ??. Field used to set the Anesthesia Provider type. Used to filter the provider dropdowns on FormAnestheticRecord</summary>
        </column>
        <column order="25" name="TaxonomyCodeOverride" type="varchar(255)">
            <summary>If none of the supplied taxonomies works.  This will show on claims.</summary>
        </column>
        <column order="26" name="IsCDAnet" type="tinyint(4)">
            <summary>For Canada. Set to true if CDA Net provider.</summary>
        </column>
        <column order="27" name="EcwID" type="varchar(255)">
            <summary>UserID from eCW so that prov abbreviations can be human readable.</summary>
        </column>
        <column order="28" name="EhrKey" type="varchar(255)">
            <summary>Allows using ehr module for this provider.  Tied to provider fname and lname.</summary>
        </column>
        <column order="29" name="StateRxID" type="varchar(255)">
            <summary>Provider medical State ID.</summary>
        </column>
        <column order="30" name="EhrHasReportAccess" type="tinyint(4)">
            <summary>True if the provider key for this provider is set up for report access.</summary>
        </column>
        <column order="31" name="IsNotPerson" type="tinyint(4)">
            <summary>Default is false because most providers are persons.  But some dummy providers used for practices or billing entities are not persons.  This is needed on 837s.</summary>
        </column>
    </table>
    <table name="providerident">
        <summary>Some insurance companies require special provider ID #s, and this table holds them.</summary>
        <column order="0" name="ProviderIdentNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  An ID only applies to one provider.</summary>
        </column>
        <column order="2" name="PayorID" type="varchar(255)" fk="carrier">
            <summary>FK to carrier.ElectID  aka Electronic ID. An ID only applies to one insurance carrier.</summary>
        </column>
        <column order="3" name="SuppIDType" type="tinyint">
            <summary>Enum:ProviderSupplementalID</summary>
            <Enumeration name="ProviderSupplementalID">
                <summary>Used when submitting e-claims to some carriers who require extra provider identifiers.  Usage varies by company.  Only used as needed.</summary>
                <EnumValue name="BlueCross">0</EnumValue>
                <EnumValue name="BlueShield">1</EnumValue>
                <EnumValue name="SiteNumber">2</EnumValue>
                <EnumValue name="CommercialNumber">3</EnumValue>
            </Enumeration>
        </column>
        <column order="4" name="IDNumber" type="varchar(255)">
            <summary>The number assigned by the ins carrier.</summary>
        </column>
    </table>
    <table name="question">
        <summary>Each row is one Question for one patient.  If a patient has never filled out a questionnaire, then they will have no rows in this table.</summary>
        <column order="0" name="QuestionNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>The order that this question shows in the list.</summary>
        </column>
        <column order="3" name="Description" type="text">
            <summary>The original question.</summary>
        </column>
        <column order="4" name="Answer" type="text">
            <summary>The answer to the question in text form.</summary>
        </column>
        <column order="5" name="FormPatNum" type="bigint(20)" fk="formpat">
            <summary>FK to formpat.FormPatNum</summary>
        </column>
    </table>
    <table name="questiondef">
        <summary>Each row represents one question on the medical history questionnaire.  Later, other questionnaires will be allowed, but for now, all questions are on one questionnaire for the patient.  This table has no dependencies, since the question is copied when added to a patient record.  Any row can be freely deleted or altered without any problems.</summary>
        <column order="0" name="QuestionDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="text">
            <summary>The question as presented to the patient.</summary>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>The order that the Questions will show.</summary>
        </column>
        <column order="3" name="QuestType" type="tinyint">
            <summary>Enum:QuestionType</summary>
            <Enumeration name="QuestionType">
                <summary>0=FreeformText, 1=YesNoUnknown. Allows for later adding other types, 3=picklist, 4, etc</summary>
                <EnumValue name="FreeformText">0</EnumValue>
                <EnumValue name="YesNoUnknown">1</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="quickpastecat">
        <summary>Quick paste categories are used by the quick paste notes feature.</summary>
        <column order="0" name="QuickPasteCatNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>The order of this category within the list. 0-based.</summary>
        </column>
        <column order="3" name="DefaultForTypes" type="text">
            <summary>Enum:QuickPasteType  Each Category can be set to be the default category for multiple types of notes. Stored as integers separated by commas.</summary>
            <Enumeration name="QuickPasteType">
                <summary>Used by QuickPasteCat to determine which category to default to when opening.</summary>
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="Procedure">1</EnumValue>
                <EnumValue name="Appointment">2</EnumValue>
                <EnumValue name="CommLog">3</EnumValue>
                <EnumValue name="Adjustment">4</EnumValue>
                <EnumValue name="Claim">5</EnumValue>
                <EnumValue name="Email">6</EnumValue>
                <EnumValue name="InsPlan">7</EnumValue>
                <EnumValue name="Letter">8</EnumValue>
                <EnumValue name="MedicalSummary">9</EnumValue>
                <EnumValue name="ServiceNotes">10</EnumValue>
                <EnumValue name="MedicalHistory">11</EnumValue>
                <EnumValue name="MedicationEdit">12</EnumValue>
                <EnumValue name="MedicationPat">13</EnumValue>
                <EnumValue name="PatAddressNote">14</EnumValue>
                <EnumValue name="Payment">15</EnumValue>
                <EnumValue name="PayPlan">16</EnumValue>
                <EnumValue name="Query">17</EnumValue>
                <EnumValue name="Referral">18</EnumValue>
                <EnumValue name="Rx">19</EnumValue>
                <EnumValue name="FinancialNotes">20</EnumValue>
                <EnumValue name="ChartTreatment">21</EnumValue>
                <EnumValue name="MedicalUrgent">22</EnumValue>
                <EnumValue name="Statement">23</EnumValue>
                <EnumValue name="Recall">24</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="quickpastenote">
        <summary>Template for quick pasted note feature.</summary>
        <column order="0" name="QuickPasteNoteNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="QuickPasteCatNum" type="bigint(20)" fk="quickpastecat">
            <summary>FK to quickpastecat.QuickPasteCatNum.  Keeps track of which category this note is in.</summary>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>The order of this note within it's category. 0-based.</summary>
        </column>
        <column order="3" name="Note" type="text">
            <summary>The actual note. Can be multiple lines and possibly very long.</summary>
        </column>
        <column order="4" name="Abbreviation" type="varchar(255)">
            <summary>The abbreviation which will automatically substitute when preceded by a ?.</summary>
        </column>
    </table>
    <table name="recall">
        <summary>Max one per patient.  A patient can only have one recall date set for each type (there is currently only one type).  The recall table stores a few dates that must be kept synchronized with other information in the database.  This is difficult.  Anytime one of the following items changes, things need to be synchronized: procedurecode.SetRecall, any procedurelog change for a patient (procs added, deleted, completed, status changed, date changed, etc), patient status changed.  There are expected to be a few bugs in the synchronization logic, so anytime a patient's recall is opened, it will also update.
            
            During synchronization, the program will frequently alter DateDueCalc, DateDue, and DatePrevious based on trigger procs.  The system will also add and delete recalls as necessary. But it will not delete a recall unless all values are default and there is no useful information.  When a user tries to delete a recall, they will only be successful if the trigger conditions do not apply.  Otherwise, they will have to disable the recall instead.</summary>
        <column order="0" name="RecallNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="DateDueCalc" type="date">
            <summary>Not editable.  The calculated date due. Generated by the program and subject to change anytime the conditions change. It can be blank (0001-01-01) if no appropriate triggers. </summary>
        </column>
        <column order="3" name="DateDue" type="date">
            <summary>This is the date that is actually used when doing reports for recall. It will usually be the same as DateDueCalc unless user has changed it. System will only update this field if it is the same as DateDueCalc.  Otherwise, it will be left alone.  Gets cleared along with DateDueCalc when resetting recall.  When setting disabled, this field will also be cleared.  This is the field to use if converting from another software.</summary>
        </column>
        <column order="4" name="DatePrevious" type="date">
            <summary>Not editable. Previous date that procedures were done to trigger this recall. It is calculated and enforced automatically.  If you want to affect this date, add a procedure to the chart with a status of C, EC, or EO.</summary>
        </column>
        <column order="5" name="RecallInterval" type="int(11)">
            <summary>The interval between recalls.  The Interval struct combines years, months, weeks, and days into a single integer value.</summary>
        </column>
        <column order="6" name="RecallStatus" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum, or 0 for none.</summary>
        </column>
        <column order="7" name="Note" type="text">
            <summary>An administrative note for staff use.</summary>
        </column>
        <column order="8" name="IsDisabled" type="tinyint">
            <summary>If true, this recall type will be disabled (there's only one type right now). This is usually used rather than deleting the recall type from the patient because the program must enforce the trigger conditions for all patients.</summary>
        </column>
        <column order="9" name="DateTStamp" type="timestamp">
            <summary>Last datetime that this row was inserted or updated.</summary>
        </column>
        <column order="10" name="RecallTypeNum" type="bigint(20)" fk="recalltype">
            <summary>FK to recalltype.RecallTypeNum.</summary>
        </column>
        <column order="11" name="DisableUntilBalance" type="double">
            <summary>Default is 0.  If a positive number is entered, then the family balance must be less in order for this recall to show in the recall list.</summary>
        </column>
        <column order="12" name="DisableUntilDate" type="date">
            <summary>If a date is entered, then this recall will be disabled until that date.</summary>
        </column>
    </table>
    <table name="recalltrigger">
        <summary>Links one procedurecode to one recalltype.  The presence of this trigger is used when determining DatePrevious in the recall table.</summary>
        <column order="0" name="RecallTriggerNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="RecallTypeNum" type="bigint(20)" fk="recalltype">
            <summary>FK to recalltype.RecallTypeNum</summary>
        </column>
        <column order="2" name="CodeNum" type="bigint(20)" fk="procedurecode">
            <summary>FK to procedurecode.CodeNum</summary>
        </column>
    </table>
    <table name="recalltype">
        <summary>All recalls are based on these recall types.  Recall triggers are in their own table.</summary>
        <column order="0" name="RecallTypeNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="DefaultInterval" type="int(11)">
            <summary>The interval between recalls.  The Interval struct combines years, months, weeks, and days into a single integer value.</summary>
        </column>
        <column order="3" name="TimePattern" type="varchar(255)">
            <summary>For scheduling the appointment.</summary>
        </column>
        <column order="4" name="Procedures" type="varchar(255)">
            <summary>What procedures to put on the recall appointment.  Comma delimited set of ProcCodes.  (We may change this to CodeNums).</summary>
        </column>
    </table>
    <table name="reconcile">
        <summary>Used in the Accounting section.  Each row represents one reconcile.  Transactions will be attached to it.</summary>
        <column order="0" name="ReconcileNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="AccountNum" type="bigint(20)" fk="account">
            <summary>FK to account.AccountNum</summary>
        </column>
        <column order="2" name="StartingBal" type="double">
            <summary>User enters starting balance here.</summary>
        </column>
        <column order="3" name="EndingBal" type="double">
            <summary>User enters ending balance here.</summary>
        </column>
        <column order="4" name="DateReconcile" type="date">
            <summary>The date that the reconcile was performed.</summary>
        </column>
        <column order="5" name="IsLocked" type="tinyint">
            <summary>If StartingBal + sum of entries selected = EndingBal, then user can lock.  Unlock requires special permission, which nobody will have by default.</summary>
        </column>
    </table>
    <table name="refattach">
        <summary>Attaches a referral to a patient.</summary>
        <column order="0" name="RefAttachNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ReferralNum" type="bigint(20)" fk="referral">
            <summary>FK to referral.ReferralNum.</summary>
        </column>
        <column order="2" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="3" name="ItemOrder" type="smallint">
            <summary>Order to display in patient info. One-based.  Will be automated more in future.</summary>
        </column>
        <column order="4" name="RefDate" type="date">
            <summary>Date of referral.</summary>
        </column>
        <column order="5" name="IsFrom" type="tinyint">
            <summary>true=from, false=to</summary>
        </column>
        <column order="6" name="RefToStatus" type="tinyint">
            <summary>Enum:ReferralToStatus 0=None,1=Declined,2=Scheduled,3=Consulted,4=InTreatment,5=Complete.</summary>
            <Enumeration name="ReferralToStatus">
                <summary>0=None,1=Declined,2=Scheduled,3=Consulted,4=InTreatment,5=Complete</summary>
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="Declined">1</EnumValue>
                <EnumValue name="Scheduled">2</EnumValue>
                <EnumValue name="Consulted">3</EnumValue>
                <EnumValue name="InTreatment">4</EnumValue>
                <EnumValue name="Complete">5</EnumValue>
            </Enumeration>
        </column>
        <column order="7" name="Note" type="text">
            <summary>Why the patient was referred out, or less commonly, the circumstances of the referral source.</summary>
        </column>
        <column order="8" name="IsTransitionOfCare" type="tinyint(4)">
            <summary>Used to track ehr events.  All outgoing referrals default to true.  The incoming ones get a popup asking if it's a transition of care.</summary>
        </column>
        <column order="9" name="ProcNum" type="bigint(20)" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum</summary>
        </column>
        <column order="10" name="DateProcComplete" type="date">
            <summary></summary>
        </column>
    </table>
    <table name="referral">
        <summary>All info about a referral is stored with that referral even if a patient.  That way, it's available for easy queries.</summary>
        <column order="0" name="ReferralNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LName" type="varchar(100)">
            <summary>Last name.</summary>
        </column>
        <column order="2" name="FName" type="varchar(100)">
            <summary>First name.</summary>
        </column>
        <column order="3" name="MName" type="varchar(100)">
            <summary>Middle name or initial.</summary>
        </column>
        <column order="4" name="SSN" type="varchar(9)">
            <summary>SSN or TIN, no punctuation.  For Canada, this holds the referring provider CDA num for claims.</summary>
        </column>
        <column order="5" name="UsingTIN" type="tinyint">
            <summary>Specificies if SSN is real SSN.</summary>
        </column>
        <column order="6" name="Specialty" type="tinyint">
            <summary>Enum:DentalSpecialty -1 is allowed to indicate no specialty.  -1 is what all non-professionals will be set to.</summary>
            <Enumeration name="DentalSpecialty">
                <summary />
                <EnumValue name="General">0</EnumValue>
                <EnumValue name="Hygienist">1</EnumValue>
                <EnumValue name="Endodontics">2</EnumValue>
                <EnumValue name="Pediatric">3</EnumValue>
                <EnumValue name="Perio">4</EnumValue>
                <EnumValue name="Prosth">5</EnumValue>
                <EnumValue name="Ortho">6</EnumValue>
                <EnumValue name="Denturist">7</EnumValue>
                <EnumValue name="Surgery">8</EnumValue>
                <EnumValue name="Assistant">9</EnumValue>
                <EnumValue name="LabTech">10</EnumValue>
                <EnumValue name="Pathology">11</EnumValue>
                <EnumValue name="PublicHealth">12</EnumValue>
                <EnumValue name="Radiology">13</EnumValue>
            </Enumeration>
        </column>
        <column order="7" name="ST" type="varchar(2)">
            <summary>State</summary>
        </column>
        <column order="8" name="Telephone" type="varchar(10)">
            <summary>Primary phone, restrictive, must only be 10 digits and only numbers.</summary>
        </column>
        <column order="9" name="Address" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="10" name="Address2" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="11" name="City" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="12" name="Zip" type="varchar(10)">
            <summary>.</summary>
        </column>
        <column order="13" name="Note" type="text">
            <summary>Holds important info about the referral.</summary>
        </column>
        <column order="14" name="Phone2" type="varchar(30)">
            <summary>Additional phone no restrictions</summary>
        </column>
        <column order="15" name="IsHidden" type="tinyint">
            <summary>Can't delete a referral, but can hide if not needed any more.</summary>
        </column>
        <column order="16" name="NotPerson" type="tinyint">
            <summary>Set to true for referralls such as Yellow Pages.</summary>
        </column>
        <column order="17" name="Title" type="varchar(255)">
            <summary>i.e. DMD or DDS</summary>
        </column>
        <column order="18" name="EMail" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="19" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum for referrals that are patients.</summary>
        </column>
        <column order="20" name="NationalProvID" type="varchar(255)">
            <summary>NPI for the referral</summary>
        </column>
        <column order="21" name="Slip" type="bigint(20)" fk="sheetdef">
            <summary>FK to sheetdef.SheetDefNum.  Referral slips can be set for individual referral sources.  If zero, then the default internal referral slip will be used instead of a custom referral slip.</summary>
        </column>
        <column order="22" name="IsDoctor" type="tinyint(4)">
            <summary>True if another dentist or physician.  Cannot be a patient.</summary>
        </column>
    </table>
    <table name="registrationkey">
        <summary>Keeps track of which product keys have been assigned to which customers. This datatype is only used if the program is being run from a distributor installation. A single customer is allowed to have more than one key, to accommodate for various circumstances, including having multiple physical business locations.</summary>
        <column order="0" name="RegistrationKeyNum" type="bigint(20)">
            <summary>Primary Key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum. The customer to which this registration key applies.</summary>
        </column>
        <column order="2" name="RegKey" type="varchar(4000)">
            <summary>The registration key as stored in the customer database.</summary>
        </column>
        <column order="3" name="Note" type="varchar(4000)">
            <summary>Db note about the registration key. Specifically, the note must include information about the location to which this key pertains, since once at least one key must be assigned to each location to be legal.</summary>
        </column>
        <column order="4" name="DateStarted" type="date">
            <summary>This will help later with tracking for licensing.</summary>
        </column>
        <column order="5" name="DateDisabled" type="date">
            <summary>This is used to completely disable a key.  Might possibly even cripple the user's program.  Usually only used if reassigning another key due to abuse or error.  If no date specified, then this key is still valid.</summary>
        </column>
        <column order="6" name="DateEnded" type="date">
            <summary>This is used when the customer cancels monthly support.  This still allows the customer to get downloads for bug fixes, but only up through a certain version.  Our web server program will use this date to deduce which version they are allowed to have.  Any version that was released as a beta before this date is allowed to be downloaded.</summary>
        </column>
        <column order="7" name="IsForeign" type="tinyint(1)">
            <summary>This is assigned automatically based on whether the registration key is a US version vs. a foreign version.  The foreign version is not able to unlock the procedure codes.  There are muliple layers of safeguards in place.</summary>
        </column>
        <column order="8" name="UsesServerVersion" type="tinyint(4)">
            <summary>Deprecated.</summary>
        </column>
        <column order="9" name="IsFreeVersion" type="tinyint(4)">
            <summary>We have given this customer a free version.  Typically in India.</summary>
        </column>
        <column order="10" name="IsOnlyForTesting" type="tinyint(4)">
            <summary>This customer is not using the software with live patient data, but only for testing and development purposes.</summary>
        </column>
        <column order="11" name="VotesAllotted" type="int(11)">
            <summary>Typically 100, although it can be more for multilocation offices.</summary>
        </column>
    </table>
    <table name="reminderrule">
        <summary>Ehr</summary>
        <column order="0" name="ReminderRuleNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ReminderCriterion" type="tinyint(4)">
            <summary>Enum:EhrCriterion Problem,Medication,Allergy,Age,Gender,LabResult.</summary>
            <Enumeration name="EhrCriterion">
                <summary>EhrCriterion: Problem,Medication,Allergy,Age,Gender,LabResult</summary>
                <EnumValue name="Problem">0-Problem (diseaseDef)</EnumValue>
                <EnumValue name="Medication">1-Medication</EnumValue>
                <EnumValue name="Allergy">2-AllergyDef</EnumValue>
                <EnumValue name="Age">3-Age</EnumValue>
                <EnumValue name="Gender">4-Gender</EnumValue>
                <EnumValue name="LabResult">5-LabResult</EnumValue>
                <EnumValue name="ICD9">6-ICD9</EnumValue>
            </Enumeration>
        </column>
        <column order="2" name="CriterionFK" type="bigint(20)">
            <summary>Foreign key to disease.DiseaseDefNum, medicationpat.MedicationNum, or allergy.AllergyDefNum. Will be 0 if Age, Gender, or LabResult are the trigger.</summary>
        </column>
        <column order="3" name="CriterionValue" type="varchar(255)">
            <summary>Only used if Age, Gender, or LabResult are the trigger. Examples: "&lt;25"(must include &lt; or &gt;), "Male"/"Female", "INR" (the simple description of the lab test)</summary>
        </column>
        <column order="4" name="Message" type="varchar(255)">
            <summary>Text that will show as the reminder.</summary>
        </column>
    </table>
    <table name="repeatcharge">
        <summary>Each row represents one charge that will be added monthly.</summary>
        <column order="0" name="RepeatChargeNum" type="bigint(20)">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="ProcCode" type="varchar(15)" fk="procedurecode">
            <summary>FK to procedurecode.ProcCode.  The code that will be added to the account as a completed procedure.</summary>
        </column>
        <column order="3" name="ChargeAmt" type="double">
            <summary>The amount that will be charged.  The amount from the procedurecode will not be used.  This way, a repeating charge cannot be accidentally altered.</summary>
        </column>
        <column order="4" name="DateStart" type="date">
            <summary>The date of the first charge.  Charges will always be added on the same day of the month as the start date.  If more than one month goes by, then multiple charges will be added.</summary>
        </column>
        <column order="5" name="DateStop" type="date">
            <summary>The last date on which a charge is allowed.  So if you want 12 charges, and the start date is 8/1/05, then the stop date should be 7/1/05, not 8/1/05.  Can be blank (0001-01-01) to represent a perpetual repeating charge.</summary>
        </column>
        <column order="6" name="Note" type="text">
            <summary>Any note for internal use.</summary>
        </column>
    </table>
    <table name="replicationserver">
        <summary>If replication is being used, then this stores information about each server.  Each row is one server.</summary>
        <column order="0" name="ReplicationServerNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Descript" type="text">
            <summary>The description or name of the server.  Optional.</summary>
        </column>
        <column order="2" name="ServerId" type="int(10)">
            <summary>Db admin sets this server_id server variable on each replication server.  Allows us to know what server each workstation is connected to.  In display, it's ordered by this value.  Users are always forced to enter a value here.</summary>
        </column>
        <column order="3" name="RangeStart" type="bigint(20)">
            <summary>The start of the key range for this server.  0 if no value entered yet.</summary>
        </column>
        <column order="4" name="RangeEnd" type="bigint(20)">
            <summary>The end of the key range for this server.  0 if no value entered yet.</summary>
        </column>
        <column order="5" name="AtoZpath" type="varchar(255)">
            <summary>The AtoZpath for this server. Optional.</summary>
        </column>
        <column order="6" name="UpdateBlocked" type="tinyint(4)">
            <summary>If true, then this server cannot initiate an update.  Typical for satellite servers.</summary>
        </column>
    </table>
    <table name="reqneeded">
        <summary>For Dental Schools.  Requirements needed in order to complete a course.</summary>
        <column order="0" name="ReqNeededNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Descript" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="SchoolCourseNum" type="bigint(20)" fk="schoolcourse">
            <summary>FK to schoolcourse.SchoolCourseNum.  Never 0.</summary>
        </column>
        <column order="3" name="SchoolClassNum" type="bigint(20)" fk="schoolclass">
            <summary>FK to schoolclass.SchoolClassNum.  Never 0.</summary>
        </column>
    </table>
    <table name="reqstudent">
        <summary>For Dental Schools.  The purpose of this table changed significantly in version 4.5.  This now only stores completed requirements.  There can be multiple completed requirements of each ReqNeededNum.  No need to synchronize any longer.</summary>
        <column order="0" name="ReqStudentNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ReqNeededNum" type="bigint(20)" fk="reqneeded">
            <summary>FK to reqneeded.ReqNeededNum.</summary>
        </column>
        <column order="2" name="Descript" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="3" name="SchoolCourseNum" type="bigint(20)" fk="schoolcourse">
            <summary>FK to schoolcourse.SchoolCourseNum.  Never 0.</summary>
        </column>
        <column order="4" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  The student.  Never 0.</summary>
        </column>
        <column order="5" name="AptNum" type="bigint(20)" fk="appointment">
            <summary>FK to appointment.AptNum.</summary>
        </column>
        <column order="6" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="7" name="InstructorNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum</summary>
        </column>
        <column order="8" name="DateCompleted" type="date">
            <summary>The date that the requirement was completed.</summary>
        </column>
    </table>
    <table name="rxalert">
        <summary>Many-to-many relationship connecting Rx with DiseaseDef, AllergyDef, or Medication.  Only one of those links may be specified in a single row; the other two will be 0.</summary>
        <column order="0" name="RxAlertNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="RxDefNum" type="bigint(20)" fk="rxdef">
            <summary>FK to rxdef.RxDefNum.</summary>
        </column>
        <column order="2" name="DiseaseDefNum" type="bigint(20)" fk="diseasedef">
            <summary>FK to diseasedef.DiseaseDefNum.  Only if DrugProblem interaction.  This is compared against disease.DiseaseDefNum using PatNum.</summary>
        </column>
        <column order="3" name="AllergyDefNum" type="bigint(20)" fk="allergydef">
            <summary>FK to allergydef.AllergyDefNum.  Only if DrugAllergy interaction.  The allergy and allergydef tables do not yet exist.  Once they are in place in place, this will be compared against allergy.AllergyDefNum using PatNum.</summary>
        </column>
        <column order="4" name="MedicationNum" type="bigint(20)" fk="medication">
            <summary>FK to medication.MedicationNum.  Only if DrugDrug interaction.  This will be compared against medicationpat.MedicationNum using PatNum.</summary>
        </column>
        <column order="5" name="NotificationMsg" type="varchar(255)">
            <summary>This is typically blank, so a default message will be displayed by OD.  But if this contains a message, then this message will be used instead.</summary>
        </column>
    </table>
    <table name="rxdef">
        <summary>Rx definitions.  Can safely delete or alter, because they get copied to the rxPat table, not referenced.</summary>
        <column order="0" name="RxDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Drug" type="varchar(255)">
            <summary>The name of the drug.</summary>
        </column>
        <column order="2" name="Sig" type="varchar(255)">
            <summary>Directions.</summary>
        </column>
        <column order="3" name="Disp" type="varchar(255)">
            <summary>Amount to dispense.</summary>
        </column>
        <column order="4" name="Refills" type="varchar(30)">
            <summary>Number of refills.</summary>
        </column>
        <column order="5" name="Notes" type="varchar(255)">
            <summary>Notes about this drug. Will not be copied to the rxpat.</summary>
        </column>
        <column order="6" name="IsControlled" type="tinyint(4)">
            <summary>Is a controlled substance.  This will affect the way it prints.</summary>
        </column>
        <column order="7" name="RxCui" type="bigint(20)">
            <summary>RxNorm Code identifier.  This is used to enhance the RxAlert functionality.  Usually, RxAlerts are triggered when an Rx is entered from an RxDef.  But if an alert needs to be triggered when entering a medication through the ehr CPOE, then this RxCui matching the RxCui of the medication is the trigger.  This is clearly not practical because there are so many RxCuis that an exact match would be extremely rare.  So the only reason this field is here is to pass ehr certification.</summary>
        </column>
    </table>
    <table name="rxnorm">
        <summary>RxNorm created from a zip file.</summary>
        <column order="0" name="RxNormNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="RxCui" type="varchar(255)">
            <summary>RxNorm Concept universal ID.  Throughout the program, this is actually used as the Primary Key of this table rather than the RxNormNum.</summary>
        </column>
        <column order="2" name="MmslCode" type="varchar(255)">
            <summary>Multum code.  Only used for import/export with electronic Rx program.  User cannot see multum codes.</summary>
        </column>
        <column order="3" name="Description" type="varchar(255)">
            <summary>Only used for RxNorms, not Multums.</summary>
        </column>
    </table>
    <table name="rxpat">
        <summary>One Rx for one patient. Copied from rxdef rather than linked to it.</summary>
        <column order="0" name="RxNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="RxDate" type="date">
            <summary>Date of Rx.</summary>
        </column>
        <column order="3" name="Drug" type="varchar(255)">
            <summary>Drug name.</summary>
        </column>
        <column order="4" name="Sig" type="varchar(255)">
            <summary>Directions.</summary>
        </column>
        <column order="5" name="Disp" type="varchar(255)">
            <summary>Amount to dispense.</summary>
        </column>
        <column order="6" name="Refills" type="varchar(30)">
            <summary>Number of refills.</summary>
        </column>
        <column order="7" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="8" name="Notes" type="varchar(255)">
            <summary>Notes specific to this Rx.  Will not show on the printout.  For staff use only.</summary>
        </column>
        <column order="9" name="PharmacyNum" type="bigint(20)" fk="pharmacy">
            <summary>FK to pharmacy.PharmacyNum.</summary>
        </column>
        <column order="10" name="IsControlled" type="tinyint(4)">
            <summary>Is a controlled substance.  This will affect the way it prints.</summary>
        </column>
        <column order="11" name="DateTStamp" type="timestamp">
            <summary>The last date and time this row was altered.  Not user editable.</summary>
        </column>
        <column order="12" name="SendStatus" type="tinyint(4)">
            <summary>Enum:RxSendStatus </summary>
        </column>
        <column order="13" name="RxCui" type="bigint(20)">
            <summary>RxNorm Code identifier.</summary>
        </column>
        <column order="14" name="DosageCode" type="varchar(255)">
            <summary>NCI Pharmaceutical Dosage Form code.  Only used with ehr.</summary>
        </column>
    </table>
    <table name="schedule">
        <summary>One block of time.  Either for practice, provider, or blockout.</summary>
        <column order="0" name="ScheduleNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="SchedDate" type="date">
            <summary>Date for this timeblock.</summary>
        </column>
        <column order="2" name="StartTime" type="time">
            <summary>Start time for this timeblock.</summary>
        </column>
        <column order="3" name="StopTime" type="time">
            <summary>Stop time for this timeblock.</summary>
        </column>
        <column order="4" name="SchedType" type="tinyint">
            <summary>Enum:ScheduleType 0=Practice,1=Provider,2=Blockout,3=Employee.  Practice is used as a way to indicate holidays and as a way to put a note in for the entire practice for one day.  But whenever type is Practice, times will be ignored.</summary>
            <Enumeration name="ScheduleType">
                <summary>For schedule timeblocks.</summary>
                <EnumValue name="Practice">0</EnumValue>
                <EnumValue name="Provider">1</EnumValue>
                <EnumValue name="Blockout">2</EnumValue>
                <EnumValue name="Employee">3</EnumValue>
            </Enumeration>
        </column>
        <column order="5" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum if a provider type.</summary>
        </column>
        <column order="6" name="BlockoutType" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum if blockout.  eg. HighProduction, RCT Only, Emerg.</summary>
        </column>
        <column order="7" name="Note" type="text">
            <summary>This contains various types of text entered by the user.</summary>
        </column>
        <column order="8" name="Status" type="tinyint">
            <summary>Enum:SchedStatus enumeration 0=Open,1=Closed,2=Holiday.  All blocks have a status of Open, but user doesn't see the status.  The "closed" status was previously used to override the defaults when the last timeblock was deleted.  But it's nearly phased out now.  Still used by blockouts.  Holidays are a special type of practice schedule item which do not have providers attached.</summary>
            <Enumeration name="SchedStatus">
                <summary>Schedule status.  Open=0,Closed=1,Holiday=2.</summary>
                <EnumValue name="Open">0</EnumValue>
                <EnumValue name="Closed">1</EnumValue>
                <EnumValue name="Holiday">2</EnumValue>
            </Enumeration>
        </column>
        <column order="9" name="EmployeeNum" type="bigint(20)" fk="employee">
            <summary>FK to employee.EmployeeNum.</summary>
        </column>
        <column order="10" name="DateTStamp" type="timestamp">
            <summary>Last datetime that this row was inserted or updated.</summary>
        </column>
    </table>
    <table name="scheduleop">
        <summary>Links one schedule block to one operatory.  So for a schedule block to show, it must be linked to one or more operatories.</summary>
        <column order="0" name="ScheduleOpNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ScheduleNum" type="bigint(20)" fk="schedule">
            <summary>FK to schedule.ScheduleNum.</summary>
        </column>
        <column order="2" name="OperatoryNum" type="bigint(20)" fk="operatory">
            <summary>FK to operatory.OperatoryNum.</summary>
        </column>
    </table>
    <table name="schoolclass">
        <summary>Used in dental schools.  eg. Dental 2009 or Hygiene 2007.</summary>
        <column order="0" name="SchoolClassNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="GradYear" type="int(11)">
            <summary>The year this class will graduate</summary>
        </column>
        <column order="2" name="Descript" type="varchar(255)">
            <summary>Description of this class. eg Dental or Hygiene</summary>
        </column>
    </table>
    <table name="schoolcourse">
        <summary>Used in dental schools.  eg OP 732 Operative Dentistry Clinic II.</summary>
        <column order="0" name="SchoolCourseNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="CourseID" type="varchar(255)">
            <summary>Alphanumeric.  eg PEDO 732.</summary>
        </column>
        <column order="2" name="Descript" type="varchar(255)">
            <summary>eg: Pediatric Dentistry Clinic II</summary>
        </column>
    </table>
    <table name="screen">
        <summary>Used in public health.  This screening table is meant to be general purpose.  It is compliant with the popular Basic Screening Survey.  It is also designed with minimal foreign keys and can be easily adapted to a palm or pocketPC.  This table can be used with only the screengroup table, but is more efficient if provider, school, and county tables are also available.</summary>
        <column order="0" name="ScreenNum" type="bigint(20)">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="ScreenDate" type="date">
            <summary>The date of the screening.</summary>
        </column>
        <column order="2" name="GradeSchool" type="varchar(255)" fk="site">
            <summary>FK to site.Description, although it will not crash if key absent.</summary>
        </column>
        <column order="3" name="County" type="varchar(255)" fk="county">
            <summary>FK to county.CountyName, although it will not crash if key absent.</summary>
        </column>
        <column order="4" name="PlaceService" type="tinyint">
            <summary>Enum:PlaceOfService</summary>
            <Enumeration name="PlaceOfService">
                <summary />
                <EnumValue name="Office">0. CPT code 11</EnumValue>
                <EnumValue name="PatientsHome">1. CPT code 12</EnumValue>
                <EnumValue name="InpatHospital">2. CPT code 21</EnumValue>
                <EnumValue name="OutpatHospital">3. CPT code 22</EnumValue>
                <EnumValue name="SkilledNursFac">4. CPT code 31</EnumValue>
                <EnumValue name="CustodialCareFacility">5. CPT code 33.  In X12, a similar code AdultLivCareFac 35 is mentioned.</EnumValue>
                <EnumValue name="OtherLocation">6. CPT code ?.  We use 11 for office.</EnumValue>
                <EnumValue name="MobileUnit">7. CPT code 15</EnumValue>
                <EnumValue name="School">8. CPT code 03</EnumValue>
                <EnumValue name="MilitaryTreatFac">9. CPT code 26</EnumValue>
                <EnumValue name="FederalHealthCenter">10. CPT code 50</EnumValue>
                <EnumValue name="PublicHealthClinic">11. CPT code 71</EnumValue>
                <EnumValue name="RuralHealthClinic">12. CPT code 72</EnumValue>
                <EnumValue name="EmergencyRoomHospital">13. CPT code 23</EnumValue>
                <EnumValue name="AmbulatorySurgicalCenter">14. CPT code 24</EnumValue>
            </Enumeration>
        </column>
        <column order="5" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  ProvNAME is always entered, but ProvNum supplements it by letting user select from list.  When entering a provNum, the name will be filled in automatically. Can be 0 if the provider is not in the list, but provName is required.</summary>
        </column>
        <column order="6" name="ProvName" type="varchar(255)">
            <summary>Required.</summary>
        </column>
        <column order="7" name="Gender" type="tinyint">
            <summary>Enum:PatientGender</summary>
            <Enumeration name="PatientGender">
                <summary />
                <EnumValue name="Male">0</EnumValue>
                <EnumValue name="Female">1</EnumValue>
                <EnumValue name="Unknown">2- This is not a joke. Required by HIPAA for privacy.  Required by ehr to track missing entries.</EnumValue>
            </Enumeration>
        </column>
        <column order="8" name="Race" type="tinyint(4)">
            <summary>Enum:PatientRace and ethnicity.</summary>
            <Enumeration name="PatientRace">
                <summary>Race and ethnicity for patient. Used by public health.  The problem is that everyone seems to want different choices.  If we give these choices their own table, then we also need to include mapping functions.  These are currently used in ArizonaReports, HL7 w ECW, and EHR.  Foreign users would like their own mappings.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Multiracial">1</EnumValue>
                <EnumValue name="HispanicLatino">2</EnumValue>
                <EnumValue name="AfricanAmerican">3</EnumValue>
                <EnumValue name="White">4</EnumValue>
                <EnumValue name="HawaiiOrPacIsland">5</EnumValue>
                <EnumValue name="AmericanIndian">6</EnumValue>
                <EnumValue name="Asian">7</EnumValue>
                <EnumValue name="Other">8</EnumValue>
                <EnumValue name="Aboriginal">9</EnumValue>
                <EnumValue name="BlackHispanic">10 - Required by EHR.</EnumValue>
            </Enumeration>
        </column>
        <column order="9" name="GradeLevel" type="tinyint(4)">
            <summary>Enum:PatientGrade</summary>
            <Enumeration name="PatientGrade">
                <summary>Grade level used in public health.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="First">1</EnumValue>
                <EnumValue name="Second">2</EnumValue>
                <EnumValue name="Third">3</EnumValue>
                <EnumValue name="Fourth">4</EnumValue>
                <EnumValue name="Fifth">5</EnumValue>
                <EnumValue name="Sixth">6</EnumValue>
                <EnumValue name="Seventh">7</EnumValue>
                <EnumValue name="Eighth">8</EnumValue>
                <EnumValue name="Ninth">9</EnumValue>
                <EnumValue name="Tenth">10</EnumValue>
                <EnumValue name="Eleventh">11</EnumValue>
                <EnumValue name="Twelfth">12</EnumValue>
                <EnumValue name="PrenatalWIC">13</EnumValue>
                <EnumValue name="PreK">14</EnumValue>
                <EnumValue name="Kindergarten">15</EnumValue>
                <EnumValue name="Other">16</EnumValue>
            </Enumeration>
        </column>
        <column order="10" name="Age" type="tinyint">
            <summary>Age of patient at the time the screening was done. Faster than recording birthdates.</summary>
        </column>
        <column order="11" name="Urgency" type="tinyint(4)">
            <summary>Enum:TreatmentUrgency</summary>
            <Enumeration name="TreatmentUrgency">
                <summary>For public health.  Unknown, NoProblems, NeedsCarE, or Urgent.</summary>
                <EnumValue name="Unknown"></EnumValue>
                <EnumValue name="NoProblems"></EnumValue>
                <EnumValue name="NeedsCare"></EnumValue>
                <EnumValue name="Urgent"></EnumValue>
            </Enumeration>
        </column>
        <column order="12" name="HasCaries" type="tinyint">
            <summary>Enum:YN Set to true if patient has cavities.</summary>
            <Enumeration name="YN">
                <summary>Unknown,Yes, or No.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Yes">1</EnumValue>
                <EnumValue name="No">2</EnumValue>
            </Enumeration>
        </column>
        <column order="13" name="NeedsSealants" type="tinyint">
            <summary>Enum:YN Set to true if patient needs sealants.</summary>
            <Enumeration name="YN">
                <summary>Unknown,Yes, or No.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Yes">1</EnumValue>
                <EnumValue name="No">2</EnumValue>
            </Enumeration>
        </column>
        <column order="14" name="CariesExperience" type="tinyint">
            <summary>Enum:YN</summary>
            <Enumeration name="YN">
                <summary>Unknown,Yes, or No.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Yes">1</EnumValue>
                <EnumValue name="No">2</EnumValue>
            </Enumeration>
        </column>
        <column order="15" name="EarlyChildCaries" type="tinyint">
            <summary>Enum:YN</summary>
            <Enumeration name="YN">
                <summary>Unknown,Yes, or No.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Yes">1</EnumValue>
                <EnumValue name="No">2</EnumValue>
            </Enumeration>
        </column>
        <column order="16" name="ExistingSealants" type="tinyint">
            <summary>Enum:YN</summary>
            <Enumeration name="YN">
                <summary>Unknown,Yes, or No.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Yes">1</EnumValue>
                <EnumValue name="No">2</EnumValue>
            </Enumeration>
        </column>
        <column order="17" name="MissingAllTeeth" type="tinyint">
            <summary>Enum:YN</summary>
            <Enumeration name="YN">
                <summary>Unknown,Yes, or No.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Yes">1</EnumValue>
                <EnumValue name="No">2</EnumValue>
            </Enumeration>
        </column>
        <column order="18" name="Birthdate" type="date">
            <summary>Optional</summary>
        </column>
        <column order="19" name="ScreenGroupNum" type="bigint(20)" fk="screengroup">
            <summary>FK to screengroup.ScreenGroupNum.</summary>
        </column>
        <column order="20" name="ScreenGroupOrder" type="smallint">
            <summary>The order of this item within its group.</summary>
        </column>
        <column order="21" name="Comments" type="varchar(255)">
            <summary>.</summary>
        </column>
    </table>
    <table name="screengroup">
        <summary>Used in public health.  Programming note: There are many extra fields in common with the screen table, but they are only in this struct and not in the database itself, where that data is stored with the individual screen items. The data in this table is irrelevant in reports.  It is just used to help organize the user interface.</summary>
        <column order="0" name="ScreenGroupNum" type="bigint(20)">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Up to the user.</summary>
        </column>
        <column order="2" name="SGDate" type="date">
            <summary>Date used to help order the groups.</summary>
        </column>
    </table>
    <table name="securitylog">
        <summary>Stores an ongoing record of database activity for security purposes.  User not allowed to edit.</summary>
        <column order="0" name="SecurityLogNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PermType" type="tinyint">
            <summary>Enum:Permissions</summary>
            <Enumeration name="Permissions">
                <summary>A hard-coded list of permissions which may be granted to usergroups.</summary>
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="AppointmentsModule">1</EnumValue>
                <EnumValue name="FamilyModule">2</EnumValue>
                <EnumValue name="AccountModule">3</EnumValue>
                <EnumValue name="TPModule">4</EnumValue>
                <EnumValue name="ChartModule">5</EnumValue>
                <EnumValue name="ImagesModule">6</EnumValue>
                <EnumValue name="ManageModule">7</EnumValue>
                <EnumValue name="Setup">8. Currently covers a wide variety of setup functions. </EnumValue>
                <EnumValue name="RxCreate">9</EnumValue>
                <EnumValue name="ProcComplEdit">10. Uses date restrictions.</EnumValue>
                <EnumValue name="ChooseDatabase">11</EnumValue>
                <EnumValue name="Schedules">12</EnumValue>
                <EnumValue name="Blockouts">13</EnumValue>
                <EnumValue name="ClaimSentEdit">14. Uses date restrictions.</EnumValue>
                <EnumValue name="PaymentCreate">15</EnumValue>
                <EnumValue name="PaymentEdit">16. Uses date restrictions.</EnumValue>
                <EnumValue name="AdjustmentCreate">17</EnumValue>
                <EnumValue name="AdjustmentEdit">18. Uses date restrictions.</EnumValue>
                <EnumValue name="UserQuery">19</EnumValue>
                <EnumValue name="StartupSingleUserOld">20.  Not used anymore.</EnumValue>
                <EnumValue name="StartupMultiUserOld">21 Not used anymore.</EnumValue>
                <EnumValue name="Reports">22</EnumValue>
                <EnumValue name="ProcComplCreate">23. Includes setting procedures complete.</EnumValue>
                <EnumValue name="SecurityAdmin">24. At least one user must have this permission.</EnumValue>
                <EnumValue name="AppointmentCreate">25. </EnumValue>
                <EnumValue name="AppointmentMove">26</EnumValue>
                <EnumValue name="AppointmentEdit">27</EnumValue>
                <EnumValue name="Backup">28</EnumValue>
                <EnumValue name="TimecardsEditAll">29</EnumValue>
                <EnumValue name="DepositSlips">30</EnumValue>
                <EnumValue name="AccountingEdit">31. Uses date restrictions.</EnumValue>
                <EnumValue name="AccountingCreate">32. Uses date restrictions.</EnumValue>
                <EnumValue name="Accounting">33</EnumValue>
                <EnumValue name="AnesthesiaIntakeMeds">34</EnumValue>
                <EnumValue name="AnesthesiaControlMeds">35</EnumValue>
                <EnumValue name="InsPayCreate">36</EnumValue>
                <EnumValue name="InsPayEdit">37. Uses date restrictions. Also includes completed claimprocs even if unattached to an insurance check.  However, it's not actually enforced when creating a check because it would be very complex.</EnumValue>
                <EnumValue name="TreatPlanEdit">38. Uses date restrictions.</EnumValue>
                <EnumValue name="ReportProdInc">39</EnumValue>
                <EnumValue name="TimecardDeleteEntry">40. Uses date restrictions.</EnumValue>
                <EnumValue name="EquipmentDelete">41. Uses date restrictions. All other equipment functions are covered by .Setup.</EnumValue>
                <EnumValue name="SheetEdit">42. Uses date restrictions.</EnumValue>
                <EnumValue name="CommlogEdit">43. Uses date restrictions.</EnumValue>
                <EnumValue name="ImageDelete">44. Uses date restrictions.</EnumValue>
                <EnumValue name="PerioEdit">45. Uses date restrictions.</EnumValue>
                <EnumValue name="ProcEditShowFee">46</EnumValue>
                <EnumValue name="AdjustmentEditZero">47</EnumValue>
                <EnumValue name="EhrEmergencyAccess">48</EnumValue>
                <EnumValue name="ProcDelete">49. Uses date restrictions.</EnumValue>
                <EnumValue name="EhrKeyAdd">50 - Only used at OD HQ.  No user interface.</EnumValue>
                <EnumValue name="Providers">51</EnumValue>
                <EnumValue name="EcwAppointmentRevise">52</EnumValue>
                <EnumValue name="ProcedureNote">53</EnumValue>
                <EnumValue name="ReferralAdd">54</EnumValue>
            </Enumeration>
        </column>
        <column order="2" name="UserNum" type="bigint(20)" fk="user">
            <summary>FK to user.UserNum</summary>
        </column>
        <column order="3" name="LogDateTime" type="datetime">
            <summary>The date and time of the entry.  It's value is set when inserting and can never change.  Even if a user changes the date on their ocmputer, this remains accurate because it uses server time.</summary>
        </column>
        <column order="4" name="LogText" type="text">
            <summary>The description of exactly what was done. Varies by permission type.</summary>
        </column>
        <column order="5" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  Can be 0 if not applicable.</summary>
        </column>
        <column order="6" name="CompName" type="varchar(255)">
            <summary>.</summary>
        </column>
    </table>
    <table name="sheet">
        <summary>One sheet for one patient.</summary>
        <column order="0" name="SheetNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="SheetType" type="int(11)">
            <summary>Enum:SheetTypeEnum</summary>
            <Enumeration name="SheetTypeEnum">
                <summary>Different types of sheets that can be used.</summary>
                <EnumValue name="LabelPatient">0-Requires SheetParameter for PatNum. Does not get saved to db.</EnumValue>
                <EnumValue name="LabelCarrier">1-Requires SheetParameter for CarrierNum. Does not get saved to db.</EnumValue>
                <EnumValue name="LabelReferral">2-Requires SheetParameter for ReferralNum. Does not get saved to db.</EnumValue>
                <EnumValue name="ReferralSlip">3-Requires SheetParameters for PatNum,ReferralNum.</EnumValue>
                <EnumValue name="LabelAppointment">4-Requires SheetParameter for AptNum. Does not get saved to db.</EnumValue>
                <EnumValue name="Rx">5-Requires SheetParameter for RxNum.</EnumValue>
                <EnumValue name="Consent">6-Requires SheetParameter for PatNum.</EnumValue>
                <EnumValue name="PatientLetter">7-Requires SheetParameter for PatNum.</EnumValue>
                <EnumValue name="ReferralLetter">8-Requires SheetParameters for PatNum,ReferralNum.</EnumValue>
                <EnumValue name="PatientForm">9-Requires SheetParameter for PatNum.</EnumValue>
                <EnumValue name="RoutingSlip">10-Requires SheetParameter for AptNum.  Does not get saved to db.</EnumValue>
                <EnumValue name="MedicalHistory">11-Requires SheetParameter for PatNum.</EnumValue>
                <EnumValue name="LabSlip">12-Requires SheetParameter for PatNum, LabCaseNum.</EnumValue>
                <EnumValue name="ExamSheet">13-Requires SheetParameter for PatNum.</EnumValue>
                <EnumValue name="DepositSlip">14-Requires SheetParameter for PatNum.</EnumValue>
            </Enumeration>
        </column>
        <column order="2" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  A saved sheet is always attached to a patient (except deposit slip).  There are a few sheets that are so minor that they don't get saved, such as a Carrier label.</summary>
        </column>
        <column order="3" name="DateTimeSheet" type="datetime">
            <summary>The date and time of the sheet as it will be displayed in the commlog.</summary>
        </column>
        <column order="4" name="FontSize" type="float">
            <summary>The default fontSize for the sheet.  The actual font must still be saved with each sheetField.</summary>
        </column>
        <column order="5" name="FontName" type="varchar(255)">
            <summary>The default fontName for the sheet.  The actual font must still be saved with each sheetField.</summary>
        </column>
        <column order="6" name="Width" type="int(11)">
            <summary>Width of the sheet in pixels, 100 pixels per inch.</summary>
        </column>
        <column order="7" name="Height" type="int(11)">
            <summary>Height of the sheet in pixels, 100 pixels per inch.</summary>
        </column>
        <column order="8" name="IsLandscape" type="tinyint(4)">
            <summary>.</summary>
        </column>
        <column order="9" name="InternalNote" type="text">
            <summary>An internal note for the use of the office staff regarding the sheet.  Not to be printed on the sheet in any way.</summary>
        </column>
        <column order="10" name="Description" type="varchar(255)">
            <summary>Copied from the SheetDef description.</summary>
        </column>
        <column order="11" name="ShowInTerminal" type="tinyint(4)">
            <summary>The order that this sheet will show in the patient terminal for the patient to fill out.  Or zero if not set.</summary>
        </column>
        <column order="12" name="IsWebForm" type="tinyint(4)">
            <summary>True if this sheet was downloaded from the webforms service.</summary>
        </column>
    </table>
    <table name="sheetdef">
        <summary>A definition (template) for a sheet.  Can be pulled from the database, or it can be internally defined.</summary>
        <column order="0" name="SheetDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>The description of this sheetdef.</summary>
        </column>
        <column order="2" name="SheetType" type="int(11)">
            <summary>Enum:SheetTypeEnum</summary>
            <Enumeration name="SheetTypeEnum">
                <summary>Different types of sheets that can be used.</summary>
                <EnumValue name="LabelPatient">0-Requires SheetParameter for PatNum. Does not get saved to db.</EnumValue>
                <EnumValue name="LabelCarrier">1-Requires SheetParameter for CarrierNum. Does not get saved to db.</EnumValue>
                <EnumValue name="LabelReferral">2-Requires SheetParameter for ReferralNum. Does not get saved to db.</EnumValue>
                <EnumValue name="ReferralSlip">3-Requires SheetParameters for PatNum,ReferralNum.</EnumValue>
                <EnumValue name="LabelAppointment">4-Requires SheetParameter for AptNum. Does not get saved to db.</EnumValue>
                <EnumValue name="Rx">5-Requires SheetParameter for RxNum.</EnumValue>
                <EnumValue name="Consent">6-Requires SheetParameter for PatNum.</EnumValue>
                <EnumValue name="PatientLetter">7-Requires SheetParameter for PatNum.</EnumValue>
                <EnumValue name="ReferralLetter">8-Requires SheetParameters for PatNum,ReferralNum.</EnumValue>
                <EnumValue name="PatientForm">9-Requires SheetParameter for PatNum.</EnumValue>
                <EnumValue name="RoutingSlip">10-Requires SheetParameter for AptNum.  Does not get saved to db.</EnumValue>
                <EnumValue name="MedicalHistory">11-Requires SheetParameter for PatNum.</EnumValue>
                <EnumValue name="LabSlip">12-Requires SheetParameter for PatNum, LabCaseNum.</EnumValue>
                <EnumValue name="ExamSheet">13-Requires SheetParameter for PatNum.</EnumValue>
                <EnumValue name="DepositSlip">14-Requires SheetParameter for PatNum.</EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="FontSize" type="float">
            <summary>The default fontSize for the sheet.  The actual font must still be saved with each sheetField.</summary>
        </column>
        <column order="4" name="FontName" type="varchar(255)">
            <summary>The default fontName for the sheet.  The actual font must still be saved with each sheetField.</summary>
        </column>
        <column order="5" name="Width" type="int(11)">
            <summary>Width of the sheet in pixels, 100 pixels per inch.</summary>
        </column>
        <column order="6" name="Height" type="int(11)">
            <summary>Height of the sheet in pixels, 100 pixels per inch.</summary>
        </column>
        <column order="7" name="IsLandscape" type="tinyint(4)">
            <summary>Set to true to print landscape.</summary>
        </column>
    </table>
    <table name="sheetfield">
        <summary>One field on a sheet.</summary>
        <column order="0" name="SheetFieldNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="SheetNum" type="bigint(20)" fk="sheet">
            <summary>FK to sheet.SheetNum.</summary>
        </column>
        <column order="2" name="FieldType" type="int(11)">
            <summary>Enum:SheetFieldType  OutputText, InputField, StaticText,Parameter(only used for SheetField, not SheetFieldDef),Image,Drawing,Line,Rectangle,CheckBox,SigBox,PatImage.</summary>
        </column>
        <column order="3" name="FieldName" type="varchar(255)">
            <summary>Mostly for OutputText and InputField types.  Each sheet typically has a main datatable type.  For OutputText types, FieldName is usually the string representation of the database column for the main table.  For other tables, it can be of the form table.Column.  There may also be extra fields available that are not strictly pulled from the database.  Extra fields will start with lowercase to indicate that they are not pure database fields.  The list of available fields for each type in SheetFieldsAvailable.  Users can pick from that list.  Likewise, InputField types are internally tied to actions to persist the data.  So they are also hard coded and are available in SheetFieldsAvailable.  For static images, this is the full file name including extension, but without path.  Static images paths are reconstructed by looking in the AtoZ folder, SheetImages folder.  For a PatImage, this now contains the long FK to the document.  A join must be done to that table to find the filename.   When a SheetField has a fieldType of Parameter, then the FieldName stores the name of the parameter.</summary>
        </column>
        <column order="4" name="FieldValue" type="text">
            <summary>For OutputText, this value is set before printing.  This is the data obtained from the database and ready to print.  For StaticText, this is copied from the sheetFieldDef, but in-line fields like [this] will have been filled.  For an archived sheet retrieved from the database (all SheetField rows), this value will have been saved and will not be filled again automatically.  For a parameter fieldtype, this will store the value of the parameter. For a Drawing fieldtype, this will be the point data for the lines.  The format would look similar to this: 45,68;48,70;49,72;0,0;55,88;etc.  It's simply a sequence of points, separated by semicolons.  For CheckBox, it will either be an X or empty.  For SigBox, the first char will be 0 or 1 to indicate SigIsTopaz, and all subsequent chars will be the Signature itself.   For Pat Image, this contains image size and image position info.  Like this: "X=0,Y=20,W=100,H=60".  This is initially generated automatically to fit the object.  It can later be changed by the user to "zoom and pan" within the confines of the object.</summary>
        </column>
        <column order="5" name="FontSize" type="float">
            <summary>The fontSize for this field regardless of the default for the sheet.  The actual font must be saved with each sheetField.</summary>
        </column>
        <column order="6" name="FontName" type="varchar(255)">
            <summary>The fontName for this field regardless of the default for the sheet.  The actual font must be saved with each sheetField.</summary>
        </column>
        <column order="7" name="FontIsBold" type="tinyint(4)">
            <summary>.</summary>
        </column>
        <column order="8" name="XPos" type="int(11)">
            <summary>In pixels.</summary>
        </column>
        <column order="9" name="YPos" type="int(11)">
            <summary>In pixels.</summary>
        </column>
        <column order="10" name="Width" type="int(11)">
            <summary>The field will be constrained horizontally to this size.  Not allowed to be zero.</summary>
        </column>
        <column order="11" name="Height" type="int(11)">
            <summary>The field will be constrained vertically to this size.  Not allowed to be 0.  It's not allowed to be zero so that it will be visible on the designer.</summary>
        </column>
        <column order="12" name="GrowthBehavior" type="int(11)">
            <summary>Enum:GrowthBehaviorEnum</summary>
            <Enumeration name="GrowthBehaviorEnum">
                <summary>For sheetFields</summary>
                <EnumValue name="None">Not allowed to grow.  Max size would be Height and Width.</EnumValue>
                <EnumValue name="DownLocal">Can grow down if needed, and will push nearby objects out of the way so that there is no overlap.</EnumValue>
                <EnumValue name="DownGlobal">Can grow down, and will push down all objects on the sheet that are below it.  Mostly used when drawing grids.</EnumValue>
            </Enumeration>
        </column>
        <column order="13" name="RadioButtonValue" type="varchar(255)">
            <summary>This is only used for checkboxes that you want to behave like radiobuttons.  Set the FieldName the same for each Checkbox in the group.  The FieldValue will likely be X for one of them and empty string for the others.  Each of them will have a different RadioButtonValue.  Whichever box has X, the RadioButtonValue for that box will be used when importing.  This field is not used for "misc" radiobutton groups.</summary>
        </column>
        <column order="14" name="RadioButtonGroup" type="varchar(255)">
            <summary>Name which identifies the group within which the radio button belongs. FieldName must be set to "misc" in order for the group to take effect.</summary>
        </column>
        <column order="15" name="IsRequired" type="tinyint(4)">
            <summary>Set to true if this field is required to have a value before the sheet is closed.</summary>
        </column>
        <column order="16" name="TabOrder" type="int(11)">
            <summary>Tab stop order for all fields. Only checkboxes and input fields can have values other than 0.</summary>
        </column>
    </table>
    <table name="sheetfielddef">
        <summary>One field on a sheetDef.</summary>
        <column order="0" name="SheetFieldDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="SheetDefNum" type="bigint(20)" fk="sheetdef">
            <summary>FK to sheetdef.SheetDefNum.</summary>
        </column>
        <column order="2" name="FieldType" type="int(11)">
            <summary>Enum:SheetFieldType  OutputText, InputField, StaticText,Parameter(only used for SheetField, not SheetFieldDef),Image,Drawing,Line,Rectangle,CheckBox,SigBox,PatImage.</summary>
        </column>
        <column order="3" name="FieldName" type="varchar(255)">
            <summary>Mostly for OutputText, InputField, and CheckBox types.  Each sheet typically has a main datatable type.  For OutputText types, FieldName is usually the string representation of the database column for the main table.  For other tables, it can be of the form table.Column.  There may also be extra fields available that are not strictly pulled from the database.  Extra fields will start with lowercase to indicate that they are not pure database fields.  The list of available fields for each type in SheetFieldsAvailable.  Users can pick from that list.  Likewise, InputField types are internally tied to actions to persist the data.  So they are also hard coded and are available in SheetFieldsAvailable.  For static images, this is the full file name including extension, but without path.  Static images paths are reconstructed by looking in the AtoZ folder, SheetImages folder.  For Pat Images, this is an long FK/DefNum to the default folder for the image.  The filename of a PatImage will later be stored in FieldValue.</summary>
        </column>
        <column order="4" name="FieldValue" type="text">
            <summary>For StaticText, this text can include bracketed fields, like [nameLF].  For OutputText and InputField, this will be blank.  For CheckBoxes, either X or blank.  Even if the checkbox is set to behave like a radio button.</summary>
        </column>
        <column order="5" name="FontSize" type="float">
            <summary>The fontSize for this field regardless of the default for the sheet.  The actual font must be saved with each sheetField.</summary>
        </column>
        <column order="6" name="FontName" type="varchar(255)">
            <summary>The fontName for this field regardless of the default for the sheet.  The actual font must be saved with each sheetField.</summary>
        </column>
        <column order="7" name="FontIsBold" type="tinyint(4)">
            <summary>.</summary>
        </column>
        <column order="8" name="XPos" type="int(11)">
            <summary>In pixels.</summary>
        </column>
        <column order="9" name="YPos" type="int(11)">
            <summary>In pixels.</summary>
        </column>
        <column order="10" name="Width" type="int(11)">
            <summary>The field will be constrained horizontally to this size.  Not allowed to be zero.</summary>
        </column>
        <column order="11" name="Height" type="int(11)">
            <summary>The field will be constrained vertically to this size.  Not allowed to be 0.  It's not allowed to be zero so that it will be visible on the designer.</summary>
        </column>
        <column order="12" name="GrowthBehavior" type="int(11)">
            <summary>Enum:GrowthBehaviorEnum</summary>
            <Enumeration name="GrowthBehaviorEnum">
                <summary>For sheetFields</summary>
                <EnumValue name="None">Not allowed to grow.  Max size would be Height and Width.</EnumValue>
                <EnumValue name="DownLocal">Can grow down if needed, and will push nearby objects out of the way so that there is no overlap.</EnumValue>
                <EnumValue name="DownGlobal">Can grow down, and will push down all objects on the sheet that are below it.  Mostly used when drawing grids.</EnumValue>
            </Enumeration>
        </column>
        <column order="13" name="RadioButtonValue" type="varchar(255)">
            <summary>This is only used for checkboxes that you want to behave like radiobuttons.  Set the FieldName the same for each Checkbox in the group.  The FieldValue will likely be X for one of them and empty string for the others.  Each of them will have a different RadioButtonValue.  Whichever box has X, the RadioButtonValue for that box will be used when importing.  This field is not used for "misc" radiobutton groups.</summary>
        </column>
        <column order="14" name="RadioButtonGroup" type="varchar(255)">
            <summary>Name which identifies the group within which the radio button belongs. FieldName must be set to "misc" in order for the group to take effect.</summary>
        </column>
        <column order="15" name="IsRequired" type="tinyint(4)">
            <summary>Set to true if this field is required to have a value before the sheet is closed.</summary>
        </column>
        <column order="16" name="TabOrder" type="int(11)">
            <summary>Tab stop order for all fields. One-based.  Only checkboxes and input fields can have values other than 0.</summary>
        </column>
    </table>
    <table name="sigbutdef">
        <summary>This defines the light buttons on the left of the main screen.</summary>
        <column order="0" name="SigButDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ButtonText" type="varchar(255)">
            <summary>The text on the button</summary>
        </column>
        <column order="2" name="ButtonIndex" type="smallint(6)">
            <summary>0-based index defines the order of the buttons.</summary>
        </column>
        <column order="3" name="SynchIcon" type="tinyint">
            <summary>0=none, or 1-9. The cell in the 3x3 tic-tac-toe main program icon that is to be synched with this button.  It will light up or clear whenever this button lights or clears.</summary>
        </column>
        <column order="4" name="ComputerName" type="varchar(255)">
            <summary>Blank for the default buttons.  Or contains the computer name for the buttons that override the defaults.</summary>
        </column>
    </table>
    <table name="sigbutdefelement">
        <summary>This table stores references to the sequence of sounds and lights that should get sent out with a button push.</summary>
        <column order="0" name="ElementNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="SigButDefNum" type="bigint(20)" fk="sigbutdef">
            <summary>FK to sigbutdef.SigButDefNum  A few elements are usually attached to a single button.</summary>
        </column>
        <column order="2" name="SigElementDefNum" type="bigint(20)" fk="sigelementdef">
            <summary>FK to sigelementdef.SigElementDefNum, which contains the actual sound or light.</summary>
        </column>
    </table>
    <table name="sigelement">
        <summary>These are the actual elements attached to each signal that is sent.  They contain references to the sounds and lights that should result.</summary>
        <column order="0" name="SigElementNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="SigElementDefNum" type="bigint(20)" fk="sigelementdef">
            <summary>FK to sigelementdef.SigElementDefNum</summary>
        </column>
        <column order="2" name="SignalNum" type="bigint(20)" fk="signalod">
            <summary>FK to signalod.SignalNum.</summary>
        </column>
    </table>
    <table name="sigelementdef">
        <summary>This defines the items that will be available for clicking when composing a manual message.  Also, these are referred to in the button definitions as a sequence of elements.</summary>
        <column order="0" name="SigElementDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LightRow" type="tinyint">
            <summary>If this element should cause a button to light up, this would be the row.  0 means none.</summary>
        </column>
        <column order="2" name="LightColor" type="int(11)">
            <summary>If a light row is set, this is the color it will turn when triggered.  Ack sets it back to white.  Note that color and row can be in two separate elements of the same signal.</summary>
        </column>
        <column order="3" name="SigElementType" type="tinyint">
            <summary>Enum:SignalElementType  0=User,1=Extra,2=Message.</summary>
            <Enumeration name="SignalElementType">
                <summary>0=User,1=Extra,2=Message.</summary>
                <EnumValue name="User">0-To and From lists.  Not tied in any way to the users that are part of security.</EnumValue>
                <EnumValue name="Extra">Typically used to insert "family" before "phone" signals.</EnumValue>
                <EnumValue name="Message">Elements of this type show in the last column and trigger the message to be sent.</EnumValue>
            </Enumeration>
        </column>
        <column order="4" name="SigText" type="varchar(255)">
            <summary>The text that shows for the element, like the user name or the two word message.  No long text is stored here.</summary>
        </column>
        <column order="5" name="Sound" type="mediumtext">
            <summary>The sound to play for this element.  Wav file stored in the database in string format until "played".  If empty string, then no sound.</summary>
        </column>
        <column order="6" name="ItemOrder" type="smallint(6)">
            <summary>The order of this element within the list of the same type.</summary>
        </column>
    </table>
    <table name="signalod">
        <summary>An actual signal that gets sent out as part of the messaging functionality.</summary>
        <column order="0" name="SignalNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="FromUser" type="varchar(255)">
            <summary>Text version of 'user' this message was sent from, which can actually be any description of a group or individual.</summary>
        </column>
        <column order="2" name="ITypes" type="text">
            <summary>Enum:InvalidType List of InvalidType long values separated by commas.  Can be empty.  When Date or Tasks are used, they are used all alone with no other flags present.</summary>
            <Enumeration name="InvalidType">
                <summary>When the autorefresh message is sent to the other computers, this is the type.</summary>
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="Date">1 Not used with any other flags</EnumValue>
                <EnumValue name="AllLocal">2 Deprecated.  Inefficient.  All flags combined except Date and Tasks.</EnumValue>
                <EnumValue name="Task">3 Not used with any other flags.  Used to just indicate added tasks, but now it indicates any change at all except those where a popup is needed.  If we also want a popup, then use TaskPopup.</EnumValue>
                <EnumValue name="ProcCodes">4</EnumValue>
                <EnumValue name="Prefs">5</EnumValue>
                <EnumValue name="Views">6 ApptViews, ApptViewItems, AppointmentRules, ProcApptColors.</EnumValue>
                <EnumValue name="AutoCodes">7</EnumValue>
                <EnumValue name="Carriers">8</EnumValue>
                <EnumValue name="ClearHouses">9</EnumValue>
                <EnumValue name="Computers">10</EnumValue>
                <EnumValue name="InsCats">11</EnumValue>
                <EnumValue name="Employees">12- Also includes payperiods.</EnumValue>
                <EnumValue name="StartupOld">13- Deprecated.</EnumValue>
                <EnumValue name="Defs">14</EnumValue>
                <EnumValue name="Email">15</EnumValue>
                <EnumValue name="Fees">16</EnumValue>
                <EnumValue name="Letters">17</EnumValue>
                <EnumValue name="QuickPaste">18</EnumValue>
                <EnumValue name="Security">19- Userod and UserGroup</EnumValue>
                <EnumValue name="Programs">20</EnumValue>
                <EnumValue name="ToolBut">21- Also includes Image Mounts</EnumValue>
                <EnumValue name="Providers">22- Also includes clinics.</EnumValue>
                <EnumValue name="ClaimForms">23</EnumValue>
                <EnumValue name="ZipCodes">24</EnumValue>
                <EnumValue name="LetterMerge">25</EnumValue>
                <EnumValue name="DentalSchools">26</EnumValue>
                <EnumValue name="Operatories">27</EnumValue>
                <EnumValue name="TaskPopup">28</EnumValue>
                <EnumValue name="Sites">29</EnumValue>
                <EnumValue name="Pharmacies">30</EnumValue>
                <EnumValue name="Sheets">31</EnumValue>
                <EnumValue name="RecallTypes">32</EnumValue>
                <EnumValue name="FeeScheds">33</EnumValue>
                <EnumValue name="PhoneNumbers">34. This is used internally by OD, Inc with the phonenumber table and the phone server.</EnumValue>
                <EnumValue name="Signals">35. Signal/message defs</EnumValue>
                <EnumValue name="DisplayFields">36</EnumValue>
                <EnumValue name="PatFields">37. And ApptFields.</EnumValue>
                <EnumValue name="AccountingAutoPays">38</EnumValue>
                <EnumValue name="ProcButtons">39</EnumValue>
                <EnumValue name="Diseases">40.  Includes ICD9s.</EnumValue>
                <EnumValue name="Languages">41</EnumValue>
                <EnumValue name="AutoNotes">42</EnumValue>
                <EnumValue name="ElectIDs">43</EnumValue>
                <EnumValue name="Employers">44</EnumValue>
                <EnumValue name="ProviderIdents">45</EnumValue>
                <EnumValue name="ShutDownNow">46</EnumValue>
                <EnumValue name="InsFilingCodes">47</EnumValue>
                <EnumValue name="ReplicationServers">48</EnumValue>
                <EnumValue name="Automation">49</EnumValue>
                <EnumValue name="PhoneAsteriskReload">50. This is used internally by OD, Inc with the phone server to trigger the phone system to reload after changing which call groups users are in.</EnumValue>
                <EnumValue name="TimeCardRules">51</EnumValue>
                <EnumValue name="Vaccines">52. Includes DrugManufacturers and DrugUnits.</EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="DateViewing" type="date">
            <summary>If IType=Date, then this is the affected date in the Appointments module.</summary>
        </column>
        <column order="4" name="SigType" type="tinyint">
            <summary>Enum:SignalType  Button, or Invalid.</summary>
            <Enumeration name="SignalType">
                <summary>The type of signal being sent.</summary>
                <EnumValue name="Button">0- Includes text messages.</EnumValue>
                <EnumValue name="Invalid">1</EnumValue>
            </Enumeration>
        </column>
        <column order="5" name="SigText" type="text">
            <summary>This is only used if the type is button, and the user types in some text.  This is the typed portion and does not include any of the text that was on the buttons.  These types of signals are displayed in their own separate list in addition to any light and sound that they may cause.</summary>
        </column>
        <column order="6" name="SigDateTime" type="datetime">
            <summary>The exact server time when this signal was entered into db.  This does not need to be set by sender since it's handled automatically.</summary>
        </column>
        <column order="7" name="ToUser" type="varchar(255)">
            <summary>Text version of 'user' this message was sent to, which can actually be any description of a group or individual.</summary>
        </column>
        <column order="8" name="AckTime" type="datetime">
            <summary>If this signal has been acknowledged, then this will contain the date and time.  This is how lights get turned off also.</summary>
        </column>
        <column order="9" name="TaskNum" type="bigint(20)" fk="task">
            <summary>FK to task.TaskNum.  If IType=Tasks, then this is the taskNum that was added.</summary>
        </column>
    </table>
    <table name="site">
        <summary>Generally used by mobile clinics to track the temporary locations where treatment is performed, such as schools, nursing homes, and community centers.  Replaces the old school table.</summary>
        <column order="0" name="SiteNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="Note" type="text">
            <summary>Notes could include phone, address, contacts, etc.</summary>
        </column>
    </table>
    <table name="statement">
        <summary>Represents one statement for one family.  Usually already sent, but could still be waiting to send.</summary>
        <column order="0" name="StatementNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum. Typically the guarantor.  Can also be the patient for walkout statements.</summary>
        </column>
        <column order="2" name="DateSent" type="date">
            <summary>This will always be a valid and reasonable date regardless of whether it's actually been sent yet.</summary>
        </column>
        <column order="3" name="DateRangeFrom" type="date">
            <summary>Typically 45 days before dateSent</summary>
        </column>
        <column order="4" name="DateRangeTo" type="date">
            <summary>Any date &gt;= year 2200 is considered max val.  We generally try to automate this value to be the same date as the statement rather than the max val.  This is so that when payment plans are displayed, we can add approximately 10 days to effectively show the charge that will soon be due.  Adding the 10 days is not done until display time.</summary>
        </column>
        <column order="5" name="Note" type="text">
            <summary>Can include line breaks.  This ordinary note will be in the standard font.</summary>
        </column>
        <column order="6" name="NoteBold" type="text">
            <summary>More important notes may go here.  Font will be bold.  Color and size of text will be customizable in setup.</summary>
        </column>
        <column order="7" name="Mode_" type="tinyint">
            <summary>Enum:StatementMode Mail, InPerson, Email, Electronic.</summary>
            <Enumeration name="StatementMode">
                <summary />
                <EnumValue name="Mail">0</EnumValue>
                <EnumValue name="InPerson">1</EnumValue>
                <EnumValue name="Email">2</EnumValue>
                <EnumValue name="Electronic">3</EnumValue>
            </Enumeration>
        </column>
        <column order="8" name="HidePayment" type="tinyint(1)">
            <summary>Set true to hide the credit card section, and the please pay box.</summary>
        </column>
        <column order="9" name="SinglePatient" type="tinyint(1)">
            <summary>One patient on statement instead of entire family.</summary>
        </column>
        <column order="10" name="Intermingled" type="tinyint(1)">
            <summary>If entire family, then this determines whether they are all intermingled into one big grid, or whether they are all listed in separate grids.</summary>
        </column>
        <column order="11" name="IsSent" type="tinyint(1)">
            <summary>True</summary>
        </column>
        <column order="12" name="DocNum" type="bigint(20)" fk="document">
            <summary>FK to document.DocNum when a pdf has been archived.</summary>
        </column>
        <column order="13" name="DateTStamp" type="timestamp">
            <summary>Date/time last altered.</summary>
        </column>
    </table>
    <table name="supplier">
        <summary>A company that provides supplies for the office, typically dental supplies.</summary>
        <column order="0" name="SupplierNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Name" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="Phone" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="3" name="CustomerId" type="varchar(255)">
            <summary>The customer ID that this office uses for transactions with the supplier</summary>
        </column>
        <column order="4" name="Website" type="text">
            <summary>Full address to website.  We might make it clickable.</summary>
        </column>
        <column order="5" name="UserName" type="varchar(255)">
            <summary>The username used to log in to the supplier website.</summary>
        </column>
        <column order="6" name="Password" type="varchar(255)">
            <summary>The password to log in to the supplier website.  Not encrypted or hidden in any way.</summary>
        </column>
        <column order="7" name="Note" type="text">
            <summary>Any note regarding supplier.  Could hold address, CC info, etc.</summary>
        </column>
    </table>
    <table name="supply">
        <summary>A dental supply or office supply item.</summary>
        <column order="0" name="SupplyNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="SupplierNum" type="bigint(20)" fk="supplier">
            <summary>FK to supplier.SupplierNum</summary>
        </column>
        <column order="2" name="CatalogNumber" type="varchar(255)">
            <summary>The catalog item number that the supplier uses to identify the supply.</summary>
        </column>
        <column order="3" name="Descript" type="varchar(255)">
            <summary>The description can be similar to the catalog, but not required.  Typically includes qty per box/case, etc.</summary>
        </column>
        <column order="4" name="Category" type="bigint(20)" fk="definition">
            <summary>FK to definition.DefNum.  User can define their own categories for supplies.</summary>
        </column>
        <column order="5" name="ItemOrder" type="int(11)">
            <summary>The zero-based order of this supply within it's category.</summary>
        </column>
        <column order="6" name="LevelDesired" type="float">
            <summary>The level that a fresh order should bring item back up to.  Can include fractions.  If this is 0, then it will be displayed as having this field blank rather than showing 0.  This simply gives a cleaner look.</summary>
        </column>
        <column order="7" name="IsHidden" type="tinyint(1)">
            <summary>If hidden, then this supply item won't normally show in the main list.</summary>
        </column>
        <column order="8" name="Price" type="double">
            <summary>The price per unit that the supplier charges for this supply.  If this is 0.00, then no price will be displayed.</summary>
        </column>
    </table>
    <table name="supplyneeded">
        <summary>A supply freeform typed in by a user.</summary>
        <column order="0" name="SupplyNeededNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="text">
            <summary>.</summary>
        </column>
        <column order="2" name="DateAdded" type="date">
            <summary>.</summary>
        </column>
    </table>
    <table name="supplyorder">
        <summary>One supply order to one supplier.  Contains SupplyOrderItems.</summary>
        <column order="0" name="SupplyOrderNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="SupplierNum" type="bigint(20)" fk="supplier">
            <summary>FK to supplier.SupplierNum.</summary>
        </column>
        <column order="2" name="DatePlaced" type="date">
            <summary>A date greater than 2200 (eg 2500), is considered a max date.  A max date is used for an order that was started but has not yet been placed.  This puts it at the end of the list where it belongs, but it will display as blank.  Only one unplaced order is allowed per supplier.</summary>
        </column>
        <column order="3" name="Note" type="text">
            <summary>.</summary>
        </column>
        <column order="4" name="AmountTotal" type="double">
            <summary>The sum of all the amounts of each item on the order.  If any of the item prices are zero, then it won't auto calculate this total.  This will allow the user to manually put in the total without having it get deleted.</summary>
        </column>
    </table>
    <table name="supplyorderitem">
        <summary>One item on one supply order.  This table links supplies to orders as well as storing a small amount of additional info.</summary>
        <column order="0" name="SupplyOrderItemNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="SupplyOrderNum" type="bigint(20)" fk="supplyorder">
            <summary>FK to supplyorder.supplyOrderNum.</summary>
        </column>
        <column order="2" name="SupplyNum" type="bigint(20)" fk="supply">
            <summary>FK to supply.SupplyNum.</summary>
        </column>
        <column order="3" name="Qty" type="int(11)">
            <summary>How many were ordered.</summary>
        </column>
        <column order="4" name="Price" type="double">
            <summary>Price per unit on this order.</summary>
        </column>
    </table>
    <table name="task">
        <summary>A task is a single todo item.</summary>
        <column order="0" name="TaskNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="TaskListNum" type="bigint(20)" fk="tasklist">
            <summary>FK to tasklist.TaskListNum.  If 0, then it will show in the trunk of a section.  </summary>
        </column>
        <column order="2" name="DateTask" type="date">
            <summary>Only used if this task is assigned to a dated category.  Children are NOT dated.  Only dated if they should show in the trunk for a date category.  They can also have a parent if they are in the main list as well.</summary>
        </column>
        <column order="3" name="KeyNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum or appointment.AptNum. Only used when ObjectType is not 0.</summary>
        </column>
        <column order="4" name="Descript" type="text">
            <summary>The description of this task.  Might be very long.</summary>
        </column>
        <column order="5" name="TaskStatus" type="tinyint">
            <summary>Enum:TaskStatusEnum New,Viewed,Done.</summary>
        </column>
        <column order="6" name="IsRepeating" type="tinyint">
            <summary>True if it is to show in the repeating section.  There should be no date.  All children and parents should also be set to IsRepeating=true.</summary>
        </column>
        <column order="7" name="DateType" type="tinyint">
            <summary>Enum:TaskDateType  None, Day, Week, Month.  If IsRepeating, then setting to None effectively disables the repeating feature.</summary>
            <Enumeration name="TaskDateType">
                <summary />
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="Day">1</EnumValue>
                <EnumValue name="Week">2</EnumValue>
                <EnumValue name="Month">3</EnumValue>
            </Enumeration>
        </column>
        <column order="8" name="FromNum" type="bigint(20)" fk="task">
            <summary>FK to task.TaskNum  If this is derived from a repeating task, then this will hold the TaskNum of that task.  It helps automate the adding and deleting of tasks.  It might be deleted automatically if not are marked complete.</summary>
        </column>
        <column order="9" name="ObjectType" type="tinyint">
            <summary>Enum:TaskObjectType  0=none,1=Patient,2=Appointment.  More will be added later. If a type is selected, then the KeyNum will contain the primary key of the corresponding Patient or Appointment.  Does not really have anything to do with the ObjectType of the parent tasklist, although they tend to match.</summary>
            <Enumeration name="TaskObjectType">
                <summary>Used when attaching objects to tasks.  These are the choices.</summary>
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="Patient">1</EnumValue>
                <EnumValue name="Appointment">2</EnumValue>
            </Enumeration>
        </column>
        <column order="10" name="DateTimeEntry" type="datetime">
            <summary>The date and time that this task was added.  Used to sort the list by the order entered.</summary>
        </column>
        <column order="11" name="UserNum" type="bigint(20)" fk="user">
            <summary>FK to user.UserNum.  The person who created the task.</summary>
        </column>
        <column order="12" name="DateTimeFinished" type="datetime">
            <summary>The date and time that this task was marked "done".</summary>
        </column>
    </table>
    <table name="taskancestor">
        <summary>Represents one ancestor of one task.  Each task will have at least one ancestor unless it is directly on a main trunk.  An ancestor is defined as a tasklist that is higher in the heirarchy for the task, regardless of how many levels up it is.  This allows us to mark task lists as having "new" tasks, and it allows us to quickly check for new tasks for a user on startup.</summary>
        <column order="0" name="TaskAncestorNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="TaskNum" type="bigint(20)" fk="task">
            <summary>FK to task.TaskNum</summary>
        </column>
        <column order="2" name="TaskListNum" type="bigint(20)" fk="tasklist">
            <summary>FK to tasklist.TaskListNum</summary>
        </column>
    </table>
    <table name="tasklist">
        <summary>A tasklist is like a folder system, where it can have child tasklists as well as tasks.</summary>
        <column order="0" name="TaskListNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Descript" type="varchar(255)">
            <summary>The description of this tasklist.  Might be very long, but not usually.</summary>
        </column>
        <column order="2" name="Parent" type="bigint(20)" fk="tasklist">
            <summary>FK to tasklist.TaskListNum  The parent task list to which this task list is assigned.  If zero, then this task list is on the main trunk of one of the sections.</summary>
        </column>
        <column order="3" name="DateTL" type="date">
            <summary>Optional. Set to 0001-01-01 for no date.  If a date is assigned, then this list will also be available from the date section.</summary>
        </column>
        <column order="4" name="IsRepeating" type="tinyint">
            <summary>True if it is to show in the repeating section.  There should be no date.  All children should also be set to IsRepeating=true.</summary>
        </column>
        <column order="5" name="DateType" type="tinyint">
            <summary>Enum:TaskDateType  None, Day, Week, Month.  If IsRepeating, then setting to None effectively disables the repeating feature.</summary>
            <Enumeration name="TaskDateType">
                <summary />
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="Day">1</EnumValue>
                <EnumValue name="Week">2</EnumValue>
                <EnumValue name="Month">3</EnumValue>
            </Enumeration>
        </column>
        <column order="6" name="FromNum" type="bigint(20)" fk="tasklist">
            <summary>FK to tasklist.TaskListNum  If this is derived from a repeating list, then this will hold the TaskListNum of that list.  It helps automate the adding and deleting of lists.  It might be deleted automatically if no tasks are marked complete.</summary>
        </column>
        <column order="7" name="ObjectType" type="tinyint">
            <summary>Enum:TaskObjectType  0=none, 1=Patient, 2=Appointment.  More will be added later. If a type is selected, then this list will be visible in the appropriate places for attaching the correct type of object.  The type is not copied to a task when created.  Tasks in this list do not have to be of the same type.  You can only attach an object to a task, not a tasklist.</summary>
            <Enumeration name="TaskObjectType">
                <summary>Used when attaching objects to tasks.  These are the choices.</summary>
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="Patient">1</EnumValue>
                <EnumValue name="Appointment">2</EnumValue>
            </Enumeration>
        </column>
        <column order="8" name="DateTimeEntry" type="datetime">
            <summary>The date and time that this list was added.  Used to sort the list by the order entered.</summary>
        </column>
    </table>
    <table name="tasknote">
        <summary>A tasknote is a note that may be added to a task. Many notes may be attached to a task. A user may only edit their own tasknotes within a task.</summary>
        <column order="0" name="TaskNoteNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="TaskNum" type="bigint(20)" fk="task">
            <summary>FK to task. The task this tasknote is attached to.</summary>
        </column>
        <column order="2" name="UserNum" type="bigint(20)" fk="user">
            <summary>FK to user. The user who created this tasknote.</summary>
        </column>
        <column order="3" name="DateTimeNote" type="datetime">
            <summary>Date and time the note was created (editable).</summary>
        </column>
        <column order="4" name="Note" type="text">
            <summary>Note. Text that the user wishes to show on the task.</summary>
        </column>
    </table>
    <table name="tasksubscription">
        <summary>A subscription of one user to either a tasklist or to a task.</summary>
        <column order="0" name="TaskSubscriptionNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="UserNum" type="bigint(20)" fk="userod">
            <summary>FK to userod.UserNum</summary>
        </column>
        <column order="2" name="TaskListNum" type="bigint(20)" fk="tasklist">
            <summary>FK to tasklist.TaskListNum</summary>
        </column>
    </table>
    <table name="taskunread">
        <summary>When a task is created or a comment made, a series of these taskunread objects are created, one for each user who is subscribed to the tasklist.  Duplicates are intelligently avoided.  Rows are deleted once user reads the task.</summary>
        <column order="0" name="TaskUnreadNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="TaskNum" type="bigint(20)" fk="task">
            <summary>FK to task.TaskNum.</summary>
        </column>
        <column order="2" name="UserNum" type="bigint(20)" fk="userod">
            <summary>FK to userod.UserNum.</summary>
        </column>
    </table>
    <table name="tempduplicatepatfields">
        <summary></summary>
        <column order="0" name="PatFieldNum" type="bigint(20)">
            <summary></summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)">
            <summary></summary>
        </column>
        <column order="2" name="FieldName" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="3" name="FieldValue" type="text">
            <summary></summary>
        </column>
    </table>
    <table name="terminalactive">
        <summary>Each row is one computer that currently acting as a terminal for new patient info input.</summary>
        <column order="0" name="TerminalActiveNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ComputerName" type="varchar(255)">
            <summary>The name of the computer where the terminal is active.</summary>
        </column>
        <column order="2" name="TerminalStatus" type="tinyint">
            <summary>Enum:TerminalStatusEnum  No longer used.  Instead, the PatNum field is used.  Used to indicates at what point the patient was in the sequence. 0=standby, 1=PatientInfo, 2=Medical, 3=UpdateOnly.  If status is 1, then nobody else on the network could open the patient edit window for that patient.</summary>
            <Enumeration name="TerminalStatusEnum">
                <summary>Indicates at what point the patient is in the sequence. 0=standby, 1=PatientInfo, 2=Medical, 3=UpdateOnly.</summary>
                <EnumValue name="Standby">0</EnumValue>
                <EnumValue name="PatientInfo">1</EnumValue>
                <EnumValue name="Medical">2</EnumValue>
                <EnumValue name="UpdateOnly">3. Only the patient info tab will be visible.  This is just to let patient up date their address and phone number.</EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.  The patient currently showing in the terminal.  If 0, then terminal is in standby mode.</summary>
        </column>
    </table>
    <table name="timeadjust">
        <summary>Used on employee timecards to make adjustments.</summary>
        <column order="0" name="TimeAdjustNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="EmployeeNum" type="bigint(20)" fk="employee">
            <summary>FK to employee.EmployeeNum</summary>
        </column>
        <column order="2" name="TimeEntry" type="datetime">
            <summary>The date and time that this entry will show on timecard.</summary>
        </column>
        <column order="3" name="RegHours" type="time">
            <summary>The number of regular hours to adjust timecard by.  Can be + or -.</summary>
        </column>
        <column order="4" name="OTimeHours" type="time">
            <summary>Overtime hours. Usually +.  Automatically combined with a - adj to RegHours.  Another option is clockevent.OTimeHours.</summary>
        </column>
        <column order="5" name="Note" type="text">
            <summary>.</summary>
        </column>
        <column order="6" name="IsAuto" type="tinyint(4)">
            <summary>Set to true if this adjustment was automatically made by the system.  When the calc weekly ot tool is run, these types of adjustments are fair game for deletion.  Other adjustments are preserved.</summary>
        </column>
    </table>
    <table name="timecardrule">
        <summary></summary>
        <column order="0" name="TimeCardRuleNum" type="bigint(20)">
            <summary>A rule for automation of timecard overtime.  Can apply to one employee or all.</summary>
        </column>
        <column order="1" name="EmployeeNum" type="bigint(20)" fk="employee">
            <summary>FK to employee.EmployeeNum. If zero, then this rule applies to all employees.</summary>
        </column>
        <column order="2" name="OverHoursPerDay" type="time">
            <summary>Typical example is 8:00.  In California, any work after the first 8 hours is overtime.</summary>
        </column>
        <column order="3" name="AfterTimeOfDay" type="time">
            <summary>Typical example is 16:00 to indicate that all time worked after 4pm for specific employees is overtime.</summary>
        </column>
    </table>
    <table name="toolbutitem">
        <summary>Each row represents one toolbar button to be placed on a toolbar and linked to a program.</summary>
        <column order="0" name="ToolButItemNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ProgramNum" type="bigint(20)" fk="program">
            <summary>FK to program.ProgramNum.</summary>
        </column>
        <column order="2" name="ToolBar" type="smallint">
            <summary>Enum:ToolBarsAvail The toolbar to show the button on.</summary>
            <Enumeration name="ToolBarsAvail">
                <summary />
                <EnumValue name="AccountModule">0</EnumValue>
                <EnumValue name="ApptModule">1</EnumValue>
                <EnumValue name="ChartModule">2</EnumValue>
                <EnumValue name="ImagesModule">3</EnumValue>
                <EnumValue name="FamilyModule">4</EnumValue>
                <EnumValue name="TreatmentPlanModule">5</EnumValue>
                <EnumValue name="ClaimsSend">6</EnumValue>
                <EnumValue name="AllModules">7 Shows in the toolbar at the top that is common to all modules.</EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="ButtonText" type="varchar(255)">
            <summary>The text to show on the toolbar button.</summary>
        </column>
    </table>
    <table name="toothinitial">
        <summary>Used to track missing teeth, primary teeth, movements, and drawings.</summary>
        <column order="0" name="ToothInitialNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="ToothNum" type="varchar(2)">
            <summary>1-32 or A-Z. Supernumeraries not supported here yet.</summary>
        </column>
        <column order="3" name="InitialType" type="tinyint">
            <summary>Enum:ToothInitialType</summary>
            <Enumeration name="ToothInitialType">
                <summary />
                <EnumValue name="Missing">0</EnumValue>
                <EnumValue name="Hidden">1 - Also hides the number.  This is now also allowed for primary teeth.</EnumValue>
                <EnumValue name="Primary">2 - Only used with 1-32.  "sets" this tooth as a primary tooth.  The result is that the primary tooth shows in addition to the perm, and that the letter shows in addition to the number.  It also does a Shift0 -12 and some other handy movements.  Even if this is set to true, there can be a separate entry for a missing primary tooth; this would be almost equivalent to not even setting the tooth as primary, but would also allow user to select the letter.</EnumValue>
                <EnumValue name="ShiftM">3</EnumValue>
                <EnumValue name="ShiftO">4</EnumValue>
                <EnumValue name="ShiftB">5</EnumValue>
                <EnumValue name="Rotate">6</EnumValue>
                <EnumValue name="TipM">7</EnumValue>
                <EnumValue name="TipB">8</EnumValue>
                <EnumValue name="Drawing">9 One segment of a drawing.</EnumValue>
            </Enumeration>
        </column>
        <column order="4" name="Movement" type="float">
            <summary>Shift in mm, or rotation / tipping in degrees.</summary>
        </column>
        <column order="5" name="DrawingSegment" type="text">
            <summary>Point data for a drawing segment.  The format would look similar to this: 45,68;48,70;49,72;0,0;55,88;etc.  It's simply a sequence of points, separated by semicolons.  Only positive numbers are used.  0,0 is the upper left of the tooth chart at original size.  Stored in pixels as originally drawn.  If we ever change the tooth chart, we will have to also keep an old version as an alternate to display old drawings.</summary>
        </column>
        <column order="6" name="ColorDraw" type="int(11)">
            <summary>.</summary>
        </column>
    </table>
    <table name="transaction">
        <summary>Used in the accounting section of the program.  Each row is one transaction in the ledger, and must always have at least two splits.  All splits must always add up to zero.</summary>
        <column order="0" name="TransactionNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="DateTimeEntry" type="datetime">
            <summary>Not user editable.  Server time.</summary>
        </column>
        <column order="2" name="UserNum" type="bigint(20)" fk="user">
            <summary>FK to user.UserNum.</summary>
        </column>
        <column order="3" name="DepositNum" type="bigint(20)" fk="deposit">
            <summary>FK to deposit.DepositNum.  Will eventually be replaced by a source document table, and deposits will just be one of many types.</summary>
        </column>
        <column order="4" name="PayNum" type="bigint(20)" fk="payment">
            <summary>FK to payment.PayNum.  Like DepositNum, it will eventually be replaced by a source document table, and payments will just be one of many types.</summary>
        </column>
    </table>
    <table name="treatplan">
        <summary>A treatment plan saved by a user.  Does not include the default tp, which is just a list of procedurelog entries with a status of tp.  A treatplan has many proctp's attached to it.</summary>
        <column order="0" name="TreatPlanNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="DateTP" type="date">
            <summary>The date of the treatment plan</summary>
        </column>
        <column order="3" name="Heading" type="varchar(255)">
            <summary>The heading that shows at the top of the treatment plan.  Usually 'Proposed Treatment Plan'</summary>
        </column>
        <column order="4" name="Note" type="text">
            <summary>A note specific to this treatment plan that shows at the bottom.</summary>
        </column>
        <column order="5" name="Signature" type="text">
            <summary>The encrypted and bound signature in base64 format.  The signature is bound to the byte sequence of the original image.</summary>
        </column>
        <column order="6" name="SigIsTopaz" type="tinyint(1)">
            <summary>True if the signature is in Topaz format rather than OD format.</summary>
        </column>
        <column order="7" name="ResponsParty" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum. Can be 0.  The patient responsible for approving the treatment.  Public health field not visible to everyone else.</summary>
        </column>
    </table>
    <table name="usergroup">
        <summary>A group of users.  Security permissions are determined by the usergroup of a user.</summary>
        <column order="0" name="UserGroupNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>.</summary>
        </column>
    </table>
    <table name="userod">
        <summary>(User OD since "user" is a reserved word) Users are a completely separate entity from Providers and Employees even though they can be linked.  A usernumber can never be changed, ensuring a permanent way to record database entries and leave an audit trail.  A user can be a provider, employee, or neither.</summary>
        <column order="0" name="UserNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="UserName" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="Password" type="varchar(255)">
            <summary>The password hash, not the actual password.  If no password has been entered, then this will be blank.</summary>
        </column>
        <column order="3" name="UserGroupNum" type="bigint(20)" fk="usergroup">
            <summary>FK to usergroup.UserGroupNum.  Every user belongs to exactly one user group.  The usergroup determines the permissions.</summary>
        </column>
        <column order="4" name="EmployeeNum" type="bigint(20)" fk="employee">
            <summary>FK to employee.EmployeeNum. Cannot be used if provnum is used. Used for timecards to block access by other users.</summary>
        </column>
        <column order="5" name="ClinicNum" type="bigint(20)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  If 0, then user has access to all clinics.</summary>
        </column>
        <column order="6" name="ProvNum" type="bigint(20)" fk="provider">
            <summary>FK to provider.ProvNum.  Cannot be used if EmployeeNum is used.</summary>
        </column>
        <column order="7" name="IsHidden" type="tinyint(1)">
            <summary>Set true to hide user from login list.</summary>
        </column>
        <column order="8" name="TaskListInBox" type="bigint(20)" fk="tasklist">
            <summary>FK to tasklist.TaskListNum.  0 if no inbox setup yet.  It is assumed that the TaskList is in the main trunk, but this is not strictly enforced.  User can't delete an attached TaskList, but they could move it.</summary>
        </column>
        <column order="9" name="AnesthProvType" type="int(2)">
            <summary> Defaults to 3 (regular user) unless specified. Helps populates the Anesthetist, Surgeon, Assistant and Circulator dropdowns properly on FormAnestheticRecord/// </summary>
        </column>
        <column order="10" name="DefaultHidePopups" type="tinyint(4)">
            <summary>If set to true, the hide popups button will start out pressed for this user.</summary>
        </column>
        <column order="11" name="PasswordIsStrong" type="tinyint(4)">
            <summary>Gets set to true if strong passwords are turned on, and this user changes their password to a strong password.  We don't store actual passwords, so this flag is the only way to tell.</summary>
        </column>
    </table>
    <table name="userquery">
        <summary>A list of query favorites that users can run.</summary>
        <column order="0" name="QueryNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description.</summary>
        </column>
        <column order="2" name="FileName" type="varchar(255)">
            <summary>The name of the file to export to.</summary>
        </column>
        <column order="3" name="QueryText" type="text">
            <summary>The text of the query.</summary>
        </column>
    </table>
    <table name="vaccinedef">
        <summary>A vaccine definition.  Should not be altered once linked to VaccinePat.</summary>
        <column order="0" name="VaccineDefNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="CVXCode" type="varchar(255)">
            <summary>RXA-5-1.</summary>
        </column>
        <column order="2" name="VaccineName" type="varchar(255)">
            <summary>Name of vaccine.  RXA-5-2.</summary>
        </column>
        <column order="3" name="DrugManufacturerNum" type="bigint(20)" fk="drugmanufacturer">
            <summary>FK to drugmanufacturer.DrugManufacturerNum.</summary>
        </column>
    </table>
    <table name="vaccinepat">
        <summary>A vaccine given to a patient on a date.</summary>
        <column order="0" name="VaccinePatNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="VaccineDefNum" type="bigint(20)" fk="vaccinedef">
            <summary>FK to vaccinedef.VaccineDefNum.</summary>
        </column>
        <column order="2" name="DateTimeStart" type="datetime">
            <summary>The datetime that the vaccine was administered.</summary>
        </column>
        <column order="3" name="DateTimeEnd" type="datetime">
            <summary>Typically set to the same as DateTimeStart.  User can change.</summary>
        </column>
        <column order="4" name="AdministeredAmt" type="float">
            <summary>Size of the dose of the vaccine.  0 indicates unknown and gets converted to 999 on HL7 output.</summary>
        </column>
        <column order="5" name="DrugUnitNum" type="bigint(20)" fk="drugunit">
            <summary>FK to drugunit.DrugUnitNum. Unit of measurement of the AdministeredAmt.  0 represents null.</summary>
        </column>
        <column order="6" name="LotNumber" type="varchar(255)">
            <summary>Optional</summary>
        </column>
        <column order="7" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="8" name="NotGiven" type="tinyint(4)">
            <summary>Set to true if no vaccine given.  Documentation required in the Note.</summary>
        </column>
        <column order="9" name="Note" type="text">
            <summary>Documentation sometimes required.</summary>
        </column>
    </table>
    <table name="vitalsign">
        <summary>For EHR module, one dated vital sign entry.</summary>
        <column order="0" name="VitalsignNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="bigint(20)" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="Height" type="float">
            <summary>Height of patient in inches. Fractions might be needed some day.  Allowed to be 0.</summary>
        </column>
        <column order="3" name="Weight" type="float">
            <summary>Lbs.  Allowed to be 0.</summary>
        </column>
        <column order="4" name="BpSystolic" type="smallint(6)">
            <summary>Allowed to be 0.</summary>
        </column>
        <column order="5" name="BpDiastolic" type="smallint(6)">
            <summary>Allowed to be 0.</summary>
        </column>
        <column order="6" name="DateTaken" type="date">
            <summary>The date that the vitalsigns were taken.</summary>
        </column>
        <column order="7" name="HasFollowupPlan" type="tinyint(4)">
            <summary>For an abnormal BMI measurement this must be true in order to meet quality measurement.</summary>
        </column>
        <column order="8" name="IsIneligible" type="tinyint(4)">
            <summary>If a BMI was not recored, this must be true in order to meet quality measurement.  For children, this is used as an IsPregnant flag, the only valid reason for not taking BMI on children.</summary>
        </column>
        <column order="9" name="Documentation" type="text">
            <summary>For HasFollowupPlan or IsIneligible, this documents the specifics.</summary>
        </column>
        <column order="10" name="ChildGotNutrition" type="tinyint(4)">
            <summary>.</summary>
        </column>
        <column order="11" name="ChildGotPhysCouns" type="tinyint(4)">
            <summary>.</summary>
        </column>
    </table>
    <table name="zipcode">
        <summary>Zipcodes are also known as postal codes.  Zipcodes are always copied to patient records rather than linked.  So items in this list can be freely altered or deleted without harming patient data.</summary>
        <column order="0" name="ZipCodeNum" type="bigint(20)">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ZipCodeDigits" type="varchar(20)">
            <summary>The actual zipcode.</summary>
        </column>
        <column order="2" name="City" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="3" name="State" type="varchar(20)">
            <summary>.</summary>
        </column>
        <column order="4" name="IsFrequent" type="tinyint">
            <summary>If true, then it will show in the dropdown list in the patient edit window.</summary>
        </column>
    </table>
</database>