forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
4_3_0-to-4_3_1_upgrade.sql
120 lines (93 loc) · 6.55 KB
/
4_3_0-to-4_3_1_upgrade.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
--
-- Comment Meta Language Constructs:
--
-- #IfNotTable
-- argument: table_name
-- behavior: if the table_name does not exist, the block will be executed
-- #IfTable
-- argument: table_name
-- behavior: if the table_name does exist, the block will be executed
-- #IfColumn
-- arguments: table_name colname
-- behavior: if the table and column exist, the block will be executed
-- #IfMissingColumn
-- arguments: table_name colname
-- behavior: if the table exists but the column does not, the block will be executed
-- #IfNotColumnType
-- arguments: table_name colname value
-- 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
-- #IfNotRow
-- arguments: table_name colname value
-- behavior: If the table table_name does not have a row where colname = value, the block will be executed.
-- #IfNotRow2D
-- arguments: table_name colname value colname2 value2
-- behavior: If the table table_name does not have a row where colname = value AND colname2 = value2, the block will be executed.
-- #IfNotRow3D
-- arguments: table_name colname value colname2 value2 colname3 value3
-- 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.
-- #IfNotRow4D
-- arguments: table_name colname value colname2 value2 colname3 value3 colname4 value4
-- 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.
-- #IfNotRow2Dx2
-- 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.
-- arguments: table_name colname value colname2 value2 colname3 value3
-- behavior: The block will be executed if both statements below are true:
-- 1) The table table_name does not have a row where colname = value AND colname2 = value2.
-- 2) The table table_name does not have a row where colname = value AND colname3 = value3.
-- #IfRow2D
-- arguments: table_name colname value colname2 value2
-- behavior: If the table table_name does have a row where colname = value AND colname2 = value2, the block will be executed.
-- #IfRow3D
-- arguments: table_name colname value colname2 value2 colname3 value3
-- behavior: If the table table_name does have a row where colname = value AND colname2 = value2 AND colname3 = value3, the block will be executed.
-- #IfIndex
-- desc: This function is most often used for dropping of indexes/keys.
-- arguments: table_name colname
-- behavior: If the table and index exist the relevant statements are executed, otherwise not.
-- #IfNotIndex
-- desc: This function will allow adding of indexes/keys.
-- arguments: table_name colname
-- behavior: If the index does not exist, it will be created
-- #EndIf
-- all blocks are terminated with a #EndIf statement.
-- #IfNotListReaction
-- Custom function for creating Reaction List
-- #IfNotListOccupation
-- Custom function for creating Occupation List
#IfNotRow clinical_rules id rule_blood_pressure
INSERT INTO `clinical_rules` ( `id`, `pid`, `active_alert_flag`, `passive_alert_flag`, `cqm_flag`, `cqm_nqf_code`, `cqm_pqri_code`, `amc_flag`, `amc_code`, `patient_reminder_flag` ) VALUES ('rule_blood_pressure', 0, 0, 0, 0, '', '', 0, '', 0);
#EndIf
#IfNotRow2D list_options list_id clinical_rules option_id rule_blood_pressure
INSERT INTO `list_options` ( `list_id`, `option_id`, `title`, `seq`, `is_default` ) VALUES ('clinical_rules', 'rule_blood_pressure', 'Measure Blood Pressure', 1610, 0);
#EndIf
#IfNotRow rule_action id rule_blood_pressure
INSERT INTO `rule_action` ( `id`, `group_id`, `category`, `item` ) VALUES ('rule_blood_pressure', 1, 'act_cat_measure', 'act_bp');
#EndIf
#IfNotRow rule_reminder id rule_blood_pressure
INSERT INTO `rule_reminder` ( `id`, `method`, `method_detail`, `value` ) VALUES ('rule_blood_pressure', 'clinical_reminder_pre', 'week', '2');
INSERT INTO `rule_reminder` ( `id`, `method`, `method_detail`, `value` ) VALUES ('rule_blood_pressure', 'clinical_reminder_post', 'month', '1');
INSERT INTO `rule_reminder` ( `id`, `method`, `method_detail`, `value` ) VALUES ('rule_blood_pressure', 'patient_reminder_pre', 'week', '2');
INSERT INTO `rule_reminder` ( `id`, `method`, `method_detail`, `value` ) VALUES ('rule_blood_pressure', 'patient_reminder_post', 'month', '1');
#EndIf
#IfNotRow rule_target id rule_blood_pressure
INSERT INTO `rule_target` ( `id`, `group_id`, `include_flag`, `required_flag`, `method`, `value`, `interval` ) VALUES ('rule_blood_pressure', 1, 1, 1, 'target_database', '::form_vitals::bps::::::ge::1', 0);
INSERT INTO `rule_target` ( `id`, `group_id`, `include_flag`, `required_flag`, `method`, `value`, `interval` ) VALUES ('rule_blood_pressure', 1, 1, 1, 'target_database', '::form_vitals::bpd::::::ge::1', 0);
#EndIf
#IfNotRow clinical_rules id rule_inr_measure
INSERT INTO `clinical_rules` ( `id`, `pid`, `active_alert_flag`, `passive_alert_flag`, `cqm_flag`, `cqm_nqf_code`, `cqm_pqri_code`, `amc_flag`, `amc_code`, `patient_reminder_flag` ) VALUES ('rule_inr_measure', 0, 0, 0, 0, '', '', 0, '', 0);
#EndIf
#IfNotRow2D list_options list_id clinical_rules option_id rule_inr_measure
INSERT INTO `list_options` ( `list_id`, `option_id`, `title`, `seq`, `is_default` ) VALUES ('clinical_rules', 'rule_inr_measure', 'Measure INR', 1620, 0);
#EndIf
#IfNotRow rule_action id rule_inr_measure
INSERT INTO `rule_action` ( `id`, `group_id`, `category`, `item` ) VALUES ('rule_inr_measure', 1, 'act_cat_measure', 'act_lab_inr');
#EndIf
#IfNotRow rule_reminder id rule_inr_measure
INSERT INTO `rule_reminder` ( `id`, `method`, `method_detail`, `value` ) VALUES ('rule_inr_measure', 'clinical_reminder_pre', 'week', '2');
INSERT INTO `rule_reminder` ( `id`, `method`, `method_detail`, `value` ) VALUES ('rule_inr_measure', 'clinical_reminder_post', 'month', '1');
INSERT INTO `rule_reminder` ( `id`, `method`, `method_detail`, `value` ) VALUES ('rule_inr_measure', 'patient_reminder_pre', 'week', '2');
INSERT INTO `rule_reminder` ( `id`, `method`, `method_detail`, `value` ) VALUES ('rule_inr_measure', 'patient_reminder_post', 'month', '1');
#EndIf
#IfNotRow rule_target id rule_inr_measure
INSERT INTO `rule_target` ( `id`, `group_id`, `include_flag`, `required_flag`, `method`, `value`, `interval` ) VALUES ('rule_inr_measure', 1, 1, 1, 'target_proc', 'INR::CPT4:85610::::::ge::1', 0);
#EndIf