# Generated by Django 3.1.3 on 2020-11-28 10:32

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('ward', '0002_auto_20201126_0143'),
    ]

    operations = [
        migrations.CreateModel(
            name='DECISION_MAKING',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('Diagnosis', models.BooleanField(default=False)),
                ('Diag_Time', models.IntegerField(default=5, verbose_name='Time required for diagnosis (In mins)')),
                ('Hospital_Recom', models.BooleanField(default=False)),
                ('Patient_Dec', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='DEP_MONITOR',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('Time', models.DateTimeField()),
                ('Status', models.BooleanField(default=True, verbose_name='Is the Dependent Healthy')),
            ],
            options={
                'verbose_name_plural': 'Dependent Monitor',
            },
        ),
        migrations.CreateModel(
            name='DEPENDENT',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('Name', models.CharField(max_length=20)),
                ('Age', models.IntegerField()),
                ('Gender', models.CharField(choices=[('Male', 'Male'), ('Female', 'Female'), ('Other', 'Other')], default='Male', max_length=6)),
            ],
        ),
        migrations.CreateModel(
            name='HAS_BANK',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('Bank_Name', models.CharField(max_length=20)),
                ('IFSC', models.CharField(max_length=11, validators=[django.core.validators.MinLengthValidator(11, message='Enter IFSC code')])),
                ('Account_No', models.CharField(max_length=20)),
                ('Cheque_no', models.CharField(blank=True, max_length=6, null=True, validators=[django.core.validators.MinLengthValidator(6, message='Enter 6 digit cheeque number')])),
                ('Eligibility', models.BooleanField(verbose_name='Eligible')),
            ],
        ),
        migrations.CreateModel(
            name='HAS_INSURANCE',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('Insurance_Provider', models.CharField(max_length=20)),
                ('Eligibility', models.BooleanField(verbose_name='Eligible')),
            ],
        ),
        migrations.CreateModel(
            name='HOME_QUARANTINE_MONITOR',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('Health_Status', models.CharField(max_length=50)),
                ('Movements', models.BooleanField()),
            ],
            options={
                'db_table': 'HOME_QUARANTINE_MONITOR',
            },
        ),
        migrations.CreateModel(
            name='PATIENT_DETAILS',
            fields=[
                ('P_id', models.IntegerField(primary_key=True, serialize=False, unique=True)),
                ('Name', models.CharField(max_length=20)),
                ('Age', models.IntegerField()),
                ('Gender', models.CharField(choices=[('Male', 'Male'), ('Female', 'Female'), ('Other', 'Other')], default='Male', max_length=6)),
                ('City', models.CharField(default='Null', max_length=20)),
                ('Street', models.CharField(default='Null', max_length=20)),
                ('Pincode', models.IntegerField(default=0)),
                ('Symptomatic', models.BooleanField(default=False)),
                ('Previous_Disease', models.CharField(default='Null', max_length=20)),
                ('Still_Exists', models.BooleanField(default=False)),
            ],
            options={
                'db_table': 'PATIENT_DETAILS',
            },
        ),
        migrations.CreateModel(
            name='ADMITTED_TO',
            fields=[
                ('Pat_ID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='patient.patient_details')),
                ('Priority', models.IntegerField(choices=[(1, '1-Low'), (2, '2'), (3, '3'), (4, '4'), (5, '5-High')], default=1)),
                ('Health_Score', models.IntegerField()),
            ],
            options={
                'db_table': 'ADMITTED_TO',
            },
        ),
        migrations.CreateModel(
            name='PAYMENT',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('Bill_ID', models.IntegerField()),
                ('Mode_of_Payment', models.CharField(choices=[('Cheque', 'Cheque'), ('Cash', 'Cash'), ('CC', 'Credit Card'), ('DC', 'Debit Card'), ('UPI', 'UPI'), ('Isurance', 'Insurance'), ('Net_Banking', 'Net Banking')], max_length=11)),
                ('Status', models.CharField(choices=[('Successful', 'Successful'), ('Unsuccessful', 'Unsuccessful')], default='Unsuccessful', max_length=12)),
                ('Patient_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patient.patient_details')),
            ],
        ),
        migrations.AddConstraint(
            model_name='patient_details',
            constraint=models.CheckConstraint(check=models.Q(Age__gte=1), name='Pat_Age_gte_1'),
        ),
        migrations.AddConstraint(
            model_name='patient_details',
            constraint=models.CheckConstraint(check=models.Q(Age__lte=120), name='Pat_Age_lte_120'),
        ),
        migrations.AddField(
            model_name='home_quarantine_monitor',
            name='Pat_ID',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='patient.patient_details'),
        ),
        migrations.AddField(
            model_name='has_insurance',
            name='Patient_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patient.patient_details'),
        ),
        migrations.AddField(
            model_name='has_bank',
            name='Patient_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patient.patient_details'),
        ),
        migrations.AddField(
            model_name='dependent',
            name='Patient_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patient.patient_details'),
        ),
        migrations.AddField(
            model_name='dep_monitor',
            name='Dep_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patient.patient_details'),
        ),
        migrations.AddField(
            model_name='decision_making',
            name='Pid',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='patient.patient_details'),
        ),
        migrations.AlterUniqueTogether(
            name='payment',
            unique_together={('Patient_id', 'Bill_ID')},
        ),
        migrations.AlterUniqueTogether(
            name='has_bank',
            unique_together={('Patient_id', 'IFSC', 'Account_No')},
        ),
        migrations.AddConstraint(
            model_name='dependent',
            constraint=models.CheckConstraint(check=models.Q(Age__range=(1, 120)), name='Dep_Age_gte_1'),
        ),
        migrations.AlterUniqueTogether(
            name='dependent',
            unique_together={('Patient_id', 'Name')},
        ),
        migrations.AlterUniqueTogether(
            name='dep_monitor',
            unique_together={('Dep_id', 'Time')},
        ),
        migrations.AddField(
            model_name='admitted_to',
            name='Ward_ID',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ward.ward_details'),
        ),
        migrations.AddConstraint(
            model_name='admitted_to',
            constraint=models.CheckConstraint(check=models.Q(Health_Score__gte=1), name='Health_Score_gte_1'),
        ),
        migrations.AddConstraint(
            model_name='admitted_to',
            constraint=models.CheckConstraint(check=models.Q(Health_Score__lte=100), name='Health_Score_lte_100'),
        ),
    ]
