This file is indexed.

/var/lib/gnumed/server/sql/gmoffice.sql is in gnumed-server 16.17-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
-- GNUmed office related/administrative tables

-- This is free software in the sense of the General Public License (GPL v2 or later)
-- For details regarding GPL v2 or later licensing see http://gnu.org

-- ===================================================================
-- force terminate + exit(3) on errors if non-interactive
\set ON_ERROR_STOP 1

-- ===================================================================
-- forms handling
-- ===================================================================
-- queue types
create table form_job_targets (
	pk serial
		primary key,
	target text
		unique
		not null
);

comment on table form_job_targets is
	'the form job targets (eg. printers, faxes, smtp servers) in
	 whatever granularity is needed locally, can be used for load
	 balancing/round robin servicing busy queues';

-- -------------------------------------------------------------------
-- queue of forms pending for processing
create table form_job_queue (
	pk serial primary key,
	fk_form_instance integer
		not null
		references clin.form_instances(pk),
	form bytea
		not null,
	fk_job_target integer
		not null
		references form_job_targets(pk),
	submitted_when timestamp with time zone
		not null
		default CURRENT_TIMESTAMP,
	fk_submitted_by integer
		not null,
	submitted_from text
		not null,
	status text
		not null
		default 'submitted'
);

-- FIXME: we need a trigger that allows UPDATEs on "status" only
-- FIXME: we also need a notify trigger on insert/update

--select add_x_db_fk_def('form_job_queue', 'fk_submitted_by', 'personalia', 'staff', 'pk');

comment on table form_job_queue is
	'Queue table for rendered form instances. Note that
	 the rows in this table will get deleted after processing.
	 This is NOT an archive of form jobs.';
comment on column form_job_queue.fk_form_instance is
	'points to the unrendered source instance of the form,
	 useful for recalling submitted jobs for changing';
comment on column form_job_queue.form is
	'the rendered form, IOW binary data such as a PDF file';
comment on column form_job_queue.fk_job_target is
	'points to the job target';
comment on column form_job_queue.submitted_when is
	'when was this form job submitted';
comment on column form_job_queue.fk_submitted_by is
	'who of the staff submitted this form job';
comment on column form_job_queue.submitted_from is
	'the workplace this form job was submitted from';
comment on column form_job_queue.status is
	'status of the form job:
	 - submitted: ready for processing
	 - in progress: being processed
	 - removable: fit for removal (either cancelled, timed out or done)
	 - halted: do not process';

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


-- ===================================================================
-- Embryo of billing tables
-- This is a highly classical accounting system, with medical-specific
-- updatable views.

--create table schedule (
--	id serial primary key,
--	code text,
--	name text,
--	min_duration integer,
--	description text
--);

--create table billing_scheme (
--	id serial primary key,
--	name text,
--	iso_countrycode char (2)
--);

--create table prices (
--	id_consult integer references schedule (id),
--	id_scheme integer references billing_scheme (id),
--	patient float,
--	bulkbill float
--);

--comment on column prices.patient is
--	'the amount of money paid by the patient';
--comment on column prices.bulkbill is
--	'the amount billed directly (bulk-billed) to the payor';

--create table accounts (
--	id serial primary key,
--	name text,
--	extra integer
--);

--alter table accounts add column parent integer references accounts (id);

--create table ledger (
--	stamp timestamp,
--	amount float,
--	debit integer references accounts (id),
--	credit integer references accounts (id)
--);

--create table consults
--(
--	start timestamp,
--	finish timestamp,
--	id_location integer,
--	id_doctor integer,
--	id_patient integer,
--	id_type integer references schedule (id),
--	id_scheme integer references billing_scheme (id)
--);

-- ===================================================================
-- permissions
-- ===================================================================
GRANT SELECT ON
	form_job_targets
	, form_job_queue
TO GROUP "gm-public";

GRANT select, insert, delete, update ON
	form_job_queue
	, form_job_queue_pk_seq
TO GROUP "gm-doctors";

-- ===================================================================
-- do simple schema revision tracking
delete from gm_schema_revision where filename='$RCSfile: gmoffice.sql,v $';
INSERT INTO gm_schema_revision (filename, version) VALUES('$RCSfile: gmoffice.sql,v $', '$Revision: 1.15 $');

--=====================================================================
-- $Log: gmoffice.sql,v $
-- Revision 1.15  2005-12-05 16:17:24  ncq
-- - remove calls to add_x_db_*
--
-- Revision 1.14  2005/11/25 15:07:28  ncq
-- - create schema "clin" and move all things clinical into it
--
-- Revision 1.13  2005/09/22 15:38:21  ncq
-- - cleanup
--
-- Revision 1.12  2005/09/19 16:38:51  ncq
-- - adjust to removed is_core from gm_schema_revision
--
-- Revision 1.11  2005/07/14 21:31:42  ncq
-- - partially use improved schema revision tracking
--
-- Revision 1.10  2005/03/01 20:38:19  ncq
-- - varchar -> text
--
-- Revision 1.9  2005/01/29 18:45:22  ncq
-- - form_target_classes -> form_job_targets
-- - form_queue -> form_job_queue
--
-- Revision 1.8  2005/01/12 12:29:29  ncq
-- - comment out some unused tables
--
-- Revision 1.7  2004/07/17 20:57:53  ncq
-- - don't use user/_user workaround anymore as we dropped supporting
--   it (but we did NOT drop supporting readonly connections on > 7.3)
--
-- Revision 1.6  2004/03/23 22:43:46  ncq
-- - 7.4 is stricter about FKs having to point to unique references
--
-- Revision 1.5  2004/03/10 15:45:15  ncq
-- - grants on form tables
--
-- Revision 1.4  2004/03/10 00:08:31  ncq
-- - add form queue handling
-- - remove papersizes
-- - cleanup
--
-- Revision 1.3  2002/12/14 08:12:22  ihaywood
-- New prescription tables in gmclinical.sql
--
-- Revision 1.2  2002/12/06 08:50:52  ihaywood
-- SQL internationalisation, gmclinical.sql now internationalised.
--
-- Revision 1.1  2002/12/03 02:50:19  ihaywood
-- new office schema: tables for printing forms