if exists (select 1
            from  sysobjects
           where  id = object_id('DR_CONTROLLER')
            and   type = 'U')
   drop table DR_CONTROLLER
go

if exists (select 1
            from  sysobjects
           where  id = object_id('DR_DOOR')
            and   type = 'U')
   drop table DR_DOOR
go

if exists (select 1
            from  sysobjects
           where  id = object_id('DR_READER')
            and   type = 'U')
   drop table DR_READER
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_ATTACH_LOG')
            and   type = 'U')
   drop table EV_ATTACH_LOG
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_CARD')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index EV_CARD.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_CARD')
            and   type = 'U')
   drop table EV_CARD
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_CARD_READ_LOG')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index EV_CARD_READ_LOG.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_CARD_READ_LOG')
            and   type = 'U')
   drop table EV_CARD_READ_LOG
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_DICT')
            and   type = 'U')
   drop table EV_DICT
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_EVENT_LOG')
            and   type = 'U')
   drop table EV_EVENT_LOG
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_GROUP_DETAIL')
            and   name  = 'Index_3'
            and   indid > 0
            and   indid < 255)
   drop index EV_GROUP_DETAIL.Index_3
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_GROUP_DETAIL')
            and   name  = 'Index_2'
            and   indid > 0
            and   indid < 255)
   drop index EV_GROUP_DETAIL.Index_2
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_GROUP_DETAIL')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index EV_GROUP_DETAIL.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_GROUP_DETAIL')
            and   type = 'U')
   drop table EV_GROUP_DETAIL
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_GUEST_ORG')
            and   type = 'U')
   drop table EV_GUEST_ORG
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_HOST')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index EV_HOST.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_HOST')
            and   type = 'U')
   drop table EV_HOST
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_IMAGE')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index EV_IMAGE.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_IMAGE')
            and   type = 'U')
   drop table EV_IMAGE
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_INFO_EXT')
            and   name  = 'Index_7'
            and   indid > 0
            and   indid < 255)
   drop index EV_INFO_EXT.Index_7
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_INFO_EXT')
            and   name  = 'Index_6'
            and   indid > 0
            and   indid < 255)
   drop index EV_INFO_EXT.Index_6
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_INFO_EXT')
            and   name  = 'Index_5'
            and   indid > 0
            and   indid < 255)
   drop index EV_INFO_EXT.Index_5
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_INFO_EXT')
            and   name  = 'Index_4'
            and   indid > 0
            and   indid < 255)
   drop index EV_INFO_EXT.Index_4
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_INFO_EXT')
            and   name  = 'Index_3'
            and   indid > 0
            and   indid < 255)
   drop index EV_INFO_EXT.Index_3
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_INFO_EXT')
            and   name  = 'Index_2'
            and   indid > 0
            and   indid < 255)
   drop index EV_INFO_EXT.Index_2
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_INFO_EXT')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index EV_INFO_EXT.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_INFO_EXT')
            and   type = 'U')
   drop table EV_INFO_EXT
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_KQ_REC')
            and   name  = 'Index_2'
            and   indid > 0
            and   indid < 255)
   drop index EV_KQ_REC.Index_2
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_KQ_REC')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index EV_KQ_REC.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_KQ_REC')
            and   type = 'U')
   drop table EV_KQ_REC
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_KQ_ROUND')
            and   type = 'U')
   drop table EV_KQ_ROUND
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_KQ_STAT')
            and   name  = 'Index_2'
            and   indid > 0
            and   indid < 255)
   drop index EV_KQ_STAT.Index_2
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_KQ_STAT')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index EV_KQ_STAT.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_KQ_STAT')
            and   type = 'U')
   drop table EV_KQ_STAT
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_KQ_WORKDAY')
            and   type = 'U')
   drop table EV_KQ_WORKDAY
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_MAN')
            and   name  = 'Index_2'
            and   indid > 0
            and   indid < 255)
   drop index EV_MAN.Index_2
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_MAN')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index EV_MAN.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_MAN')
            and   type = 'U')
   drop table EV_MAN
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_MAN_GROUP')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index EV_MAN_GROUP.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_MAN_GROUP')
            and   type = 'U')
   drop table EV_MAN_GROUP
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_MAN_ID')
            and   type = 'U')
   drop table EV_MAN_ID
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_MAN_ROLERIGHT')
            and   type = 'U')
   drop table EV_MAN_ROLERIGHT
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_NOTICE_LIST')
            and   type = 'U')
   drop table EV_NOTICE_LIST
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_OPER_LOG')
            and   type = 'U')
   drop table EV_OPER_LOG
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_ORG')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index EV_ORG.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_ORG')
            and   type = 'U')
   drop table EV_ORG
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_ROLE_RIGHT')
            and   type = 'U')
   drop table EV_ROLE_RIGHT
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_USER')
            and   type = 'U')
   drop table EV_USER
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('EV_VISIT_LOG')
            and   name  = 'Index_3'
            and   indid > 0
            and   indid < 255)
   drop index EV_VISIT_LOG.Index_3
go

if exists (select 1
            from  sysobjects
           where  id = object_id('EV_VISIT_LOG')
            and   type = 'U')
   drop table EV_VISIT_LOG
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('GS_CARD')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index GS_CARD.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('GS_CARD')
            and   type = 'U')
   drop table GS_CARD
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('GS_CARD_EVENT_LOG')
            and   name  = 'Index_2'
            and   indid > 0
            and   indid < 255)
   drop index GS_CARD_EVENT_LOG.Index_2
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('GS_CARD_EVENT_LOG')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index GS_CARD_EVENT_LOG.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('GS_CARD_EVENT_LOG')
            and   type = 'U')
   drop table GS_CARD_EVENT_LOG
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('GS_CARD_READ_LOG')
            and   name  = 'Index_2'
            and   indid > 0
            and   indid < 255)
   drop index GS_CARD_READ_LOG.Index_2
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('GS_CARD_READ_LOG')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index GS_CARD_READ_LOG.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('GS_CARD_READ_LOG')
            and   type = 'U')
   drop table GS_CARD_READ_LOG
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('GS_INFO')
            and   name  = 'Index_3'
            and   indid > 0
            and   indid < 255)
   drop index GS_INFO.Index_3
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('GS_INFO')
            and   name  = 'Index_2'
            and   indid > 0
            and   indid < 255)
   drop index GS_INFO.Index_2
go

if exists (select 1
            from  sysindexes
           where  id    = object_id('GS_INFO')
            and   name  = 'Index_1'
            and   indid > 0
            and   indid < 255)
   drop index GS_INFO.Index_1
go

if exists (select 1
            from  sysobjects
           where  id = object_id('GS_INFO')
            and   type = 'U')
   drop table GS_INFO
go

if exists (select 1
            from  sysobjects
           where  id = object_id('MT_CHECK')
            and   type = 'U')
   drop table MT_CHECK
go

if exists (select 1
            from  sysobjects
           where  id = object_id('MT_MAN')
            and   type = 'U')
   drop table MT_MAN
go

if exists (select 1
            from  sysobjects
           where  id = object_id('MT_MEET')
            and   type = 'U')
   drop table MT_MEET
go

if exists (select 1
            from  sysobjects
           where  id = object_id('MT_ROOM')
            and   type = 'U')
   drop table MT_ROOM
go

if exists (select 1
            from  sysobjects
           where  id = object_id('MT_SUB')
            and   type = 'U')
   drop table MT_SUB
go

if exists (select 1
            from  sysobjects
           where  id = object_id('SYS_MESSAGE')
            and   type = 'U')
   drop table SYS_MESSAGE
go

if exists (select 1
            from  sysobjects
           where  id = object_id('SYS_SESSION')
            and   type = 'U')
   drop table SYS_SESSION
go

create table DR_CONTROLLER (
   dcid                 numeric              identity,
   snid                 varchar(128)         null,
   name                 varchar(128)         null,
   dcType               varchar(8)           null,
   enabled              varchar(8)           null,
   comstr               varchar(128)         null,
   mask                 varchar(20)          null,
   gate                 varchar(20)          null,
   mac                  varchar(128)         null,
   softwareVer          varchar(128)         null,
   createTime           varchar(25)          null,
   syncTime             varchar(25)          null,
   memory               varchar(255)         null,
   reserved             varchar(255)         null,
   constraint PK_DR_CONTROLLER primary key (dcid)
)
go

create table DR_DOOR (
   doorId               numeric              identity,
   dcid                 int                  null,
   name                 varchar(128)         null,
   doorIndex            int                  null,
   onlineState          varchar(8)           null,
   openDelay            int                  null,
   enabled              int                  null,
   reserved             varchar(255)         null,
   constraint PK_DR_DOOR primary key (doorId)
)
go

create table DR_READER (
   readerId             numeric              identity,
   doorId               numeric              null,
   name                 varchar(128)         null,
   direction            varchar(8)           null,
   readerIndex          int                  null,
   timeBook             varchar(8)           null,
   reserved             varchar(255)         null,
   constraint PK_DR_READER primary key (readerId)
)
go

create table EV_ATTACH_LOG (
   ATTACHID             numeric              identity,
   VISITLOGID           int                  null,
   ATTACHTYPE           varchar(128)         null,
   ATTACHCOUNT          int                  null,
   MEMORY               varchar(255)         null,
   reserved             varchar(255)         null,
   constraint PK_EV_ATTACH_LOG primary key (ATTACHID)
)
go

create table EV_CARD (
   CARDRECID            numeric              identity,
   CARDID               varchar(20)          not null,
   CARDTYPE             int                  null,
   USERID               int                  null,
   RELBIZINFO           varchar(255)         null,
   USERNAME             varchar(128)         null,
   CARDSTATE            int                  null,
   EFFDATE              varchar(25)          null,
   EXPDATE              varchar(25)          null,
   MEMORY               varchar(255)         null,
   reserved             varchar(255)         null,
   constraint PK_EV_CARD primary key nonclustered (CARDRECID)
)
go

create index Index_1 on EV_CARD (
CARDID ASC
)
go

create table EV_CARD_READ_LOG (
   READLOGID            numeric              identity,
   CARDRECID            int                  null,
   READDATE             varchar(25)          not null,
   CARDID               varchar(20)          null,
   NAME                 varchar(128)         null,
   CARDTYPE             int                  null,
   ASSOINFO             varchar(255)         null,
   OPERATORID           int                  null,
   GUARD                int                  not null,
   recType              varchar(8)           null,
   opDir                varchar(255)         null,
   opResult             varchar(255)         null,
   pic                  varchar(255)         null,
   MEMORY               varchar(255)         null,
   STATE                int                  null,
   r1                   varchar(255)         null,
   r2                   varchar(255)         null,
   r3                   varchar(255)         null,
   constraint PK_EV_CARD_READ_LOG primary key nonclustered (READLOGID)
)
go

create index Index_1 on EV_CARD_READ_LOG (
READDATE ASC
)
go

create table EV_DICT (
   DID                  numeric              identity,
   RECTYPE              varchar(8)           null,
   DCODE                varchar(128)         not null,
   DKEY                 varchar(128)         not null,
   DNAME                varchar(128)         null,
   DVALUE               varchar(255)         null,
   DGROUP               varchar(255)         null,
   MEMORY               varchar(255)         null,
   WORK                 int                  not null,
   ORDERINDEX           int                  null,
   reserved             varchar(255)         null,
   constraint PK_EV_DICT primary key nonclustered (DID)
)
go

create table EV_EVENT_LOG (
   LOGID                numeric              identity,
   OPERATORID           int                  null,
   GUARD                int                  not null,
   CARDTYPE             int                  null,
   eventObjectId        varchar(128)         null,
   EVENTTYPE            int                  null,
   NAME                 varchar(128)         null,
   OCCURDATE            varchar(25)          null,
   EFFDATE              varchar(25)          null,
   EXPDATE              varchar(25)          null,
   MEMORY               varchar(255)         null,
   bizowner             varchar(255)         null,
   recType              varchar(8)           null,
   operated             varchar(255)         null,
   opDir                varchar(255)         null,
   opResult             varchar(255)         null,
   e1                   varchar(255)         null,
   e2                   varchar(255)         null,
   e3                   varchar(255)         null,
   constraint PK_EV_EVENT_LOG primary key nonclustered (LOGID)
)
go

create table EV_GROUP_DETAIL (
   DETAILID             numeric              identity,
   groupid              int                  null,
   MANID                int                  null,
   CREATETIME           varchar(25)          null,
   ORDERINDEX           int                  not null,
   constraint PK_EV_GROUP_DETAIL primary key (DETAILID)
)
go

create index Index_1 on EV_GROUP_DETAIL (
groupid ASC
)
go

create index Index_2 on EV_GROUP_DETAIL (
MANID ASC
)
go

create unique index Index_3 on EV_GROUP_DETAIL (
groupid ASC,
MANID ASC
)
go

create table EV_GUEST_ORG (
   ORGID                numeric              identity,
   NAME                 varchar(255)         not null,
   ADDRESS              varchar(255)         null,
   PHONE                varchar(255)         null,
   MEMORY               varchar(255)         null,
   GO1                  varchar(255)         null,
   GO2                  varchar(255)         null,
   constraint PK_4 primary key nonclustered (NAME)
)
go

create table EV_HOST (
   HOSTID               numeric              identity,
   HOSTNAME             varchar(128)         not null,
   PHONE                varchar(128)         null,
   ADDRESS              varchar(128)         null,
   EMAIL                varchar(128)         null,
   H1                   varchar(255)         null,
   H2                   varchar(255)         null,
   H3                   varchar(255)         null,
   H4                   varchar(255)         null,
   H5                   varchar(255)         null,
   recType              varchar(8)           null,
   nbr                  varchar(255)         null,
   state1               varchar(8)           null,
   state2               varchar(8)           null,
   state3               varchar(8)           null,
   ext1                 varchar(255)         null,
   ext2                 varchar(255)         null,
   ext3                 varchar(255)         null,
   ext4                 varchar(255)         null,
   ext5                 varchar(255)         null,
   constraint PK_2 primary key nonclustered (HOSTID)
)
go

create unique index Index_1 on EV_HOST (
HOSTNAME ASC
)
go

create table EV_IMAGE (
   IMAGEID              numeric              identity,
   FILEPATH             varchar(255)         null,
   DATA                 image                null,
   MEMORY               varchar(255)         null,
   STATE                int                  null,
   constraint PK_EV_IMAGE primary key nonclustered (IMAGEID)
)
go

create unique index Index_1 on EV_IMAGE (
FILEPATH ASC
)
go

create table EV_INFO_EXT (
   EXTID                numeric              identity,
   OBJTYPE              varchar(128)         null,
   OBJID                varchar(128)         null,
   ATTRSRC              varchar(255)         null,
   ATTRTYPE             varchar(128)         null,
   ATTRNAME             varchar(128)         null,
   ATTRVALUE            varchar(128)         null,
   PARENT               int                  null,
   FILTER               varchar(128)         null,
   ORDERINDEX           int                  null,
   reserved             varchar(255)         null
)
go

create index Index_1 on EV_INFO_EXT (
OBJTYPE ASC,
OBJID ASC
)
go

create index Index_2 on EV_INFO_EXT (
ATTRSRC ASC
)
go

create index Index_3 on EV_INFO_EXT (
ATTRTYPE ASC
)
go

create index Index_4 on EV_INFO_EXT (
ATTRNAME ASC
)
go

create index Index_5 on EV_INFO_EXT (
ATTRVALUE ASC
)
go

create index Index_6 on EV_INFO_EXT (
FILTER ASC
)
go

create index Index_7 on EV_INFO_EXT (
PARENT ASC
)
go

create table EV_KQ_REC (
   recId                numeric              identity,
   manId                int                  not null,
   dataSrc              varchar(128)         null,
   dataSrcId            varchar(128)         null,
   recDate              varchar(25)          not null,
   beginTime            varchar(25)          null,
   endTime              varchar(25)          null,
   come                 int                  null,
   leave                int                  null,
   offday               int                  null,
   overTime             int                  null,
   state                int                  null,
   createTime           varchar(25)          null,
   memory               varchar(255)         null,
   reserved1            varchar(255)         null,
   reserved2            varchar(255)         null,
   reserved3            varchar(255)         null,
   reserved4            varchar(255)         null,
   reserved5            varchar(255)         null,
   constraint PK_EV_KQ_REC primary key (recId)
)
go

create index Index_1 on EV_KQ_REC (
manId ASC
)
go

create index Index_2 on EV_KQ_REC (
recDate ASC
)
go

create table EV_KQ_ROUND (
   roundId              numeric              identity,
   roundName            varchar(128)         null,
   beginTime            int                  null,
   endTime              int                  null,
   memory               varchar(255)         null,
   reserved1            varchar(255)         null,
   reserved2            varchar(255)         null,
   reserved3            varchar(255)         null,
   reserved4            varchar(255)         null,
   reserved5            varchar(255)         null,
   constraint PK_EV_KQ_ROUND primary key (roundId)
)
go

create table EV_KQ_STAT (
   statId               numeric              identity,
   manId                int                  not null,
   cycleTime            varchar(128)         not null,
   absentTimes          int                  null,
   absentTime           int                  null,
   payOffdayTimes       int                  null,
   payOffdayTime        int                  null,
   noPayOffdayTimes     int                  null,
   noPayOffdayTime      int                  null,
   lateTimes            int                  null,
   lateTime             int                  null,
   leaveTimes           int                  null,
   leaveTime            int                  null,
   nOverTimes           int                  null,
   nOverTime            int                  null,
   wOverTimes           int                  null,
   wOverTime            int                  null,
   hOverTimes           int                  null,
   hOverTime            int                  null,
   memory               varchar(255)         null,
   reserved1            varchar(255)         null,
   reserved2            varchar(255)         null,
   reserved3            varchar(255)         null,
   reserved4            varchar(255)         null,
   reserved5            varchar(255)         null,
   constraint PK_EV_KQ_STAT primary key (statId)
)
go

create index Index_1 on EV_KQ_STAT (
cycleTime ASC
)
go

create index Index_2 on EV_KQ_STAT (
manId ASC
)
go

create table EV_KQ_WORKDAY (
   dayId                numeric              identity,
   dayGroup             varchar(128)         null,
   dayType              varchar(128)         null,
   dayDate              varchar(25)          null,
   beginTime            int                  null,
   endTime              int                  null,
   memory               varchar(255)         null,
   reserved1            varchar(255)         null,
   reserved2            varchar(255)         null,
   reserved3            varchar(255)         null,
   reserved4            varchar(255)         null,
   reserved5            varchar(255)         null,
   constraint PK_EV_KQ_WORKDAY primary key (dayId)
)
go

create table EV_MAN (
   MANID                numeric              identity,
   recType              varchar(8)           not null,
   ORGID                int                  null,
   LINKTYPECODE         varchar(255)         not null,
   NAME                 varchar(128)         not null,
   LOGINNAME            varchar(128)         not null,
   nbr                  varchar(255)         null,
   PHONE                varchar(128)         null,
   MOBILE               varchar(255)         null,
   EMAIL                varchar(128)         null,
   ADDRESS              varchar(128)         null,
   STATE                int                  null,
   operState            int                  null,
   BIZSTATE             varchar(255)         null,
   RECSTATE             varchar(8)           null,
   POSITION             varchar(255)         null,
   CAR                  varchar(255)         null,
   FINGLEPRINT          varchar(255)         null,
   LONGCARD             varchar(255)         null,
   LONGCARDREMAINS      varchar(255)         null,
   REMAIN               varchar(255)         null,
   ASSOMOBILE           varchar(255)         null,
   MSG                  varchar(255)         null,
   PASSWORD             varchar(255)         null,
   MEMORY               varchar(255)         null,
   m1                   varchar(255)         null,
   m2                   varchar(255)         null,
   m3                   varchar(255)         null,
   m4                   varchar(255)         null,
   m5                   varchar(255)         null,
   constraint PK_EV_MAN primary key nonclustered (MANID)
)
go

create unique index Index_1 on EV_MAN (
LOGINNAME ASC
)
go

create index Index_2 on EV_MAN (
PHONE ASC
)
go

create table EV_MAN_GROUP (
   groupid              numeric              identity,
   recType              varchar(8)           not null,
   name                 varchar(128)         not null,
   createTime           varchar(25)          null,
   memory               varchar(255)         null,
   constraint PK_EV_MAN_GROUP primary key (groupid)
)
go

create index Index_1 on EV_MAN_GROUP (
recType ASC
)
go

create table EV_MAN_ID (
   RECID                numeric              identity,
   MANID                int                  null,
   IDTYPE               varchar(128)         null,
   IDTYPECODE           varchar(128)         null,
   NAME                 varchar(128)         not null,
   KIND                 varchar(128)         null,
   SEX                  varchar(16)          null,
   BIRTHDAY             varchar(25)          null,
   ADDRESS              varchar(255)         null,
   CERT                 varchar(255)         null,
   EFFECT               varchar(25)          null,
   EXPIRE               varchar(25)          null,
   ADDIINFO             varchar(255)         null,
   CARDID               varchar(128)         not null,
   SCANHEADPIC          varchar(255)         null,
   SCANPIC              varchar(255)         null,
   i1                   varchar(255)         null,
   i2                   varchar(255)         null,
   i3                   varchar(255)         null,
   constraint PK_EV_MAN_ID primary key (RECID)
)
go

create table EV_MAN_ROLERIGHT (
   manRoleRightId       numeric              identity,
   manId                int                  not null,
   effectTime           varchar(25)          null,
   expireTime           varchar(25)          null,
   roleRightType        varchar(8)           null,
   roleRightId          int                  not null,
   relayEnabled         int                  null,
   memory               varchar(255)         null,
   reserved             varchar(255)         null,
   constraint PK_EV_MAN_ROLERIGHT primary key (manRoleRightId)
)
go

create table EV_NOTICE_LIST (
   NOTICEID             numeric              identity,
   ORGNAME              varchar(255)         null,
   CARDTYPE             int                  null,
   CARDID               varchar(128)         null,
   GUESTNAME            varchar(128)         null,
   NOTICETYPE           int                  not null,
   MEMORY               varchar(255)         null,
   reserved             varchar(255)         null,
   constraint PK_3 primary key nonclustered (NOTICEID, NOTICETYPE)
)
go

create table EV_OPER_LOG (
   LOGID                numeric              identity,
   USERID               int                  null,
   OPTIME               varchar(25)          null,
   GUARD                varchar(128)         null,
   MEMORY               varchar(255)         null,
   reserved             varchar(255)         null,
   constraint PK_EV_OPER_LOG primary key nonclustered (LOGID)
)
go

create table EV_ORG (
   ORGID                numeric              identity,
   RECTYPE              varchar(8)           not null,
   PARENT               int                  not null,
   UNITNAME             varchar(255)         not null,
   NAME                 varchar(255)         not null,
   ADDRESS              varchar(255)         null,
   PHONE                varchar(255)         null,
   MEMORY               varchar(255)         null,
   OLEVEL               varchar(255)         null,
   ROOMSTATE            varchar(255)         null,
   o1                   varchar(255)         null,
   o2                   varchar(255)         null,
   o3                   varchar(255)         null,
   constraint PK_1 primary key nonclustered (ORGID)
)
go

create unique index Index_1 on EV_ORG (
NAME ASC
)
go

create table EV_ROLE_RIGHT (
   roleRightId          numeric              identity,
   roleDid              int                  null,
   recType              varchar(8)           null,
   rightId              int                  null,
   memory               varchar(255)         null,
   reserved             varchar(255)         null,
   constraint PK_EV_ROLE_RIGHT primary key (roleRightId)
)
go

create table EV_USER (
   USERID               numeric              identity,
   USERNAME             varchar(128)         not null,
   PASSWORD             varchar(255)         not null,
   PHONE                varchar(255)         null,
   STATE                int                  not null,
   MEMORY               varchar(255)         null,
   MANID                int                  null,
   constraint PK_EV_USER primary key nonclustered (USERID)
)
go

create table EV_VISIT_LOG (
   VISITLOGID           numeric              identity,
   RECTYPE              varchar(8)           null,
   BIZCODE              varchar(8)           null,
   BIZSTATE             varchar(8)           null,
   GUESTID              varchar(255)         null,
   GUESTNAME            varchar(255)         null,
   GUESTTYPE            varchar(255)         null,
   RIGHTID              varchar(255)         null,
   RIGHTNAME            varchar(255)         null,
   HOSTID               varchar(255)         null,
   HOSTNAME             varchar(255)         null,
   APPROVER             varchar(128)         null,
   APPROVERNAME         varchar(255)         null,
   CAPTUREPIC           varchar(255)         null,
   CAPTUREID            varchar(255)         null,
   REASON               varchar(255)         null,
   DEPOSIT              varchar(20)          null,
   EXPECTCOMETIME       varchar(25)          null,
   EXPIRETIME           varchar(25)          null,
   EXPECTCHECKOUTTIME   varchar(25)          null,
   CHECKINTIME          varchar(25)          null,
   PEOPLECOUNT          int                  not null,
   CHECKOUTTIME         varchar(25)          null,
   HAVELEFTCOUNT        int                  null,
   STATE                int                  not null,
   INGUARD              int                  null,
   OUTGUARD             int                  null,
   INOPER               int                  null,
   OUTOPER              int                  null,
   TEMPCARD             varchar(255)         null,
   docNbr               varchar(255)         null,
   MEMORY               varchar(255)         null,
   CAR                  varchar(255)         null,
   REMAINCOUNT          varchar(255)         null,
   RELMAN               varchar(128)         null,
   CREATETIME           varchar(25)          null,
   l1                   varchar(255)         null,
   l2                   varchar(255)         null,
   l3                   varchar(255)         null,
   l4                   varchar(255)         null,
   l5                   varchar(255)         null,
   constraint PK_EV_VISIT_LOG primary key nonclustered (VISITLOGID)
)
go

create index Index_3 on EV_VISIT_LOG (
CHECKINTIME ASC
)
go

create table GS_CARD (
   CARDID               numeric              identity,
   CARD                 varchar(20)          not null,
   USERID               int                  null,
   STATE                int                  null,
   EFFTIME              varchar(25)          null,
   EXPTIME              varchar(25)          null,
   MEMORY               varchar(255)         null,
   constraint PK_GS_CARD primary key nonclustered (CARDID, CARD)
)
go

create index Index_1 on GS_CARD (
USERID ASC
)
go

create table GS_CARD_EVENT_LOG (
   logId                numeric              identity,
   CARDID               char(10)             null,
   card                 varchar(20)          null,
   userId               int                  null,
   eventtype            int                  null,
   occurtime            varchar(25)          null,
   endtime              varchar(25)          null,
   MEMORY               varchar(255)         null,
   constraint PK_GS_CARD_EVENT_LOG primary key nonclustered (logId)
)
go

create index Index_1 on GS_CARD_EVENT_LOG (
card ASC
)
go

create index Index_2 on GS_CARD_EVENT_LOG (
occurtime ASC
)
go

create table GS_CARD_READ_LOG (
   readLogId            numeric              identity,
   userId               int                  null,
   readtime             varchar(25)          not null,
   cardtype             int                  null,
   state                int                  null,
   hdinfo               varchar(128)         not null,
   MEMORY               varchar(255)         null,
   constraint PK_GS_CARD_READ_LOG primary key nonclustered (readLogId)
)
go

create index Index_1 on GS_CARD_READ_LOG (
readtime ASC
)
go

create index Index_2 on GS_CARD_READ_LOG (
userId ASC
)
go

create table GS_INFO (
   userId               numeric              identity,
   mankind              varchar(25)          null,
   SEX                  varchar(16)          null,
   BIRTHDAY             varchar(25)          null,
   ADDRESS              varchar(255)         null,
   certify              varchar(255)         null,
   efftime              varchar(25)          null,
   exptime              varchar(25)          null,
   addiinfo             varchar(255)         null,
   NAME                 varchar(128)         not null,
   idtype               varchar(128)         not null,
   idno                 varchar(128)         not null,
   headpic              varchar(255)         null,
   PHONE                varchar(128)         null,
   org                  varchar(128)         null,
   MEMORY               varchar(255)         null,
   STATE                int                  null,
   constraint PK_GS_INFO primary key nonclustered (userId)
)
go

create index Index_1 on GS_INFO (
idno ASC
)
go

create index Index_2 on GS_INFO (
PHONE ASC
)
go

create index Index_3 on GS_INFO (
NAME ASC
)
go

create table MT_CHECK (
   checkId              numeric              identity,
   subId                numeric              null,
   meetManId            numeric              null,
   place                varchar(255)         null,
   askForLeaveTime      varchar(25)          null,
   askForLeaveReason    varchar(255)         null,
   msgSent              varchar(255)         null,
   confirmMode          varchar(255)         null,
   confirmTime          varchar(25)          null,
   beginTime            varchar(25)          null,
   endTime              varchar(25)          null,
   memory               varchar(255)         null,
   c1                   varchar(255)         null,
   c2                   varchar(255)         null,
   c3                   varchar(255)         null,
   c4                   varchar(255)         null,
   c5                   varchar(255)         null,
   constraint PK_MT_CHECK primary key (checkId)
)
go

create table MT_MAN (
   meetManId            numeric              identity,
   recType              varchar(8)           null,
   meetId               int                  null,
   manId                int                  not null,
   state                int                  null,
   createTime           varchar(25)          null,
   cardId               varchar(20)          null,
   cardNo               varchar(255)         null,
   place                varchar(255)         null,
   memory               varchar(255)         null,
   m1                   varchar(255)         null,
   m2                   varchar(255)         null,
   m3                   varchar(255)         null,
   m5                   varchar(255)         null,
   m4                   varchar(255)         null,
   constraint PK_MT_MAN primary key (meetManId)
)
go

create table MT_MEET (
   meetId               numeric              identity,
   recType              varchar(8)           null,
   name                 varchar(128)         null,
   ownerId              int                  null,
   ownerName            varchar(128)         null,
   creator              int                  null,
   createTime           varchar(25)          null,
   phone                varchar(20)          null,
   specialCard          int                  null,
   beginTime            varchar(25)          null,
   endTime              varchar(25)          null,
   memory               varchar(255)         null,
   m1                   varchar(255)         null,
   m2                   varchar(255)         null,
   m3                   varchar(255)         null,
   m4                   varchar(255)         null,
   m5                   varchar(255)         null,
   constraint PK_MT_MEET primary key (meetId)
)
go

create table MT_ROOM (
   roomId               numeric              identity,
   name                 varchar(128)         null,
   recType              varchar(8)           null,
   enabled              int                  null,
   address              varchar(255)         null,
   capacity             int                  null,
   maintainer           varchar(128)         null,
   phone                varchar(20)          null,
   memory               varchar(255)         null,
   r1                   varchar(255)         null,
   r2                   varchar(255)         null,
   r3                   varchar(255)         null,
   r4                   varchar(255)         null,
   r5                   varchar(255)         null,
   constraint PK_MT_ROOM primary key (roomId)
)
go

create table MT_SUB (
   subId                numeric              identity,
   meetId               numeric              null,
   roomId               numeric              null,
   roomName             varchar(128)         null,
   sn                   varchar(128)         null,
   beginTime            varchar(25)          null,
   endTime              varchar(25)          null,
   memory               varchar(255)         null,
   createTime           varchar(25)          null,
   s1                   varchar(255)         null,
   s2                   varchar(255)         null,
   s3                   varchar(255)         null,
   s4                   varchar(255)         null,
   s5                   varchar(255)         null,
   constraint PK_MT_SUB primary key (subId)
)
go

create table SYS_MESSAGE (
   recId                numeric              identity,
   reqId                int                  null,
   rspId                int                  null,
   done                 int                  null,
   reqContent           varchar(255)         null,
   reqType              varchar(8)           null,
   needRsp              int                  null,
   expireTime           varchar(25)          null,
   rspContent           varchar(255)         null,
   rspType              varchar(8)           null,
   createTime           varchar(25)          null,
   reserved             varchar(255)         null,
   constraint PK_SYS_MESSAGE primary key nonclustered (recId)
)
go

create table SYS_SESSION (
   recId                numeric              identity,
   manId                int                  null,
   loginName            varchar(128)         null,
   ip                   varchar(20)          null,
   port                 varchar(20)          null,
   serviceType          varchar(8)           null,
   loginTime            varchar(25)          null,
   checkTime            varchar(25)          null,
   state                int                  null,
   mobile               varchar(20)          null,
   phone                varchar(20)          null,
   reserved             varchar(255)         null,
   constraint PK_SYS_SESSION primary key nonclustered (recId)
)
go

