Created
December 12, 2017 07:00
-
-
Save bruce-willis/d20e4930d16afc079493dbc1c075e428 to your computer and use it in GitHub Desktop.
sqripts.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET DATEFORMAT ymd | |
SET ARITHABORT, ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER, ANSI_NULLS, NOCOUNT ON | |
SET NUMERIC_ROUNDABORT, IMPLICIT_TRANSACTIONS, XACT_ABORT OFF | |
GO | |
SET IDENTITY_INSERT MedHelp.dbo.FormModels ON | |
GO | |
INSERT MedHelp.dbo.FormModels(FormModelId, Anamnesis, DoctorName, PatientBirthday, PatientName, Recommended, Speciality, VisitDay, Complaints) VALUES (1, NULL, NULL, '0001-01-01 00:00:00.0000000', NULL, NULL, NULL, '0001-01-01 00:00:00.0000000', NULL) | |
INSERT MedHelp.dbo.FormModels(FormModelId, Anamnesis, DoctorName, PatientBirthday, PatientName, Recommended, Speciality, VisitDay, Complaints) VALUES (2, NULL, NULL, '0001-01-01 00:00:00.0000000', NULL, NULL, NULL, '0001-01-01 00:00:00.0000000', NULL) | |
INSERT MedHelp.dbo.FormModels(FormModelId, Anamnesis, DoctorName, PatientBirthday, PatientName, Recommended, Speciality, VisitDay, Complaints) VALUES (3, NULL, NULL, '0001-01-01 00:00:00.0000000', NULL, NULL, NULL, '0001-01-01 00:00:00.0000000', NULL) | |
GO | |
SET IDENTITY_INSERT MedHelp.dbo.FormModels OFF | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET DATEFORMAT ymd | |
SET ARITHABORT, ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER, ANSI_NULLS, NOCOUNT ON | |
SET NUMERIC_ROUNDABORT, IMPLICIT_TRANSACTIONS, XACT_ABORT OFF | |
GO | |
SET IDENTITY_INSERT MedHelp.dbo.LastOpenedDocuments ON | |
GO | |
INSERT MedHelp.dbo.LastOpenedDocuments(LastOpenedDocumentId, LastOpenedTime, Patient, TemplateId, ModelJson) VALUES (1, '2017-12-11 23:00:46.1372947', N'Наглая бабка, у которой болит мизинец на ноге', 1, NULL) | |
INSERT MedHelp.dbo.LastOpenedDocuments(LastOpenedDocumentId, LastOpenedTime, Patient, TemplateId, ModelJson) VALUES (2, '2017-12-12 07:00:46.1518648', N'Дедуля', 2, NULL) | |
INSERT MedHelp.dbo.LastOpenedDocuments(LastOpenedDocumentId, LastOpenedTime, Patient, TemplateId, ModelJson) VALUES (3, '2017-12-12 04:00:46.1522039', N'Ребенок, у которого 36.9', 3, NULL) | |
GO | |
SET IDENTITY_INSERT MedHelp.dbo.LastOpenedDocuments OFF | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET DATEFORMAT ymd | |
SET ARITHABORT, ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER, ANSI_NULLS, NOCOUNT ON | |
SET NUMERIC_ROUNDABORT, IMPLICIT_TRANSACTIONS, XACT_ABORT OFF | |
GO | |
SET IDENTITY_INSERT MedHelp.dbo.Medicines ON | |
GO | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (1, N'НО-ШПА') | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (2, N'Фазостабил') | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (3, N'Аскорбиновая кислота-Русфар') | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (4, N'Аспирин') | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (5, N'Афала') | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (6, N'АФАЛАЗА') | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (7, N'Афлодерм') | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (8, N'Афлюдол') | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (9, N'Афобазол') | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (10, N'Ацизол') | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (11, N'Календула') | |
INSERT MedHelp.dbo.Medicines(MedicineId, MedicineName) VALUES (12, N'Калмирекс') | |
GO | |
SET IDENTITY_INSERT MedHelp.dbo.Medicines OFF | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET DATEFORMAT ymd | |
SET ARITHABORT, ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER, ANSI_NULLS, NOCOUNT ON | |
SET NUMERIC_ROUNDABORT, IMPLICIT_TRANSACTIONS, XACT_ABORT OFF | |
GO | |
SET IDENTITY_INSERT MedHelp.dbo.Templates ON | |
GO | |
INSERT MedHelp.dbo.Templates(TemplateId, Description, ImagePath, Name, SchemeJson, FormModelId) VALUES (1, N'Самая обычная справка о приеме какая только может быть', N'https://doc-rf.com/templates/SYNERGY-CP1251/images/sprav/ych/doc.jpg', N'Справка о приеме', N'{"fields":[{"type":"submit","buttonText":"Сохранить"},{"type":"input","inputType":"text","model":"patientName","label":"ФИО пацента","placeholder":"Введите сюда имя пациента"},{"type":"dateTimePicker","label":"Дата рождения пациента","model":"patientBirthday","dateTimePickerOptions":{"format":"YYYY-MM-DD"}},{"type":"dateTimePicker","label":"Дата посещения","model":"visitDay","dateTimePickerOptions":{"format":"YYYY-MM-DD"}},{"type":"input","inputType":"text","model":"speciality","label":"Специальность"},{"type":"input","inputType":"text","model":"doctorName","label":"Имя доктора"},{"type":"textArea","model":"complaints","label":"Жалобы","rows":5},{"type":"textArea","model":"anammnesis","label":"Анамнез","rows":5},{"type":"textArea","model":"recommended","label":"Рекомендации","rows":5},{"type":"vueMultiSelect","label":"Лекарства","placeholder":"Пожалуйста, выберите лекарства","values":[ | |
], "selectOptions":{"multiple":true,"hideselected":true,"multiSelect":true,"closeOnSelect":true,"showLabels":false,"searchable":true,"taggable":true,"limit":10}},{"type":"submit","buttonText":"Сохранить"}]}', 1) | |
INSERT MedHelp.dbo.Templates(TemplateId, Description, ImagePath, Name, SchemeJson, FormModelId) VALUES (2, N'Без анализов тут не обойтись', N'http://mediaspravka.ru/photos/15_1.jpg', N'Направление на анализы', NULL, 2) | |
INSERT MedHelp.dbo.Templates(TemplateId, Description, ImagePath, Name, SchemeJson, FormModelId) VALUES (3, N'Такого я ещё не видел. Пусть мои коллеги посмотрят', N'https://i.imgur.com/AoSVPpc.png', N'Направление к другому врачу', NULL, 3) | |
GO | |
SET IDENTITY_INSERT MedHelp.dbo.Templates OFF | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE MedHelp | |
GO | |
IF DB_NAME() <> N'MedHelp' SET NOEXEC ON | |
GO | |
-- | |
-- Создать таблицу [dbo].[Medicines] | |
-- | |
PRINT (N'Создать таблицу [dbo].[Medicines]') | |
GO | |
CREATE TABLE dbo.Medicines ( | |
MedicineId int IDENTITY, | |
MedicineName nvarchar(max) NULL, | |
CONSTRAINT PK_Medicines PRIMARY KEY CLUSTERED (MedicineId) | |
) | |
ON [PRIMARY] | |
TEXTIMAGE_ON [PRIMARY] | |
GO | |
-- | |
-- Создать таблицу [dbo].[FormModels] | |
-- | |
PRINT (N'Создать таблицу [dbo].[FormModels]') | |
GO | |
CREATE TABLE dbo.FormModels ( | |
FormModelId int IDENTITY, | |
Anamnesis nvarchar(max) NULL, | |
DoctorName nvarchar(max) NULL, | |
PatientBirthday datetime2 NOT NULL, | |
PatientName nvarchar(max) NULL, | |
Recommended nvarchar(max) NULL, | |
Speciality nvarchar(max) NULL, | |
VisitDay datetime2 NOT NULL, | |
Complaints nvarchar(max) NULL, | |
CONSTRAINT PK_FormModels PRIMARY KEY CLUSTERED (FormModelId) | |
) | |
ON [PRIMARY] | |
TEXTIMAGE_ON [PRIMARY] | |
GO | |
-- | |
-- Создать таблицу [dbo].[Templates] | |
-- | |
PRINT (N'Создать таблицу [dbo].[Templates]') | |
GO | |
CREATE TABLE dbo.Templates ( | |
TemplateId int IDENTITY, | |
Description nvarchar(max) NULL, | |
ImagePath nvarchar(max) NULL, | |
Name nvarchar(max) NULL, | |
SchemeJson nvarchar(max) NULL, | |
FormModelId int NOT NULL DEFAULT (0), | |
CONSTRAINT PK_Templates PRIMARY KEY CLUSTERED (TemplateId) | |
) | |
ON [PRIMARY] | |
TEXTIMAGE_ON [PRIMARY] | |
GO | |
-- | |
-- Создать индекс [IX_Templates_FormModelId] для объекта типа таблица [dbo].[Templates] | |
-- | |
PRINT (N'Создать индекс [IX_Templates_FormModelId] для объекта типа таблица [dbo].[Templates]') | |
GO | |
CREATE UNIQUE INDEX IX_Templates_FormModelId | |
ON dbo.Templates (FormModelId) | |
ON [PRIMARY] | |
GO | |
-- | |
-- Создать внешний ключ [FK_Templates_FormModels_FormModelId] для объекта типа таблица [dbo].[Templates] | |
-- | |
PRINT (N'Создать внешний ключ [FK_Templates_FormModels_FormModelId] для объекта типа таблица [dbo].[Templates]') | |
GO | |
ALTER TABLE dbo.Templates | |
ADD CONSTRAINT FK_Templates_FormModels_FormModelId FOREIGN KEY (FormModelId) REFERENCES dbo.FormModels (FormModelId) ON DELETE CASCADE | |
GO | |
-- | |
-- Создать таблицу [dbo].[LastOpenedDocuments] | |
-- | |
PRINT (N'Создать таблицу [dbo].[LastOpenedDocuments]') | |
GO | |
CREATE TABLE dbo.LastOpenedDocuments ( | |
LastOpenedDocumentId int IDENTITY, | |
LastOpenedTime datetime2 NOT NULL, | |
Patient nvarchar(max) NULL, | |
TemplateId int NOT NULL, | |
FormModelId int NOT NULL DEFAULT (0), | |
UserId nvarchar(max) NULL, | |
CONSTRAINT PK_LastOpenedDocuments PRIMARY KEY CLUSTERED (LastOpenedDocumentId) | |
) | |
ON [PRIMARY] | |
TEXTIMAGE_ON [PRIMARY] | |
GO | |
-- | |
-- Создать индекс [IX_LastOpenedDocuments_FormModelId] для объекта типа таблица [dbo].[LastOpenedDocuments] | |
-- | |
PRINT (N'Создать индекс [IX_LastOpenedDocuments_FormModelId] для объекта типа таблица [dbo].[LastOpenedDocuments]') | |
GO | |
CREATE UNIQUE INDEX IX_LastOpenedDocuments_FormModelId | |
ON dbo.LastOpenedDocuments (FormModelId) | |
ON [PRIMARY] | |
GO | |
-- | |
-- Создать индекс [IX_LastOpenedDocuments_TemplateId] для объекта типа таблица [dbo].[LastOpenedDocuments] | |
-- | |
PRINT (N'Создать индекс [IX_LastOpenedDocuments_TemplateId] для объекта типа таблица [dbo].[LastOpenedDocuments]') | |
GO | |
CREATE INDEX IX_LastOpenedDocuments_TemplateId | |
ON dbo.LastOpenedDocuments (TemplateId) | |
ON [PRIMARY] | |
GO | |
-- | |
-- Создать внешний ключ [FK_LastOpenedDocuments_FormModels_FormModelId] для объекта типа таблица [dbo].[LastOpenedDocuments] | |
-- | |
PRINT (N'Создать внешний ключ [FK_LastOpenedDocuments_FormModels_FormModelId] для объекта типа таблица [dbo].[LastOpenedDocuments]') | |
GO | |
ALTER TABLE dbo.LastOpenedDocuments | |
ADD CONSTRAINT FK_LastOpenedDocuments_FormModels_FormModelId FOREIGN KEY (FormModelId) REFERENCES dbo.FormModels (FormModelId) | |
GO | |
-- | |
-- Создать внешний ключ [FK_LastOpenedDocuments_Templates_TemplateId] для объекта типа таблица [dbo].[LastOpenedDocuments] | |
-- | |
PRINT (N'Создать внешний ключ [FK_LastOpenedDocuments_Templates_TemplateId] для объекта типа таблица [dbo].[LastOpenedDocuments]') | |
GO | |
ALTER TABLE dbo.LastOpenedDocuments | |
ADD CONSTRAINT FK_LastOpenedDocuments_Templates_TemplateId FOREIGN KEY (TemplateId) REFERENCES dbo.Templates (TemplateId) ON DELETE CASCADE | |
GO | |
-- | |
-- Создать таблицу [dbo].[MedicineFormModel] | |
-- | |
PRINT (N'Создать таблицу [dbo].[MedicineFormModel]') | |
GO | |
CREATE TABLE dbo.MedicineFormModel ( | |
MedicineId int NOT NULL, | |
FormModelId int NOT NULL, | |
CONSTRAINT PK_MedicineFormModel PRIMARY KEY CLUSTERED (MedicineId, FormModelId) | |
) | |
ON [PRIMARY] | |
GO | |
-- | |
-- Создать индекс [IX_MedicineFormModel_FormModelId] для объекта типа таблица [dbo].[MedicineFormModel] | |
-- | |
PRINT (N'Создать индекс [IX_MedicineFormModel_FormModelId] для объекта типа таблица [dbo].[MedicineFormModel]') | |
GO | |
CREATE INDEX IX_MedicineFormModel_FormModelId | |
ON dbo.MedicineFormModel (FormModelId) | |
ON [PRIMARY] | |
GO | |
-- | |
-- Создать внешний ключ [FK_MedicineFormModel_FormModels_FormModelId] для объекта типа таблица [dbo].[MedicineFormModel] | |
-- | |
PRINT (N'Создать внешний ключ [FK_MedicineFormModel_FormModels_FormModelId] для объекта типа таблица [dbo].[MedicineFormModel]') | |
GO | |
ALTER TABLE dbo.MedicineFormModel | |
ADD CONSTRAINT FK_MedicineFormModel_FormModels_FormModelId FOREIGN KEY (FormModelId) REFERENCES dbo.FormModels (FormModelId) ON DELETE CASCADE | |
GO | |
-- | |
-- Создать внешний ключ [FK_MedicineFormModel_Medicines_MedicineId] для объекта типа таблица [dbo].[MedicineFormModel] | |
-- | |
PRINT (N'Создать внешний ключ [FK_MedicineFormModel_Medicines_MedicineId] для объекта типа таблица [dbo].[MedicineFormModel]') | |
GO | |
ALTER TABLE dbo.MedicineFormModel | |
ADD CONSTRAINT FK_MedicineFormModel_Medicines_MedicineId FOREIGN KEY (MedicineId) REFERENCES dbo.Medicines (MedicineId) ON DELETE CASCADE | |
GO | |
SET NOEXEC OFF | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment