/*
Navicat SQL Server Data Transfer

Source Server         : 9000
Source Server Version : 105000
Source Host           : .\sqlexpress:1433
Source Database       : LHBMS
Source Schema         : dbo

Target Server Type    : SQL Server
Target Server Version : 105000
File Encoding         : 65001

Date: 2021-05-11 15:28:26
*/


-- ----------------------------
-- Table structure for AlarmEvent
-- ----------------------------
DROP TABLE [dbo].[AlarmEvent]
GO
CREATE TABLE [dbo].[AlarmEvent] (
[ID] uniqueidentifier NOT NULL DEFAULT (newid()) ROWGUIDCOL ,
[EventCode] nvarchar(50) NOT NULL ,
[EventContent] nvarchar(100) NOT NULL ,
[EventType] nvarchar(50) NULL ,
[AlarmLevel] tinyint NULL ,
[EventDate] datetime NULL ,
[Operator] nvarchar(50) NULL ,
[OrgzID] uniqueidentifier NULL ,
[OrgzName] nvarchar(50) NULL ,
[DeviceID] uniqueidentifier NULL ,
[DeviceName] nvarchar(50) NULL ,
[DeviceEndpoint] nvarchar(50) NULL ,
[Owner] nvarchar(50) NULL ,
[OwnerTelphone] nvarchar(20) NULL ,
[AreaNo] int NULL ,
[AreaName] nvarchar(50) NULL ,
[ZoneNo] int NULL ,
[ZoneName] nvarchar(50) NULL ,
[PersonID] uniqueidentifier NULL ,
[PersonName] nvarchar(50) NULL ,
[PersonAddress] nvarchar(50) NULL ,
[IsDK903Event] bit NULL ,
[IsEventTriger] bit NULL ,
[ETail] nvarchar(50) NULL ,
[RTail] nvarchar(50) NULL ,
[EventStatus] tinyint NULL DEFAULT ((0)) ,
[CallTime] datetime NULL ,
[Weather] nvarchar(50) NULL ,
[PreDeal] nvarchar(50) NULL ,
[Manager] nvarchar(50) NULL ,
[Watcher] nvarchar(50) NULL ,
[OutTime] datetime NULL ,
[OutType] nvarchar(50) NULL ,
[Suspect] nvarchar(50) NULL ,
[Scene] nvarchar(50) NULL ,
[DealResult] nvarchar(50) NULL ,
[Feedback] nvarchar(50) NULL ,
[ColorE_B] nvarchar(50) NULL ,
[ColorE_F] nvarchar(50) NULL 
)


GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'Owner')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'负责人'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Owner'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'负责人'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Owner'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'OwnerTelphone')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'负责人联系电话'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'OwnerTelphone'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'负责人联系电话'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'OwnerTelphone'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'ETail')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'触发的提示'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'ETail'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'触发的提示'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'ETail'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'RTail')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'恢复提示'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'RTail'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'恢复提示'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'RTail'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'EventStatus')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'事件状态'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'EventStatus'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'事件状态'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'EventStatus'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'CallTime')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'报警时间'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'CallTime'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'报警时间'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'CallTime'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'Weather')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'天气描述'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Weather'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'天气描述'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Weather'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'PreDeal')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'预处理'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'PreDeal'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'预处理'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'PreDeal'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'Manager')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'值班负责人'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Manager'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'值班负责人'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Manager'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'Watcher')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'值班员'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Watcher'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'值班员'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Watcher'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'OutTime')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'出警时间'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'OutTime'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'出警时间'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'OutTime'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'OutType')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'出警方式'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'OutType'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'出警方式'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'OutType'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'Suspect')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'嫌疑人'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Suspect'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'嫌疑人'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Suspect'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'Scene')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'现场情况'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Scene'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'现场情况'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Scene'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'DealResult')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'处警结果'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'DealResult'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'处警结果'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'DealResult'
GO
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'AlarmEvent', 
'COLUMN', N'Feedback')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'用户评价'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Feedback'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'用户评价'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'AlarmEvent'
, @level2type = 'COLUMN', @level2name = N'Feedback'
GO

-- ----------------------------
-- Records of AlarmEvent
-- ----------------------------

-- ----------------------------
-- Indexes structure for table AlarmEvent
-- ----------------------------
CREATE INDEX [IX_AlarmEvent_EventDate] ON [dbo].[AlarmEvent]
([EventDate] ASC) 
WITH (FILLFACTOR = 30)
GO
CREATE INDEX [IX_AlarmEvent_EventType] ON [dbo].[AlarmEvent]
([EventType] ASC) 
WITH (FILLFACTOR = 30)
GO
CREATE INDEX [IX_AlarmEvent_AlarmLevel] ON [dbo].[AlarmEvent]
([AlarmLevel] ASC) 
WITH (FILLFACTOR = 30)
GO
CREATE INDEX [IX_AlarmEvent_EventCode] ON [dbo].[AlarmEvent]
([EventCode] ASC) 
WITH (FILLFACTOR = 30)
GO
CREATE INDEX [IX_AlarmEvent_DeviceName] ON [dbo].[AlarmEvent]
([DeviceName] ASC) 
WITH (FILLFACTOR = 30)
GO
CREATE INDEX [IX_AlarmEvent_DeviceEndpoint] ON [dbo].[AlarmEvent]
([DeviceEndpoint] ASC) 
WITH (FILLFACTOR = 30)
GO

-- ----------------------------
-- Primary Key structure for table AlarmEvent
-- ----------------------------
ALTER TABLE [dbo].[AlarmEvent] ADD PRIMARY KEY ([ID])
GO
