File: gmClinical.au.sql

package info (click to toggle)
gnumed-server 22.19-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 45,148 kB
  • sloc: sql: 1,217,279; python: 15,659; sh: 1,582; makefile: 20
file content (79 lines) | stat: -rw-r--r-- 2,642 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
-- Project: GNUmed - service "clinical" -- Australian specific stuff
-- ===================================================================
-- $Source: /home/ncq/Projekte/cvs2git/vcs-mirror/gnumed/gnumed/server/sql/country.specific/au/gmClinical.au.sql,v $
-- $Revision: 1.5 $
-- 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

-- ===================================================================
create schema au authorization "gm-dbo";

-- =============================================
create table au.referral (
	id serial primary key,
	fk_referee integer
		not null
		references clin.xlnk_identity(xfk_identity)
		on update cascade
		on delete restrict,
	fk_form integer
		not null
		references clin.form_instances (pk)
) inherits (clin.clin_root_item);

alter table au.referral add foreign key (fk_encounter)
		references clin.encounter(pk)
		on update cascade
		on delete restrict;
alter table au.referral add foreign key (fk_episode)
		references clin.episode(pk)
		on update cascade
		on delete restrict;

select audit.add_table_for_audit ('au', 'referral');

comment on table au.referral is 'table for referrals to defined individuals';
comment on column au.referral.fk_referee is 'person to whom the referral is directed';
comment on column au.referral.narrative is
	'inherited from clin.clin_root_item;
	 stores text of referral letter';
comment on column au.referral.fk_form is 'foreign key to the form instance of
this referral.';

-- ===================================================================
grant usage on schema "au" to group "gm-doctors";
GRANT SELECT, INSERT, UPDATE, DELETE ON
	au.referral
	to group "gm-doctors";


-- ===================================================================
-- $Log: gmClinical.au.sql,v $
-- Revision 1.5  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.4  2005/12/27 03:42:54  sjtan
--
-- grants to allow relinking episodes
--
-- Revision 1.3  2005/12/06 13:26:55  ncq
-- - clin.clin_encounter -> clin.encounter
-- - also id -> pk
--
-- Revision 1.2  2005/12/01 16:48:37  ncq
-- - improved
--
-- Revision 1.1  2005/12/01 16:46:50  ncq
-- - added schema "au"
--