--[RDS].[T_EXPORT_FRLLO_NEEDS]
CREATE TABLE [RDS].[T_EXPORT_FRLLO_NEEDS]
(
    [ExportFrlloNeedsID] int NOT NULL,
    [Users] uniqueidentifier NULL,
    [Status] int NULL,
    [ReceiveDateTime] datetime NULL,
    [Statistics] varbinary(max) NULL
)
ON [PRIMARY]
GO

-- Alters

ALTER TABLE [RDS].[T_EXPORT_FRLLO_NEEDS] ADD CONSTRAINT [PK_T_EXPORT_FRLLO_NEEDS]
PRIMARY KEY CLUSTERED ([ExportFrlloNeedsID]) ON [PRIMARY]
GO

ALTER TABLE [RDS].[T_EXPORT_FRLLO_NEEDS] ADD CONSTRAINT [FK_T_USERS_T_EXPORT_FRLLO_NEEDS_Users]
FOREIGN KEY([Users]) REFERENCES [RDS].[T_USERS] ([UserID])
GO
--------------------------------------------------------------------------
--[RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT]
CREATE TABLE [RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT]
(
    [ExportFrlloNeedsElementID] int NOT NULL,
    [ExportFrlloNeeds] int NULL,
    [prognosis_needs_id] varchar(255) NULL,
    [appl_prcd_code] varchar(255) NULL,
    [region_okato5] varchar(255) NULL,
    [EhrRusSdo8u3n5ro] uniqueidentifier NULL,
    [EhrRusMkb308] uniqueidentifier NULL,
    [qty_mkb10_code] int NULL,
    [qty_benefit] int NULL,
    [equip_id] varchar(100) NULL,
    [equip_ext_id] varchar(100) NULL,
    [EhrRus9a9g09e8kl] uniqueidentifier NULL,
    [drug_name] varchar(1000) NULL,
    [EhrRusP08TSH954N] uniqueidentifier NULL,
    [EhrRus575VSF88OG] uniqueidentifier NULL,
    [qty_count] decimal(31, 10) NULL,
    [date_count] datetime NULL,
    [qty_confirm] int NULL,
    [FileNumber] int NULL
)
ON [PRIMARY]
GO

-- Alters

ALTER TABLE [RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT] ADD CONSTRAINT [PK_T_EXPORT_FRLLO_NEEDS_ELEMENT]
PRIMARY KEY CLUSTERED ([ExportFrlloNeedsElementID]) ON [PRIMARY]
GO

ALTER TABLE [RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT] ADD CONSTRAINT [FK_T_EXPORT_FRLLO_NEEDS_T_EXPORT_FRLLO_NEEDS_ELEMENT_ExportFrlloNeeds]
FOREIGN KEY([ExportFrlloNeeds]) REFERENCES [RDS].[T_EXPORT_FRLLO_NEEDS] ([ExportFrlloNeedsID])
GO

ALTER TABLE [RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT] ADD CONSTRAINT [FK_T_EHR_RUS_SDO8U3N5RO_T_EXPORT_FRLLO_NEEDS_ELEMENT_EhrRusSdo8u3n5ro]
FOREIGN KEY([EhrRusSdo8u3n5ro]) REFERENCES [EHR].[T_EHR_RUS_SDO8U3N5RO] ([EhrRusID])
GO

ALTER TABLE [RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT] ADD CONSTRAINT [FK_T_EHR_RUS_MKB308_T_EXPORT_FRLLO_NEEDS_ELEMENT_EhrRusMkb308]
FOREIGN KEY([EhrRusMkb308]) REFERENCES [EHR].[T_EHR_RUS_MKB308] ([EhrRusID])
GO

ALTER TABLE [RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT] ADD CONSTRAINT [FK_T_EHR_RUS_9A9G09E8KL_T_EXPORT_FRLLO_NEEDS_ELEMENT_EhrRus9a9g09e8kl]
FOREIGN KEY([EhrRus9a9g09e8kl]) REFERENCES [EHR].[T_EHR_RUS_9A9G09E8KL] ([EhrRusID])
GO

ALTER TABLE [RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT] ADD CONSTRAINT [FK_T_EHR_RUS_P08TSH954N_T_EXPORT_FRLLO_NEEDS_ELEMENT_EhrRusP08TSH954N]
FOREIGN KEY([EhrRusP08TSH954N]) REFERENCES [EHR].[T_EHR_RUS_P08TSH954N] ([EhrRusID])
GO

ALTER TABLE [RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT] ADD CONSTRAINT [FK_T_EHR_RUS_575VSF88OG_T_EXPORT_FRLLO_NEEDS_ELEMENT_EhrRus575VSF88OG]
FOREIGN KEY([EhrRus575VSF88OG]) REFERENCES [EHR].[T_EHR_RUS_575VSF88OG] ([EhrRusID])
GO
