2 -- Comment Meta Language Constructs:
5 -- argument: table_name
6 -- behavior: if the table_name does not exist, the block will be executed
9 -- argument: table_name
10 -- behavior: if the table_name does exist, the block will be executed
13 -- arguments: table_name colname
14 -- behavior: if the table and column exist, the block will be executed
17 -- arguments: table_name colname
18 -- behavior: if the table exists but the column does not, the block will be executed
21 -- arguments: table_name colname value
22 -- behavior: If the table table_name does not have a column colname with a data type equal to value, then the block will be executed
25 -- arguments: table_name colname value
26 -- behavior: If the table table_name does not have a row where colname = value, the block will be executed.
29 -- arguments: table_name colname value colname2 value2
30 -- behavior: If the table table_name does not have a row where colname = value AND colname2 = value2, the block will be executed.
33 -- arguments: table_name colname value colname2 value2 colname3 value3
34 -- behavior: If the table table_name does not have a row where colname = value AND colname2 = value2 AND colname3 = value3, the block will be executed.
37 -- arguments: table_name colname value colname2 value2 colname3 value3 colname4 value4
38 -- behavior: If the table table_name does not have a row where colname = value AND colname2 = value2 AND colname3 = value3 AND colname4 = value4, the block will be executed.
41 -- desc: This is a very specialized function to allow adding items to the list_options table to avoid both redundant option_id and title in each element.
42 -- arguments: table_name colname value colname2 value2 colname3 value3
43 -- behavior: The block will be executed if both statements below are true:
44 -- 1) The table table_name does not have a row where colname = value AND colname2 = value2.
45 -- 2) The table table_name does not have a row where colname = value AND colname3 = value3.
48 -- arguments: table_name colname value colname2 value2
49 -- behavior: If the table table_name does have a row where colname = value AND colname2 = value2, the block will be executed.
52 -- arguments: table_name colname value colname2 value2 colname3 value3
53 -- behavior: If the table table_name does have a row where colname = value AND colname2 = value2 AND colname3 = value3, the block will be executed.
56 -- desc: This function is most often used for dropping of indexes/keys.
57 -- arguments: table_name colname
58 -- behavior: If the table and index exist the relevant statements are executed, otherwise not.
61 -- desc: This function will allow adding of indexes/keys.
62 -- arguments: table_name colname
63 -- behavior: If the index does not exist, it will be created
66 -- all blocks are terminated with a #EndIf statement.
69 -- Custom function for creating Reaction List
71 -- #IfNotListOccupation
72 -- Custom function for creating Occupation List
74 -- #IfTextNullFixNeeded
75 -- desc: convert all text fields without default null to have default null.
79 -- desc: Execute SQL if the table has been created with given engine specified.
80 -- arguments: table_name engine
81 -- behavior: Use when engine conversion requires more than one ALTER TABLE
83 -- #IfInnoDBMigrationNeeded
84 -- desc: find all MyISAM tables and convert them to InnoDB.
86 -- behavior: can take a long time.
88 UPDATE `background_services` SET `require_once`='/library/MedEx/MedEx_background.php' WHERE `name`='MedEx';
90 #IfNotRow2Dx2 list_options list_id proc_type option_id fgp title Custom Favorite Group
91 INSERT INTO list_options ( list_id, option_id, title, seq, is_default ) VALUES ('proc_type','fgp','Custom Favorite Group' ,50,0);
94 #IfNotRow2Dx2 list_options list_id proc_type option_id for title Custom Favorite Item
95 INSERT INTO list_options ( list_id, option_id, title, seq, is_default ) VALUES ('proc_type','for','Custom Favorite Item' ,60,0);
98 #IfNotTable form_eye_base
99 CREATE TABLE `form_eye_base` (
100 `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Links to forms.form_id',
101 `date` datetime DEFAULT NULL,
102 `pid` bigint(20) DEFAULT NULL,
103 `user` varchar(255) DEFAULT NULL,
104 `groupname` varchar(255) DEFAULT NULL,
105 `authorized` tinyint(4) DEFAULT NULL,
106 `activity` tinyint(4) DEFAULT NULL,
107 PRIMARY KEY `form_link` (`id`),
108 UNIQUE KEY `id_date` (`id`,`date`)
111 CREATE TABLE `form_eye_hpi` (
112 `id` bigint(20) NOT NULL COMMENT 'Links to forms.form_id',
113 `pid` bigint(20) DEFAULT NULL,
114 `CC1` varchar(255) DEFAULT NULL,
116 `QUALITY1` varchar(255) DEFAULT NULL,
117 `TIMING1` varchar(255) DEFAULT NULL,
118 `DURATION1` varchar(255) DEFAULT NULL,
119 `CONTEXT1` varchar(255) DEFAULT NULL,
120 `SEVERITY1` varchar(255) DEFAULT NULL,
121 `MODIFY1` varchar(255) DEFAULT NULL,
122 `ASSOCIATED1` varchar(255) DEFAULT NULL,
123 `LOCATION1` varchar(255) DEFAULT NULL,
124 `CHRONIC1` varchar(255) DEFAULT NULL,
125 `CHRONIC2` varchar(255) DEFAULT NULL,
126 `CHRONIC3` varchar(255) DEFAULT NULL,
147 PRIMARY KEY `hpi_link` (`id`),
148 UNIQUE KEY `id_pid` (`id`,`pid`)
151 CREATE TABLE `form_eye_ros` (
152 `id` bigint(20) NOT NULL COMMENT 'Links to forms.form_id',
153 `pid` bigint(20) DEFAULT NULL,
167 PRIMARY KEY `ros_link` (`id`),
168 UNIQUE KEY `id_pid` (`id`,`pid`)
171 CREATE TABLE `form_eye_vitals` (
172 `id` bigint(20) NOT NULL COMMENT 'Links to forms.form_id',
173 `pid` bigint(20) DEFAULT NULL,
174 `alert` char(3) DEFAULT 'yes',
175 `oriented` char(3) DEFAULT 'TPP',
176 `confused` char(3) DEFAULT 'nml',
177 `ODIOPAP` varchar(10) DEFAULT NULL,
178 `OSIOPAP` varchar(10) DEFAULT NULL,
179 `ODIOPTPN` varchar(10) DEFAULT NULL,
180 `OSIOPTPN` varchar(10) DEFAULT NULL,
181 `ODIOPFTN` varchar(10) DEFAULT NULL,
182 `OSIOPFTN` varchar(10) DEFAULT NULL,
183 `IOPTIME` time NOT NULL,
184 `ODIOPPOST` varchar(10) NOT NULL,
185 `OSIOPPOST` varchar(10) NOT NULL,
186 `IOPPOSTTIME` time DEFAULT NULL,
187 `ODIOPTARGET` varchar(10) NOT NULL,
188 `OSIOPTARGET` varchar(10) NOT NULL,
189 `AMSLEROD` smallint(1) DEFAULT NULL,
190 `AMSLEROS` smallint(1) DEFAULT NULL,
191 `ODVF1` tinyint(1) DEFAULT NULL,
192 `ODVF2` tinyint(1) DEFAULT NULL,
193 `ODVF3` tinyint(1) DEFAULT NULL,
194 `ODVF4` tinyint(1) DEFAULT NULL,
195 `OSVF1` tinyint(1) DEFAULT NULL,
196 `OSVF2` tinyint(1) DEFAULT NULL,
197 `OSVF3` tinyint(1) DEFAULT NULL,
198 `OSVF4` tinyint(1) DEFAULT NULL,
199 PRIMARY KEY `vitals_link` (`id`),
200 UNIQUE KEY `id_pid` (`id`,`pid`)
203 CREATE TABLE `form_eye_acuity` (
204 `id` bigint(20) NOT NULL COMMENT 'Links to forms.form_id',
205 `pid` bigint(20) DEFAULT NULL,
206 `SCODVA` varchar(25) DEFAULT NULL,
207 `SCOSVA` varchar(25) DEFAULT NULL,
208 `PHODVA` varchar(25) DEFAULT NULL,
209 `PHOSVA` varchar(25) DEFAULT NULL,
210 `CTLODVA` varchar(25) DEFAULT NULL,
211 `CTLOSVA` varchar(25) DEFAULT NULL,
212 `MRODVA` varchar(25) DEFAULT NULL,
213 `MROSVA` varchar(25) DEFAULT NULL,
214 `SCNEARODVA` varchar(25) DEFAULT NULL,
215 `SCNEAROSVA` varchar(25) DEFAULT NULL,
216 `MRNEARODVA` varchar(25) DEFAULT NULL,
217 `MRNEAROSVA` varchar(25) DEFAULT NULL,
218 `GLAREODVA` varchar(25) DEFAULT NULL,
219 `GLAREOSVA` varchar(25) DEFAULT NULL,
220 `GLARECOMMENTS` varchar(255) DEFAULT NULL,
221 `ARODVA` varchar(25) DEFAULT NULL,
222 `AROSVA` varchar(25) DEFAULT NULL,
223 `CRODVA` varchar(25) DEFAULT NULL,
224 `CROSVA` varchar(25) DEFAULT NULL,
225 `CTLODVA1` varchar(25) DEFAULT NULL,
226 `CTLOSVA1` varchar(25) DEFAULT NULL,
227 `PAMODVA` varchar(25) DEFAULT NULL,
228 `PAMOSVA` varchar(25) DEFAULT NULL,
229 `LIODVA` varchar(25) NOT NULL,
230 `LIOSVA` varchar(25) NOT NULL,
231 `WODVANEAR` varchar(25) DEFAULT NULL,
232 `OSVANEARCC` varchar(25) DEFAULT NULL,
233 PRIMARY KEY `acuity_link` (`id`),
234 UNIQUE KEY `id_pid` (`id`,`pid`)
237 CREATE TABLE `form_eye_refraction` (
238 `id` bigint(20) NOT NULL COMMENT 'Links to forms.form_id',
239 `pid` bigint(20) DEFAULT NULL,
240 `MRODSPH` varchar(25) DEFAULT NULL,
241 `MRODCYL` varchar(25) DEFAULT NULL,
242 `MRODAXIS` varchar(25) DEFAULT NULL,
243 `MRODPRISM` varchar(25) DEFAULT NULL,
244 `MRODBASE` varchar(25) DEFAULT NULL,
245 `MRODADD` varchar(25) DEFAULT NULL,
246 `MROSSPH` varchar(25) DEFAULT NULL,
247 `MROSCYL` varchar(25) DEFAULT NULL,
248 `MROSAXIS` varchar(25) DEFAULT NULL,
249 `MROSPRISM` varchar(50) DEFAULT NULL,
250 `MROSBASE` varchar(50) DEFAULT NULL,
251 `MROSADD` varchar(25) DEFAULT NULL,
252 `MRODNEARSPHERE` varchar(25) DEFAULT NULL,
253 `MRODNEARCYL` varchar(25) DEFAULT NULL,
254 `MRODNEARAXIS` varchar(25) DEFAULT NULL,
255 `MRODPRISMNEAR` varchar(50) DEFAULT NULL,
256 `MRODBASENEAR` varchar(25) DEFAULT NULL,
257 `MROSNEARSHPERE` varchar(25) DEFAULT NULL,
258 `MROSNEARCYL` varchar(25) DEFAULT NULL,
259 `MROSNEARAXIS` varchar(125) DEFAULT NULL,
260 `MROSPRISMNEAR` varchar(50) DEFAULT NULL,
261 `MROSBASENEAR` varchar(25) DEFAULT NULL,
262 `CRODSPH` varchar(25) DEFAULT NULL,
263 `CRODCYL` varchar(25) DEFAULT NULL,
264 `CRODAXIS` varchar(25) DEFAULT NULL,
265 `CROSSPH` varchar(25) DEFAULT NULL,
266 `CROSCYL` varchar(25) DEFAULT NULL,
267 `CROSAXIS` varchar(25) DEFAULT NULL,
268 `CRCOMMENTS` varchar(255) DEFAULT NULL,
269 `BALANCED` char(2) NOT NULL,
270 `ARODSPH` varchar(25) DEFAULT NULL,
271 `ARODCYL` varchar(25) DEFAULT NULL,
272 `ARODAXIS` varchar(25) DEFAULT NULL,
273 `AROSSPH` varchar(25) DEFAULT NULL,
274 `AROSCYL` varchar(25) DEFAULT NULL,
275 `AROSAXIS` varchar(25) DEFAULT NULL,
276 `ARODADD` varchar(25) DEFAULT NULL,
277 `AROSADD` varchar(25) DEFAULT NULL,
278 `ARNEARODVA` varchar(25) DEFAULT NULL,
279 `ARNEAROSVA` varchar(25) DEFAULT NULL,
280 `ARODPRISM` varchar(50) DEFAULT NULL,
281 `AROSPRISM` varchar(50) DEFAULT NULL,
282 `CTLODSPH` varchar(25) DEFAULT NULL,
283 `CTLODCYL` varchar(25) DEFAULT NULL,
284 `CTLODAXIS` varchar(25) DEFAULT NULL,
285 `CTLODBC` varchar(25) DEFAULT NULL,
286 `CTLODDIAM` varchar(25) DEFAULT NULL,
287 `CTLOSSPH` varchar(25) DEFAULT NULL,
288 `CTLOSCYL` varchar(25) DEFAULT NULL,
289 `CTLOSAXIS` varchar(25) DEFAULT NULL,
290 `CTLOSBC` varchar(25) DEFAULT NULL,
291 `CTLOSDIAM` varchar(25) DEFAULT NULL,
293 `CTLMANUFACTUREROD` varchar(50) DEFAULT NULL,
294 `CTLSUPPLIEROD` varchar(50) DEFAULT NULL,
295 `CTLBRANDOD` varchar(50) DEFAULT NULL,
296 `CTLMANUFACTUREROS` varchar(50) DEFAULT NULL,
297 `CTLSUPPLIEROS` varchar(50) DEFAULT NULL,
298 `CTLBRANDOS` varchar(50) DEFAULT NULL,
299 `CTLODADD` varchar(25) DEFAULT NULL,
300 `CTLOSADD` varchar(25) DEFAULT NULL,
301 `NVOCHECKED` varchar(25) DEFAULT NULL,
302 `ADDCHECKED` varchar(25) DEFAULT NULL,
303 PRIMARY KEY `refraction_link` (`id`),
304 UNIQUE KEY `id_pid` (`id`,`pid`)
307 CREATE TABLE `form_eye_biometrics` (
308 `id` bigint (20) NOT NULL COMMENT 'Links to forms.form_id',
309 `pid` bigint(20) DEFAULT NULL,
310 `ODK1` varchar (10) DEFAULT NULL,
311 `ODK2` varchar (10) DEFAULT NULL,
312 `ODK2AXIS` varchar (10) DEFAULT NULL,
313 `OSK1` varchar (10) DEFAULT NULL,
314 `OSK2` varchar (10) DEFAULT NULL,
315 `OSK2AXIS` varchar (10) DEFAULT NULL,
316 `ODAXIALLENGTH` varchar (20) DEFAULT NULL,
317 `OSAXIALLENGTH` varchar (20) DEFAULT NULL,
318 `ODPDMeasured` varchar (20) DEFAULT NULL,
319 `OSPDMeasured` varchar (20) DEFAULT NULL,
320 `ODACD` varchar (20) DEFAULT NULL,
321 `OSACD` varchar (20) DEFAULT NULL,
322 `ODW2W` varchar (20) DEFAULT NULL,
323 `OSW2W` varchar (20) DEFAULT NULL,
324 `ODLT` varchar (20) DEFAULT NULL,
325 `OSLT` varchar (20) DEFAULT NULL,
326 PRIMARY KEY `biometrics_link` (`id`),
327 UNIQUE KEY `id_pid` (`id`,`pid`)
330 CREATE TABLE `form_eye_external` (
331 `id` bigint(20) NOT NULL COMMENT 'Links to forms.form_id',
332 `pid` bigint(20) DEFAULT NULL,
343 `RMRD` varchar(25) DEFAULT NULL,
344 `LMRD` varchar(25) DEFAULT NULL,
345 `RLF` varchar(25) DEFAULT NULL,
346 `LLF` varchar(25) DEFAULT NULL,
347 `RVFISSURE` varchar(25) DEFAULT NULL,
348 `LVFISSURE` varchar(25) DEFAULT NULL,
349 `ODHERTEL` varchar(25) DEFAULT NULL,
350 `OSHERTEL` varchar(25) DEFAULT NULL,
351 `HERTELBASE` varchar(25) DEFAULT NULL,
361 PRIMARY KEY `external_link` (`id`),
362 UNIQUE KEY `id_pid` (`id`,`pid`)
365 CREATE TABLE `form_eye_antseg` (
366 `id` bigint(20) NOT NULL COMMENT 'Links to forms.form_id',
367 `pid` bigint(20) DEFAULT NULL,
368 `ODSCHIRMER1` varchar(25) DEFAULT NULL,
369 `OSSCHIRMER1` varchar(25) DEFAULT NULL,
370 `ODSCHIRMER2` varchar(25) DEFAULT NULL,
371 `OSSCHIRMER2` varchar(25) DEFAULT NULL,
372 `ODTBUT` varchar(25) DEFAULT NULL,
373 `OSTBUT` varchar(25) DEFAULT NULL,
374 `OSCONJ` varchar(25) DEFAULT NULL,
384 `PUPIL_NORMAL` varchar(2) DEFAULT '1',
385 `ODPUPILSIZE1` varchar(25) DEFAULT NULL,
386 `ODPUPILSIZE2` varchar(25) DEFAULT NULL,
387 `ODPUPILREACTIVITY` char(25) DEFAULT NULL,
388 `ODAPD` varchar(25) DEFAULT NULL,
389 `OSPUPILSIZE1` varchar(25) DEFAULT NULL,
390 `OSPUPILSIZE2` varchar(25) DEFAULT NULL,
391 `OSPUPILREACTIVITY` char(25) DEFAULT NULL,
392 `OSAPD` varchar(25) DEFAULT NULL,
393 `DIMODPUPILSIZE1` varchar(25) DEFAULT NULL,
394 `DIMODPUPILSIZE2` varchar(25) DEFAULT NULL,
395 `DIMODPUPILREACTIVITY` varchar(25) DEFAULT NULL,
396 `DIMOSPUPILSIZE1` varchar(25) DEFAULT NULL,
397 `DIMOSPUPILSIZE2` varchar(25) DEFAULT NULL,
398 `DIMOSPUPILREACTIVITY` varchar(25) DEFAULT NULL,
399 `PUPIL_COMMENTS` text,
400 `ODKTHICKNESS` varchar(25) DEFAULT NULL,
401 `OSKTHICKNESS` varchar(25) DEFAULT NULL,
402 `ODGONIO` varchar(25) DEFAULT NULL,
403 `OSGONIO` varchar(25) DEFAULT NULL,
404 `ANTSEG_COMMENTS` text,
405 PRIMARY KEY `antseg_link` (`id`),
406 UNIQUE KEY `id_pid` (`id`,`pid`)
409 CREATE TABLE `form_eye_postseg` (
410 `id` bigint(20) NOT NULL COMMENT 'Links to forms.form_id',
411 `pid` bigint(20) DEFAULT NULL,
426 `RETINA_COMMENTS` text,
427 `DIL_RISKS` char(2) NOT NULL DEFAULT 'on',
428 `DIL_MEDS` mediumtext,
429 `WETTYPE` varchar(10) NOT NULL,
430 `ATROPINE` varchar(25) NOT NULL,
431 `CYCLOMYDRIL` varchar(25) NOT NULL,
432 `TROPICAMIDE` varchar(25) NOT NULL,
433 `CYCLOGYL` varchar(25) NOT NULL,
434 `NEO25` varchar(25) NOT NULL,
435 PRIMARY KEY `postseg_link` (`id`),
436 UNIQUE KEY `id_pid` (`id`,`pid`)
439 CREATE TABLE `form_eye_neuro` (
440 `id` bigint (20) NOT NULL COMMENT 'Links to forms.form_id',
441 `pid` bigint(20) DEFAULT NULL,
442 `ACT` char (3) NOT NULL DEFAULT 'on',
487 `MOTILITYNORMAL` char (3) NOT NULL DEFAULT 'on',
488 `MOTILITY_RS` char (1) DEFAULT '0',
489 `MOTILITY_RI` char (1) DEFAULT '0',
490 `MOTILITY_RR` char (1) DEFAULT '0',
491 `MOTILITY_RL` char (1) DEFAULT '0',
492 `MOTILITY_LS` char (1) DEFAULT '0',
493 `MOTILITY_LI` char (1) DEFAULT '0',
494 `MOTILITY_LR` char (1) DEFAULT '0',
495 `MOTILITY_LL` char (1) DEFAULT '0',
496 `MOTILITY_RRSO` int (1) DEFAULT NULL,
497 `MOTILITY_RLSO` int (1) DEFAULT NULL,
498 `MOTILITY_RRIO` int (1) DEFAULT NULL,
499 `MOTILITY_RLIO` int (1) DEFAULT NULL,
500 `MOTILITY_LRSO` int (1) DEFAULT NULL,
501 `MOTILITY_LLSO` int (1) DEFAULT NULL,
502 `MOTILITY_LRIO` int (1) DEFAULT NULL,
503 `MOTILITY_LLIO` int (1) DEFAULT NULL,
504 `NEURO_COMMENTS` text,
505 `STEREOPSIS` varchar (25) DEFAULT NULL,
509 `DIVERGENCEAMPS` text,
510 `NPC` varchar (10) DEFAULT NULL,
511 `DACCDIST` varchar (20) DEFAULT NULL,
512 `DACCNEAR` varchar (20) DEFAULT NULL,
513 `CACCDIST` varchar (20) DEFAULT NULL,
514 `CACCNEAR` varchar (20) DEFAULT NULL,
519 `ODREDDESAT` varchar (20) DEFAULT NULL,
520 `OSREDDESAT` varchar (20) DEFAULT NULL,
521 PRIMARY KEY `neuro_link` (`id`),
522 UNIQUE KEY `id_pid` (`id`,`pid`)
525 CREATE TABLE `form_eye_locking` (
526 `id` bigint(20) NOT NULL COMMENT 'Links to forms.form_id',
527 `pid` bigint(20) DEFAULT NULL,
530 `Resource` varchar(50) DEFAULT NULL,
531 `Technician` varchar(50) DEFAULT NULL,
532 `LOCKED` varchar(3) DEFAULT NULL,
533 `LOCKEDDATE` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
534 ON UPDATE CURRENT_TIMESTAMP,
535 `LOCKEDBY` varchar(50) DEFAULT NULL,
536 PRIMARY KEY `locking_link` (`id`),
537 UNIQUE KEY `id_pid` (`id`,`pid`)
540 ALTER TABLE `form_eye_mag_orders`
541 CHANGE `id` `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
542 CHANGE `ORDER_PID` `pid` BIGINT(20) NOT NULL,
543 ADD `form_id` bigint(20) NOT NULL AFTER `id`,
544 DROP INDEX `VISIT_ID`;
545 ALTER TABLE `form_eye_mag_orders`
546 ADD UNIQUE KEY `VISIT_ID` (`pid`, `ORDER_DETAILS`, `ORDER_DATE_PLACED`);
548 INSERT into `form_eye_base` (`id`,`date`,`pid`,`user`,`groupname`,`authorized`, `activity`)
549 select `id`,`date`,`pid`,`user`,`groupname`,`authorized`, `activity` from `form_eye_mag`;
551 INSERT INTO `form_eye_hpi` ( `id`,`pid`, `CC1`, `HPI1`, `QUALITY1` , `TIMING1`, `DURATION1`, `CONTEXT1`, `SEVERITY1`, `MODIFY1`, `ASSOCIATED1` , `LOCATION1` , `CHRONIC1` , `CHRONIC2` , `CHRONIC3` , `CC2` , `HPI2` , `QUALITY2` , `TIMING2` , `DURATION2` , `CONTEXT2` , `SEVERITY2` , `MODIFY2` , `ASSOCIATED2` , `LOCATION2` , `CC3` , `HPI3` , `QUALITY3` , `TIMING3` , `DURATION3` , `CONTEXT3` , `SEVERITY3` , `MODIFY3` , `ASSOCIATED3` , `LOCATION3` )
552 select `id`,`pid`, `CC1`, `HPI1`, `QUALITY1` , `TIMING1`, `DURATION1`, `CONTEXT1`, `SEVERITY1`, `MODIFY1`, `ASSOCIATED1` , `LOCATION1` , `CHRONIC1` , `CHRONIC2` , `CHRONIC3` , `CC2` , `HPI2` , `QUALITY2` , `TIMING2` , `DURATION2` , `CONTEXT2` , `SEVERITY2` , `MODIFY2` , `ASSOCIATED2` , `LOCATION2` , `CC3` , `HPI3` , `QUALITY3` , `TIMING3` , `DURATION3` , `CONTEXT3` , `SEVERITY3` , `MODIFY3` , `ASSOCIATED3` , `LOCATION3`
555 INSERT INTO `form_eye_ros` ( `id`,`pid`,`ROSGENERAL`, `ROSHEENT`, `ROSCV`, `ROSPULM`, `ROSGI`, `ROSGU`,`ROSDERM`, `ROSNEURO` , `ROSPSYCH` , `ROSMUSCULO`, `ROSIMMUNO`, `ROSENDOCRINE` )
556 select `id`,`pid`,`ROSGENERAL`, `ROSHEENT`, `ROSCV`, `ROSPULM`, `ROSGI`, `ROSGU`,
557 `ROSDERM`, `ROSNEURO` , `ROSPSYCH` , `ROSMUSCULO`, `ROSIMMUNO`, `ROSENDOCRINE` from `form_eye_mag`;
559 INSERT INTO `form_eye_vitals` (`id`,`pid`,`alert`,`oriented`,`confused`,`ODIOPAP`,`OSIOPAP`,`ODIOPTPN`,`OSIOPTPN`,`ODIOPFTN`,`OSIOPFTN`,`IOPTIME`,`ODIOPPOST`,`OSIOPPOST`,`IOPPOSTTIME`,`ODIOPTARGET`,`OSIOPTARGET`,`AMSLEROD`,`AMSLEROS`,`ODVF1`,`ODVF2`,`ODVF3`,`ODVF4`,`OSVF1`,`OSVF2`,`OSVF3`,`OSVF4`)
560 SELECT `id`,`pid`,`alert`,`oriented`,`confused`,`ODIOPAP`,`OSIOPAP`,`ODIOPTPN`,`OSIOPTPN`,`ODIOPFTN`,`OSIOPFTN`,`IOPTIME`,`ODIOPPOST`,`OSIOPPOST`,`IOPPOSTTIME`,`ODIOPTARGET`,`OSIOPTARGET`,`AMSLEROD`,`AMSLEROS`,`ODVF1`,`ODVF2`,`ODVF3`,`ODVF4`,`OSVF1`,`OSVF2`,`OSVF3`,`OSVF4`
563 INSERT INTO `form_eye_acuity` ( `id`,`pid`,`SCODVA`, `SCOSVA`, `PHODVA`, `PHOSVA`, `CTLODVA`, `CTLOSVA`, `MRODVA`, `MROSVA`, `SCNEARODVA`, `SCNEAROSVA`, `MRNEARODVA`, `MRNEAROSVA`, `GLAREODVA`, `GLAREOSVA`, `GLARECOMMENTS`, `ARODVA`, `AROSVA`, `CRODVA`, `CROSVA`, `CTLODVA1`, `CTLOSVA1`, `PAMODVA`, `PAMOSVA`, `LIODVA`, `LIOSVA`)
564 SELECT `id`,`pid`,`SCODVA`, `SCOSVA`, `PHODVA`, `PHOSVA`, `CTLODVA`, `CTLOSVA`, `MRODVA`, `MROSVA`, `SCNEARODVA`, `SCNEAROSVA`, `MRNEARODVA`, `MRNEAROSVA`, `GLAREODVA`, `GLAREOSVA`, `GLARECOMMENTS`, `ARODVA`, `AROSVA`, `CRODVA`, `CROSVA`, `CTLODVA1`, `CTLOSVA1`, `PAMODVA`, `PAMOSVA`, `LIODVA`, `LIOSVA`
567 INSERT INTO `form_eye_refraction` ( `id`, `pid`,`MRODSPH`, `MRODCYL`, `MRODAXIS`, `MRODPRISM`, `MRODBASE`, `MRODADD`, `MROSSPH`, `MROSCYL`, `MROSAXIS`, `MROSPRISM`, `MROSBASE`, `MROSADD`, `MRODNEARSPHERE`, `MRODNEARCYL`, `MRODNEARAXIS`, `MRODPRISMNEAR`, `MRODBASENEAR`, `MROSNEARSHPERE`, `MROSNEARCYL`, `MROSNEARAXIS`, `MROSPRISMNEAR`, `MROSBASENEAR`, `CRODSPH`, `CRODCYL`, `CRODAXIS`, `CROSSPH`, `CROSCYL`, `CROSAXIS`, `CRCOMMENTS`, `BALANCED`, `ARODSPH`, `ARODCYL`, `ARODAXIS`, `AROSSPH`, `AROSCYL`, `AROSAXIS`, `ARODADD`, `AROSADD`, `ARNEARODVA`, `ARNEAROSVA`, `ARODPRISM`, `AROSPRISM`, `CTLODSPH`, `CTLODCYL`, `CTLODAXIS`, `CTLODBC`, `CTLODDIAM`, `CTLOSSPH`, `CTLOSCYL`, `CTLOSAXIS`, `CTLOSBC`, `CTLOSDIAM`, `CTL_COMMENTS`, `CTLMANUFACTUREROD`, `CTLSUPPLIEROD`, `CTLBRANDOD`, `CTLMANUFACTUREROS`, `CTLSUPPLIEROS`, `CTLBRANDOS`, `CTLODADD`, `CTLOSADD`, `NVOCHECKED`, `ADDCHECKED`)
568 SELECT `id`, `pid`,`MRODSPH`, `MRODCYL`, `MRODAXIS`, `MRODPRISM`, `MRODBASE`, `MRODADD`, `MROSSPH`, `MROSCYL`, `MROSAXIS`, `MROSPRISM`, `MROSBASE`, `MROSADD`, `MRODNEARSPHERE`, `MRODNEARCYL`, `MRODNEARAXIS`, `MRODPRISMNEAR`, `MRODBASENEAR`, `MROSNEARSHPERE`, `MROSNEARCYL`, `MROSNEARAXIS`, `MROSPRISMNEAR`, `MROSBASENEAR`, `CRODSPH`, `CRODCYL`, `CRODAXIS`, `CROSSPH`, `CROSCYL`, `CROSAXIS`, `CRCOMMENTS`, `BALANCED`, `ARODSPH`, `ARODCYL`, `ARODAXIS`, `AROSSPH`, `AROSCYL`, `AROSAXIS`, `ARODADD`, `AROSADD`, `ARNEARODVA`, `ARNEAROSVA`, `ARODPRISM`, `AROSPRISM`, `CTLODSPH`, `CTLODCYL`, `CTLODAXIS`, `CTLODBC`, `CTLODDIAM`, `CTLOSSPH`, `CTLOSCYL`, `CTLOSAXIS`, `CTLOSBC`, `CTLOSDIAM`, `CTL_COMMENTS`, `CTLMANUFACTUREROD`, `CTLSUPPLIEROD`, `CTLBRANDOD`, `CTLMANUFACTUREROS`, `CTLSUPPLIEROS`, `CTLBRANDOS`, `CTLODADD`, `CTLOSADD`, `NVOCHECKED`, `ADDCHECKED`
571 INSERT INTO `form_eye_biometrics` (`id`, `pid`, `ODK1`, `ODK2`, `ODK2AXIS`, `OSK1`, `OSK2`, `OSK2AXIS`, `ODAXIALLENGTH`, `OSAXIALLENGTH`, `ODPDMeasured`, `OSPDMeasured`, `ODACD`, `OSACD`, `ODW2W`, `OSW2W`, `ODLT`, `OSLT`)
572 select `id`, `pid`, `ODK1`, `ODK2`, `ODK2AXIS`, `OSK1`, `OSK2`, `OSK2AXIS`, `ODAXIALLENGTH`, `OSAXIALLENGTH`, `ODPDMeasured`, `OSPDMeasured`, `ODACD`, `OSACD`, `ODW2W`, `OSW2W`, `ODLT`, `OSLT`
575 INSERT INTO `form_eye_external` (`id`, `pid`, `RUL`, `LUL`, `RLL`, `LLL`, `RBROW`, `LBROW`, `RMCT`, `LMCT`, `RADNEXA`, `LADNEXA`, `RMRD`, `LMRD`, `RLF`, `LLF`, `RVFISSURE`, `LVFISSURE`, `ODHERTEL`, `OSHERTEL`, `HERTELBASE`, `RCAROTID`, `LCAROTID`, `RTEMPART`, `LTEMPART`, `RCNV`, `LCNV`, `RCNVII`, `LCNVII`, `EXT_COMMENTS`)
576 SELECT `id`, `pid`, `RUL`, `LUL`, `RLL`, `LLL`, `RBROW`, `LBROW`, `RMCT`, `LMCT`, `RADNEXA`, `LADNEXA`, `RMRD`, `LMRD`, `RLF`, `LLF`, `RVFISSURE`, `LVFISSURE`, `ODHERTEL`, `OSHERTEL`, `HERTELBASE`, `RCAROTID`, `LCAROTID`, `RTEMPART`, `LTEMPART`, `RCNV`, `LCNV`, `RCNVII`, `LCNVII`, `EXT_COMMENTS`
579 INSERT INTO `form_eye_antseg` (`id`, `pid`, `ODSCHIRMER1`, `OSSCHIRMER1`, `ODSCHIRMER2`, `OSSCHIRMER2`, `OSCONJ`, `ODCONJ`, `ODCORNEA`, `OSCORNEA`, `ODAC`, `OSAC`, `ODLENS`, `OSLENS`, `ODIRIS`, `OSIRIS`, `PUPIL_NORMAL`, `ODPUPILSIZE1`, `ODPUPILSIZE2`, `ODPUPILREACTIVITY`, `ODAPD`, `OSPUPILSIZE1`, `OSPUPILSIZE2`, `OSPUPILREACTIVITY`, `OSAPD`, `DIMODPUPILSIZE1`, `DIMODPUPILSIZE2`, `DIMODPUPILREACTIVITY`, `DIMOSPUPILSIZE1`, `DIMOSPUPILSIZE2`, `DIMOSPUPILREACTIVITY`, `PUPIL_COMMENTS`, `ODKTHICKNESS`, `OSKTHICKNESS`, `ODGONIO`, `OSGONIO`, `ANTSEG_COMMENTS`)
580 SELECT `id`, `pid`, `ODSCHIRMER1`, `OSSCHRIMER1`, `ODSCHRIMER2`, `OSSCHRIMER2`, `OSCONJ`, `ODCONJ`, `ODCORNEA`, `OSCORNEA`, `ODAC`, `OSAC`, `ODLENS`, `OSLENS`, `ODIRIS`, `OSIRIS`, `PUPIL_NORMAL`, `ODPUPILSIZE1`, `ODPUPILSIZE2`, `ODPUPILREACTIVITY`, `ODAPD`, `OSPUPILSIZE1`, `OSPUPILSIZE2`, `OSPUPILREACTIVITY`, `OSAPD`, `DIMODPUPILSIZE1`, `DIMODPUPILSIZE2`, `DIMODPUPILREACTIVITY`, `DIMOSPUPILSIZE1`, `DIMOSPUPILSIZE2`, `DIMOSPUPILREACTIVITY`, `PUPIL_COMMENTS`, `ODKTHICKNESS`, `OSKTHICKNESS`, `ODGONIO`, `OSGONIO`, `ANTSEG_COMMENTS`
583 INSERT INTO `form_eye_postseg` (`id`, `pid`, `ODDISC`, `OSDISC`, `ODCUP`, `OSCUP`, `ODMACULA`, `OSMACULA`, `ODVESSELS`, `OSVESSELS`, `ODPERIPH`, `OSPERIPH`, `ODCMT`, `OSCMT`, `RETINA_COMMENTS`, `DIL_RISKS`, `WETTYPE`, `ATROPINE`, `CYCLOMYDRIL`, `TROPICAMIDE`, `CYCLOGYL`, `NEO25`)
584 SELECT `id`, `pid`, `ODDISC`, `OSDISC`, `ODCUP`, `OSCUP`, `ODMACULA`, `OSMACULA`, `ODVESSELS`, `OSVESSELS`, `ODPERIPH`, `OSPERIPH`, `ODCMT`, `OSCMT`, `RETINA_COMMENTS`, `DIL_RISKS`, `WETTYPE`, `ATROPINE`, `CYCLOMYDRIL`, `TROPICAMIDE`, `CYCLOGYL`, `NEO25`
587 INSERT INTO `form_eye_neuro` (`id`, `pid`, `ACT`, `ACT5CCDIST`, `ACT1CCDIST`, `ACT2CCDIST`, `ACT3CCDIST`, `ACT4CCDIST`, `ACT6CCDIST`, `ACT7CCDIST`, `ACT8CCDIST`, `ACT9CCDIST`, `ACT10CCDIST`, `ACT11CCDIST`, `ACT1SCDIST`, `ACT2SCDIST`, `ACT3SCDIST`, `ACT4SCDIST`, `ACT5SCDIST`, `ACT6SCDIST`, `ACT7SCDIST`, `ACT8SCDIST`, `ACT9SCDIST`, `ACT10SCDIST`, `ACT11SCDIST`, `ACT1SCNEAR`, `ACT2SCNEAR`, `ACT3SCNEAR`, `ACT4SCNEAR`, `ACT5CCNEAR`, `ACT6CCNEAR`, `ACT7CCNEAR`, `ACT8CCNEAR`, `ACT9CCNEAR`, `ACT10CCNEAR`, `ACT11CCNEAR`, `ACT5SCNEAR`, `ACT6SCNEAR`, `ACT7SCNEAR`, `ACT8SCNEAR`, `ACT9SCNEAR`, `ACT10SCNEAR`, `ACT11SCNEAR`, `ACT1CCNEAR`, `ACT2CCNEAR`, `ACT3CCNEAR`, `ACT4CCNEAR`, `MOTILITYNORMAL`, `MOTILITY_RS`, `MOTILITY_RI`, `MOTILITY_RR`, `MOTILITY_RL`, `MOTILITY_LS`, `MOTILITY_LI`, `MOTILITY_LR`, `MOTILITY_LL`, `MOTILITY_RRSO`, `MOTILITY_RLSO`, `MOTILITY_RRIO`, `MOTILITY_RLIO`, `MOTILITY_LRSO`, `MOTILITY_LLSO`, `MOTILITY_LRIO`, `MOTILITY_LLIO`, `NEURO_COMMENTS`, `STEREOPSIS`, `ODNPA`, `OSNPA`, `VERTFUSAMPS`, `DIVERGENCEAMPS`, `NPC`, `DACCDIST`, `DACCNEAR`, `CACCDIST`, `CACCNEAR`, `ODCOLOR`, `OSCOLOR`, `ODCOINS`, `OSCOINS`, `ODREDDESAT`, `OSREDDESAT`)
588 SELECT `id`, `pid`, `ACT`, `ACT5CCDIST`, `ACT1CCDIST`, `ACT2CCDIST`, `ACT3CCDIST`, `ACT4CCDIST`, `ACT6CCDIST`, `ACT7CCDIST`, `ACT8CCDIST`, `ACT9CCDIST`, `ACT10CCDIST`, `ACT11CCDIST`, `ACT1SCDIST`, `ACT2SCDIST`, `ACT3SCDIST`, `ACT4SCDIST`, `ACT5SCDIST`, `ACT6SCDIST`, `ACT7SCDIST`, `ACT8SCDIST`, `ACT9SCDIST`, `ACT10SCDIST`, `ACT11SCDIST`, `ACT1SCNEAR`, `ACT2SCNEAR`, `ACT3SCNEAR`, `ACT4SCNEAR`, `ACT5CCNEAR`, `ACT6CCNEAR`, `ACT7CCNEAR`, `ACT8CCNEAR`, `ACT9CCNEAR`, `ACT10CCNEAR`, `ACT11CCNEAR`, `ACT5SCNEAR`, `ACT6SCNEAR`, `ACT7SCNEAR`, `ACT8SCNEAR`, `ACT9SCNEAR`, `ACT10SCNEAR`, `ACT11SCNEAR`, `ACT1CCNEAR`, `ACT2CCNEAR`, `ACT3CCNEAR`, `ACT4CCNEAR`, `MOTILITYNORMAL`, `MOTILITY_RS`, `MOTILITY_RI`, `MOTILITY_RR`, `MOTILITY_RL`, `MOTILITY_LS`, `MOTILITY_LI`, `MOTILITY_LR`, `MOTILITY_LL`, `MOTILITY_RRSO`, `MOTILITY_RLSO`, `MOTILITY_RRIO`, `MOTILITY_RLIO`, `MOTILITY_LRSO`, `MOTILITY_LLSO`, `MOTILITY_LRIO`, `MOTILITY_LLIO`, `NEURO_COMMENTS`, `STEREOPSIS`, `ODNPA`, `OSNPA`, `VERTFUSAMPS`, `DIVERGENCEAMPS`, `NPC`, `DACCDIST`, `DACCNEAR`, `CACCDIST`, `CACCNEAR`, `ODCOLOR`, `OSCOLOR`, `ODCOINS`, `OSCOINS`, `ODREDDESAT`, `OSREDDESAT`
591 INSERT INTO `form_eye_locking` (`id`, `pid`, `IMP`, `PLAN`, `Resource`, `Technician`, `LOCKED`, `LOCKEDDATE`, `LOCKEDBY`)
592 SELECT `id`, `pid`, `IMP`, `PLAN`, `Resource`, `Technician`, `LOCKED`, `LOCKEDDATE`, `LOCKEDBY` FROM `form_eye_mag`;
594 DROP TABLE `form_eye_mag`;
597 #IfMissingColumn lists list_option_id
598 ALTER TABLE `lists` ADD `list_option_id` VARCHAR (100) DEFAULT NULL COMMENT 'Reference to list_options table';
601 #IfNotRow2D list_options list_id page_validation option_id messages#new_note
602 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `notes`, `activity`) VALUES ('page_validation', 'messages#new_note','/interface/main/messages/messages.php',150, '{form_datetime:{futureDate:{message: "Must be future date"}}, reply_to:{presence: {message: "Please choose a patient"}}}', 1);
605 #IfNotRow4D supported_external_dataloads load_type ICD10 load_source CMS load_release_date 2018-10-01 load_filename 2019-ICD-10-CM-Code-Descriptions.zip
606 INSERT INTO `supported_external_dataloads` (`load_type`, `load_source`, `load_release_date`, `load_filename`, `load_checksum`) VALUES ('ICD10', 'CMS', '2018-10-01', '2019-ICD-10-CM-Code-Descriptions.zip', 'b23e0128eb2dce0cb007c31638a8dc00');
608 #IfNotRow4D supported_external_dataloads load_type ICD10 load_source CMS load_release_date 2018-10-01 load_filename 2019-ICD-10-PCS-Order-File.zip
609 INSERT INTO `supported_external_dataloads` (`load_type`, `load_source`, `load_release_date`, `load_filename`, `load_checksum`) VALUES ('ICD10', 'CMS', '2018-10-01', '2019-ICD-10-PCS-Order-File.zip', 'eb545fe61ada9efad0ad97a669f8671f');
612 #IfNotTable login_mfa_registrations
613 CREATE TABLE `login_mfa_registrations` (
614 `user_id` bigint(20) NOT NULL,
615 `name` varchar(30) NOT NULL,
616 `last_challenge` datetime DEFAULT NULL,
617 `method` varchar(31) NOT NULL COMMENT 'Q&A, U2F, TOTP etc.',
618 `var1` varchar(4096) NOT NULL DEFAULT '' COMMENT 'Question, U2F registration etc.',
619 `var2` varchar(256) NOT NULL DEFAULT '' COMMENT 'Answer etc.',
620 PRIMARY KEY (`user_id`, `name`)
624 #IfMissingColumn users_secure last_challenge_response
625 ALTER TABLE `users_secure` ADD COLUMN `last_challenge_response` datetime DEFAULT NULL;
628 #IfMissingColumn users_secure login_work_area
629 ALTER TABLE `users_secure` ADD COLUMN `login_work_area` text;
632 #IfNotColumnType onsite_messages sender_id VARCHAR(64)
633 ALTER TABLE `onsite_messages` CHANGE `sender_id` `sender_id` VARCHAR(64) NULL COMMENT 'who sent id';
636 #IfMissingColumn form_eye_mag_dispense CTLODQUANTITY
637 ALTER TABLE `form_eye_mag_dispense` ADD COLUMN `CTLODQUANTITY` varchar(255) DEFAULT NULL;
640 #IfMissingColumn form_eye_mag_dispense CTLOSQUANTITY
641 ALTER TABLE `form_eye_mag_dispense` ADD COLUMN `CTLOSQUANTITY` varchar(255) DEFAULT NULL;
644 #IfMissingColumn medex_prefs status
645 ALTER TABLE `medex_prefs` ADD COLUMN `status` text;
648 UPDATE `list_options` SET `notes`='{"form_title":{"presence": true}}' WHERE `list_id`='page_validation' AND `option_id`='add_edit_issue#theform';
649 UPDATE `list_options` SET `notes`='{"pc_catid":{"exclusion": ["_blank"]}}' WHERE `list_id`='page_validation' AND `option_id`='common#new_encounter';
650 UPDATE `list_options` SET `notes`='{"form_patient":{"presence": {"message": "Patient Name Required"}}}' WHERE `list_id`='page_validation' AND `option_id`='add_edit_event#theform';
651 UPDATE `list_options` SET `notes`='{"rumple":{"presence": {"message":"Required field missing: Please enter the User Name"}}, "stiltskin":{"presence": {"message":"Please enter the password"}}, "fname":{"presence": {"message":"Required field missing: Please enter the First name"}}, "lname":{"presence": {"message":"Required field missing: Please enter the Last name"}}}' WHERE `list_id`='page_validation' AND `option_id`='usergroup_admin_add#new_user';
652 UPDATE `list_options` SET `notes`='{"fname":{"presence": {"message":"Required field missing: Please enter the First name"}}, "lname":{"presence": {"message":"Required field missing: Please enter the Last name"}}}' WHERE `list_id`='page_validation' AND `option_id`='user_admin#user_form';
653 UPDATE `list_options` SET `notes`='{"facility":{"presence": true}, "ncolor":{"presence": true}}' WHERE `list_id`='page_validation' AND `option_id`='facility_admin#facility-form';
654 UPDATE `list_options` SET `notes`='{"facility":{"presence": true}, "ncolor":{"presence": true}}' WHERE `list_id`='page_validation' AND `option_id`='facilities_add#facility-add';
655 UPDATE `list_options` SET `notes`='{"group_name":{"presence": true}}' WHERE `list_id`='page_validation' AND `option_id`='therapy_groups_add#addGroup';
656 UPDATE `list_options` SET `notes`='{"group_name":{"presence": true}}' WHERE `list_id`='page_validation' AND `option_id`='therapy_groups_edit#editGroup';
657 UPDATE `list_options` SET `notes`='{"participant_name":{"presence": true}, "group_patient_start":{"presence": true}}' WHERE `list_id`='page_validation' AND `option_id`='tg_add#add-participant-form';
658 UPDATE `list_options` SET `notes`='{"pc_catid":{"exclusion": ["_blank"]}}' WHERE `list_id`='page_validation' AND `option_id`='common#new-encounter-form';
659 UPDATE `list_options` SET `notes`='{"form_group":{"presence": true}}' WHERE `list_id`='page_validation' AND `option_id`='add_edit_event#theform_groups';
660 UPDATE `list_options` SET `notes`='{"form_datetime":{"futureDate":{"message": "Must be future date"}}, "reply_to":{"presence": {"message": "Please choose a patient"}}}' WHERE `list_id`='page_validation' AND `option_id`='messages#new_note';
662 #IfNotTable api_token
663 CREATE TABLE `api_token` (
664 `id` bigint(20) NOT NULL AUTO_INCREMENT,
665 `user_id` bigint(20) NOT NULL,
666 `token` varchar(256) DEFAULT NULL,
667 `expiry` datetime NULL,
672 #IfMissingColumn pnotes update_by
673 ALTER TABLE `pnotes` ADD `update_by` bigint(20) default NULL;
676 #IfMissingColumn pnotes update_date
677 ALTER TABLE `pnotes` ADD `update_date` DATETIME DEFAULT NULL;
680 #IfNotColumnType onsite_documents full_document MEDIUMBLOB
681 ALTER TABLE `onsite_documents` CHANGE `full_document` `full_document` MEDIUMBLOB;
684 #IfMissingColumn facility mail_street
685 ALTER TABLE `facility` ADD `mail_street` VARCHAR(30) default NULL;
688 #IfMissingColumn facility mail_street2
689 ALTER TABLE `facility` ADD `mail_street2` VARCHAR(30) default NULL;
692 #IfMissingColumn facility mail_city
693 ALTER TABLE `facility` ADD `mail_city` VARCHAR(50) default NULL;
696 #IfMissingColumn facility mail_state
697 ALTER TABLE `facility` ADD `mail_state` VARCHAR(3) default NULL;
700 #IfMissingColumn facility mail_zip
701 ALTER TABLE `facility` ADD `mail_zip` VARCHAR(10) default NULL;
704 #IfMissingColumn facility oid
705 ALTER TABLE `facility` ADD `oid` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'HIEs CCDA and FHIR an OID is required/wanted';
709 CREATE TABLE `keys` (
710 `id` bigint(20) NOT NULL auto_increment,
711 `name` varchar(20) NOT NULL DEFAULT '',
718 #IfNotColumnType amendments pid bigint(20)
719 ALTER TABLE `amendments`
720 MODIFY `pid` bigint(20) NOT NULL COMMENT 'Patient ID from patient_data';
723 #IfNotColumnType billing pid bigint(20)
724 ALTER TABLE `billing`
725 MODIFY `pid` bigint(20) default NULL;
728 #IfNotColumnType dated_reminders pid bigint(20)
729 ALTER TABLE `dated_reminders`
730 MODIFY `pid` bigint(20) NOT NULL;
733 #IfNotColumnType drug_sales pid bigint(20)
734 ALTER TABLE `drug_sales`
735 MODIFY `pid` bigint(20) NOT NULL default '0';
738 #IfNotColumnType form_ros pid bigint(20)
739 ALTER TABLE `form_ros`
740 MODIFY `pid` bigint(20) NOT NULL;
743 #IfNotColumnType issue_encounter pid bigint(20)
744 ALTER TABLE `issue_encounter`
745 MODIFY `pid` bigint(20) NOT NULL;
748 #IfNotColumnType onsite_documents pid bigint(20) unsigned
749 ALTER TABLE `onsite_documents`
750 MODIFY `pid` bigint(20) UNSIGNED default NULL;
753 #IfNotColumnType patient_access_onsite pid bigint(20)
754 ALTER TABLE `patient_access_onsite`
755 MODIFY `pid` bigint(20);
758 #IfNotColumnType patient_access_offsite pid bigint(20)
759 ALTER TABLE `patient_access_offsite`
760 MODIFY `pid` bigint(20) NOT NULL;
763 #IfNotColumnType form_eye_mag_wearing PID bigint(20)
764 ALTER TABLE `form_eye_mag_wearing`
765 MODIFY `PID` bigint(20) NOT NULL;
768 #IfNotColumnType therapy_groups_participants pid bigint(20)
769 ALTER TABLE `therapy_groups_participants`
770 MODIFY `pid` bigint(20) NOT NULL;
773 #IfNotColumnType therapy_groups_participant_attendance pid bigint(20)
774 ALTER TABLE `therapy_groups_participant_attendance`
775 MODIFY `pid` bigint(20) NOT NULL;
778 #IfNotColumnType notification_log pid bigint(20)
779 ALTER TABLE `notification_log`
780 MODIFY `pid` bigint(20) NOT NULL;
783 #IfNotColumnType documents foreign_id bigint(20)
784 ALTER TABLE `documents`
785 MODIFY `foreign_id` bigint(20) default NULL;
788 #IfNotColumnType batchcom patient_id bigint(20)
789 ALTER TABLE `batchcom`
790 MODIFY `patient_id` bigint(20) NOT NULL default '0';
793 #IfNotColumnType claims patient_id bigint(20)
795 MODIFY `patient_id` bigint(20) NOT NULL;
798 #IfNotColumnType immunizations patient_id bigint(20)
799 ALTER TABLE `immunizations`
800 MODIFY `patient_id` bigint(20) default NULL;
803 #IfNotColumnType prescriptions patient_id bigint(20)
804 ALTER TABLE `prescriptions`
805 MODIFY `patient_id` bigint(20) default NULL;
808 #IfNotColumnType ar_session patient_id bigint(20)
809 ALTER TABLE `ar_session`
810 MODIFY `patient_id` bigint(20) NOT NULL;
813 #IfMissingColumn documents encrypted
814 ALTER TABLE `documents` ADD `encrypted` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '0->No,1->Yes';
817 #IfNotRow4D supported_external_dataloads load_type CQM_VALUESET load_source NIH_VSAC load_release_date 2017-09-29 load_filename ep_ec_only_cms_20170929.xml.zip
818 INSERT INTO `supported_external_dataloads` (`load_type`, `load_source`, `load_release_date`, `load_filename`, `load_checksum`) VALUES ('CQM_VALUESET', 'NIH_VSAC', '2017-09-29','ep_ec_only_cms_20170929.xml.zip','38d2e1a27646f2f09fcc389fd2335c50');
821 #IfNotColumnType eligibility_verification response_id varchar(32)
822 ALTER TABLE `eligibility_verification` CHANGE `response_id` `response_id` VARCHAR(32) DEFAULT NULL;
825 #IfNotTable benefit_eligibility
826 CREATE TABLE `benefit_eligibility` (
827 `response_id` bigint(20) NOT NULL,
828 `verification_id` bigint(20) NOT NULL,
829 `type` varchar(4) DEFAULT NULL,
830 `benefit_type` varchar(255) DEFAULT NULL,
831 `start_date` date DEFAULT NULL,
832 `end_date` date DEFAULT NULL,
833 `coverage_level` varchar(255) DEFAULT NULL,
834 `coverage_type` varchar(512) DEFAULT NULL,
835 `plan_type` varchar(255) DEFAULT NULL,
836 `plan_description` varchar(255) DEFAULT NULL,
837 `coverage_period` varchar(255) DEFAULT NULL,
838 `amount` decimal(5,2) DEFAULT NULL,
839 `percent` decimal(3,2) DEFAULT NULL,
840 `network_ind` varchar(2) DEFAULT NULL,
841 `message` varchar(512) DEFAULT NULL,
842 `response_status` enum('A','D') DEFAULT 'A',
843 `response_create_date` date DEFAULT NULL,
844 `response_modify_date` date DEFAULT NULL
848 #IfTable eligibility_response
849 DROP TABLE `eligibility_response`;
852 #IfTable x12_partners
853 ALTER TABLE `x12_partners` CHANGE `processing_format` `processing_format` ENUM('standard','medi-cal','cms','proxymed','oa_eligibility','availity_eligibility') DEFAULT NULL;
856 #IfMissingColumn insurance_companies eligibility_id
857 ALTER TABLE `insurance_companies` ADD `eligibility_id` VARCHAR(32) DEFAULT NULL;
860 #IfMissingColumn insurance_companies x12_default_eligibility_id
861 ALTER TABLE `insurance_companies` ADD `x12_default_eligibility_id` INT(11) DEFAULT NULL;
864 #IfMissingColumn users_secure login_fail_counter
865 ALTER TABLE `users_secure` ADD `login_fail_counter` INT(11) DEFAULT '0';
868 #IfMissingColumn x12_partners x12_dtp03
869 ALTER TABLE `x12_partners` ADD `x12_dtp03` CHAR(1) DEFAULT 'A';
872 #IfMissingColumn procedure_order order_diagnosis
873 ALTER TABLE `procedure_order` ADD `order_diagnosis` VARCHAR(255) DEFAULT '';
876 #IfTable erx_drug_paid
877 DROP TABLE `erx_drug_paid`;
880 #IfNotTable erx_weno_drugs
881 CREATE TABLE `erx_weno_drugs` (
882 `drug_id` int(11) NOT NULL AUTO_INCREMENT,
883 `rxcui_drug_coded` int(11) DEFAULT NULL,
884 `generic_rxcui` int(11) DEFAULT NULL,
885 `drug_db_code_qualifier` text,
886 `full_name` varchar(250) NOT NULL,
887 `rxn_dose_form` text,
888 `full_generic_name` varchar(250) NOT NULL,
889 `brand_name` varchar(250) NOT NULL,
890 `display_name` varchar(250) NOT NULL,
892 `new_dose_form` varchar(100) DEFAULT NULL,
893 `strength` varchar(15) DEFAULT NULL,
895 `display_name_synonym` text,
897 `sxdg_rxcui` varchar(10) DEFAULT NULL,
899 `sxdg_name` varchar(100) DEFAULT NULL,
900 `psn_drugdescription` varchar(100) DEFAULT NULL,
901 `ncpdp_quantity_term` text,
902 `potency_unit_code` varchar(10) DEFAULT NULL,
903 `dea_schedule_no` int(2) DEFAULT NULL,
904 `dea_schedule` varchar(7) DEFAULT NULL,
905 `ingredients` varchar(100) DEFAULT NULL,
906 `drug_interaction` varchar(100) DEFAULT NULL,
907 `unit_source_code` varchar(3) DEFAULT NULL,
908 `code_list_qualifier` int(3) DEFAULT NULL,
909 PRIMARY KEY (`drug_id`)
916 #IfTable openemr_postcalendar_limits
917 DROP TABLE `openemr_postcalendar_limits`;
920 #IfTable openemr_postcalendar_topics
921 DROP TABLE `openemr_postcalendar_topics`;
924 #IfTable openemr_session_info
925 DROP TABLE `openemr_session_info`;
937 DROP TABLE `config_seq`;
940 #IfTable geo_country_reference
941 DROP TABLE `geo_country_reference`;
944 #IfTable geo_zone_reference
945 DROP TABLE `geo_zone_reference`;
948 #IfMissingColumn form_eye_acuity BINOCVA
949 ALTER TABLE `form_eye_acuity` ADD `BINOCVA` varchar(25) DEFAULT NULL;
952 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id ODVITREOUS_0
953 UPDATE `list_options` SET `seq`= 1022 WHERE `list_id`='Eye_QP_RETINA_defaults' AND `option_id`='ODPERIPH_0';
954 UPDATE `list_options` SET `seq`= 1024 WHERE `list_id`='Eye_QP_RETINA_defaults' AND `option_id`='OSPERIPH_0';
955 UPDATE `list_options` SET `seq`= 1026 WHERE `list_id`='Eye_QP_RETINA_defaults' AND `option_id`='OUPERIPH_0';
956 UPDATE `list_options` SET `title`= 'clear', `seq` = 505 WHERE `list_id`='Eye_Defaults_for_GENERAL' AND `option_id`='ODPERIPH';
957 UPDATE `list_options` SET `title`= 'clear', `seq` = 515 WHERE `list_id`='Eye_Defaults_for_GENERAL' AND `option_id`='OSPERIPH';
958 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
959 ('Eye_QP_RETINA_defaults', 'ODVITREOUS_0', 'vit: clear field', 910, 0, 0, 'VITREOUS', '', '', 0, 0, 1, 'OD');
962 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id OSVITREOUS_0
963 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
964 ('Eye_QP_RETINA_defaults', 'OSVITREOUS_0', 'vit: clear field', 920, 0, 0, 'VITREOUS', '', '', 0, 0, 1, 'OS');
967 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id OUVITREOUS_0
968 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
969 ('Eye_QP_RETINA_defaults', 'OUVITREOUS_0', 'vit: clear field', 930, 0, 0, 'VITREOUS', '', '', 0, 0, 1, 'OU');
972 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id ODVITREOUS_float
973 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
974 ('Eye_QP_RETINA_defaults', 'ODVITREOUS_float', 'vit: floater', 940, 0, 0, 'VITREOUS', 'vitreous floater', '', 0, 0, 0, 'OD');
977 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id OSVITREOUS_float
978 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
979 ('Eye_QP_RETINA_defaults', 'OSVITREOUS_float', 'vit: floater', 950, 0, 0, 'VITREOUS', 'vitreous floater', '', 0, 0, 0, 'OS');
982 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id OUVITREOUS_float
983 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
984 ('Eye_QP_RETINA_defaults', 'OUVITREOUS_float', 'vit: floater', 960, 0, 0, 'VITREOUS', 'vitreous floater', '', 0, 0, 0, 'OU');
987 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id ODVITREOUS_pvd
988 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
989 ('Eye_QP_RETINA_defaults', 'ODVITREOUS_pvd', 'vit: PVD', 970, 0, 0, 'VITREOUS', 'PVD', '', 0, 0, 0, 'OD');
992 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id OSVITREOUS_pvd
993 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
994 ('Eye_QP_RETINA_defaults', 'OSVITREOUS_pvd', 'vit: PVD', 980, 0, 0, 'VITREOUS', 'PVD', '', 0, 0, 0, 'OS');
997 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id OUVITREOUS_pvd
998 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
999 ('Eye_QP_RETINA_defaults', 'OUVITREOUS_pvd', 'vit: PVD', 990, 0, 0, 'VITREOUS', 'PVD', '', 0, 0, 0, 'OU');
1002 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id ODVITREOUS_vh
1003 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
1004 ('Eye_QP_RETINA_defaults', 'ODVITREOUS_vh', 'vit: hemorrhage', 1000, 0, 0, 'VITREOUS', 'vitreous hemorrhage', '', 0, 0, 0, 'OD');
1007 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id OSVITREOUS_vh
1008 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
1009 ('Eye_QP_RETINA_defaults', 'OSVITREOUS_vh', 'vit: hemorrhage', 1010, 0, 0, 'VITREOUS', 'vitreous hemorrhage', '', 0, 0, 0, 'OS');
1012 #IfNotRow2D list_options list_id Eye_QP_RETINA_defaults option_id OUVITREOUS_vh
1013 INSERT INTO `list_options` (`list_id`, `option_id`, `title`, `seq`, `is_default`, `option_value`, `mapping`, `notes`, `codes`, `toggle_setting_1`, `toggle_setting_2`, `activity`, `subtype`) VALUES
1014 ('Eye_QP_RETINA_defaults', 'OUVITREOUS_vh', 'vit: hemorrhage', 1020, 0, 0, 'VITREOUS', 'vitreous hemorrhage', '', 0, 0, 0, 'OU');