# Generated by Django 3.1.2 on 2020-12-02 13:20

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('nomenclature', '0022_auto_20201106_1832'),
    ]

    operations = [
        migrations.CreateModel(
            name='PlaceOfExecution',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, verbose_name='Наименование')),
                ('type', models.CharField(choices=[('Аутсорсинг', (('MO', 'Москва'), ('PL', 'Местный'))), ('Лаборатория', (('INS', 'Прибор'), ('MAN', 'Ручная методика')))], max_length=20, verbose_name='Тип места выполнения')),
            ],
        ),
        migrations.CreateModel(
            name='Region',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20, unique=True, verbose_name='Филиал')),
            ],
        ),
        migrations.CreateModel(
            name='Test',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('keycode', models.CharField(max_length=50, verbose_name='Ключ теста')),
                ('name', models.CharField(max_length=250, verbose_name='Наименование теста')),
                ('kdl_test_code', models.CharField(blank=True, max_length=50, null=True, verbose_name='Внешний код (КДЛ.Тест.Код)')),
                ('kdl_test_key', models.CharField(blank=True, max_length=50, null=True, verbose_name='Внешний код (КДЛ.Тест.Ключ)')),
                ('result_type', models.CharField(choices=[('N', 'Numeric'), ('FT', 'Free Text'), ('TICR', 'Test Item Coded Result'), ('DTA', 'Display Text Area')], max_length=30, verbose_name='Тип результата')),
                ('measure_unit', models.CharField(blank=True, max_length=50, verbose_name='Единицы измерения')),
                ('decimal_places', models.SmallIntegerField(blank=True, verbose_name='Количество знаков после запятой')),
            ],
        ),
        migrations.CreateModel(
            name='TestSet',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('key_code', models.CharField(max_length=50, unique=True, verbose_name='Ключ набора тестов')),
                ('name', models.CharField(max_length=250, unique=True, verbose_name='Наименование набора тестов')),
                ('date_from', models.DateTimeField(blank=True, null=True)),
                ('date_to', models.DateTimeField(blank=True, null=True)),
                ('department', models.CharField(default='не определен', max_length=15, verbose_name='Отдел')),
                ('addendum_key', models.CharField(default=None, max_length=50, null=True, verbose_name='Код выгрузки приложения в портал')),
                ('place_of_execution', models.ManyToManyField(related_name='Места_выполнения', to='nomenclature.PlaceOfExecution')),
                ('tests', models.ManyToManyField(related_name='Тесты_в_наборе', to='nomenclature.Test')),
            ],
        ),
        migrations.CreateModel(
            name='Reference',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(default=True, verbose_name='активность')),
                ('position', models.SmallIntegerField(null=True, verbose_name='Позиция')),
                ('age_from', models.CharField(blank=True, max_length=10, verbose_name='Возраст с')),
                ('age_to', models.CharField(blank=True, max_length=10, verbose_name='Возраст по')),
                ('sex', models.CharField(choices=[('M', 'Мужской'), ('F', 'Женский'), ('A', 'Любой')], max_length=10, verbose_name='Пол')),
                ('lower_normal_value', models.DecimalField(blank=True, decimal_places=8, max_digits=16, verbose_name='Норма нижняя')),
                ('upper_normal_value', models.DecimalField(blank=True, decimal_places=8, max_digits=16, verbose_name='Норма верхняя')),
                ('normal_text', models.CharField(blank=True, max_length=50, verbose_name='Норма текстом')),
                ('clinic_interpretation_key', models.CharField(max_length=50, verbose_name='Ключ клинической интерпретации')),
                ('clinic_interpretation_name', models.CharField(max_length=50, verbose_name='Наименование клинической интерпретации')),
                ('clinic_interpretation_text', models.CharField(max_length=1000, verbose_name='Текс клинической интерпретации')),
                ('test', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='nomenclature.test', verbose_name='Тест')),
            ],
        ),
        migrations.AddField(
            model_name='placeofexecution',
            name='region',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='nomenclature.region', verbose_name='Филиал'),
        ),
    ]
