some assorted updates
[openemr.git] / sql / 2_8_3-to-2_8_4_upgrade.sql
blobc2f4878e719225a9b9b3e36abaabf6131091a902
1 ALTER TABLE form_encounter
2   ADD billing_note text NOT NULL DEFAULT '';
4 ALTER TABLE users
5   ADD organization varchar(255) NOT NULL DEFAULT '',
6   ADD valedictory  varchar(255) NOT NULL DEFAULT '';
8 ALTER TABLE openemr_postcalendar_events
9   ADD pc_facility smallint(6) NOT NULL default '0' COMMENT 'facility id for this event';
11 ALTER TABLE payments
12   ADD encounter bigint(20) NOT NULL DEFAULT 0,
13   ADD KEY pid (pid);
15 ALTER TABLE patient_data
16   ADD `usertext1`  varchar(255) NOT NULL DEFAULT '',
17   ADD `usertext2`  varchar(255) NOT NULL DEFAULT '',
18   ADD `userlist1`  varchar(255) NOT NULL DEFAULT '',
19   ADD `userlist2`  varchar(255) NOT NULL DEFAULT '',
20   ADD `pricelevel` varchar(255) NOT NULL DEFAULT 'standard';
22 CREATE TABLE list_options (
23   list_id        varchar(31)   NOT NULL,
24   option_id      varchar(31)   NOT NULL,
25   title          varchar(255)  NOT NULL DEFAULT '',
26   seq            int(11)       NOT NULL DEFAULT 0,
27   is_default     tinyint(1)    NOT NULL DEFAULT 0,
28   option_value   float         NOT NULL DEFAULT 0,
29   PRIMARY KEY (list_id, option_id)
30 ) TYPE=MyISAM;
32 INSERT INTO list_options VALUES ('yesno'  ,'NO' ,'NO' ,1,0,0);
33 INSERT INTO list_options VALUES ('yesno'  ,'YES','YES',2,0,0);
35 INSERT INTO list_options VALUES ('titles' ,'Mr.'   ,'Mr.'    ,1,0,0);
36 INSERT INTO list_options VALUES ('titles' ,'Mrs.'  ,'Mrs.'   ,2,0,0);
37 INSERT INTO list_options VALUES ('titles' ,'Ms.'   ,'Ms.'    ,3,0,0);
38 INSERT INTO list_options VALUES ('titles' ,'Dr.'   ,'Dr.'    ,4,0,0);
40 INSERT INTO list_options VALUES ('sex'    ,'Female','Female' ,1,0,0);
41 INSERT INTO list_options VALUES ('sex'    ,'Male'  ,'Male'   ,2,0,0);
43 INSERT INTO list_options VALUES ('marital','married'         ,'Married'         ,1,0,0);
44 INSERT INTO list_options VALUES ('marital','single'          ,'Single'          ,2,0,0);
45 INSERT INTO list_options VALUES ('marital','divorced'        ,'Divorced'        ,3,0,0);
46 INSERT INTO list_options VALUES ('marital','widowed'         ,'Widowed'         ,4,0,0);
47 INSERT INTO list_options VALUES ('marital','separated'       ,'Separated'       ,5,0,0);
48 INSERT INTO list_options VALUES ('marital','domestic partner','Domestic Partner',6,0,0);
50 INSERT INTO list_options VALUES ('language','English','English',1,1,0);
51 INSERT INTO list_options VALUES ('language','Spanish','Spanish',2,0,0);
53 INSERT INTO list_options VALUES ('ethrace','Caucasian','Caucasian',1,0,0);
54 INSERT INTO list_options VALUES ('ethrace','Asian'    ,'Asian'    ,2,0,0);
55 INSERT INTO list_options VALUES ('ethrace','Black'    ,'Black'    ,3,0,0);
56 INSERT INTO list_options VALUES ('ethrace','Hispanic' ,'Hispanic' ,4,0,0);
58 INSERT INTO list_options VALUES ('userlist1','sample','Sample',1,0,0);
60 INSERT INTO list_options VALUES ('userlist2','sample','Sample',1,0,0);
62 INSERT INTO list_options VALUES ('pricelevel','standard','Standard',1,1,0);
64 CREATE TABLE layout_options (
65   form_id        varchar(31)   NOT NULL,
66   field_id       varchar(31)   NOT NULL,
67   group_name     varchar(31)   NOT NULL DEFAULT '',
68   title          varchar(63)   NOT NULL DEFAULT '',
69   seq            int(11)       NOT NULL DEFAULT 0,
70   data_type      tinyint(3)    NOT NULL DEFAULT 0,
71   uor            tinyint(1)    NOT NULL DEFAULT 1,
72   fld_length     int(11)       NOT NULL DEFAULT 15,
73   max_length     int(11)       NOT NULL DEFAULT 0,
74   list_id        varchar(31)   NOT NULL DEFAULT '',
75   titlecols      tinyint(3)    NOT NULL DEFAULT 1,
76   datacols       tinyint(3)    NOT NULL DEFAULT 1,
77   default_value  varchar(255)  NOT NULL DEFAULT '',
78   edit_options   varchar(36)   NOT NULL DEFAULT '',
79   description    varchar(255)  NOT NULL DEFAULT '',
80   PRIMARY KEY (form_id, field_id, seq)
81 ) TYPE=MyISAM;
83 INSERT INTO layout_options VALUES ('DEM','title'          ,'1Who','Name'          , 1, 1,1, 0, 0,'titles' ,1,1,'','' ,'Title');
84 INSERT INTO layout_options VALUES ('DEM','fname'          ,'1Who',''              , 2, 2,2,10,63,''       ,0,0,'','C','First Name');
85 INSERT INTO layout_options VALUES ('DEM','mname'          ,'1Who',''              , 3, 2,1, 2,63,''       ,0,0,'','C','Middle Name');
86 INSERT INTO layout_options VALUES ('DEM','lname'          ,'1Who',''              , 4, 2,2,10,63,''       ,0,0,'','C','Last Name');
87 INSERT INTO layout_options VALUES ('DEM','pubpid'         ,'1Who','External ID'   , 5, 2,1,10,15,''       ,1,1,'','' ,'External identifier');
88 INSERT INTO layout_options VALUES ('DEM','DOB'            ,'1Who','DOB'           , 6, 4,2,10,10,''       ,1,1,'','D','Date of Birth');
89 INSERT INTO layout_options VALUES ('DEM','sex'            ,'1Who','Sex'           , 7, 1,2, 0, 0,'sex'    ,1,1,'','' ,'Sex');
90 INSERT INTO layout_options VALUES ('DEM','ss'             ,'1Who','S.S.'          , 8, 2,1,11,11,''       ,1,1,'','' ,'Social Security Number');
91 INSERT INTO layout_options VALUES ('DEM','drivers_license','1Who','License/ID'    , 9, 2,1,15,63,''       ,1,1,'','' ,'Drivers License or State ID');
92 INSERT INTO layout_options VALUES ('DEM','status'         ,'1Who','Marital Status',10, 1,1, 0, 0,'marital',1,3,'','' ,'Marital Status');
93 INSERT INTO layout_options VALUES ('DEM','genericname1'   ,'1Who','User Defined'  ,11, 2,1,15,63,''       ,1,3,'','' ,'User Defined Field');
94 INSERT INTO layout_options VALUES ('DEM','genericval1'    ,'1Who',''              ,12, 2,1,15,63,''       ,0,0,'','' ,'User Defined Field');
95 INSERT INTO layout_options VALUES ('DEM','genericname2'   ,'1Who',''              ,13, 2,1,15,63,''       ,0,0,'','' ,'User Defined Field');
96 INSERT INTO layout_options VALUES ('DEM','genericval2'    ,'1Who',''              ,14, 2,1,15,63,''       ,0,0,'','' ,'User Defined Field');
97 INSERT INTO layout_options VALUES ('DEM','squad'          ,'1Who','Squad'         ,15,13,0, 0, 0,''       ,1,3,'','' ,'Squad Membership');
98 INSERT INTO layout_options VALUES ('DEM','pricelevel'     ,'1Who','Price Level'   ,16, 1,0, 0, 0,'pricelevel',1,1,'','' ,'Discount Level');
100 INSERT INTO layout_options VALUES ('DEM','street'              ,'2Contact','Address'          , 1, 2,1,25,63,''     ,1,1,'','C','Street and Number');
101 INSERT INTO layout_options VALUES ('DEM','city'                ,'2Contact','City'             , 2, 2,1,15,63,''     ,1,1,'','C','City Name');
102 INSERT INTO layout_options VALUES ('DEM','state'               ,'2Contact','State'            , 3, 2,1,15,63,''     ,1,1,'','C','State/Locality');
103 INSERT INTO layout_options VALUES ('DEM','postal_code'         ,'2Contact','Postal Code'      , 4, 2,1, 6,63,''     ,1,1,'','' ,'Postal Code');
104 INSERT INTO layout_options VALUES ('DEM','country_code'        ,'2Contact','Country'          , 5, 1,1, 0, 0,'country',1,1,'','','Country');
105 INSERT INTO layout_options VALUES ('DEM','contact_relationship','2Contact','Emergency Contact', 6, 2,1,10,63,''     ,1,1,'','C','Emergency Contact Person');
106 INSERT INTO layout_options VALUES ('DEM','phone_contact'       ,'2Contact','Emergency Phone'  , 7, 2,1,20,63,''     ,1,1,'','P','Emergency Contact Phone Number');
107 INSERT INTO layout_options VALUES ('DEM','phone_home'          ,'2Contact','Home Phone'       , 8, 2,1,20,63,''     ,1,1,'','P','Home Phone Number');
108 INSERT INTO layout_options VALUES ('DEM','phone_biz'           ,'2Contact','Work Phone'       , 9, 2,1,20,63,''     ,1,1,'','P','Work Phone Number');
109 INSERT INTO layout_options VALUES ('DEM','phone_cell'          ,'2Contact','Mobile Phone'     ,10, 2,1,20,63,''     ,1,1,'','P','Cell Phone Number');
110 INSERT INTO layout_options VALUES ('DEM','email'               ,'2Contact','Contact Email'    ,11, 2,1,30,95,''     ,1,1,'','' ,'Contact Email Address');
112 INSERT INTO layout_options VALUES ('DEM','providerID'   ,'3Choices','Provider'             , 1,11,2, 0, 0,''       ,1,3,'','' ,'Referring Provider');
113 INSERT INTO layout_options VALUES ('DEM','pharmacy_id'  ,'3Choices','Pharmacy'             , 2,12,1, 0, 0,''       ,1,3,'','' ,'Preferred Pharmacy');
114 INSERT INTO layout_options VALUES ('DEM','hipaa_notice' ,'3Choices','HIPAA Notice Received', 3, 1,1, 0, 0,'yesno'  ,1,1,'','' ,'Did you receive a copy of the HIPAA Notice?');
115 INSERT INTO layout_options VALUES ('DEM','hipaa_voice'  ,'3Choices','Allow Voice Message'  , 4, 1,1, 0, 0,'yesno'  ,1,1,'','' ,'Allow telephone messages?');
116 INSERT INTO layout_options VALUES ('DEM','hipaa_mail'   ,'3Choices','Allow Mail Message'   , 5, 1,1, 0, 0,'yesno'  ,1,1,'','' ,'Allow email messages?');
117 INSERT INTO layout_options VALUES ('DEM','hipaa_message','3Choices','Leave Message With'   , 6, 2,1,20,63,''       ,1,1,'','' ,'With whom may we leave a message?');
119 INSERT INTO layout_options VALUES ('DEM','occupation'    ,'4Employer','Occupation'      , 1, 2,1,20,63,''     ,1,1,'','C','Occupation');
120 INSERT INTO layout_options VALUES ('DEM','em_name'       ,'4Employer','Employer Name'   , 2, 2,1,20,63,''     ,1,1,'','C','Employer Name');
121 INSERT INTO layout_options VALUES ('DEM','em_street'     ,'4Employer','Employer Address', 3, 2,1,25,63,''     ,1,1,'','C','Street and Number');
122 INSERT INTO layout_options VALUES ('DEM','em_city'       ,'4Employer','City'            , 4, 2,1,15,63,''     ,1,1,'','C','City Name');
123 INSERT INTO layout_options VALUES ('DEM','em_state'      ,'4Employer','State'           , 5, 2,1,15,63,''     ,1,1,'','C','State/Locality');
124 INSERT INTO layout_options VALUES ('DEM','em_postal_code','4Employer','Postal Code'     , 6, 2,1, 6,63,''     ,1,1,'','' ,'Postal Code');
125 INSERT INTO layout_options VALUES ('DEM','em_country'    ,'4Employer','Country'         , 7, 2,1,10,63,''     ,1,1,'','C','Country');
127 INSERT INTO layout_options VALUES ('DEM','language'        ,'5Stats','Language'             , 1, 1,1, 0, 0,'language',1,1,'','' ,'Preferred Language');
128 INSERT INTO layout_options VALUES ('DEM','ethnoracial'     ,'5Stats','Race/Ethnicity'       , 2, 1,1, 0, 0,'ethrace' ,1,1,'','' ,'Ethnicity or Race');
129 INSERT INTO layout_options VALUES ('DEM','financial_review','5Stats','Financial Review Date', 3, 2,1,10,10,''        ,1,1,'','D','Financial Review Date');
130 INSERT INTO layout_options VALUES ('DEM','family_size'     ,'5Stats','Family Size'          , 4, 2,1,20,63,''        ,1,1,'','' ,'Family Size');
131 INSERT INTO layout_options VALUES ('DEM','monthly_income'  ,'5Stats','Monthly Income'       , 5, 2,1,20,63,''        ,1,1,'','' ,'Monthly Income');
132 INSERT INTO layout_options VALUES ('DEM','homeless'        ,'5Stats','Homeless, etc.'       , 6, 2,1,20,63,''        ,1,1,'','' ,'Homeless or similar?');
133 INSERT INTO layout_options VALUES ('DEM','interpretter'    ,'5Stats','Interpreter'          , 7, 2,1,20,63,''        ,1,1,'','' ,'Interpreter needed?');
134 INSERT INTO layout_options VALUES ('DEM','migrantseasonal' ,'5Stats','Migrant/Seasonal'     , 8, 2,1,20,63,''        ,1,1,'','' ,'Migrant or seasonal worker?');
136 INSERT INTO layout_options VALUES ('DEM','usertext1'       ,'6Misc','User Defined Text 1'   , 1, 2,0,10,63,''         ,1,1,'','' ,'User Defined');
137 INSERT INTO layout_options VALUES ('DEM','usertext2'       ,'6Misc','User Defined Text 2'   , 2, 2,0,10,63,''         ,1,1,'','' ,'User Defined');
138 INSERT INTO layout_options VALUES ('DEM','userlist1'       ,'6Misc','User Defined List 1'   , 9, 1,0, 0, 0,'userlist1',1,1,'','' ,'User Defined');
139 INSERT INTO layout_options VALUES ('DEM','userlist2'       ,'6Misc','User Defined List 2'   ,10, 1,0, 0, 0,'userlist2',1,1,'','' ,'User Defined');
141 ALTER TABLE transactions
142   ADD `refer_date`              date         DEFAULT NULL,
143   ADD `refer_from`              int(11)      NOT NULL DEFAULT 0,
144   ADD `refer_to`                int(11)      NOT NULL DEFAULT 0,
145   ADD `refer_diag`              varchar(255) NOT NULL DEFAULT '',
146   ADD `refer_risk_level`        varchar(255) NOT NULL DEFAULT '',
147   ADD `refer_vitals`            tinyint(1)   NOT NULL DEFAULT 0,
148   ADD `reply_date`              date         DEFAULT NULL,
149   ADD `reply_from`              varchar(255) NOT NULL DEFAULT '',
150   ADD `reply_init_diag`         varchar(255) NOT NULL DEFAULT '',
151   ADD `reply_final_diag`        varchar(255) NOT NULL DEFAULT '',
152   ADD `reply_documents`         varchar(255) NOT NULL DEFAULT '',
153   ADD `reply_findings`          text         NOT NULL DEFAULT '',
154   ADD `reply_services`          text         NOT NULL DEFAULT '',
155   ADD `reply_recommend`         text         NOT NULL DEFAULT '',
156   ADD `reply_rx_refer`          text         NOT NULL DEFAULT '';
158 INSERT INTO layout_options VALUES ('REF','refer_date'      ,'1Referral','Referral Date'                  , 1, 4,2, 0,  0,''         ,1,1,'C','D','Date of referral');
159 INSERT INTO layout_options VALUES ('REF','refer_from'      ,'1Referral','Refer By'                       , 2,10,2, 0,  0,''         ,1,1,'' ,'' ,'Referral By');
160 INSERT INTO layout_options VALUES ('REF','refer_to'        ,'1Referral','Refer To'                       , 3,14,2, 0,  0,''         ,1,1,'' ,'' ,'Referral To');
161 INSERT INTO layout_options VALUES ('REF','body'            ,'1Referral','Reason'                         , 4, 3,2,30,  3,''         ,1,1,'' ,'' ,'Reason for referral');
162 INSERT INTO layout_options VALUES ('REF','refer_external'  ,'1Referral','External Referral'              , 5, 1,1, 0,  0,'boolean'  ,1,1,'' ,'' ,'External referral?');
163 INSERT INTO layout_options VALUES ('REF','refer_diag'      ,'1Referral','Referrer Diagnosis'             , 6, 2,1,30,255,''         ,1,1,'' ,'X','Referrer diagnosis');
164 INSERT INTO layout_options VALUES ('REF','refer_risk_level','1Referral','Risk Level'                     , 7, 1,1, 0,  0,'risklevel',1,1,'' ,'' ,'Level of urgency');
165 INSERT INTO layout_options VALUES ('REF','refer_vitals'    ,'1Referral','Include Vitals'                 , 8, 1,1, 0,  0,'boolean'  ,1,1,'' ,'' ,'Include vitals data?');
166 INSERT INTO layout_options VALUES ('REF','reply_date'      ,'2Counter-Referral','Reply Date'             , 9, 4,1, 0,  0,''         ,1,1,'' ,'D','Date of reply');
167 INSERT INTO layout_options VALUES ('REF','reply_from'      ,'2Counter-Referral','Reply From'             ,10, 2,1,30,255,''         ,1,1,'' ,'' ,'Who replied?');
168 INSERT INTO layout_options VALUES ('REF','reply_init_diag' ,'2Counter-Referral','Presumed Diagnosis'     ,11, 2,1,30,255,''         ,1,1,'' ,'' ,'Presumed diagnosis by specialist');
169 INSERT INTO layout_options VALUES ('REF','reply_final_diag','2Counter-Referral','Final Diagnosis'        ,12, 2,1,30,255,''         ,1,1,'' ,'' ,'Final diagnosis by specialist');
170 INSERT INTO layout_options VALUES ('REF','reply_documents' ,'2Counter-Referral','Documents'              ,13, 2,1,30,255,''         ,1,1,'' ,'' ,'Where may related scanned or paper documents be found?');
171 INSERT INTO layout_options VALUES ('REF','reply_findings'  ,'2Counter-Referral','Findings'               ,14, 3,1,30,  3,''         ,1,1,'' ,'' ,'Findings by specialist');
172 INSERT INTO layout_options VALUES ('REF','reply_services'  ,'2Counter-Referral','Services Provided'      ,15, 3,1,30,  3,''         ,1,1,'' ,'' ,'Service provided by specialist');
173 INSERT INTO layout_options VALUES ('REF','reply_recommend' ,'2Counter-Referral','Recommendations'        ,16, 3,1,30,  3,''         ,1,1,'' ,'' ,'Recommendations by specialist');
174 INSERT INTO layout_options VALUES ('REF','reply_rx_refer'  ,'2Counter-Referral','Prescriptions/Referrals',17, 3,1,30,  3,''         ,1,1,'' ,'' ,'Prescriptions and/or referrals by specialist');
176 INSERT INTO list_options VALUES ('risklevel','low'   ,'Low'   ,1,0,0);
177 INSERT INTO list_options VALUES ('risklevel','medium','Medium',2,1,0);
178 INSERT INTO list_options VALUES ('risklevel','high'  ,'High'  ,3,0,0);
180 INSERT INTO list_options VALUES ('boolean','0','No' ,1,0,0);
181 INSERT INTO list_options VALUES ('boolean','1','Yes',2,0,0);
183 ALTER TABLE codes
184   ADD related_code varchar(255)  NOT NULL DEFAULT '' COMMENT 'may reference a related codes.code';
186 CREATE TABLE prices (
187   pr_id          varchar(11)   NOT NULL            COMMENT 'references codes.id or drugs.id',
188   pr_selector    varchar(15)   NOT NULL DEFAULT '' COMMENT 'template selector for drugs, empty for codes',
189   pr_level       varchar(31)   NOT NULL DEFAULT '' COMMENT 'price level',
190   pr_price       decimal(12,2) NOT NULL DEFAULT 0  COMMENT 'price in local currency',
191   PRIMARY KEY (pr_id, pr_selector, pr_level)
192 ) TYPE=MyISAM;
194 INSERT INTO prices ( pr_id, pr_level, pr_price )
195   SELECT codes.id, 'standard', codes.fee FROM codes
196   WHERE codes.fee IS NOT NULL AND codes.fee > 0;
198 ALTER TABLE codes
199   ADD taxrates varchar(255) NOT NULL DEFAULT '' COMMENT 'tax rate names delimited by colons';
201 ALTER TABLE drug_templates
202   ADD taxrates varchar(255) NOT NULL DEFAULT '' COMMENT 'tax rate names delimited by colons';
204 ALTER TABLE drug_sales
205   ADD billed tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates if the sale is posted to accounting';
206 UPDATE drug_sales
207   SET billed = 1 WHERE encounter > 0;
209 ALTER TABLE form_encounter
210   ADD pc_catid int(11) NOT NULL DEFAULT 5 COMMENT 'event category from openemr_postcalendar_categories';
212 CREATE TABLE fee_sheet_options (
213   fs_category varchar(63)  NOT NULL DEFAULT '' COMMENT 'Descriptive category name',
214   fs_option   varchar(63)  NOT NULL DEFAULT '' COMMENT 'Descriptive option name',
215   fs_codes    varchar(255) NOT NULL DEFAULT '' COMMENT 'multiple instances of type:id:selector;'
216 ) TYPE=MyISAM;
217 INSERT INTO fee_sheet_options VALUES ('1New Patient','1Brief'  ,'CPT4|99201|');
218 INSERT INTO fee_sheet_options VALUES ('1New Patient','2Limited','CPT4|99202|');
219 INSERT INTO fee_sheet_options VALUES ('1New Patient','3Detailed','CPT4|99203|');
220 INSERT INTO fee_sheet_options VALUES ('1New Patient','4Extended','CPT4|99204|');
221 INSERT INTO fee_sheet_options VALUES ('1New Patient','5Comprehensive','CPT4|99205|');
222 INSERT INTO fee_sheet_options VALUES ('2Established Patient','1Brief'  ,'CPT4|99211|');
223 INSERT INTO fee_sheet_options VALUES ('2Established Patient','2Limited','CPT4|99212|');
224 INSERT INTO fee_sheet_options VALUES ('2Established Patient','3Detailed','CPT4|99213|');
225 INSERT INTO fee_sheet_options VALUES ('2Established Patient','4Extended','CPT4|99214|');
226 INSERT INTO fee_sheet_options VALUES ('2Established Patient','5Comprehensive','CPT4|99215|');
228 ALTER TABLE `users`
229   ADD COLUMN `cal_ui` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Specifies calendar display style';
231 ALTER TABLE drugs
232   ADD related_code varchar(255)  NOT NULL DEFAULT '' COMMENT 'may reference a related codes.code';
234 ALTER TABLE billing
235   MODIFY `justify` varchar(255) NOT NULL DEFAULT '';
237 ALTER TABLE prescriptions
238   MODIFY `quantity` varchar(31) default '';
240 ALTER TABLE codes
241   MODIFY `superbill` varchar(31) default '';
242 INSERT INTO list_options VALUES ('superbill','newpt','New Patient'        ,1,0,0);
243 INSERT INTO list_options VALUES ('superbill','estpt','Established Patient',2,0,0);
245 ALTER TABLE patient_data
246   ADD `userlist3`  varchar(255) NOT NULL DEFAULT '',
247   ADD `userlist4`  varchar(255) NOT NULL DEFAULT '',
248   ADD `userlist5`  varchar(255) NOT NULL DEFAULT '',
249   ADD `userlist6`  varchar(255) NOT NULL DEFAULT '',
250   ADD `userlist7`  varchar(255) NOT NULL DEFAULT '',
251   ADD `regdate`    date DEFAULT NULL COMMENT 'Registration Date';
253 INSERT INTO list_options VALUES ('userlist3','sample','Sample',1,0,0);
254 INSERT INTO list_options VALUES ('userlist4','sample','Sample',1,0,0);
255 INSERT INTO list_options VALUES ('userlist5','sample','Sample',1,0,0);
256 INSERT INTO list_options VALUES ('userlist6','sample','Sample',1,0,0);
257 INSERT INTO list_options VALUES ('userlist7','sample','Sample',1,0,0);
259 INSERT INTO layout_options VALUES ('DEM','userlist3'       ,'6Misc','User Defined List 3'   ,11, 1,0, 0, 0,'userlist3',1,1,'','' ,'User Defined');
260 INSERT INTO layout_options VALUES ('DEM','userlist4'       ,'6Misc','User Defined List 4'   ,12, 1,0, 0, 0,'userlist4',1,1,'','' ,'User Defined');
261 INSERT INTO layout_options VALUES ('DEM','userlist5'       ,'6Misc','User Defined List 5'   ,13, 1,0, 0, 0,'userlist5',1,1,'','' ,'User Defined');
262 INSERT INTO layout_options VALUES ('DEM','userlist6'       ,'6Misc','User Defined List 6'   ,14, 1,0, 0, 0,'userlist6',1,1,'','' ,'User Defined');
263 INSERT INTO layout_options VALUES ('DEM','userlist7'       ,'6Misc','User Defined List 7'   ,15, 1,0, 0, 0,'userlist7',1,1,'','' ,'User Defined');
264 INSERT INTO layout_options VALUES ('DEM','regdate'         ,'6Misc','Registration Date'     ,16, 4,0,10,10,''         ,1,1,'','D','Start Date at This Clinic');
266 INSERT INTO list_options VALUES ('refsource','Patient'      ,'Patient'      , 1,0,0);
267 INSERT INTO list_options VALUES ('refsource','Employee'     ,'Employee'     , 2,0,0);
268 INSERT INTO list_options VALUES ('refsource','Walk-In'      ,'Walk-In'      , 3,0,0);
269 INSERT INTO list_options VALUES ('refsource','Newspaper'    ,'Newspaper'    , 4,0,0);
270 INSERT INTO list_options VALUES ('refsource','Radio'        ,'Radio'        , 5,0,0);
271 INSERT INTO list_options VALUES ('refsource','T.V.'         ,'T.V.'         , 6,0,0);
272 INSERT INTO list_options VALUES ('refsource','Direct Mail'  ,'Direct Mail'  , 7,0,0);
273 INSERT INTO list_options VALUES ('refsource','Coupon'       ,'Coupon'       , 8,0,0);
274 INSERT INTO list_options VALUES ('refsource','Referral Card','Referral Card', 9,0,0);
275 INSERT INTO list_options VALUES ('refsource','Other'        ,'Other'        ,10,0,0);
277 INSERT INTO list_options VALUES ('country','USA','USA',1,0,0);
279 ALTER TABLE patient_data ADD `contrastart` date DEFAULT NULL COMMENT 'Date contraceptives initially used';
280 INSERT INTO layout_options VALUES ('DEM','contrastart','5Stats','Contraceptives Start',9,4,0,10,10,'',1,1,'','D','Date contraceptive services initially provided');
282 ALTER TABLE transactions
283   ADD `refer_external`          tinyint(1)   NOT NULL DEFAULT 0;
285 ALTER TABLE history_data
286   ADD `exams`      text         NOT NULL DEFAULT '',
287   ADD `usertext11` varchar(255) NOT NULL DEFAULT '',
288   ADD `usertext12` varchar(255) NOT NULL DEFAULT '',
289   ADD `usertext13` varchar(255) NOT NULL DEFAULT '',
290   ADD `usertext14` varchar(255) NOT NULL DEFAULT '',
291   ADD `usertext15` varchar(255) NOT NULL DEFAULT '',
292   ADD `usertext16` varchar(255) NOT NULL DEFAULT '',
293   ADD `usertext17` varchar(255) NOT NULL DEFAULT '',
294   ADD `usertext18` varchar(255) NOT NULL DEFAULT '',
295   ADD `usertext19` varchar(255) NOT NULL DEFAULT '',
296   ADD `usertext20` varchar(255) NOT NULL DEFAULT '',
297   ADD `usertext21` varchar(255) NOT NULL DEFAULT '',
298   ADD `usertext22` varchar(255) NOT NULL DEFAULT '',
299   ADD `usertext23` varchar(255) NOT NULL DEFAULT '',
300   ADD `usertext24` varchar(255) NOT NULL DEFAULT '',
301   ADD `usertext25` varchar(255) NOT NULL DEFAULT '',
302   ADD `usertext26` varchar(255) NOT NULL DEFAULT '',
303   ADD `usertext27` varchar(255) NOT NULL DEFAULT '',
304   ADD `usertext28` varchar(255) NOT NULL DEFAULT '',
305   ADD `usertext29` varchar(255) NOT NULL DEFAULT '',
306   ADD `usertext30` varchar(255) NOT NULL DEFAULT '',
307   ADD `userdate11` date DEFAULT NULL,
308   ADD `userdate12` date DEFAULT NULL,
309   ADD `userdate13` date DEFAULT NULL,
310   ADD `userdate14` date DEFAULT NULL,
311   ADD `userdate15` date DEFAULT NULL;
313 UPDATE history_data SET exams = CONCAT(exams, '|brs:1:', last_breast_exam              ) WHERE SUBSTRING(last_exam_results, 1, 1) = '1';
314 UPDATE history_data SET exams = CONCAT(exams, '|brs:2:', last_breast_exam              ) WHERE SUBSTRING(last_exam_results, 1, 1) = '2';
315 UPDATE history_data SET exams = CONCAT(exams, '|mam:1:', last_mammogram                ) WHERE SUBSTRING(last_exam_results, 2, 1) = '1';
316 UPDATE history_data SET exams = CONCAT(exams, '|mam:2:', last_mammogram                ) WHERE SUBSTRING(last_exam_results, 2, 1) = '2';
317 UPDATE history_data SET exams = CONCAT(exams, '|gyn:1:', last_gynocological_exam       ) WHERE SUBSTRING(last_exam_results, 3, 1) = '1';
318 UPDATE history_data SET exams = CONCAT(exams, '|gyn:2:', last_gynocological_exam       ) WHERE SUBSTRING(last_exam_results, 3, 1) = '2';
319 UPDATE history_data SET exams = CONCAT(exams, '|rec:1:', last_rectal_exam              ) WHERE SUBSTRING(last_exam_results, 4, 1) = '1';
320 UPDATE history_data SET exams = CONCAT(exams, '|rec:2:', last_rectal_exam              ) WHERE SUBSTRING(last_exam_results, 4, 1) = '2';
321 UPDATE history_data SET exams = CONCAT(exams, '|pro:1:', last_prostate_exam            ) WHERE SUBSTRING(last_exam_results, 5, 1) = '1';
322 UPDATE history_data SET exams = CONCAT(exams, '|pro:2:', last_prostate_exam            ) WHERE SUBSTRING(last_exam_results, 5, 1) = '2';
323 UPDATE history_data SET exams = CONCAT(exams, '|phy:1:', last_physical_exam            ) WHERE SUBSTRING(last_exam_results, 6, 1) = '1';
324 UPDATE history_data SET exams = CONCAT(exams, '|phy:2:', last_physical_exam            ) WHERE SUBSTRING(last_exam_results, 6, 1) = '2';
325 UPDATE history_data SET exams = CONCAT(exams, '|sic:1:', last_sigmoidoscopy_colonoscopy) WHERE SUBSTRING(last_exam_results, 7, 1) = '1';
326 UPDATE history_data SET exams = CONCAT(exams, '|sic:2:', last_sigmoidoscopy_colonoscopy) WHERE SUBSTRING(last_exam_results, 7, 1) = '2';
327 UPDATE history_data SET exams = CONCAT(exams, '|ecg:1:', last_ecg                      ) WHERE SUBSTRING(last_exam_results, 8, 1) = '1';
328 UPDATE history_data SET exams = CONCAT(exams, '|ecg:2:', last_ecg                      ) WHERE SUBSTRING(last_exam_results, 8, 1) = '2';
329 UPDATE history_data SET exams = CONCAT(exams, '|cec:1:', last_cardiac_echo             ) WHERE SUBSTRING(last_exam_results, 9, 1) = '1';
330 UPDATE history_data SET exams = CONCAT(exams, '|cec:2:', last_cardiac_echo             ) WHERE SUBSTRING(last_exam_results, 9, 1) = '2';
331 UPDATE history_data SET exams = CONCAT(exams, '|ret:1:', last_retinal                  ) WHERE SUBSTRING(last_exam_results,10, 1) = '1';
332 UPDATE history_data SET exams = CONCAT(exams, '|ret:2:', last_retinal                  ) WHERE SUBSTRING(last_exam_results,10, 1) = '2';
333 UPDATE history_data SET exams = CONCAT(exams, '|flu:1:', last_fluvax                   ) WHERE SUBSTRING(last_exam_results,11, 1) = '1';
334 UPDATE history_data SET exams = CONCAT(exams, '|flu:2:', last_fluvax                   ) WHERE SUBSTRING(last_exam_results,11, 1) = '2';
335 UPDATE history_data SET exams = CONCAT(exams, '|pne:1:', last_pneuvax                  ) WHERE SUBSTRING(last_exam_results,12, 1) = '1';
336 UPDATE history_data SET exams = CONCAT(exams, '|pne:2:', last_pneuvax                  ) WHERE SUBSTRING(last_exam_results,12, 1) = '2';
337 UPDATE history_data SET exams = CONCAT(exams, '|ldl:1:', last_ldl                      ) WHERE SUBSTRING(last_exam_results,13, 1) = '1';
338 UPDATE history_data SET exams = CONCAT(exams, '|ldl:2:', last_ldl                      ) WHERE SUBSTRING(last_exam_results,13, 1) = '2';
339 UPDATE history_data SET exams = CONCAT(exams, '|hem:1:', last_hemoglobin               ) WHERE SUBSTRING(last_exam_results,14, 1) = '1';
340 UPDATE history_data SET exams = CONCAT(exams, '|hem:2:', last_hemoglobin               ) WHERE SUBSTRING(last_exam_results,14, 1) = '2';
341 UPDATE history_data SET exams = CONCAT(exams, '|psa:1:', last_psa                      ) WHERE SUBSTRING(last_exam_results,15, 1) = '1';
342 UPDATE history_data SET exams = CONCAT(exams, '|psa:2:', last_psa                      ) WHERE SUBSTRING(last_exam_results,15, 1) = '2';
344 DELETE FROM layout_options WHERE form_id = 'HIS' AND group_name = '1General';
345 INSERT INTO layout_options VALUES ('HIS','usertext11','1General','Risk Factors',1,21,1,0,0,'riskfactors',1,1,'','' ,'Risk Factors');
346 INSERT INTO layout_options VALUES ('HIS','exams'     ,'1General','Exams/Tests' ,2,23,1,0,0,'exams'      ,1,1,'','' ,'Exam and test results');
348 DELETE FROM layout_options WHERE form_id = 'HIS' AND group_name = '2Family History';
349 INSERT INTO layout_options VALUES ('HIS','history_father'   ,'2Family History','Father'   ,1, 2,1,20,255,'',1,1,'','' ,'');
350 INSERT INTO layout_options VALUES ('HIS','history_mother'   ,'2Family History','Mother'   ,2, 2,1,20,255,'',1,1,'','' ,'');
351 INSERT INTO layout_options VALUES ('HIS','history_siblings' ,'2Family History','Siblings' ,3, 2,1,20,255,'',1,1,'','' ,'');
352 INSERT INTO layout_options VALUES ('HIS','history_spouse'   ,'2Family History','Spouse'   ,4, 2,1,20,255,'',1,1,'','' ,'');
353 INSERT INTO layout_options VALUES ('HIS','history_offspring','2Family History','Offspring',5, 2,1,20,255,'',1,3,'','' ,'');
355 DELETE FROM layout_options WHERE form_id = 'HIS' AND group_name = '3Relatives';
356 INSERT INTO layout_options VALUES ('HIS','relatives_cancer'             ,'3Relatives','Cancer'             ,1, 2,1,20,255,'',1,1,'','' ,'');
357 INSERT INTO layout_options VALUES ('HIS','relatives_tuberculosis'       ,'3Relatives','Tuberculosis'       ,2, 2,1,20,255,'',1,1,'','' ,'');
358 INSERT INTO layout_options VALUES ('HIS','relatives_diabetes'           ,'3Relatives','Diabetes'           ,3, 2,1,20,255,'',1,1,'','' ,'');
359 INSERT INTO layout_options VALUES ('HIS','relatives_high_blood_pressure','3Relatives','High Blood Pressure',4, 2,1,20,255,'',1,1,'','' ,'');
360 INSERT INTO layout_options VALUES ('HIS','relatives_heart_problems'     ,'3Relatives','Heart Problems'     ,5, 2,1,20,255,'',1,1,'','' ,'');
361 INSERT INTO layout_options VALUES ('HIS','relatives_stroke'             ,'3Relatives','Stroke'             ,6, 2,1,20,255,'',1,1,'','' ,'');
362 INSERT INTO layout_options VALUES ('HIS','relatives_epilepsy'           ,'3Relatives','Epilepsy'           ,7, 2,1,20,255,'',1,1,'','' ,'');
363 INSERT INTO layout_options VALUES ('HIS','relatives_mental_illness'     ,'3Relatives','Mental Illness'     ,8, 2,1,20,255,'',1,1,'','' ,'');
364 INSERT INTO layout_options VALUES ('HIS','relatives_suicide'            ,'3Relatives','Suicide'            ,9, 2,1,20,255,'',1,3,'','' ,'');
366 DELETE FROM layout_options WHERE form_id = 'HIS' AND group_name = '4Lifestyle';
367 INSERT INTO layout_options VALUES ('HIS','coffee'              ,'4Lifestyle','Coffee'              ,1, 2,1,20,255,'',1,1,'','' ,'Caffeine consumption');
368 INSERT INTO layout_options VALUES ('HIS','tobacco'             ,'4Lifestyle','Tobacco'             ,2, 2,1,20,255,'',1,1,'','' ,'Tobacco use');
369 INSERT INTO layout_options VALUES ('HIS','alcohol'             ,'4Lifestyle','Alcohol'             ,3, 2,1,20,255,'',1,1,'','' ,'Alcohol consumption');
370 INSERT INTO layout_options VALUES ('HIS','sleep_patterns'      ,'4Lifestyle','Sleep Patterns'      ,4, 2,1,20,255,'',1,1,'','' ,'Sleep patterns');
371 INSERT INTO layout_options VALUES ('HIS','exercise_patterns'   ,'4Lifestyle','Exercise Patterns'   ,5, 2,1,20,255,'',1,1,'','' ,'Exercise patterns');
372 INSERT INTO layout_options VALUES ('HIS','seatbelt_use'        ,'4Lifestyle','Seatbelt Use'        ,6, 2,1,20,255,'',1,1,'','' ,'Seatbelt use');
373 INSERT INTO layout_options VALUES ('HIS','counseling'          ,'4Lifestyle','Counseling'          ,7, 2,1,20,255,'',1,1,'','' ,'Counseling activities');
374 INSERT INTO layout_options VALUES ('HIS','hazardous_activities','4Lifestyle','Hazardous Activities',8, 2,1,20,255,'',1,1,'','' ,'Hazardous activities');
376 DELETE FROM layout_options WHERE form_id = 'HIS' AND group_name = '5Other';
377 INSERT INTO layout_options VALUES ('HIS','name_1'            ,'5Other','Name/Value'        ,1, 2,1,10,255,'',1,1,'','' ,'Name 1' );
378 INSERT INTO layout_options VALUES ('HIS','value_1'           ,'5Other',''                  ,2, 2,1,10,255,'',0,0,'','' ,'Value 1');
379 INSERT INTO layout_options VALUES ('HIS','name_2'            ,'5Other','Name/Value'        ,3, 2,1,10,255,'',1,1,'','' ,'Name 2' );
380 INSERT INTO layout_options VALUES ('HIS','value_2'           ,'5Other',''                  ,4, 2,1,10,255,'',0,0,'','' ,'Value 2');
381 INSERT INTO layout_options VALUES ('HIS','additional_history','5Other','Additional History',5, 3,1,30,  3,'',1,3,'' ,'' ,'Additional history notes');
383 DELETE FROM list_options WHERE list_id = 'riskfactors';
384 INSERT INTO list_options VALUES ('riskfactors','vv' ,'Varicose Veins'                      , 1,0,0);
385 INSERT INTO list_options VALUES ('riskfactors','ht' ,'Hypertension'                        , 2,0,0);
386 INSERT INTO list_options VALUES ('riskfactors','db' ,'Diabetes'                            , 3,0,0);
387 INSERT INTO list_options VALUES ('riskfactors','sc' ,'Sickle Cell'                         , 4,0,0);
388 INSERT INTO list_options VALUES ('riskfactors','fib','Fibroids'                            , 5,0,0);
389 INSERT INTO list_options VALUES ('riskfactors','pid','PID (Pelvic Inflammatory Disease)'   , 6,0,0);
390 INSERT INTO list_options VALUES ('riskfactors','mig','Severe Migraine'                     , 7,0,0);
391 INSERT INTO list_options VALUES ('riskfactors','hd' ,'Heart Disease'                       , 8,0,0);
392 INSERT INTO list_options VALUES ('riskfactors','str','Thrombosis/Stroke'                   , 9,0,0);
393 INSERT INTO list_options VALUES ('riskfactors','hep','Hepatitis'                           ,10,0,0);
394 INSERT INTO list_options VALUES ('riskfactors','gb' ,'Gall Bladder Condition'              ,11,0,0);
395 INSERT INTO list_options VALUES ('riskfactors','br' ,'Breast Disease'                      ,12,0,0);
396 INSERT INTO list_options VALUES ('riskfactors','dpr','Depression'                          ,13,0,0);
397 INSERT INTO list_options VALUES ('riskfactors','all','Allergies'                           ,14,0,0);
398 INSERT INTO list_options VALUES ('riskfactors','inf','Infertility'                         ,15,0,0);
399 INSERT INTO list_options VALUES ('riskfactors','ast','Asthma'                              ,16,0,0);
400 INSERT INTO list_options VALUES ('riskfactors','ep' ,'Epilepsy'                            ,17,0,0);
401 INSERT INTO list_options VALUES ('riskfactors','cl' ,'Contact Lenses'                      ,18,0,0);
402 INSERT INTO list_options VALUES ('riskfactors','coc','Contraceptive Complication (specify)',19,0,0);
403 INSERT INTO list_options VALUES ('riskfactors','oth','Other (specify)'                     ,20,0,0);
405 DELETE FROM list_options WHERE list_id = 'exams';
406 INSERT INTO list_options VALUES ('exams' ,'brs','Breast Exam'          , 1,0,0);
407 INSERT INTO list_options VALUES ('exams' ,'cec','Cardiac Echo'         , 2,0,0);
408 INSERT INTO list_options VALUES ('exams' ,'ecg','ECG'                  , 3,0,0);
409 INSERT INTO list_options VALUES ('exams' ,'gyn','Gynecological Exam'   , 4,0,0);
410 INSERT INTO list_options VALUES ('exams' ,'mam','Mammogram'            , 5,0,0);
411 INSERT INTO list_options VALUES ('exams' ,'phy','Physical Exam'        , 6,0,0);
412 INSERT INTO list_options VALUES ('exams' ,'pro','Prostate Exam'        , 7,0,0);
413 INSERT INTO list_options VALUES ('exams' ,'rec','Rectal Exam'          , 8,0,0);
414 INSERT INTO list_options VALUES ('exams' ,'sic','Sigmoid/Colonoscopy'  , 9,0,0);
415 INSERT INTO list_options VALUES ('exams' ,'ret','Retinal Exam'         ,10,0,0);
416 INSERT INTO list_options VALUES ('exams' ,'flu','Flu Vaccination'      ,11,0,0);
417 INSERT INTO list_options VALUES ('exams' ,'pne','Pneumonia Vaccination',12,0,0);
418 INSERT INTO list_options VALUES ('exams' ,'ldl','LDL'                  ,13,0,0);
419 INSERT INTO list_options VALUES ('exams' ,'hem','Hemoglobin'           ,14,0,0);
420 INSERT INTO list_options VALUES ('exams' ,'psa','PSA'                  ,15,0,0);
422 DELETE FROM list_options WHERE list_id = 'lists';
423 INSERT INTO list_options VALUES ('lists' ,'boolean'    ,'Boolean'            , 1,0,0);
424 INSERT INTO list_options VALUES ('lists' ,'country'    ,'Country'            , 2,0,0);
425 INSERT INTO list_options VALUES ('lists' ,'feesheet'   ,'Fee Sheet'          , 3,0,0);
426 INSERT INTO list_options VALUES ('lists' ,'language'   ,'Language'           , 4,0,0);
427 INSERT INTO list_options VALUES ('lists' ,'marital'    ,'Marital Status'     , 5,0,0);
428 INSERT INTO list_options VALUES ('lists' ,'pricelevel' ,'Price Level'        , 6,0,0);
429 INSERT INTO list_options VALUES ('lists' ,'ethrace'    ,'Race/Ethnicity'     , 7,0,0);
430 INSERT INTO list_options VALUES ('lists' ,'refsource'  ,'Referral Source'    , 8,0,0);
431 INSERT INTO list_options VALUES ('lists' ,'risklevel'  ,'Risk Level'         , 9,0,0);
432 INSERT INTO list_options VALUES ('lists' ,'superbill'  ,'Service Category'   ,10,0,0);
433 INSERT INTO list_options VALUES ('lists' ,'sex'        ,'Sex'                ,11,0,0);
434 INSERT INTO list_options VALUES ('lists' ,'taxrate'    ,'Tax Rate'           ,13,0,0);
435 INSERT INTO list_options VALUES ('lists' ,'titles'     ,'Titles'             ,14,0,0);
436 INSERT INTO list_options VALUES ('lists' ,'yesno'      ,'Yes/No'             ,15,0,0);
437 INSERT INTO list_options VALUES ('lists' ,'userlist1'  ,'User Defined List 1',16,0,0);
438 INSERT INTO list_options VALUES ('lists' ,'userlist2'  ,'User Defined List 2',17,0,0);
439 INSERT INTO list_options VALUES ('lists' ,'userlist3'  ,'User Defined List 3',18,0,0);
440 INSERT INTO list_options VALUES ('lists' ,'userlist4'  ,'User Defined List 4',19,0,0);
441 INSERT INTO list_options VALUES ('lists' ,'userlist5'  ,'User Defined List 5',20,0,0);
442 INSERT INTO list_options VALUES ('lists' ,'userlist6'  ,'User Defined List 6',21,0,0);
443 INSERT INTO list_options VALUES ('lists' ,'userlist7'  ,'User Defined List 7',22,0,0);
444 INSERT INTO list_options VALUES ('lists' ,'riskfactors','Risk Factors'       ,23,0,0);
445 INSERT INTO list_options VALUES ('lists' ,'exams'      ,'Exams/Tests'        ,24,0,0);
447 ALTER TABLE patient_data
448   ADD hipaa_allowsms   varchar(3) NOT NULL DEFAULT 'NO',
449   ADD hipaa_allowemail varchar(3) NOT NULL DEFAULT 'NO';
451 INSERT INTO `layout_options` VALUES ('DEM', 'hipaa_allowsms'  , '3Choices', 'Allow SMS'  , 5, 1, 1, 0, 0, 'yesno', 1, 1, '', '', 'Allow SMS (text messages)?');
452 INSERT INTO `layout_options` VALUES ('DEM', 'hipaa_allowemail', '3Choices', 'Allow Email', 5, 1, 1, 0, 0, 'yesno', 1, 1, '', '', 'Allow Email?');
454 INSERT INTO list_options VALUES ('drug_form','1','suspension' ,1,0,0);
455 INSERT INTO list_options VALUES ('drug_form','2','tablet'     ,2,0,0);
456 INSERT INTO list_options VALUES ('drug_form','3','capsule'    ,3,0,0);
457 INSERT INTO list_options VALUES ('drug_form','4','solution'   ,4,0,0);
458 INSERT INTO list_options VALUES ('drug_form','5','tsp'        ,5,0,0);
459 INSERT INTO list_options VALUES ('drug_form','6','ml'         ,6,0,0);
460 INSERT INTO list_options VALUES ('drug_form','7','units'      ,7,0,0);
461 INSERT INTO list_options VALUES ('drug_form','8','inhalations',8,0,0);
462 INSERT INTO list_options VALUES ('drug_form','9','gtts(drops)',9,0,0);
464 INSERT INTO list_options VALUES ('drug_units','1','mg'    ,1,0,0);
465 INSERT INTO list_options VALUES ('drug_units','2','mg/1cc',2,0,0);
466 INSERT INTO list_options VALUES ('drug_units','3','mg/2cc',3,0,0);
467 INSERT INTO list_options VALUES ('drug_units','4','mg/3cc',4,0,0);
468 INSERT INTO list_options VALUES ('drug_units','5','mg/4cc',5,0,0);
469 INSERT INTO list_options VALUES ('drug_units','6','mg/5cc',6,0,0);
470 INSERT INTO list_options VALUES ('drug_units','7','grams' ,7,0,0);
471 INSERT INTO list_options VALUES ('drug_units','8','mcg'   ,8,0,0);
473 INSERT INTO list_options VALUES ('drug_route', '1','Per Oris'         , 1,0,0);
474 INSERT INTO list_options VALUES ('drug_route', '2','Per Rectum'       , 2,0,0);
475 INSERT INTO list_options VALUES ('drug_route', '3','To Skin'          , 3,0,0);
476 INSERT INTO list_options VALUES ('drug_route', '4','To Affected Area' , 4,0,0);
477 INSERT INTO list_options VALUES ('drug_route', '5','Sublingual'       , 5,0,0);
478 INSERT INTO list_options VALUES ('drug_route',' 6','OS'               , 6,0,0);
479 INSERT INTO list_options VALUES ('drug_route', '7','OD'               , 7,0,0);
480 INSERT INTO list_options VALUES ('drug_route', '8','OU'               , 8,0,0);
481 INSERT INTO list_options VALUES ('drug_route', '9','SQ'               , 9,0,0);
482 INSERT INTO list_options VALUES ('drug_route','10','IM'               ,10,0,0);
483 INSERT INTO list_options VALUES ('drug_route','11','IV'               ,11,0,0);
484 INSERT INTO list_options VALUES ('drug_route','12','Per Nostril'      ,12,0,0);
486 INSERT INTO list_options VALUES ('drug_interval','1','b.i.d.',1,0,0);
487 INSERT INTO list_options VALUES ('drug_interval','2','t.i.d.',2,0,0);
488 INSERT INTO list_options VALUES ('drug_interval','3','q.i.d.',3,0,0);
489 INSERT INTO list_options VALUES ('drug_interval','4','q.3h'  ,4,0,0);
490 INSERT INTO list_options VALUES ('drug_interval','5','q.4h'  ,5,0,0);
491 INSERT INTO list_options VALUES ('drug_interval','6','q.5h'  ,6,0,0);
492 INSERT INTO list_options VALUES ('drug_interval','7','q.6h'  ,7,0,0);
493 INSERT INTO list_options VALUES ('drug_interval','8','q.8h'  ,8,0,0);
494 INSERT INTO list_options VALUES ('drug_interval','9','q.d.'  ,9,0,0);
496 INSERT INTO list_options VALUES ('lists' ,'drug_form'    ,'Drug Forms'    ,24,0,0);
497 INSERT INTO list_options VALUES ('lists' ,'drug_units'   ,'Drug Units'    ,25,0,0);
498 INSERT INTO list_options VALUES ('lists' ,'drug_route'   ,'Drug Routes'   ,26,0,0);
499 INSERT INTO list_options VALUES ('lists' ,'drug_interval','Drug Intervals',27,0,0);
501 ALTER TABLE drugs
502   ADD cyp_factor float NOT NULL DEFAULT 0 COMMENT 'quantity representing a years supply';
504 ALTER TABLE codes
505   ADD cyp_factor float NOT NULL DEFAULT 0 COMMENT 'quantity representing a years supply';
507 INSERT INTO list_options VALUES ('state','CA','California',1,0,0);
508 INSERT INTO list_options VALUES ('lists' ,'state','State',12,0,0);
509 UPDATE layout_options SET data_type = 1, list_id = 'state' WHERE form_id = 'DEM' AND field_id = 'state';
511 ALTER TABLE transactions
512   ADD refer_related_code varchar(255) NOT NULL DEFAULT '' COMMENT 'may reference codes.code as referral reason';
514 INSERT INTO layout_options VALUES ('REF','refer_related_code','1Referral','Requested Service',8,15,1,30,255,'',1,1,'','','Billing Code for Requested Service');
516 ALTER TABLE billing
517   MODIFY `fee` decimal(12,2) NOT NULL DEFAULT 0.00;
518 ALTER TABLE codes
519   MODIFY `fee` decimal(12,2) NOT NULL DEFAULT 0.00;
520 ALTER TABLE drug_sales
521   MODIFY `fee` decimal(12,2) NOT NULL DEFAULT 0.00;
522 ALTER TABLE payments
523   MODIFY `amount1` decimal(12,2) NOT NULL DEFAULT 0.00,
524   MODIFY `amount2` decimal(12,2) NOT NULL DEFAULT 0.00,
525   MODIFY `posted1` decimal(12,2) NOT NULL DEFAULT 0.00,
526   MODIFY `posted2` decimal(12,2) NOT NULL DEFAULT 0.00;
528 ALTER TABLE users
529   ADD `taxonomy` varchar(30) NOT NULL DEFAULT '207Q00000X';
531 ALTER TABLE patient_data
532   ADD `usertext3` varchar(255) NOT NULL DEFAULT '',
533   ADD `usertext4` varchar(255) NOT NULL DEFAULT '',
534   ADD `usertext5` varchar(255) NOT NULL DEFAULT '',
535   ADD `usertext6` varchar(255) NOT NULL DEFAULT '',
536   ADD `usertext7` varchar(255) NOT NULL DEFAULT '',
537   ADD `usertext8` varchar(255) NOT NULL DEFAULT '';
539 INSERT INTO layout_options VALUES ('DEM','usertext3','6Misc','User Defined Text 3', 3,2,0,10,63,'',1,1,'','','User Defined');
540 INSERT INTO layout_options VALUES ('DEM','usertext4','6Misc','User Defined Text 4', 4,2,0,10,63,'',1,1,'','','User Defined');
541 INSERT INTO layout_options VALUES ('DEM','usertext5','6Misc','User Defined Text 5', 5,2,0,10,63,'',1,1,'','','User Defined');
542 INSERT INTO layout_options VALUES ('DEM','usertext6','6Misc','User Defined Text 6', 6,2,0,10,63,'',1,1,'','','User Defined');
543 INSERT INTO layout_options VALUES ('DEM','usertext7','6Misc','User Defined Text 7', 7,2,0,10,63,'',1,1,'','','User Defined');
544 INSERT INTO layout_options VALUES ('DEM','usertext8','6Misc','User Defined Text 8', 8,2,0,10,63,'',1,1,'','','User Defined');
546 ALTER TABLE history_data
547   ADD `userarea11` text NOT NULL DEFAULT '',
548   ADD `userarea12` text NOT NULL DEFAULT '';
550 INSERT INTO layout_options VALUES ('HIS','userarea11','5Other','User Defined Area 11',6,3,0,30,3,'',1,3,'','','User Defined');
551 INSERT INTO layout_options VALUES ('HIS','userarea12','5Other','User Defined Area 12',7,3,0,30,3,'',1,3,'','','User Defined');