File: gmWaitingList.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 (76 lines) | stat: -rw-r--r-- 2,452 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
-- Project: GNUmed - waiting list tables
-- ===================================================================
-- $Source: /home/ncq/Projekte/cvs2git/vcs-mirror/gnumed/gnumed/server/sql/gmWaitingList.sql,v $
-- $Revision: 1.4 $
-- license: GPL v2 or later
-- author: Karsten Hilbert

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

create table clin.waiting_list (
	pk serial primary key,
	fk_patient integer
		not null
		references clin.xlnk_identity(xfk_identity)
		on update cascade
		on delete cascade,
	registered timestamp with time zone
		not null
		default CURRENT_TIMESTAMP,
	urgency integer
		not null
		default 0,
	list_position integer
		unique
		not null
		check (list_position > 0),
	comment text
) inherits (audit.audit_fields);

select audit.add_table_for_audit('clin', 'waiting_list');

comment on table clin.waiting_list is
	'aggregates all the patients currently waiting for an encounter';

comment on column clin.waiting_list.fk_patient is
	'the waiting patient';
comment on column clin.waiting_list.registered is
	'when did the patient arrive (enter the waiting list, that is)';
comment on column clin.waiting_list.urgency is
	'relative urgency, used by practices as they see fit,
	   0 - "standard" urgency
	 < 0 - less urgent
	 > 0 - more urgent';
comment on column clin.waiting_list.list_position is
	'the currently assigned position of
	 this patient on the waiting list';
comment on column clin.waiting_list.comment is
	'a free comment regarding this entry,
	 NOT THE RFE !';

-- =============================================
-- do simple schema revision tracking
select log_script_insertion('$RCSfile: gmWaitingList.sql,v $', '$Revision: 1.4 $');

-- =============================================
-- $Log: gmWaitingList.sql,v $
-- Revision 1.4  2006-01-06 10:12:02  ncq
-- - add missing grants
-- - add_table_for_audit() now in "audit" schema
-- - demographics now in "dem" schema
-- - add view v_inds4vaccine
-- - move staff_role from clinical into demographics
-- - put add_coded_term() into "clin" schema
-- - put German things into "de_de" schema
--
-- Revision 1.3  2006/01/05 16:04:37  ncq
-- - move auditing to its own schema "audit"
--
-- Revision 1.2  2005/11/25 15:07:28  ncq
-- - create schema "clin" and move all things clinical into it
--
-- Revision 1.1  2005/09/21 10:18:59  ncq
-- - start waiting list
--