1 ALTER TABLE `users` ADD `upin` varchar(255) default NULL;
3 CREATE TABLE issue_encounter (
4 pid int(11) NOT NULL, -- pid from patient_data table
5 list_id int(11) NOT NULL, -- id from lists table
6 encounter int(11) NOT NULL, -- encounter from form_encounters table
7 resolved tinyint(1) NOT NULL, -- if problem seems resolved with this encounter
8 PRIMARY KEY (pid, list_id, encounter)
12 CREATE TABLE `immunization` (
13 `id` int(11) NOT NULL auto_increment,
14 `name` varchar(255) NOT NULL default '',
16 KEY `immunization_name` (`name`)
17 ) ENGINE=MyISAM AUTO_INCREMENT=36 ;
19 INSERT INTO `immunization` VALUES (1, 'DTaP 1');
20 INSERT INTO `immunization` VALUES (2, 'DTaP 2');
21 INSERT INTO `immunization` VALUES (3, 'DTaP 3');
22 INSERT INTO `immunization` VALUES (4, 'DTaP 4');
23 INSERT INTO `immunization` VALUES (5, 'DTaP 5');
24 INSERT INTO `immunization` VALUES (6, 'DT 1');
25 INSERT INTO `immunization` VALUES (7, 'DT 2');
26 INSERT INTO `immunization` VALUES (8, 'DT 3');
27 INSERT INTO `immunization` VALUES (9, 'DT 4');
28 INSERT INTO `immunization` VALUES (10, 'DT 5');
29 INSERT INTO `immunization` VALUES (11, 'IPV 1');
30 INSERT INTO `immunization` VALUES (12, 'IPV 2');
31 INSERT INTO `immunization` VALUES (13, 'IPV 3');
32 INSERT INTO `immunization` VALUES (14, 'IPV 4');
33 INSERT INTO `immunization` VALUES (15, 'Hib 1');
34 INSERT INTO `immunization` VALUES (16, 'Hib 2');
35 INSERT INTO `immunization` VALUES (17, 'Hib 3');
36 INSERT INTO `immunization` VALUES (18, 'Hib 4');
37 INSERT INTO `immunization` VALUES (19, 'Pneumococcal Conjugate 1');
38 INSERT INTO `immunization` VALUES (20, 'Pneumococcal Conjugate 2');
39 INSERT INTO `immunization` VALUES (21, 'Pneumococcal Conjugate 3');
40 INSERT INTO `immunization` VALUES (22, 'Pneumococcal Conjugate 4');
41 INSERT INTO `immunization` VALUES (23, 'MMR 1');
42 INSERT INTO `immunization` VALUES (24, 'MMR 2');
43 INSERT INTO `immunization` VALUES (25, 'Varicella 1');
44 INSERT INTO `immunization` VALUES (26, 'Varicella 2');
45 INSERT INTO `immunization` VALUES (27, 'Hepatitis B 1');
46 INSERT INTO `immunization` VALUES (28, 'Hepatitis B 2');
47 INSERT INTO `immunization` VALUES (29, 'Hepatitis B 3');
48 INSERT INTO `immunization` VALUES (30, 'Influenza 1');
49 INSERT INTO `immunization` VALUES (31, 'Influenza 2');
50 INSERT INTO `immunization` VALUES (32, 'Td');
51 INSERT INTO `immunization` VALUES (33, 'Hepatitis A 1');
52 INSERT INTO `immunization` VALUES (34, 'Hepatitis A 2');
53 INSERT INTO `immunization` VALUES (35, 'Other');
56 CREATE TABLE `immunizations` (
57 `id` bigint(20) NOT NULL auto_increment,
58 `patient_id` int(11) default NULL,
59 `administered_date` date default NULL,
60 `immunization_id` int(11) default NULL,
61 `manufacturer` varchar(100) default NULL,
62 `lot_number` varchar(50) default NULL,
63 `administered_by_id` bigint(20) default NULL,
64 `education_date` date default NULL,
66 `create_date` datetime default NULL,
67 `update_date` timestamp(14) NOT NULL,
68 `created_by` bigint(20) default NULL,
69 `updated_by` bigint(20) default NULL,
74 replace into immunizations (patient_id,create_date,note,created_by,updated_by,administered_by_id)
75 select l.pid,l.date,concat(l.title,': ',l.comments),u.id, u.id, u.id
77 left join users u on l.user = u.username
78 where l.type = 'immunization';