update create.sql
This commit is contained in:
parent
1d3bcc6efe
commit
71f280027d
@ -22,12 +22,12 @@ GO
|
|||||||
DROP TABLE IF EXISTS dim_drugs;
|
DROP TABLE IF EXISTS dim_drugs;
|
||||||
CREATE TABLE dim_drugs (
|
CREATE TABLE dim_drugs (
|
||||||
drug_sk INTEGER identity(1, 1) PRIMARY KEY,
|
drug_sk INTEGER identity(1, 1) PRIMARY KEY,
|
||||||
DrugProductId INTEGER NOT NULL, -- business key
|
drug_product_id_bk INTEGER NOT NULL, -- business key
|
||||||
RecordStatus CHAR(1), -- A for active, D for deactivated
|
record_status CHAR(1), -- A for active, D for deactivated
|
||||||
DrugProductName NVARCHAR(250),
|
drug_product_name NVARCHAR(250),
|
||||||
RONumber NVARCHAR(20),
|
ro_number NVARCHAR(20),
|
||||||
DrugProductFamilyId INTEGER,
|
drug_product_family_id INTEGER,
|
||||||
DrugProductFamilyName NVARCHAR(250)
|
drug_product_family_name NVARCHAR(250)
|
||||||
);
|
);
|
||||||
GO
|
GO
|
||||||
|
|
||||||
@ -41,13 +41,13 @@ CREATE TABLE dim_countries (
|
|||||||
DROP TABLE IF EXISTS dim_claim_statuses;
|
DROP TABLE IF EXISTS dim_claim_statuses;
|
||||||
CREATE TABLE dim_claim_statuses (
|
CREATE TABLE dim_claim_statuses (
|
||||||
claim_status_sk INTEGER identity(1, 1) PRIMARY KEY,
|
claim_status_sk INTEGER identity(1, 1) PRIMARY KEY,
|
||||||
status_code VARCHAR(1) NOT NULL, -- A for Accepted, D for Declined, W for Waiting
|
status_code_bk VARCHAR(1) NOT NULL, -- A for Accepted, D for Declined, W for Waiting
|
||||||
status_description NVARCHAR(50)
|
status_description NVARCHAR(50)
|
||||||
);
|
);
|
||||||
GO
|
GO
|
||||||
|
|
||||||
-- insert statuses
|
-- insert statuses
|
||||||
INSERT INTO dim_claim_statuses(status_code, status_description)
|
INSERT INTO dim_claim_statuses(status_code_bk, status_description)
|
||||||
VALUES
|
VALUES
|
||||||
('A', 'Accepted'),
|
('A', 'Accepted'),
|
||||||
('D', 'Declined'),
|
('D', 'Declined'),
|
||||||
@ -57,9 +57,9 @@ GO
|
|||||||
DROP TABLE IF EXISTS dim_indications;
|
DROP TABLE IF EXISTS dim_indications;
|
||||||
CREATE TABLE dim_indications (
|
CREATE TABLE dim_indications (
|
||||||
indication_sk INTEGER identity(1, 1) PRIMARY KEY,
|
indication_sk INTEGER identity(1, 1) PRIMARY KEY,
|
||||||
IndicationId INTEGER NOT NULL,
|
indication_id_bk INTEGER NOT NULL,
|
||||||
RecordStatus CHAR(1),
|
record_status CHAR(1),
|
||||||
IndicationDescription NVARCHAR(500)
|
indication_description NVARCHAR(500)
|
||||||
);
|
);
|
||||||
GO
|
GO
|
||||||
|
|
||||||
@ -68,40 +68,43 @@ GO
|
|||||||
--IF OBJECT_ID('dbo.FT1_Registartion') IS NOT NULL DROP TABLE dbo.MyCategories;
|
--IF OBJECT_ID('dbo.FT1_Registartion') IS NOT NULL DROP TABLE dbo.MyCategories;
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS FT1_Registartion;
|
DROP TABLE IF EXISTS FT1_Registration;
|
||||||
CREATE TABLE FT1_Registartion (
|
CREATE TABLE FT1_Registration (
|
||||||
id INTEGER identity(1,1) PRIMARY KEY,
|
id INTEGER identity(1,1) PRIMARY KEY,
|
||||||
expected_response integer,
|
expected_response_fk integer,
|
||||||
submission_date integer,
|
submission_date_fk integer,
|
||||||
response_time integer,
|
response_time_fk integer,
|
||||||
drug_sk integer,
|
drug_fk integer,
|
||||||
factory_sk_API integer,
|
factory_API_fk integer,
|
||||||
factory_sk_bulk integer,
|
factory_bulk_fk integer,
|
||||||
factory_sk_package integer,
|
factory_package_fk integer,
|
||||||
country_sk integer,
|
country_fk integer,
|
||||||
--claim status do uspójnienia z tabelą dim_status, wydaje mi się, że można by dodać przedrostek claim do kolumn, będzie czytelniej :)
|
--claim status do uspójnienia z tabelą dim_status, wydaje mi się, że można by dodać przedrostek claim do kolumn, będzie czytelniej :)
|
||||||
claim_status_sk integer,
|
claim_status_fk integer,
|
||||||
indication_sk integer,
|
indication_fk integer,
|
||||||
claim_number integer,
|
claim_number integer,
|
||||||
-- cnt jest tylko zliczeniowy, będzie miał 1, więc dałbym tinyint
|
-- cnt jest tylko zliczeniowy, będzie miał 1, więc dałbym tinyint
|
||||||
cnt tinyint
|
cnt tinyint,
|
||||||
);
|
);
|
||||||
GO
|
GO
|
||||||
|
|
||||||
DROP TABLE IF EXISTS FT2_Refund;
|
DROP TABLE IF EXISTS FT2_Refund;
|
||||||
CREATE TABLE FT2_Registartion (
|
CREATE TABLE FT2_Refund (
|
||||||
id INTEGER identity(1,1) PRIMARY KEY,
|
id INTEGER identity(1,1) PRIMARY KEY,
|
||||||
claim_status_sk integer,
|
claim_status_fk integer,
|
||||||
drug_sk integer,
|
drug_fk integer,
|
||||||
submission_date integer,
|
submission_date_fk integer,
|
||||||
expected_response integer,
|
expected_response_fk integer,
|
||||||
country_sk integer,
|
response_time_fk integer,
|
||||||
indication_sk integer,
|
country_fk integer,
|
||||||
registration_country integer,
|
indication_fk integer,
|
||||||
|
registration_country_fk integer,
|
||||||
--decimal zjada mniej, niż money, do przedyskutowania (precyzja - liczba miejsc przed i po przecinku, skala - liczba miejsc po przecinku)
|
--decimal zjada mniej, niż money, do przedyskutowania (precyzja - liczba miejsc przed i po przecinku, skala - liczba miejsc po przecinku)
|
||||||
price decimal(9,2),
|
price money,
|
||||||
reimbursement_amountPercent smallint,
|
reimbursement_amountPercent smallint,
|
||||||
--tu obliczymy jako iloczyn price * reimbursement_amountPercent
|
--tu obliczymy jako iloczyn price * reimbursement_amountPercent
|
||||||
reimbursement_amount decimal(9,2),
|
reimbursement_amount decimal(9,2),
|
||||||
|
claim_number integer,
|
||||||
|
cnt tinyint,
|
||||||
);
|
);
|
||||||
GO
|
GO
|
Loading…
Reference in New Issue
Block a user