1 ALTER TABLE form_vitals
2 MODIFY `weight` FLOAT(5,2) default 0,
3 MODIFY `height` FLOAT(5,2) default 0,
4 MODIFY `BMI` FLOAT(4,1) default 0;
6 #IfNotTable form_misc_billing_options
7 CREATE TABLE IF NOT EXISTS `form_misc_billing_options` (
8 id bigint(20) NOT NULL auto_increment,
9 date datetime default NULL,
10 pid bigint(20) default NULL,
11 user varchar(255) default NULL,
12 groupname varchar(255) default NULL,
13 authorized tinyint(4) default NULL,
14 activity tinyint(4) default NULL,
15 employment_related tinyint(1) default NULL,
16 auto_accident tinyint(1) default NULL,
17 accident_state varchar(2) default NULL,
18 other_accident tinyint(1) default NULL,
19 outside_lab tinyint(1) default NULL,
20 lab_amount decimal(5,2) default NULL,
21 is_unable_to_work tinyint(1) default NULL,
22 off_work_from date default NULL,
23 off_work_to date default NULL,
24 is_hospitalized tinyint(1) default NULL,
25 hospitalization_date_from date default NULL,
26 hospitalization_date_to date default NULL,
27 medicaid_resubmission_code varchar(10) default NULL,
28 medicaid_original_reference varchar(15) default NULL,
29 prior_auth_number varchar(20) default NULL,
30 comments varchar(255) default NULL,
35 #IfMissingColumn facility facility_npi
37 ADD `facility_npi` varchar(15) NOT NULL DEFAULT '';
40 #IfMissingColumn lists classification
42 ADD `classification` int(11) NOT NULL DEFAULT 0;
45 #IfMissingColumn form_football_injury_audit fimatchtype
46 ALTER TABLE form_football_injury_audit
47 ADD `fimatchtype` int(11) NOT NULL DEFAULT 0;
50 #IfMissingColumn documents docdate
52 ADD `docdate` date DEFAULT NULL,
53 ADD `list_id` bigint(20) NOT NULL DEFAULT 0;
56 #IfMissingColumn users streetb
58 ADD streetb varchar(60) NOT NULL DEFAULT '',
59 ADD streetb2 varchar(60) NOT NULL DEFAULT '',
60 ADD notes text NOT NULL DEFAULT '';
63 #IfMissingColumn history_data last_retinal
64 ALTER TABLE history_data
65 ADD `last_retinal` varchar(255) NOT NULL DEFAULT '',
66 ADD `last_fluvax` varchar(255) NOT NULL DEFAULT '',
67 ADD `last_pneuvax` varchar(255) NOT NULL DEFAULT '',
68 ADD `last_ldl` varchar(255) NOT NULL DEFAULT '',
69 ADD `last_hemoglobin` varchar(255) NOT NULL DEFAULT '',
70 ADD `last_psa` varchar(255) NOT NULL DEFAULT '';
73 #IfMissingColumn openemr_postcalendar_events pc_multiple
74 ALTER TABLE openemr_postcalendar_events
75 ADD `pc_multiple` int(10) unsigned NOT NULL DEFAULT 0;
78 #IfMissingColumn billing ndc_info
80 ADD `ndc_info` varchar(255) NOT NULL DEFAULT '';
85 patient_id int(11) NOT NULL,
86 encounter_id int(11) NOT NULL,
87 version int unsigned NOT NULL AUTO_INCREMENT,
88 payer_id int(11) NOT NULL DEFAULT 0,
89 status tinyint(2) NOT NULL DEFAULT 0,
90 payer_type tinyint(4) NOT NULL DEFAULT 0,
91 bill_process tinyint(2) NOT NULL DEFAULT 0,
92 bill_time datetime DEFAULT NULL,
93 process_time datetime DEFAULT NULL,
94 process_file varchar(255) NOT NULL DEFAULT '',
95 target varchar(30) NOT NULL DEFAULT '',
96 x12_partner_id int(11) NOT NULL DEFAULT 0,
97 PRIMARY KEY (patient_id, encounter_id, version)
99 INSERT IGNORE INTO claims (
100 patient_id, encounter_id, bill_time, payer_id,
102 bill_process, process_time, process_file, target,
105 b.pid, b.encounter, b.bill_date, b.payer_id,
106 b.billed * 2 + 1, FIND_IN_SET(i.type, 'primary,secondary,tertiary'),
107 b.bill_process, b.process_date, b.process_file, b.target,
110 LEFT OUTER JOIN insurance_data AS i ON i.pid = b.pid AND i.provider = b.payer_id
111 WHERE b.activity > 0 AND b.encounter > 0 AND b.code_type != 'ICD9' AND b.payer_id > 0;
114 #IfNotColumnType insurance_data date date
115 ALTER TABLE insurance_data
116 MODIFY `date` date NOT NULL DEFAULT '0000-00-00',
119 ADD UNIQUE KEY pid_type_date (pid, type, date);
122 #IfMissingColumn facility service_location
124 ADD `service_location` tinyint(1) NOT NULL DEFAULT 1;
127 #IfMissingColumn form_encounter facility_id
128 ALTER TABLE form_encounter
129 ADD facility_id int(11) NOT NULL DEFAULT 0;
130 UPDATE form_encounter, facility
131 SET form_encounter.facility_id = facility.id WHERE
132 facility.name = form_encounter.facility;
135 #IfMissingColumn users facility_id
137 ADD facility_id int(11) NOT NULL DEFAULT 0;
138 UPDATE users, facility
139 SET users.facility_id = facility.id WHERE
140 facility.name = users.facility;