-- -----------------------------------------------------------------------------
-- SHC Software GmbH
-- Copyright (c) 2014 - 2017
--
-- SHC Mobile (SHC8Mobile_Tables_2016)
--
-- Encoding must be Windows-1252 ANSI NOT UTF8
--
-- $Id:$
--
-- @author  infoMantis GmbH
-- @package distler-shcmobile
--
-- -----------------------------------------------------------------------------
--- CREATE IMPORT BUFFER TABLES FOR SENT DATA FROM SHC MOBILE / SHC RAI MOBILE
--  TO SHC DATABASE. WILL BE TRANSFERRED TO DESTINATION TABLES BY SHC Software
-- -----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_PREST') IS NOT NULL
DROP TABLE [dbo].[MOB_PREST]
GO
CREATE TABLE [dbo].[MOB_PREST](
		[ID] int identity not null,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,
		[LEISTUNGSID] [int] not null,
		[PATIENTNUMMER] [int] null,
		[DATUM] [datetime] null,
		[VON] [datetime] null,
		[BIS] [datetime] null,
		[extension1] varchar(64) null,
		[extension2] varchar(64) null,
		[anzahl] [float] null,
		[ext2] varchar(10)not null,
		[ext3] varchar(256) null,
		[mflag] [varchar](1) null,
		[CODTR] [varchar](1) null DEFAULT('2')
);
GO
ALTER TABLE dbo.MOB_PREST ADD CONSTRAINT
	PK_MOB_PREST PRIMARY KEY NONCLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_PREST SET (LOCK_ESCALATION = TABLE)
GO
---
CREATE CLUSTERED INDEX IX_MOB_PREST ON dbo.MOB_PREST
	(
	LEISTUNGSID,
	CODTR
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE dbo.MOB_PREST SET (LOCK_ESCALATION = TABLE)
GO

-- -----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_PRESTRAI') IS NOT NULL
DROP TABLE [dbo].[MOB_PRESTRAI]
GO 
CREATE TABLE [dbo].[MOB_PRESTRAI](
		[ID] int identity not null,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,
		[LEISTUNGSID] [int] not null,
		[RID] [int] null,
		[EXTENSION1] [varchar](255) null,
		[EXTENSION2] [varchar](64) null,
		[EXTENSION3] [varchar](64) null,
		[EXTENSION4] [varchar](64) null,
		[CODTR] [varchar](1) null DEFAULT('2')
);
GO
ALTER TABLE dbo.MOB_PRESTRAI ADD CONSTRAINT
	PK_MOB_PRESTRAI PRIMARY KEY NONCLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_PRESTRAI SET (LOCK_ESCALATION = TABLE)
GO
-- -----------------------------------------------------------------------------
CREATE CLUSTERED INDEX IX_MOB_PRESTRAI ON [dbo].[MOB_PRESTRAI]([PERSONALNUMMER] ASC,[LEISTUNGSID] ASC)WITH 
(PAD_INDEX = OFF, 
 STATISTICS_NORECOMPUTE = OFF, 
 SORT_IN_TEMPDB = OFF, 
 DROP_EXISTING = OFF, 
 ONLINE = OFF, 
 ALLOW_ROW_LOCKS = ON, 
 ALLOW_PAGE_LOCKS = ON); 
GO

-- -----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_VERLAUF') IS NOT NULL
DROP TABLE [dbo].[MOB_VERLAUF]
GO 
CREATE TABLE [dbo].[MOB_VERLAUF](
		[ID] int identity not null,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,	
		[patientnummer] [int] not null,
		[punkt] [int] null,
		[datum] [datetime] not null,
		[text1] [varchar](256) not null,
		[text2] [varchar](256) not null,
		[text3] [varchar](256) not null,
		[text4] [varchar](256) not null,
		[initialen] [varchar](8) null,
		[extension1] [varchar](64) null,
		[extension2] [varchar](64) null,
		[extension3] [varchar](64) null,
		[extension4] [varchar](64) null,
		[CODTR] [varchar](1) null DEFAULT('2')
);
GO
ALTER TABLE dbo.MOB_VERLAUF ADD CONSTRAINT
	PK_MOB_VERLAUF PRIMARY KEY CLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_VERLAUF SET (LOCK_ESCALATION = TABLE)
GO
-- -----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_VITALWERTE') IS NOT NULL
DROP TABLE [dbo].[MOB_VITALWERTE]
GO  
CREATE TABLE [dbo].[MOB_VITALWERTE](
		[ID] int identity not null,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,
		[patientnummer] [int] not null,
		[zeitpunkt] [datetime] not null,
		[puls] [int] null,
		[puls_bem] [varchar](255) null,
		[temperatur] [decimal](3, 1) null,
		[temperatur_bem] [varchar](255) null,
		[blutdruck_sys] [int] null,
		[blutdruck_dia] [int] null,
		[blutdruck_bem] [varchar](255) null,
		[blutzucker] [decimal](9, 1) null,
		[blutzucker_bem] [varchar](255) null,
		[gewicht] [decimal](4, 1) null,
		[gewicht_bem] [varchar](255) null,
		[groesse] [decimal](5, 2) null,
		[stuhlgang] [int] null,
		[reserveart1] [varchar](64) null,
		[reserveart2] [varchar](64) null,
		[reserveart3] [varchar](64) null,
		[reserve_bem] [varchar](255) null,
		[EXTENSION1] [varchar](255) null,
		[EXTENSION2] [varchar](255) null,
		[EXTENSION3] [varchar](255) null,
		[AENID] [int] null,
		[CODTR] [varchar](1) null DEFAULT('2')
);
GO
ALTER TABLE dbo.MOB_VITALWERTE ADD CONSTRAINT
	PK_MOB_VITALWERTE PRIMARY KEY CLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_VITALWERTE SET (LOCK_ESCALATION = TABLE)
GO
-- -----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_WUNDDOKU') IS NOT NULL
DROP TABLE [dbo].[MOB_WUNDDOKU]
GO  
CREATE TABLE [dbo].[MOB_WUNDDOKU](
		[ID] int identity not null,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,
		[patientnummer] [int] not null,
		[wunddok_dte] [datetime] not null,
		[gueltvon_dte] [datetime] null,
		[gueltbis_dte] [datetime] null,
		[verheilt_dte] [datetime] null,
		[verheilt_kuerzel] [char](8) null,
		[wundnr] [int] null,
		[lokalisation] [varchar](255) null,
		[klassif_st] [varchar](255) null,
		[wutyp_st] [varchar](255) null,
		[flaeche] [decimal](10, 2) null,
		[flaecheinh_st] [varchar](255) null,
		[tiefe] [decimal](10, 2) null,
		[tiefeneinh_st] [varchar](255) null,
		[is_tasche] [int] null,
		[is_unterminierung] [int] null,
		[nekrose_st] [varchar](255) null,
		[infektionsz_st] [varchar](255) null,
		[exsudation_st] [varchar](255) null,
		[granulation_st] [varchar](255) null,
		[epithelbild_st] [varchar](255) null,
		[wundgeruch_st] [varchar](255) null,
		[wundgeruch_bemerk] [varchar](250) null,
		[wundumgeb_st] [varchar](255) null,
		[wundpflege] [text] null,
		[wundpos_x] [int] null,
		[wundpos_y] [int] null,
		[loeschbemerk] [varchar](50) null,
		[wundreinigung_st] [varchar](255) null,
		[wundumgebung_h_st] [varchar](255) null,
		[wundfueller_st] [varchar](255) null,
		[wundflaeche_bef_st] [varchar](255) null,
		[wundabdeckung_st] [varchar](255) null,
		[verbandfixierung_st] [varchar](255) null,
		[vacuum_st] [varchar](255) null,
		[ernaehrung_st] [varchar](255) null,
		[SONSTIGES] [varchar](255) null,
		[EXTENSION1] [varchar](255) null,
		[EXTENSION2] [varchar](255) null,
		[EXTENSION3] [varchar](255) null,
		[ERDAT] [datetime] null,
		[AENDAT] [datetime] null,
		[AENID] [int] null,
		[CODTR] [varchar](1) null DEFAULT('2'),
		[wundart] [varchar](255) null,
		[stadium] [varchar](64) null,
		[schmerz] [varchar](1) null,
		[exudat] [varchar](64) null,
		[wundrand] [varchar](64) null,
		[entstehungsort] [varchar](64) null,
		[entstehungsort_bem] [varchar](255) null,
		[arztinfo] [varchar](1) null,
		[aenid_stopp] [int] null
);
GO
ALTER TABLE dbo.MOB_WUNDDOKU ADD CONSTRAINT
	PK_MOB_WUNDDOKU PRIMARY KEY CLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_WUNDDOKU SET (LOCK_ESCALATION = TABLE)
GO

-- -----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_STURZPROTOKOLL') IS NOT NULL
DROP TABLE [dbo].[MOB_STURZPROTOKOLL]
GO  
CREATE TABLE [dbo].[MOB_STURZPROTOKOLL](
		[ID] int identity not null,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,
		[patientnummer] [int] not null,
		[sturzzeitpunkt] [datetime] not null,
		[sturzort_st] [varchar](255) null,
		[sturzort_bem] [varchar](500) null,
		[sturzart_st] [varchar](255) null,
		[sturzart_bem] [varchar](500) null,
		[sturzursache_st] [varchar](255) null,
		[sturzursache_bem] [varchar](500) null,
		[verletzart_st] [varchar](255) null,
		[verletzart_bem] [varchar](500) null,
		[arztbericht] [varchar](1) null,
		[schuhwerk_st] [varchar](255) null,
		[sturzbeschreibung] [varchar](500) null,
		[EXTENSION1] [varchar](255) null,
		[EXTENSION2] [varchar](255) null,
		[EXTENSION3] [varchar](255) null,
		[BETTGITTER] [varchar](255) null,
		[ROLLEN] [varchar](255) null,
		[ERDAT] [datetime] null,
		[AENDAT] [datetime] null,
		[AENID] [int] null,
		[CODTR] [varchar](1) null DEFAULT('2'),
		[verletzungsort] [varchar](64) null,
		[verletzungsort_bem] [varchar](255) null,
		[arztinfo] [varchar](1) null,
		[massnahmen] [varchar](1) null,
		[schuhwerk_bem] [varchar](500) null,
		[schutzmassnahmen] [varchar](255) null,
		[schutzmassnahmen_bem] [varchar](500) null,
		[hilfsmittel] [varchar](255) null,
		[hilfsmittel_bem] [varchar](500) null,
		[hausarzt] [int] null,
		[notfallarzt] [int] null,
		[spitaleinweisung] [varchar](1) null,
		[spital] [int] null,
		[ang_informiert] [varchar](1) null,
		[ang_informiert_bem] [varchar](500) null,
		[zeugen] [varchar](1) null,
		[zeugen_bem] [varchar](500) null
);
GO
ALTER TABLE dbo.MOB_STURZPROTOKOLL ADD CONSTRAINT
	PK_MOB_STURZPROTOKOLL PRIMARY KEY CLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_STURZPROTOKOLL SET (LOCK_ESCALATION = TABLE)
GO

-- -----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_SCHMERZPROT') IS NOT NULL
DROP TABLE [dbo].[MOB_SCHMERZPROT]
GO  
CREATE TABLE [dbo].[MOB_SCHMERZPROT](
		[ID] int identity not null,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,
		[datum] [datetime] null,
		[uhrzeit] [datetime] null,
		[patientnummer] [int] null,
		[item1] [int] null,
		[item2] [int] null,
		[item3] [int] null,
		[item4] [int] null,
		[item5] [int] null,
		[item6] [int] null,
		[item7] [int] null,
		[item8] [int] null,
		[item9] [int] null,
		[item10] [int] null,
		[item11] [int] null,
		[verbal] [int] null,
		[medikation] [varchar](255) null,
		[medikation_bem] [varchar](255) null,
		[res_medikation] [varchar](255) null,
		[res_medikation_bem] [varchar](255) null,
		[Nebenwirkungen] [varchar](255) null,
		[EXTENSION1] [varchar](255) null,
		[EXTENSION2] [varchar](255) null,
		[EXTENSION3] [varchar](255) null,
		[ERDAT] [datetime] null,
		[AENDAT] [datetime] null,
		[AENID] [int] null,
		[CODTR] [varchar](1) null DEFAULT('2'),
		[medikation_text] [varchar](255) null
);
GO
ALTER TABLE dbo.MOB_SCHMERZPROT ADD CONSTRAINT
	PK_MOB_SCHMERZPROT PRIMARY KEY CLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_SCHMERZPROT SET (LOCK_ESCALATION = TABLE)
GO


-- -----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_COMBURTEST') IS NOT NULL
DROP TABLE [dbo].[MOB_COMBURTEST]
GO  
CREATE TABLE [dbo].[MOB_COMBURTEST](
		[ID] int identity not null,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,	
		[patientnummer] [int] not null,
		[testdte] [datetime] not null,
		[fachpersonid] [int] null,
		[mitarbeiterid] [int] null,
		[lc] [varchar](30) null,
		[nitrit] [varchar](30) null,
		[ph] [varchar](30) null,
		[eiweiss] [varchar](30) null,
		[glucose] [varchar](30) null,
		[keton] [varchar](30) null,
		[urobilinogen] [varchar](30) null,
		[bilirubin] [varchar](30) null,
		[blut] [varchar](30) null,
		[haemoglobin] [varchar](30) null,
		[bemerkung] [varchar](255) null,
		[loeschbemerk] [varchar](50) null,
		[EXTENSION1] [varchar](255) null,
		[EXTENSION2] [varchar](255) null,
		[EXTENSION3] [varchar](255) null,
		[ERDAT] [datetime] null,
		[AENDAT] [datetime] null,
		[AENID] [int] null,
		[CODTR] [varchar](1) null DEFAULT('2')
);
GO
ALTER TABLE dbo.MOB_COMBURTEST ADD CONSTRAINT
	PK_MOB_COMBURTEST PRIMARY KEY CLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_COMBURTEST SET (LOCK_ESCALATION = TABLE)
GO

-- -----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_EIN_AUSFUHR') IS NOT NULL
DROP TABLE [dbo].[MOB_EIN_AUSFUHR]
GO  
CREATE TABLE [dbo].[MOB_EIN_AUSFUHR](
		[ID] int identity not null,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,
		[PATIENTNUMMER] [int] null,
		[DATUM] [datetime] null,
		[EINFUHR] [float] null,
		[AUSFUHR] [float] null,
		[EINFUHRART] [varchar](255) null,
		[AUSFUHRART] [varchar](255) null,
		[EINFUHR_BEM] [varchar](255) null,
		[AUSFUHR_BEM] [varchar](255) null,
		[EXTENSION1] [varchar](255) null,
		[EXTENSION2] [varchar](255) null,
		[EXTENSION3] [varchar](255) null,
		[ERDAT] [datetime] null,
		[AENDAT] [datetime] null,
		[AENID] [int] null,
		[CODTR] [varchar](1) null DEFAULT('2'),
		[aktueller_bedarf] [float] null
);
GO
ALTER TABLE dbo.MOB_EIN_AUSFUHR ADD CONSTRAINT
	PK_MOB_EIN_AUSFUHR PRIMARY KEY CLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_EIN_AUSFUHR SET (LOCK_ESCALATION = TABLE)
GO

-----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_RAI_ABKLAERUNG_MDS') IS NOT NULL
DROP TABLE [dbo].[MOB_RAI_ABKLAERUNG_MDS]
GO 
CREATE TABLE [dbo].[MOB_RAI_ABKLAERUNG_MDS](
		[ID] [int] IDENTITY(1,1) NOT NULL,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,
		[ANTWORTID] [int] NULL,
		[ANTWORTGUID] [varchar](42) NULL,
		[PATIENTNUMMER] [int] NULL,
		[DATUM] [datetime] NULL,
		[FALLNUMMER] [varchar](16) NULL,
		[FRAGE_ID] [int] NULL,
		[WERT] [varchar](16) NULL,
		[EXTENSION1] [varchar](255) NULL,
		[EXTENSION2] [varchar](255) NULL,
		[EXTENSION3] [varchar](255) NULL,
		[EXTENSION4] [varchar](255) NULL,
		[ERDAT] [datetime] NULL,
		[AENDAT] [datetime] NULL,
		[AENID] [int] NULL,
		[CODTR] [varchar](1) null DEFAULT('2'),
		[ASSESSMENT] [int] NULL,
		[POS] [int] NULL,
		[Version] [int] NULL
);
GO
ALTER TABLE dbo.MOB_RAI_ABKLAERUNG_MDS ADD CONSTRAINT
	PK_MOB_RAI_ABKLAERUNG_MDS PRIMARY KEY CLUSTERED
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_RAI_ABKLAERUNG_MDS SET (LOCK_ESCALATION = TABLE)
GO

-----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_RAI_ABKLAERUNG_MH') IS NOT NULL
DROP TABLE [dbo].[MOB_RAI_ABKLAERUNG_MH]
GO
CREATE TABLE [dbo].[MOB_RAI_ABKLAERUNG_MH](
		[ID] [int] IDENTITY(1,1) NOT NULL,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,
		[ANTWORTID] [int] NULL,
		[ANTWORTGUID] [varchar](42) NULL,
		[PATIENTNUMMER] [int] NULL,
		[DATUM] [datetime] NULL,
		[FALLNUMMER] [varchar](16) NULL,
		[FRAGE_ID] [int] NULL,
		[WERT] [varchar](16) NULL,
		[EXTENSION1] [varchar](255) NULL,
		[EXTENSION2] [varchar](255) NULL,
		[EXTENSION3] [varchar](255) NULL,
		[EXTENSION4] [varchar](255) NULL,
		[ERDAT] [datetime] NULL,
		[AENDAT] [datetime] NULL,
		[AENID] [int] NULL,
		[CODTR] [varchar](1) null DEFAULT('2'),
		[ASSESSMENT] [int] NULL,
		[POS] [int] NULL,
		[Version] [int] NULL
);
GO
ALTER TABLE dbo.MOB_RAI_ABKLAERUNG_MH ADD CONSTRAINT
	PK_MOB_RAI_ABKLAERUNG_MH PRIMARY KEY CLUSTERED
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_RAI_ABKLAERUNG_MH SET (LOCK_ESCALATION = TABLE)
GO

-----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_RAI_ABKLAERUNG_ADMIN') IS NOT NULL
DROP TABLE [dbo].[MOB_RAI_ABKLAERUNG_ADMIN]
GO
CREATE TABLE [dbo].[MOB_RAI_ABKLAERUNG_ADMIN](
		[ID] [int] IDENTITY(1,1) NOT NULL,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,
		[ANTWORTID] [int] NULL,
		[ANTWORTGUID] [varchar](42) NULL,
		[PATIENTNUMMER] [int] NULL,
		[DATUM] [datetime] NULL,
		[FALLNUMMER] [varchar](16) NULL,
		[FRAGE_ID] [int] NULL,
		[WERT] [varchar](16) NULL,
		[EXTENSION1] [varchar](255) NULL,
		[EXTENSION2] [varchar](255) NULL,
		[EXTENSION3] [varchar](255) NULL,
		[EXTENSION4] [varchar](255) NULL,
		[ERDAT] [datetime] NULL,
		[AENDAT] [datetime] NULL,
		[AENID] [int] NULL,
		[CODTR] [varchar](1) null DEFAULT('2'),
		[ASSESSMENT] [int] NULL,
		[POS] [int] NULL,
		[Version] [int] NULL
);
GO
ALTER TABLE dbo.MOB_RAI_ABKLAERUNG_ADMIN ADD CONSTRAINT
	PK_MOB_RAI_ABKLAERUNG_ADMIN PRIMARY KEY CLUSTERED
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_RAI_ABKLAERUNG_ADMIN SET (LOCK_ESCALATION = TABLE)
GO

-----------------------------------------------------------------------------
IF OBJECT_ID('dbo.MOB_RAI_ABKLAERUNG_HW') IS NOT NULL
DROP TABLE [dbo].[MOB_RAI_ABKLAERUNG_HW]
GO
CREATE TABLE [dbo].[MOB_RAI_ABKLAERUNG_HW](
		[ID] [int] IDENTITY(1,1) NOT NULL,
		[PERSONALNUMMER] [int] not null,
		[ERSTELLT] datetime not null,
		[ANTWORTID] [int] NULL,
		[ANTWORTGUID] [varchar](42) NULL,
		[PATIENTNUMMER] [int] NULL,
		[DATUM] [datetime] NULL,
		[FALLNUMMER] [varchar](16) NULL,
		[FRAGE_ID] [int] NULL,
		[WERT] [varchar](16) NULL,
		[EXTENSION1] [varchar](255) NULL,
		[EXTENSION2] [varchar](255) NULL,
		[EXTENSION3] [varchar](255) NULL,
		[EXTENSION4] [varchar](255) NULL,
		[ERDAT] [datetime] NULL,
		[AENDAT] [datetime] NULL,
		[AENID] [int] NULL,
		[CODTR] [varchar](1) null DEFAULT('2'),
		[ASSESSMENT] [int] NULL,
		[POS] [int] NULL,
		[Version] [int] NULL
);
GO
ALTER TABLE dbo.MOB_RAI_ABKLAERUNG_HW ADD CONSTRAINT
	PK_MOB_RAI_ABKLAERUNG_HW PRIMARY KEY CLUSTERED
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.MOB_RAI_ABKLAERUNG_HW SET (LOCK_ESCALATION = TABLE)
GO
