1 #IfMissingColumn pnotes deleted
3 ADD `deleted` TINYINT DEFAULT '0' COMMENT 'flag indicates note is deleted';
6 #IfNotRow list_options list_id adjreason
7 INSERT INTO list_options VALUES ('lists' ,'adjreason' ,'Adjustment Reasons',1,0,0);
8 INSERT INTO list_options VALUES ('adjreason','Adm adjust' ,'Adm adjust' , 5,0,0);
9 INSERT INTO list_options VALUES ('adjreason','After hrs calls','After hrs calls',10,0,0);
10 INSERT INTO list_options VALUES ('adjreason','Bad check' ,'Bad check' ,15,0,0);
11 INSERT INTO list_options VALUES ('adjreason','Bad debt' ,'Bad debt' ,20,0,0);
12 INSERT INTO list_options VALUES ('adjreason','Coll w/o' ,'Coll w/o' ,25,0,0);
13 INSERT INTO list_options VALUES ('adjreason','Discount' ,'Discount' ,30,0,0);
14 INSERT INTO list_options VALUES ('adjreason','Hardship w/o' ,'Hardship w/o' ,35,0,0);
15 INSERT INTO list_options VALUES ('adjreason','Ins adjust' ,'Ins adjust' ,40,0,0);
16 INSERT INTO list_options VALUES ('adjreason','Ins bundling' ,'Ins bundling' ,45,0,0);
17 INSERT INTO list_options VALUES ('adjreason','Ins overpaid' ,'Ins overpaid' ,50,0,0);
18 INSERT INTO list_options VALUES ('adjreason','Ins refund' ,'Ins refund' ,55,0,0);
19 INSERT INTO list_options VALUES ('adjreason','Pt overpaid' ,'Pt overpaid' ,60,0,0);
20 INSERT INTO list_options VALUES ('adjreason','Pt refund' ,'Pt refund' ,65,0,0);
21 INSERT INTO list_options VALUES ('adjreason','Pt released' ,'Pt released' ,70,0,0);
22 INSERT INTO list_options VALUES ('adjreason','Sm debt w/o' ,'Sm debt w/o' ,75,0,0);
23 INSERT INTO list_options VALUES ('adjreason','To copay' ,'To copay' ,80,0,0);
24 INSERT INTO list_options VALUES ('adjreason','To ded\'ble' ,'To ded\'ble' ,85,0,0);
25 INSERT INTO list_options VALUES ('adjreason','Untimely filing','Untimely filing',90,0,0);
28 #IfNotRow list_options list_id sub_relation
29 INSERT INTO list_options VALUES ('lists' ,'sub_relation','Subscriber Relationship',18,0,0);
30 INSERT INTO list_options VALUES ('sub_relation','self' ,'Self' , 1,0,0);
31 INSERT INTO list_options VALUES ('sub_relation','spouse' ,'Spouse' , 2,0,0);
32 INSERT INTO list_options VALUES ('sub_relation','child' ,'Child' , 3,0,0);
33 INSERT INTO list_options VALUES ('sub_relation','other' ,'Other' , 4,0,0);
36 #IfNotRow list_options list_id occurrence
37 INSERT INTO list_options VALUES ('lists' ,'occurrence','Occurrence' ,10,0,0);
38 INSERT INTO list_options VALUES ('occurrence','0' ,'Unknown or N/A' , 5,0,0);
39 INSERT INTO list_options VALUES ('occurrence','1' ,'First' ,10,0,0);
40 INSERT INTO list_options VALUES ('occurrence','6' ,'Early Recurrence (<2 Mo)' ,15,0,0);
41 INSERT INTO list_options VALUES ('occurrence','7' ,'Late Recurrence (2-12 Mo)' ,20,0,0);
42 INSERT INTO list_options VALUES ('occurrence','8' ,'Delayed Recurrence (> 12 Mo)',25,0,0);
43 INSERT INTO list_options VALUES ('occurrence','4' ,'Chronic/Recurrent' ,30,0,0);
44 INSERT INTO list_options VALUES ('occurrence','5' ,'Acute on Chronic' ,35,0,0);
47 #IfNotRow list_options list_id outcome
48 INSERT INTO list_options VALUES ('lists' ,'outcome','Outcome' ,10,0,0);
49 INSERT INTO list_options VALUES ('outcome','0' ,'Unassigned' , 2,0,0);
50 INSERT INTO list_options VALUES ('outcome','1' ,'Resolved' , 5,0,0);
51 INSERT INTO list_options VALUES ('outcome','2' ,'Improved' ,10,0,0);
52 INSERT INTO list_options VALUES ('outcome','3' ,'Status quo' ,15,0,0);
53 INSERT INTO list_options VALUES ('outcome','4' ,'Worse' ,20,0,0);
54 INSERT INTO list_options VALUES ('outcome','5' ,'Pending followup',25,0,0);
57 #IfNotRow list_options list_id note_type
58 INSERT INTO list_options VALUES ('lists' ,'note_type' ,'Patient Note Types',10,0,0);
59 INSERT INTO list_options VALUES ('note_type','Unassigned' ,'Unassigned' , 1,0,0);
60 INSERT INTO list_options VALUES ('note_type','Chart Note' ,'Chart Note' , 2,0,0);
61 INSERT INTO list_options VALUES ('note_type','Insurance' ,'Insurance' , 3,0,0);
62 INSERT INTO list_options VALUES ('note_type','New Document' ,'New Document' , 4,0,0);
63 INSERT INTO list_options VALUES ('note_type','Pharmacy' ,'Pharmacy' , 5,0,0);
64 INSERT INTO list_options VALUES ('note_type','Prior Auth' ,'Prior Auth' , 6,0,0);
65 INSERT INTO list_options VALUES ('note_type','Referral' ,'Referral' , 7,0,0);
66 INSERT INTO list_options VALUES ('note_type','Test Scheduling','Test Scheduling' , 8,0,0);
67 INSERT INTO list_options VALUES ('note_type','Bill/Collect' ,'Bill/Collect' , 9,0,0);
68 INSERT INTO list_options VALUES ('note_type','Other' ,'Other' ,10,0,0);
71 #IfNotRow list_options list_id immunizations
72 INSERT INTO list_options VALUES ('lists','immunizations','Immunizations',8,0,0);
73 INSERT INTO list_options (list_id,option_id,title) SELECT 'immunizations',id,name FROM immunization ORDER BY name;
74 DROP TABLE immunization;
77 #IfNotRow2D list_options list_id drug_form option_id 0
78 INSERT INTO list_options VALUES ('drug_form' ,'0' ,'' , 0,0,0);
80 #IfNotRow2D list_options list_id drug_form option_id 10
81 INSERT INTO list_options VALUES ('drug_form' ,'10','cream' ,10,0,0);
83 #IfNotRow2D list_options list_id drug_form option_id 11
84 INSERT INTO list_options VALUES ('drug_form' ,'11','ointment' ,11,0,0);
86 #IfNotRow2D list_options list_id drug_units option_id 0
87 INSERT INTO list_options VALUES ('drug_units' ,'0' ,'' , 0,0,0);
89 #IfNotRow2D list_options list_id drug_route option_id 0
90 INSERT INTO list_options VALUES ('drug_route' ,'0' ,'' , 0,0,0);
92 #IfNotRow2D list_options list_id drug_route option_id 13
93 INSERT INTO list_options VALUES ('drug_route' ,'13','Both Ears',13,0,0);
95 #IfNotRow2D list_options list_id drug_route option_id 14
96 INSERT INTO list_options VALUES ('drug_route' ,'14','Left Ear' ,14,0,0);
98 #IfNotRow2D list_options list_id drug_route option_id 15
99 INSERT INTO list_options VALUES ('drug_route' ,'15','Right Ear',15,0,0);
101 #IfNotRow2D list_options list_id drug_interval option_id 0
102 INSERT INTO list_options VALUES ('drug_interval','0' ,'' , 0,0,0);
104 #IfNotRow2D list_options list_id drug_interval option_id 10
105 INSERT INTO list_options VALUES ('drug_interval','10','a.c.' ,10,0,0);
107 #IfNotRow2D list_options list_id drug_interval option_id 11
108 INSERT INTO list_options VALUES ('drug_interval','11','p.c.' ,11,0,0);
110 #IfNotRow2D list_options list_id drug_interval option_id 12
111 INSERT INTO list_options VALUES ('drug_interval','12','a.m.' ,12,0,0);
113 #IfNotRow2D list_options list_id drug_interval option_id 13
114 INSERT INTO list_options VALUES ('drug_interval','13','p.m.' ,13,0,0);
116 #IfNotRow2D list_options list_id drug_interval option_id 14
117 INSERT INTO list_options VALUES ('drug_interval','14','ante' ,14,0,0);
119 #IfNotRow2D list_options list_id drug_interval option_id 15
120 INSERT INTO list_options VALUES ('drug_interval','15','h' ,15,0,0);
122 #IfNotRow2D list_options list_id drug_interval option_id 16
123 INSERT INTO list_options VALUES ('drug_interval','16','h.s.' ,16,0,0);
125 #IfNotRow2D list_options list_id drug_interval option_id 17
126 INSERT INTO list_options VALUES ('drug_interval','17','p.r.n.' ,17,0,0);
128 #IfNotRow2D list_options list_id drug_interval option_id 18
129 INSERT INTO list_options VALUES ('drug_interval','18','stat' ,18,0,0);
133 SET option_id = '6' WHERE option_id = ' 6' and list_id = 'drug_route';
135 SET title = 'mcg' WHERE option_id = '7' and list_id = 'drug_units';
137 SET title = 'grams' WHERE option_id = '8' and list_id = 'drug_units';
139 UPDATE `layout_options`
140 SET data_type = 26 WHERE form_id = 'DEM' and field_id = 'state';
141 UPDATE `layout_options`
142 SET data_type = 26 WHERE form_id = 'DEM' and field_id = 'country_code';
143 UPDATE `layout_options`
144 SET data_type = 26, list_id = 'state', fld_length = 0, max_length = 0, edit_options = '' WHERE form_id = 'DEM' and field_id = 'em_state';
145 UPDATE `layout_options`
146 SET data_type = 26, list_id = 'country', fld_length = 0, max_length = 0, edit_options = '' WHERE form_id = 'DEM' and field_id = 'em_country';
149 CHANGE `pr_selector` `pr_selector` VARCHAR( 255 ) NOT NULL default '' COMMENT 'template selector for drugs, empty for codes';
151 #IfMissingColumn form_encounter provider_id
152 ALTER TABLE `form_encounter`
153 ADD `provider_id` INT(11) DEFAULT '0' COMMENT 'default and main provider for this visit';
154 UPDATE form_encounter AS fe, forms AS f, billing AS b, users AS u
155 SET fe.provider_id = u.id WHERE
156 fe.provider_id = 0 AND
157 f.form_id = fe.id AND
158 f.formdir = 'newpatient' AND
161 b.encounter = fe.encounter AND
163 b.provider_id > 0 AND
165 u.id = b.provider_id AND
167 UPDATE form_encounter AS fe, forms AS f, users AS u
168 SET fe.provider_id = u.id WHERE
169 fe.provider_id = 0 AND
170 f.form_id = fe.id AND
171 f.formdir = 'newpatient' AND
173 u.username = f.user AND
175 UPDATE form_encounter AS fe, forms AS f, billing AS b
176 SET b.provider_id = 0 WHERE
177 fe.provider_id > 0 AND
178 f.form_id = fe.id AND
179 f.formdir = 'newpatient' AND
182 b.encounter = fe.encounter AND
186 #IfMissingColumn codes active
188 ADD `active` TINYINT(1) DEFAULT 1 COMMENT '0 = inactive, 1 = active';
191 #IfMissingColumn drugs active
193 ADD `active` TINYINT(1) DEFAULT 1 COMMENT '0 = inactive, 1 = active';
196 #IfNotTable users_facility
197 CREATE TABLE `users_facility` (
198 `tablename` varchar(64) NOT NULL,
199 `table_id` int(11) NOT NULL,
200 `facility_id` int(11) NOT NULL,
201 PRIMARY KEY (`tablename`,`table_id`,`facility_id`)
202 ) ENGINE=InnoDB COMMENT='joins users or patient_data to facility table';