File: v15-staging-hl7-static.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 (80 lines) | stat: -rw-r--r-- 2,282 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
-- ==============================================================
-- GNUmed database schema change script
--
-- License: GPL v2 or later
-- Author: karsten.hilbert@gmx.net
-- 
-- ==============================================================
\set ON_ERROR_STOP 1

-- --------------------------------------------------------------
create schema staging authorization "gm-dbo";

-- --------------------------------------------------------------
create table staging.lab_request (
	like clin.lab_request
		including defaults
		including constraints
		including indexes
);

alter table staging.lab_request
	add column fk_incoming_data_unmatched integer;

--CREATE TABLE staging.lab_request (
--    pk integer primary key,
--    fk_incoming_data_unmatched integer,
--    fk_test_org integer,
--    request_id text,
--    fk_requestor integer,
--    orig_requestor text,
--    lab_request_id text,
--    lab_rxd_when timestamp with time zone,
--    results_reported_when timestamp with time zone,
--    request_status text,
--    is_pending boolean,
--    diagnostic_service_section text,
--    ordered_service text
--) inherits (clin.clin_root_item);

alter table staging.lab_request
	drop column fk_encounter;

-- --------------------------------------------------------------
create table staging.test_result (
	like clin.test_result
		including defaults
		including constraints
		including indexes
);

alter table staging.test_result
	add column orig_intended_reviewer text;

--CREATE TABLE staging.test_result (
--    pk integer primary key,
--    fk_type integer,
--    fk_request integer,
--    val_num numeric,
--    val_alpha text,
--    val_unit text,
--    val_normal_min numeric,
--    val_normal_max numeric,
--    val_normal_range text,
--    val_target_min numeric,
--    val_target_max numeric,
--    val_target_range text,
--    abnormality_indicator text,
--    norm_ref_group text,
--    note_test_org text,
--    material text,
--    material_detail text,
--    fk_intended_reviewer integer,
--    orig_intended_reviewer text
--) inherits (clin.clin_root_item);

alter table staging.test_result
	drop column fk_encounter;

-- --------------------------------------------------------------
select gm.log_script_insertion('v15-staging-hl7-static.sql', 'Revision: 1.1');