DROP TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION
GO

DROP TABLE AKUZ.T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH
GO

CREATE TABLE [AKUZ].[T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION]
(
    [FpumpStcSimultaneousServiceZnoContraindicationID] uniqueidentifier NOT NULL,
    [Contraindication] uniqueidentifier NULL,
    [RegistrationDate] datetime NULL,
    [SimultaneousService] uniqueidentifier NOT NULL
)
ON [PRIMARY]
GO

ALTER TABLE [AKUZ].[T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION] ADD CONSTRAINT [PK_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION]
PRIMARY KEY CLUSTERED ([FpumpStcSimultaneousServiceZnoContraindicationID]) ON [PRIMARY]
GO

ALTER TABLE [AKUZ].[T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION] ADD CONSTRAINT [FK_T_N001_ONKPROT_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION_Contraindication]
FOREIGN KEY([Contraindication]) REFERENCES [AKUZ].[T_N001_OnkPrOt] ([N001ID])
GO

ALTER TABLE [AKUZ].[T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION] ADD CONSTRAINT [FK_T_FPUMP_STC_SIMULTANEOUS_SERVICE_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_CONTRAINDICATION_SimultaneousService]
FOREIGN KEY([SimultaneousService]) REFERENCES [AKUZ].[T_FPUMP_STC_SIMULTANEOUS_SERVICE] ([FpumpStcSimultaneousServiceID])
GO

CREATE TABLE [AKUZ].[T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH]
(
    [FpumpStcSimultaneousServiceZnoResearchID] uniqueidentifier NOT NULL,
    [MaterialCollectDate] datetime NULL,
    [IsResultReceived] bit NOT NULL,
    [MarkTypeCode] int NULL,
    [Mark] uniqueidentifier NULL,
    [Result] uniqueidentifier NULL,
    [SimultaneousService] uniqueidentifier NOT NULL
)
ON [PRIMARY]
GO

ALTER TABLE [AKUZ].[T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH] ADD CONSTRAINT [PK_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH]
PRIMARY KEY CLUSTERED ([FpumpStcSimultaneousServiceZnoResearchID]) ON [PRIMARY]
GO

ALTER TABLE [AKUZ].[T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH] ADD CONSTRAINT [FK_T_N007_ONKMRF_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH_Mark]
FOREIGN KEY([Mark]) REFERENCES [AKUZ].[T_N007_OnkMrf] ([N007ID])
GO

ALTER TABLE [AKUZ].[T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH] ADD CONSTRAINT [FK_T_N008_ONKMRFRT_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH_Result]
FOREIGN KEY([Result]) REFERENCES [AKUZ].[T_N008_OnkMrfRt] ([N008ID])
GO

ALTER TABLE [AKUZ].[T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH] ADD CONSTRAINT [FK_T_FPUMP_STC_SIMULTANEOUS_SERVICE_T_FPUMP_STC_SIMULTANEOUS_SERVICE_ZNO_RESEARCH_SimultaneousService]
FOREIGN KEY([SimultaneousService]) REFERENCES [AKUZ].[T_FPUMP_STC_SIMULTANEOUS_SERVICE] ([FpumpStcSimultaneousServiceID])
GO
