# Generated by Django 2.2.28 on 2025-06-04 20:41

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


class Migration(migrations.Migration):

    dependencies = [
        ('doctor', '0003_auto_20250603_1441'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('reservation', '0002_auto_20250601_0958'),
    ]

    operations = [
        migrations.CreateModel(
            name='MedicalRecord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('chief_complaint', models.TextField(blank=True, null=True)),
                ('history_of_present_patient', models.TextField(blank=True, null=True)),
                ('past_medical_history', models.TextField(blank=True, null=True)),
                ('family_history', models.TextField(blank=True, null=True)),
                ('social_history', models.TextField(blank=True, null=True)),
                ('vital_signs', models.TextField(blank=True, null=True)),
                ('physical_examination', models.TextField(blank=True, null=True)),
                ('diagnosis', models.TextField(blank=True, null=True)),
                ('treatment_plan', models.TextField(blank=True, null=True)),
                ('prescriptions', models.TextField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_medical_records', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'medical report',
                'verbose_name_plural': 'medicals report',
            },
        ),
        migrations.AlterModelOptions(
            name='reservation',
            options={'ordering': ['-created_at']},
        ),
        migrations.CreateModel(
            name='ReservationChangeLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('action_type', models.CharField(choices=[('create', 'create'), ('update', 'update'), ('delete', 'delete'), ('status_change', 'status change')], max_length=20)),
                ('old_data', models.TextField(blank=True, null=True)),
                ('new_data', models.TextField(blank=True, null=True)),
                ('changed_fields', models.TextField(blank=True, null=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('changed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reservation_changes', to=settings.AUTH_USER_MODEL)),
                ('reservation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='change_logs', to='reservation.Reservation')),
            ],
            options={
                'verbose_name': 'لاگ تغییر رزرو',
                'verbose_name_plural': 'لاگ\u200cهای تغییر رزرو',
                'ordering': ['-timestamp'],
            },
        ),
        migrations.CreateModel(
            name='MedicalRecordEntry',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('entry_type', models.CharField(blank=True, choices=[('doctor_note', 'doctor_note'), ('technician_note', 'technician_note'), ('prescription', 'prescription'), ('examination', 'examination'), ('diagnosis', 'diagnosis'), ('treatment', 'treatment'), ('follow_up', 'follow_up'), ('other', 'other')], max_length=20, null=True)),
                ('title', models.CharField(blank=True, max_length=200, null=True)),
                ('content', models.TextField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_medical_entries', to=settings.AUTH_USER_MODEL)),
                ('doctor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='doctors_medical_entries', to='doctor.Doctor')),
                ('medical_record', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='entries', to='reservation.MedicalRecord')),
                ('technician', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='فechnician_medical_entries', to='doctor.Technician')),
            ],
            options={
                'verbose_name': 'entry medical report',
                'verbose_name_plural': 'entry medicals report',
                'ordering': ['-created_at'],
            },
        ),
        migrations.AddField(
            model_name='medicalrecord',
            name='reservation',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='medical_record', to='reservation.Reservation'),
        ),
    ]
