-- Tables

/***** Object:  Table [AKUZ].[T_PROCEDURE_JOURNAL_NOTE] *****/
CREATE TABLE [AKUZ].[T_PROCEDURE_JOURNAL_NOTE]
(
    [ProcedureJournalNoteID] uniqueidentifier NOT NULL,
    [AmbulanceCard] uniqueidentifier NOT NULL,
    [Research] uniqueidentifier NOT NULL,
    [Resource] int NOT NULL,
    [RouteDateTime] datetime NOT NULL,
    [PerformerPost] int NULL,
    [PerformerDateTime] datetime NULL,
    [Comment] varchar(1024) NULL
)
ON [PRIMARY]
GO

-- Alters

ALTER TABLE [AKUZ].[T_PROCEDURE_JOURNAL_NOTE] ADD CONSTRAINT [PK_T_PROCEDURE_JOURNAL_NOTE]
PRIMARY KEY CLUSTERED ([ProcedureJournalNoteID]) ON [PRIMARY]
GO

ALTER TABLE [AKUZ].[T_PROCEDURE_JOURNAL_NOTE] ADD CONSTRAINT [FK_T_AMBULANCE_CARD_T_PROCEDURE_JOURNAL_NOTE_AmbulanceCard]
FOREIGN KEY([AmbulanceCard]) REFERENCES [AKUZ].[T_AMBULANCE_CARD] ([AmbulanceCardID])
GO

ALTER TABLE [AKUZ].[T_PROCEDURE_JOURNAL_NOTE] ADD CONSTRAINT [FK_T_RESEARCH_T_PROCEDURE_JOURNAL_NOTE_Research]
FOREIGN KEY([Research]) REFERENCES [AKUZ].[T_RESEARCH] ([MedicalServiceID])
GO

ALTER TABLE [AKUZ].[T_PROCEDURE_JOURNAL_NOTE] ADD CONSTRAINT [FK_T_RESOURCE_T_PROCEDURE_JOURNAL_NOTE_Resource]
FOREIGN KEY([Resource]) REFERENCES [AKUZ].[T_RESOURCE] ([ResourceID])
GO

ALTER TABLE [AKUZ].[T_PROCEDURE_JOURNAL_NOTE] ADD CONSTRAINT [FK_T_POST_T_PROCEDURE_JOURNAL_NOTE_PerformerPost]
FOREIGN KEY([PerformerPost]) REFERENCES [AKUZ].[T_POST] ([ResourceID])
GO

