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',
443 `ACT5CCDIST` varchar (50) DEFAULT NULL,
444 `ACT1CCDIST` varchar (50) DEFAULT NULL,
445 `ACT2CCDIST` varchar (50) DEFAULT NULL,
446 `ACT3CCDIST` varchar (50) DEFAULT NULL,
447 `ACT4CCDIST` varchar (50) DEFAULT NULL,
448 `ACT6CCDIST` varchar (50) DEFAULT NULL,
449 `ACT7CCDIST` varchar (50) DEFAULT NULL,
450 `ACT8CCDIST` varchar (50) DEFAULT NULL,
451 `ACT9CCDIST` varchar (50) DEFAULT NULL,
452 `ACT10CCDIST` varchar (50) DEFAULT NULL,
453 `ACT11CCDIST` varchar (50) DEFAULT NULL,
454 `ACT1SCDIST` varchar (50) DEFAULT NULL,
455 `ACT2SCDIST` varchar (50) DEFAULT NULL,
456 `ACT3SCDIST` varchar (50) DEFAULT NULL,
457 `ACT4SCDIST` varchar (50) DEFAULT NULL,
458 `ACT5SCDIST` varchar (50) DEFAULT NULL,
459 `ACT6SCDIST` varchar (50) DEFAULT NULL,
460 `ACT7SCDIST` varchar (50) DEFAULT NULL,
461 `ACT8SCDIST` varchar (50) DEFAULT NULL,
462 `ACT9SCDIST` varchar (50) DEFAULT NULL,
463 `ACT10SCDIST` varchar (50) DEFAULT NULL,
464 `ACT11SCDIST` varchar (50) DEFAULT NULL,
465 `ACT1SCNEAR` varchar (50) DEFAULT NULL,
466 `ACT2SCNEAR` varchar (50) DEFAULT NULL,
467 `ACT3SCNEAR` varchar (50) DEFAULT NULL,
468 `ACT4SCNEAR` varchar (50) DEFAULT NULL,
469 `ACT5CCNEAR` varchar (50) DEFAULT NULL,
470 `ACT6CCNEAR` varchar (50) DEFAULT NULL,
471 `ACT7CCNEAR` varchar (50) DEFAULT NULL,
472 `ACT8CCNEAR` varchar (50) DEFAULT NULL,
473 `ACT9CCNEAR` varchar (50) DEFAULT NULL,
474 `ACT10CCNEAR` varchar (50) DEFAULT NULL,
475 `ACT11CCNEAR` varchar (50) DEFAULT NULL,
476 `ACT5SCNEAR` varchar (50) DEFAULT NULL,
477 `ACT6SCNEAR` varchar (50) DEFAULT NULL,
478 `ACT7SCNEAR` varchar (50) DEFAULT NULL,
479 `ACT8SCNEAR` varchar (50) DEFAULT NULL,
480 `ACT9SCNEAR` varchar (50) DEFAULT NULL,
481 `ACT10SCNEAR` varchar (50) DEFAULT NULL,
482 `ACT11SCNEAR` varchar (50) DEFAULT NULL,
483 `ACT1CCNEAR` varchar (50) DEFAULT NULL,
484 `ACT2CCNEAR` varchar (50) DEFAULT NULL,
485 `ACT3CCNEAR` varchar (50) DEFAULT NULL,
486 `ACT4CCNEAR` varchar (50) DEFAULT NULL,
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,
506 `ODNPA` varchar (50) DEFAULT NULL,
507 `OSNPA` varchar (50) DEFAULT NULL,
508 `VERTFUSAMPS` varchar (50) DEFAULT NULL,
509 `DIVERGENCEAMPS` varchar (50) DEFAULT NULL,
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,
515 `ODCOLOR` varchar (50) DEFAULT NULL,
516 `OSCOLOR` varchar (50) DEFAULT NULL,
517 `ODCOINS` varchar (50) DEFAULT NULL,
518 `OSCOINS` varchar (50) 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 `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;