File: gmReference.sql

package info (click to toggle)
gnumed-server 22.31-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 46,268 kB
  • sloc: sql: 1,217,633; python: 15,878; sh: 1,590; makefile: 20
file content (350 lines) | stat: -rw-r--r-- 11,268 bytes parent folder | download | duplicates (7)
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
-- Project: GNUmed - service "Reference" -- Australian specific stuff
-- ===================================================================
-- $Source: /home/ncq/Projekte/cvs2git/vcs-mirror/gnumed/gnumed/server/sql/country.specific/au/gmReference.sql,v $
-- $Revision: 1.13 $
-- license: GPL v2 or later
-- author: Ian Haywood

-- This file populates the tables in the reference service with Australian-specific content.
-- ===================================================================
-- force terminate + exit(3) on errors if non-interactive
\set ON_ERROR_STOP 1

-- ===================================================================

insert into form_types (name) values ('workplace sick certificate');
insert into form_types (name) values ('vaccination report');
-- a list of persons (usually children) vaccinated, to a central
-- government registry
insert into form_types (name) values ('referral');
insert into form_types (name) values ('surveillance');
-- a report of disease case to a public health authority
insert into form_types (name) values ('prescription');
insert into form_types (name) values ('invoice');
insert into form_types (name) values ('bulk invoice');
-- a list of services performed to a whole group of patients,
-- to an insurer.
insert into form_types (name) values ('request');
-- pathology/radiology/physio/etc.
insert into form_types (name) values ('reminder');
-- a reminder letter to patient, asking them to make an appointment

insert into form_defs (fk_type, country, name_short, name_long, revision, engine, is_user, template) values (5,
	'AU',
	'Standard Referral',
	'Standard specialist referral letter for AU',
	1,
	'L',
	false,
'\\documentclass{letter}
\\address{ @"%(title)s %(first)s %(last)s" % user.get_names ()@ \\\\ 
@"%(number)s %(street)s" % user[''addresses''][''work'']@ \\\\
@"%(city)s %(postcode)s" % user[''addresses''][''work'']@ \\\\}
\\signature{ @"%(title)s %(first)s %(last)s" % user.get_names ()@}
\\begin{document}
\\begin{letter}{@"%(title)s %(first)s %(last)s" % addressee.get_names ()@ \\\\ 
@"%(number)s %(street)s" % address@ \\\\
@"%(urb)s %(postcode)s" % address@ \\\\} }

\\opening{Dear @"%(title)s %(first)s %(last)s" % addressee.get_names ()@ }

\\textbf{Re:} @"%(first)s %(last)s" % patient.get_names ()@, 
@"%(number)s %(street)s, %(city)s %(postcode)s" % patient[''addresses''][''home'']@, 
DOB: @patient.getDOB ().Format (''%x'')@

@text@

\\ifnum@incl_meds@>0
\\textbf{Medications List}

\\begin{tabular}{lll}
@[[med[''name''], med[''form''], med[''direction'']] for med in clinical.getMedicationsList ()]@
\\end{tabular}
\\fi

\\ifnum@flags[''incl_phx'']@>0
\\textbf{Disease List}

\\begin{tabular}{ll}
@[[phx[''diagnosis''], phx[''started'']] for phx in clinical.getPastHistory ()]@
\\end{tabular}
\\fi

\\closing{Yours sincerely,}

\\end{letter}
\\end{document}');

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 1, 'Addressee', 'addressee', 
  'Person the referral is sent to', 
  6,
  NULL, 1);
insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 1, 'Address', 'address', 
  'Address to mail to', 
  7,
  NULL, 2);
insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 1, 'Text', 'text', 
  'Text of referral', 
  4,
  NULL, 3);
insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 1, 'Include medications', 'incl_meds', 
  '', 
  3,
  NULL, 4);
insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 1, 'Include past history', 'incl_phx', 
  '', 
  3,
  NULL, 5);




insert into form_defs (fk_type, country, name_short, name_long, revision, engine, is_user, template) values (
	7,
	'AU', 
	'PBS Script',
	'Prescription using the standard form of the Pharmaceutical Benefits Scheme',
	1,
	'L',
	false,
'\\documentclass{a4form}
\\usepackage{multicol}
% this is a template of a *community* PBS script form
% (hospital scripts are completely different and must be handwritten [sob])

\\begin{document}
\\begin{page}
\\text{25}{25}{80}{@user[''ext_ids'']["Prescriber No."]@}
\\text{130}{25}{80}{@user[''ext_ids'']["Prescriber No."]@}

\\text{35}{33}{80}{@(patient[''ext_ids''].has_key ("Repat No.") and patient[''ext_ids''][''Repat No.'']) or patient[''ext_ids'']["Medicare No."]@}
\\text{140}{33}{80}{@(patient.[[''ext_ids''].has_key (''Repat No.''] and patient[''ext_ids'']["Repat No."]) or patient[''ext_ids'']["Medicare No."]@}
% use the Department of Veteran''s affairs number if available: these patients get extra benefits

\\text{24}{57}{80}{@"%(first)s %(last)s" % patient.get_names ()@}
\\text{129}{57}{80}{@"(first)s %(last)s" % patient.get_names ()@}

\\text{15}{60}{80}{@"%(number)s %(street)s, %(city)s %(postcode)s" % patient[''addresses''][''home'']@}
\\text{120}{60}{80}{@"%(number)s %(street)s, %(city)s %(postcode)s" % patient[''addresses''][''home'']@}

\\text{9}{72}{50}{\\today}
\\text{114}{72}{50}{\\today}

\\ifnum@patient[''ext_id''s].has_key ("Repat No.")@>0
\\text{27}{77}{10}{X} % mark as RPBS script
\\text{132}{77}{10}{X}
\\else
\\text{7}{77}{10}{X} % ordinary PBS
\\text{112}{77}{10}{X}
\\fi

\\ifnum@brand@>0
\\text{43}{74.5}{7}{X}
\\text{148}{74.5}{7}{X}
\\fi

\\text{22.5}{84}{82.5}{
% TODO: drugs business objects yet to be written
\\vspace{1cm}
\\hspace{1cm} @"%(name)s %(form)s %(direction)s " % drug_list@
}

\\text{127.5}{84}{82.5}{
% TODO: drugs business objects yet to be written
\\vspace{1cm}
\\hspace{1cm} @"%(name)s %(form)s %(direction)s" % drug_list@
}
\\end{page}
\\end{document}');

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 2, 'Items', 'drug_list', 
  'Drugs to be prescribed', 
  8,
  NULL, 1);
insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 2, 'Brand only', 'brand', 
  'Brand-subsitution by pharmacist forbidden', 
  3,
  NULL, 2);


insert into form_defs (fk_type, country, name_short, name_long, revision, engine, is_user, template) values (
	(select pk from form_types where name='request'),
	'AU',
	'Basic request',
	'A proof-of-concept basic request form',
	1,
	'L',
	false,
'\\documentclass{a4form}
\\usepackage{multicol}

\\begin{document}
\\begin{page}
\\text{20}{12}{70}{} % to address

\\lineh{20}{40}{170} % horizontal separators
\\lineh{20}{50}{110}
\\lineh{20}{80}{170}
\\lineh{20}{135}{170}
\\lineh{20}{220}{170}
\\lineh{20}{255}{170}

\\linev{20}{40}{215} % sidelines
\\linev{190}{40}{215}

\\linev{130}{40}{95} % broken vertical separator
\\linev{130}{220}{35}

\\lineh{130}{107}{60} % smaller separators
\\linev{57}{40}{10}
\\linev{90}{40}{10}

\\text{22}{45}{20}{Billing}
\\text{59}{45}{15}{Our ref:}
\\text{92}{45}{20}{Your ref:}
\\text{133}{45}{55}{
\\textbf{Requesting Practitioner}\\
\\
@''%(title)s %(firstnames)s %(lastnames)s'' % user.get_names ()@\\\\
@''%(number)s %(street)s'' % user[''addresses''][``work'']\\\\
@''%(city)s %(postcode)s'' % user[''addresses''][``work'']\\\\
@user[''comms''].has_key (''fax'') and ''FAX: %s\\\\\\\\'' % user[''comms''][''fax'']@
@user[''comms''].has_key (''telephone'') and ''PHONE: %s\\\\\\\\'' % user[''comms''][''telephone'']@

\\text{22}{55}{50}{
\\begin{tabular}{ll}
\\textbf{Patient:} & @"%(title)s %(first)s %(last)s" % patient.get_names ()@ \\\\
& @"%(number)s %(street)s" % patient[''addresses''][''home'']@ \\\\
& @"%(city)s %(postcode)s" % patient[''addresses''][''home'']@ \\\\
DOB: & @patient.getDOB ().Format (''%x'')@ \\\\
@patient[''comms''].has_key (''telephone'') and ''PHONE: & %s\\\\\\\\'' % patient[''comms''][''telephone'']@
\\end{tabular}
}
\\text{22}{85}{100}{
\textbf{REQUEST FOR @type@}\\\\
@request@\\
\\\\
\\ifnum@len (therapy)@>0
\\textbf{THERAPY}\\\\
@therapy@\\\\
\\fi
\\
\\ifnum@len (clinical_notes)@>0
\\textbf{CLINICAL NOTES}\\
@clinical_notes@\\
}

\\ifnum@copy_to is not None@>0
\text{133}{85}{55}{
\textbf{Copy of report to:}\\
\\
@copy_to and ''%(title)s %(firstnames)s %(lastnames)s'' % copy_to.get_names ()@\\\\
@copy_to and ''%(number)s %(street)s, %(city)s %(postcode)s'' % copy_to[''addresses''][''work'']@\\\\
@copy_to and copy_to[''comms''].has_key (''fax'') and ''FAX: %s'' % copy_to[''comms''][''fax'']@\\\\
}
\\fi
\\text{130}{107}{60}{
\\begin{multicols}{2}
\\checkbox{@routine@} Routine\\\\
\\checkbox{@urgent@} Urgent\\\\\
\\checkbox{@fax_result@} Fax result\\\\
\\checkbox{@phone_result@} Phone result\\\\
\\checkbox{@pensioner@} Pensioner\\\\
\\checkbox{@patient[''ext id''].has_key (''Repat No.'')@} Veteran\\\\
\\checkbox{@referral_pad@} Referral pads\\\\
\\end{multicols}
}

\\text{22}{140}{165}{
\\textbf{PATIENT INSTRUCTIONS}\\\\

@instructions@}

\\text{133}{225}{55}{
\\textbf{Doctor''s Signature}
}

\\text{57}{260}{80}{GNUMed v0.1.0}

\\end{page}
\\end{document}
');

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 3, 'Request', 'request', 
  'The services requested', 
  4,
  NULL, 1);

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 3, 'Clinical Notes', 'clinical_notes', 
  '', 
  4,
  NULL, 2);

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 3, 'Therapy', 'therapy', 
  'Description of patient''s current therapy', 
  4,
  NULL, 3);

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 3, 'Patient Instructions', 'instructions', 
  'Instructions for the Patient', 
  4,
  NULL, 4);

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 3, 'Routine', 'routine', 
  'Routine request', 
  3,
  NULL, 5);

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 3, 'Urgent', 'urgent', 
  '', 
  3, NULL, 6);

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 3, 'Fax result', 'fax_result', 
  '', 
  3, NULL, 7);

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 3, 'Phone result', 'phone_result', 
  '', 
  3, NULL, 8);

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 3, 'Pensioner', 'pensioner', 
  'Patient is a pensioner (i.e. asking referree for discount)', 
  3, NULL, 9);

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 3, 'Referral pads', 'referral_pad', 
  '', 
  3, NULL, 10);

insert into form_fields (fk_form, long_name, template_placeholder, help, fk_type, param, display_order ) values
( 3, 'Type', 'type', 
  'The clinical discipline of the referree', 
  2, 'Pathology
Radiology
Vascular
Cardiology
Neurophysiology
Respiratory
Nuclear Medicine
Audiology
Physiotherapy
Occupational Therapy', 11);
-- these referral types must match entries in org_category.description in the demographics service.