





















const db = require('../models');
const Users = db.users;






const Patients = db.patients;

const Guarantors = db.guarantors;

const Doctors = db.doctors;

const Visits = db.visits;

const Orders = db.orders;

const RadiologyTypes = db.radiology_types;

const RadiologyStudies = db.radiology_studies;

const CtTypes = db.ct_types;

const CtStudies = db.ct_studies;

const LabTests = db.lab_tests;

const LabOrders = db.lab_orders;

const LabResults = db.lab_results;

const EndoscopyCases = db.endoscopy_cases;

const SurgeryCases = db.surgery_cases;

const SurgeryConsumables = db.surgery_consumables;

const AnesthesiaRecords = db.anesthesia_records;

const CathlabCases = db.cathlab_cases;

const EcgStressTests = db.ecg_stress_tests;

const NursingStaff = db.nursing_staff;

const CleaningStaff = db.cleaning_staff;

const InventoryConsumables = db.inventory_consumables;

const PharmacyInventory = db.pharmacy_inventory;

const PharmacySalesInvoices = db.pharmacy_sales_invoices;

const Suppliers = db.suppliers;

const Purchases = db.purchases;

const PatientInvoices = db.patient_invoices;

const LedgerEntries = db.ledger_entries;

const JournalEntries = db.journal_entries;

const TrialBalances = db.trial_balances;

const ClosingBalances = db.closing_balances;

const InpatientRooms = db.inpatient_rooms;

const RoomBookings = db.room_bookings;

const RestaurantMeals = db.restaurant_meals;

const RestaurantInventory = db.restaurant_inventory;

const MaternityCases = db.maternity_cases;

const PregnancyFollowups = db.pregnancy_followups;

const NicuIncubators = db.nicu_incubators;

const DailyFollowupClinic = db.daily_followup_clinic;

const AuditLog = db.audit_log;

const Settings = db.settings;







const PatientsData = [
    
    {
    
        
        
            
                "full_name": "محمد علي حسن",
            
        
    
        
        
            
                "national_number": "1001987654321",
            
        
    
        
        
            
                "phone": "0944123456",
            
        
    
        
        
            
                "address": "طرطوس شارع النور بناية 12",
            
        
    
        
        
            
                "blood_group": "A+",
            
        
    
        
        
            
                "gender": "female",
            
        
    
        
        
            
                "birth_date": new Date('1985-05-12T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "full_name": "سارة محمود عبيد",
            
        
    
        
        
            
                "national_number": "1002987654322",
            
        
    
        
        
            
                "phone": "0944876543",
            
        
    
        
        
            
                "address": "اللاذقية حي النجم عمارة 3",
            
        
    
        
        
            
                "blood_group": "B-",
            
        
    
        
        
            
                "gender": "female",
            
        
    
        
        
            
                "birth_date": new Date('1990-11-02T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "full_name": "أحمد سامي إبراهيم",
            
        
    
        
        
            
                "national_number": "1003987654323",
            
        
    
        
        
            
                "phone": "0944001122",
            
        
    
        
        
            
                "address": "حمص شارع الثورة منزل 5",
            
        
    
        
        
            
                "blood_group": "AB+",
            
        
    
        
        
            
                "gender": "other",
            
        
    
        
        
            
                "birth_date": new Date('1978-02-20T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const GuarantorsData = [
    
    {
    
        
        
            
                "name": "خالد محمد",
            
        
    
        
        
            
                "national_number": "2011980001111",
            
        
    
        
        
            
                "phone": "0944000001",
            
        
    
        
        
            
                "address": "طرطوس شارع النور",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "منى سعيد",
            
        
    
        
        
            
                "national_number": "2012980002222",
            
        
    
        
        
            
                "phone": "0944000002",
            
        
    
        
        
            
                "address": "اللاذقية حي النصر",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "وليد حسام",
            
        
    
        
        
            
                "national_number": "2013980003333",
            
        
    
        
        
            
                "phone": "0944000003",
            
        
    
        
        
            
                "address": "حمص شارع السلام",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DoctorsData = [
    
    {
    
        
        
            
                "full_name": "د. سامر الحاج",
            
        
    
        
        
            
                "national_number": "3001987654001",
            
        
    
        
        
            
                "hire_date": new Date('2015-03-01T00:00:00Z'),
            
        
    
        
        
            
                "specialty": "باطنية",
            
        
    
        
        
            
                "visit_price": 500.0,
            
        
    
        
        
            
                "doctor_type": "internal",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "full_name": "د. ليلى ناصر",
            
        
    
        
        
            
                "national_number": "3001987654002",
            
        
    
        
        
            
                "hire_date": new Date('2018-07-15T00:00:00Z'),
            
        
    
        
        
            
                "specialty": "جراحة",
            
        
    
        
        
            
                "visit_price": 700.0,
            
        
    
        
        
            
                "doctor_type": "resident",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "full_name": "د. خالد مراد",
            
        
    
        
        
            
                "national_number": "3001987654003",
            
        
    
        
        
            
                "hire_date": new Date('2020-01-10T00:00:00Z'),
            
        
    
        
        
            
                "specialty": "قلب",
            
        
    
        
        
            
                "visit_price": 800.0,
            
        
    
        
        
            
                "doctor_type": "external",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const VisitsData = [
    
    {
    
        
        
            
                "visit_number": "V-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "department": "clinic",
            
        
    
        
        
            
                "visit_price": 200.0,
            
        
    
        
        
            
                "arrival_time": new Date('2026-01-10T09:30:00Z'),
            
        
    
        
        
            
                "discharge_time": new Date('2026-01-10T10:00:00Z'),
            
        
    
        
        
            
                "blood_pressure": "120/80",
            
        
    
        
        
            
                "glucose": 5.6,
            
        
    
        
        
            
                "pulse": 78,
            
        
    
        
        
            
                "temperature": 36.6,
            
        
    
        
        
            
                "spo2": 98,
            
        
    
        
        
            
                "chief_complaint": "صداع ودوار",
            
        
    
        
        
            
                "initial_diagnosis": "تعب عام",
            
        
    
        
        
            
                "emergency_treatment": "",
            
        
    
        
        
            
                "fluids_iv": "",
            
        
    
        
        
            
                "notes": "",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
    },
    
    {
    
        
        
            
                "visit_number": "V-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "department": "clinic",
            
        
    
        
        
            
                "visit_price": 300.0,
            
        
    
        
        
            
                "arrival_time": new Date('2026-01-11T14:15:00Z'),
            
        
    
        
        
            
                "discharge_time": new Date('2026-01-11T16:00:00Z'),
            
        
    
        
        
            
                "blood_pressure": "130/85",
            
        
    
        
        
            
                "glucose": 6.2,
            
        
    
        
        
            
                "pulse": 90,
            
        
    
        
        
            
                "temperature": 37.2,
            
        
    
        
        
            
                "spo2": 96,
            
        
    
        
        
            
                "chief_complaint": "الم في الصدر",
            
        
    
        
        
            
                "initial_diagnosis": "مراقبة",
            
        
    
        
        
            
                "emergency_treatment": "أكسجين",
            
        
    
        
        
            
                "fluids_iv": "مصل",
            
        
    
        
        
            
                "notes": "تم إرسال ECG",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
    },
    
    {
    
        
        
            
                "visit_number": "V-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "department": "emergency",
            
        
    
        
        
            
                "visit_price": 250.0,
            
        
    
        
        
            
                "arrival_time": new Date('2026-01-12T10:00:00Z'),
            
        
    
        
        
            
                "discharge_time": new Date('2026-01-12T10:30:00Z'),
            
        
    
        
        
            
                "blood_pressure": "115/75",
            
        
    
        
        
            
                "glucose": 5.1,
            
        
    
        
        
            
                "pulse": 70,
            
        
    
        
        
            
                "temperature": 36.4,
            
        
    
        
        
            
                "spo2": 99,
            
        
    
        
        
            
                "chief_complaint": "آلام بطن",
            
        
    
        
        
            
                "initial_diagnosis": "تحويل لمخبر",
            
        
    
        
        
            
                "emergency_treatment": "",
            
        
    
        
        
            
                "fluids_iv": "",
            
        
    
        
        
            
                "notes": "",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
    },
    
];



const OrdersData = [
    
    {
    
        
        
            
                "order_number": "O-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_type": "lab",
            
        
    
        
        
            
                "subtype": "تحليل دم كامل",
            
        
    
        
        
            
                "price": 50.0,
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "created_datetime": new Date('2026-01-10T09:45:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                "order_number": "O-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_type": "other",
            
        
    
        
        
            
                "subtype": "اشعة صدر",
            
        
    
        
        
            
                "price": 120.0,
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "created_datetime": new Date('2026-01-11T14:30:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                "order_number": "O-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_type": "endoscopy",
            
        
    
        
        
            
                "subtype": "CT رأس",
            
        
    
        
        
            
                "price": 400.0,
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "created_datetime": new Date('2026-01-12T10:15:00Z'),
            
        
    
    },
    
];



const RadiologyTypesData = [
    
    {
    
        
        
            
                "name": "اشعة صدر",
            
        
    
        
        
            
                "price": 120.0,
            
        
    
        
        
            
                "notes": "صورة عادية للصدر",
            
        
    
    },
    
    {
    
        
        
            
                "name": "اشعة عظام",
            
        
    
        
        
            
                "price": 90.0,
            
        
    
        
        
            
                "notes": "زوايا متعددة عند الحاجة",
            
        
    
    },
    
    {
    
        
        
            
                "name": "ايكو قلب",
            
        
    
        
        
            
                "price": 250.0,
            
        
    
        
        
            
                "notes": "فحص ايكو شامل",
            
        
    
    },
    
];



const RadiologyStudiesData = [
    
    {
    
        
        
            
                "study_number": "R-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "report_summary": "صورة صدر طبيعية",
            
        
    
        
        
            
                "price": 120.0,
            
        
    
        
        
            
                "status": "completed",
            
        
    
    },
    
    {
    
        
        
            
                "study_number": "R-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "report_summary": "كسور محتملة بحاجة لمقارنة",
            
        
    
        
        
            
                "price": 90.0,
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
    },
    
    {
    
        
        
            
                "study_number": "R-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "report_summary": "ايكو يظهر تضخم طفيف",
            
        
    
        
        
            
                "price": 250.0,
            
        
    
        
        
            
                "status": "completed",
            
        
    
    },
    
];



const CtTypesData = [
    
    {
    
        
        
            
                "name": "CT رأس متعدد الشرائح 128",
            
        
    
        
        
            
                "price": 400.0,
            
        
    
    },
    
    {
    
        
        
            
                "name": "CT صدر",
            
        
    
        
        
            
                "price": 450.0,
            
        
    
    },
    
    {
    
        
        
            
                "name": "CT بطن وحوض",
            
        
    
        
        
            
                "price": 500.0,
            
        
    
    },
    
];



const CtStudiesData = [
    
    {
    
        
        
            
                "ct_number": "CT-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "result_text": "لا وجود لتغيرات حادة",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "price": 400.0,
            
        
    
    },
    
    {
    
        
        
            
                "ct_number": "CT-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "result_text": "تجمع سائل بسيط",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "price": 450.0,
            
        
    
    },
    
    {
    
        
        
            
                "ct_number": "CT-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "result_text": "نوصي متابعة بعد شهر",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "price": 500.0,
            
        
    
    },
    
];



const LabTestsData = [
    
    {
    
        
        
            
                "code": "CBC",
            
        
    
        
        
            
                "name": "تحليل دم كامل CBC",
            
        
    
        
        
            
                "unit": "فحص",
            
        
    
        
        
            
                "reference_range": "متغير حسب العمر",
            
        
    
        
        
            
                "price": 20.0,
            
        
    
        
        
            
                "notes": "يشمل فورمات الدم",
            
        
    
    },
    
    {
    
        
        
            
                "code": "GLU",
            
        
    
        
        
            
                "name": "سكر صائم",
            
        
    
        
        
            
                "unit": "مليمول/لتر",
            
        
    
        
        
            
                "reference_range": "3.9-5.5",
            
        
    
        
        
            
                "price": 10.0,
            
        
    
        
        
            
                "notes": "",
            
        
    
    },
    
    {
    
        
        
            
                "code": "CRP",
            
        
    
        
        
            
                "name": "CRP التهاب",
            
        
    
        
        
            
                "unit": "ملغم/ل",
            
        
    
        
        
            
                "reference_range": "0-5",
            
        
    
        
        
            
                "price": 25.0,
            
        
    
        
        
            
                "notes": "",
            
        
    
    },
    
];



const LabOrdersData = [
    
    {
    
        
        
            
                "lab_order_number": "LAB-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
    },
    
    {
    
        
        
            
                "lab_order_number": "LAB-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "completed",
            
        
    
    },
    
    {
    
        
        
            
                "lab_order_number": "LAB-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "pending",
            
        
    
    },
    
];



const LabResultsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result_value": "خلال النطاق الطبيعي",
            
        
    
        
        
            
                "unit": "",
            
        
    
        
        
            
                "reference_range": "",
            
        
    
        
        
            
                "remarks": "",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result_value": "مرتفع طفيف",
            
        
    
        
        
            
                "unit": "",
            
        
    
        
        
            
                "reference_range": "",
            
        
    
        
        
            
                "remarks": "مراقبة",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "result_value": "منخفض",
            
        
    
        
        
            
                "unit": "",
            
        
    
        
        
            
                "reference_range": "",
            
        
    
        
        
            
                "remarks": "تكرار التحليل بعد اسبوع",
            
        
    
    },
    
];



const EndoscopyCasesData = [
    
    {
    
        
        
            
                "case_number": "E-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "diagnosis": "قرحة بسيطة بالمعدة",
            
        
    
        
        
            
                "procedure_details": "تنظير اعتيادي مع اخذ خزعة",
            
        
    
        
        
            
                "recommendations": "مضاد حيوي ومتابعة",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "price": 300.0,
            
        
    
        
        
            
                "status": "completed",
            
        
    
    },
    
    {
    
        
        
            
                "case_number": "E-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "diagnosis": "التهاب مرئي",
            
        
    
        
        
            
                "procedure_details": "تنظير تشخيصي",
            
        
    
        
        
            
                "recommendations": "تعديل نظام غذائي",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "price": 250.0,
            
        
    
        
        
            
                "status": "completed",
            
        
    
    },
    
    {
    
        
        
            
                "case_number": "E-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "diagnosis": "اصابة سطحية",
            
        
    
        
        
            
                "procedure_details": "تنظيف وتوثيق",
            
        
    
        
        
            
                "recommendations": "",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "price": 200.0,
            
        
    
        
        
            
                "status": "pending",
            
        
    
    },
    
];



const SurgeryCasesData = [
    
    {
    
        
        
            
                "case_number": "S-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scheduled_start": new Date('2026-02-01T08:00:00Z'),
            
        
    
        
        
            
                "scheduled_end": new Date('2026-02-01T10:00:00Z'),
            
        
    
        
        
            
                "surgical_details": "استئصال زائدة دودية",
            
        
    
        
        
            
                "price": 2000.0,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
    },
    
    {
    
        
        
            
                "case_number": "S-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scheduled_start": new Date('2026-02-02T09:00:00Z'),
            
        
    
        
        
            
                "scheduled_end": new Date('2026-02-02T12:00:00Z'),
            
        
    
        
        
            
                "surgical_details": "جراحة مرورية بسيطة",
            
        
    
        
        
            
                "price": 3500.0,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "status": "completed",
            
        
    
    },
    
    {
    
        
        
            
                "case_number": "S-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scheduled_start": new Date('2026-02-03T07:30:00Z'),
            
        
    
        
        
            
                "scheduled_end": new Date('2026-02-03T09:00:00Z'),
            
        
    
        
        
            
                "surgical_details": "خياطة جروح كبيرة",
            
        
    
        
        
            
                "price": 1500.0,
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
    },
    
];



const SurgeryConsumablesData = [
    
    {
    
        
        
            
                "name": "قفازات جراحية",
            
        
    
        
        
            
                "quantity": 10,
            
        
    
        
        
            
                "unit_price": 2.5,
            
        
    
        
        
            
                "total_price": 25.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "شرائح معقمة",
            
        
    
        
        
            
                "quantity": 5,
            
        
    
        
        
            
                "unit_price": 10.0,
            
        
    
        
        
            
                "total_price": 50.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "خيوط جراحية",
            
        
    
        
        
            
                "quantity": 3,
            
        
    
        
        
            
                "unit_price": 15.0,
            
        
    
        
        
            
                "total_price": 45.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AnesthesiaRecordsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "medications": "بروبوفول ومهدئ",
            
        
    
        
        
            
                "start_time": new Date('2026-02-01T07:50:00Z'),
            
        
    
        
        
            
                "end_time": new Date('2026-02-01T10:10:00Z'),
            
        
    
        
        
            
                "recovery_notes": "استفاقة طبيعية",
            
        
    
        
        
            
                "price": 300.0,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "medications": "اسيتيل كولين ومهدئ",
            
        
    
        
        
            
                "start_time": new Date('2026-02-02T08:50:00Z'),
            
        
    
        
        
            
                "end_time": new Date('2026-02-02T12:10:00Z'),
            
        
    
        
        
            
                "recovery_notes": "مراقبة ساعة",
            
        
    
        
        
            
                "price": 400.0,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "medications": "مهدئ ومسكّن",
            
        
    
        
        
            
                "start_time": new Date('2026-02-03T07:20:00Z'),
            
        
    
        
        
            
                "end_time": new Date('2026-02-03T09:30:00Z'),
            
        
    
        
        
            
                "recovery_notes": "طبيعي",
            
        
    
        
        
            
                "price": 250.0,
            
        
    
    },
    
];



const CathlabCasesData = [
    
    {
    
        
        
            
                "case_number": "CATH-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "procedure_details": "قثطرة تشخيصية للقلب",
            
        
    
        
        
            
                "price": 5000.0,
            
        
    
        
        
            
                "scheduled_date": new Date('2026-03-01T08:00:00Z'),
            
        
    
        
        
            
                "status": "scheduled",
            
        
    
    },
    
    {
    
        
        
            
                "case_number": "CATH-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "procedure_details": "قثطرة علاجية وتركيب دعامات",
            
        
    
        
        
            
                "price": 15000.0,
            
        
    
        
        
            
                "scheduled_date": new Date('2026-03-05T09:00:00Z'),
            
        
    
        
        
            
                "status": "scheduled",
            
        
    
    },
    
    {
    
        
        
            
                "case_number": "CATH-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "procedure_details": "فحص شرايين",
            
        
    
        
        
            
                "price": 7000.0,
            
        
    
        
        
            
                "scheduled_date": new Date('2026-03-10T07:30:00Z'),
            
        
    
        
        
            
                "status": "scheduled",
            
        
    
    },
    
];



const EcgStressTestsData = [
    
    {
    
        
        
            
                "test_number": "ECG-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "result_text": "نتيجة طبيعية",
            
        
    
        
        
            
                "price": 60.0,
            
        
    
    },
    
    {
    
        
        
            
                "test_number": "ECG-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "result_text": "تغيرات بسيطة يحتاج متابعة",
            
        
    
        
        
            
                "price": 80.0,
            
        
    
    },
    
    {
    
        
        
            
                "test_number": "ECG-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "result_text": "دلائل اجهاد قلبي",
            
        
    
        
        
            
                "price": 120.0,
            
        
    
    },
    
];



const NursingStaffData = [
    
    {
    
        
        
            
                "full_name": "ممرضة هناء علي",
            
        
    
        
        
            
                "national_number": "4001987001111",
            
        
    
        
        
            
                "specialty": "قلب",
            
        
    
        
        
            
                "address": "طرطوس حي الطبي",
            
        
    
        
        
            
                "phone": "0944211001",
            
        
    
        
        
            
                "marital_status": "single",
            
        
    
        
        
            
                "children_count": 2,
            
        
    
        
        
            
                "night_shifts": true,
            
        
    
        
        
            
                "salary": 400.0,
            
        
    
        
        
            
                "bonuses": 50.0,
            
        
    
        
        
            
                "hire_date": new Date('2016-05-10T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                "full_name": "ممرضة سارة جميل",
            
        
    
        
        
            
                "national_number": "4001987002222",
            
        
    
        
        
            
                "specialty": "تمريض عام",
            
        
    
        
        
            
                "address": "اللاذقية شارع البحر",
            
        
    
        
        
            
                "phone": "0944211002",
            
        
    
        
        
            
                "marital_status": "divorced",
            
        
    
        
        
            
                "children_count": 0,
            
        
    
        
        
            
                "night_shifts": false,
            
        
    
        
        
            
                "salary": 350.0,
            
        
    
        
        
            
                "bonuses": 30.0,
            
        
    
        
        
            
                "hire_date": new Date('2018-09-20T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                "full_name": "ممرض كريم يوسف",
            
        
    
        
        
            
                "national_number": "4001987003333",
            
        
    
        
        
            
                "specialty": "طوارئ",
            
        
    
        
        
            
                "address": "حمص حي السلام",
            
        
    
        
        
            
                "phone": "0944211003",
            
        
    
        
        
            
                "marital_status": "divorced",
            
        
    
        
        
            
                "children_count": 3,
            
        
    
        
        
            
                "night_shifts": true,
            
        
    
        
        
            
                "salary": 380.0,
            
        
    
        
        
            
                "bonuses": 40.0,
            
        
    
        
        
            
                "hire_date": new Date('2014-03-15T00:00:00Z'),
            
        
    
    },
    
];



const CleaningStaffData = [
    
    {
    
        
        
            
                "full_name": "ياسر عبد الله",
            
        
    
        
        
            
                "national_number": "5001987001111",
            
        
    
        
        
            
                "phone": "0944300001",
            
        
    
        
        
            
                "address": "طرطوس",
            
        
    
        
        
            
                "specialty": "cleaning",
            
        
    
        
        
            
                "salary": 200.0,
            
        
    
        
        
            
                "bonuses": 20.0,
            
        
    
        
        
            
                "hire_date": new Date('2020-02-01T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                "full_name": "منى علي",
            
        
    
        
        
            
                "national_number": "5001987002222",
            
        
    
        
        
            
                "phone": "0944300002",
            
        
    
        
        
            
                "address": "اللاذقية",
            
        
    
        
        
            
                "specialty": "cleaning",
            
        
    
        
        
            
                "salary": 220.0,
            
        
    
        
        
            
                "bonuses": 25.0,
            
        
    
        
        
            
                "hire_date": new Date('2019-04-10T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                "full_name": "عمر حمد",
            
        
    
        
        
            
                "national_number": "5001987003333",
            
        
    
        
        
            
                "phone": "0944300003",
            
        
    
        
        
            
                "address": "حمص",
            
        
    
        
        
            
                "specialty": "sterilization",
            
        
    
        
        
            
                "salary": 190.0,
            
        
    
        
        
            
                "bonuses": 15.0,
            
        
    
        
        
            
                "hire_date": new Date('2021-06-01T00:00:00Z'),
            
        
    
    },
    
];



const InventoryConsumablesData = [
    
    {
    
        
        
            
                "name": "سرنجة 10 مل",
            
        
    
        
        
            
                "received_quantity": 500,
            
        
    
        
        
            
                "available_quantity": 420,
            
        
    
        
        
            
                "shortage": 0,
            
        
    
        
        
            
                "last_received_date": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "last_issued_date": new Date('2026-01-20T00:00:00Z'),
            
        
    
        
        
            
                "last_supplier": "المورد العام",
            
        
    
    },
    
    {
    
        
        
            
                "name": "قفازات طبية",
            
        
    
        
        
            
                "received_quantity": 1000,
            
        
    
        
        
            
                "available_quantity": 850,
            
        
    
        
        
            
                "shortage": 0,
            
        
    
        
        
            
                "last_received_date": new Date('2026-01-10T00:00:00Z'),
            
        
    
        
        
            
                "last_issued_date": new Date('2026-01-22T00:00:00Z'),
            
        
    
        
        
            
                "last_supplier": "مخزن الامان",
            
        
    
    },
    
    {
    
        
        
            
                "name": "محاليل ملحية 500 مل",
            
        
    
        
        
            
                "received_quantity": 200,
            
        
    
        
        
            
                "available_quantity": 120,
            
        
    
        
        
            
                "shortage": 10,
            
        
    
        
        
            
                "last_received_date": new Date('2026-01-05T00:00:00Z'),
            
        
    
        
        
            
                "last_issued_date": new Date('2026-01-21T00:00:00Z'),
            
        
    
        
        
            
                "last_supplier": "مورد الدواء",
            
        
    
    },
    
];



const PharmacyInventoryData = [
    
    {
    
        
        
            
                "drug_name": "باراسيتامول 500",
            
        
    
        
        
            
                "supplier": "مورد الادوية",
            
        
    
        
        
            
                "wholesale_price": 0.5,
            
        
    
        
        
            
                "retail_price": 1.0,
            
        
    
        
        
            
                "quantity": 200,
            
        
    
        
        
            
                "expiry_date": new Date('2027-06-01T00:00:00Z'),
            
        
    
        
        
            
                "batch_number": "BATCH001",
            
        
    
    },
    
    {
    
        
        
            
                "drug_name": "اكسبرين 100",
            
        
    
        
        
            
                "supplier": "شركة الصحة",
            
        
    
        
        
            
                "wholesale_price": 0.8,
            
        
    
        
        
            
                "retail_price": 1.5,
            
        
    
        
        
            
                "quantity": 150,
            
        
    
        
        
            
                "expiry_date": new Date('2026-12-01T00:00:00Z'),
            
        
    
        
        
            
                "batch_number": "BATCH002",
            
        
    
    },
    
    {
    
        
        
            
                "drug_name": "محلول ملحي",
            
        
    
        
        
            
                "supplier": "مورد النماذج",
            
        
    
        
        
            
                "wholesale_price": 2.0,
            
        
    
        
        
            
                "retail_price": 3.5,
            
        
    
        
        
            
                "quantity": 80,
            
        
    
        
        
            
                "expiry_date": new Date('2028-01-01T00:00:00Z'),
            
        
    
        
        
            
                "batch_number": "BATCH003",
            
        
    
    },
    
];



const PharmacySalesInvoicesData = [
    
    {
    
        
        
            
                "invoice_number": "PINV-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "items": "باراسيتامول 500 x2",
            
        
    
        
        
            
                "total_amount": 2.0,
            
        
    
        
        
            
                "tax": 0.1,
            
        
    
        
        
            
                "final_price": 2.1,
            
        
    
        
        
            
                "date": new Date('2026-01-10T10:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "invoice_number": "PINV-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "items": "اكسبرين 100 x1",
            
        
    
        
        
            
                "total_amount": 1.5,
            
        
    
        
        
            
                "tax": 0.08,
            
        
    
        
        
            
                "final_price": 1.58,
            
        
    
        
        
            
                "date": new Date('2026-01-11T15:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "invoice_number": "PINV-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "items": "محلول ملحي x1",
            
        
    
        
        
            
                "total_amount": 3.5,
            
        
    
        
        
            
                "tax": 0.18,
            
        
    
        
        
            
                "final_price": 3.68,
            
        
    
        
        
            
                "date": new Date('2026-01-12T11:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SuppliersData = [
    
    {
    
        
        
            
                "name": "المورد العام",
            
        
    
        
        
            
                "phone": "0944999001",
            
        
    
        
        
            
                "address": "طرطوس منطقة الميناء",
            
        
    
    },
    
    {
    
        
        
            
                "name": "مورد الادوية",
            
        
    
        
        
            
                "phone": "0944999002",
            
        
    
        
        
            
                "address": "دمشق منطقة التجارة",
            
        
    
    },
    
    {
    
        
        
            
                "name": "شركة الرعاية",
            
        
    
        
        
            
                "phone": "0944999003",
            
        
    
        
        
            
                "address": "اللاذقية منطقة المصنع",
            
        
    
    },
    
];



const PurchasesData = [
    
    {
    
        
        
            
                "purchase_number": "PUR-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "items": "باراسيتامول 500 x100",
            
        
    
        
        
            
                "total": 50.0,
            
        
    
        
        
            
                "date": new Date('2026-01-05T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                "purchase_number": "PUR-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "items": "قفازات x500",
            
        
    
        
        
            
                "total": 200.0,
            
        
    
        
        
            
                "date": new Date('2026-01-08T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                "purchase_number": "PUR-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "items": "محاليل ملحية x50",
            
        
    
        
        
            
                "total": 100.0,
            
        
    
        
        
            
                "date": new Date('2026-01-10T00:00:00Z'),
            
        
    
    },
    
];



const PatientInvoicesData = [
    
    {
    
        
        
            
                "invoice_number": "INV-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "items": "معاينة طوارئ",
            
        
    
        
        
            
                "subtotal": 200.0,
            
        
    
        
        
            
                "tax": 10.0,
            
        
    
        
        
            
                "total": 210.0,
            
        
    
        
        
            
                "status": "partial",
            
        
    
        
        
            
                "hide_real_price": true,
            
        
    
        
        
            
                "print_price": 210.0,
            
        
    
    },
    
    {
    
        
        
            
                "invoice_number": "INV-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "items": "تحاليل ومختبر",
            
        
    
        
        
            
                "subtotal": 120.0,
            
        
    
        
        
            
                "tax": 6.0,
            
        
    
        
        
            
                "total": 126.0,
            
        
    
        
        
            
                "status": "paid",
            
        
    
        
        
            
                "hide_real_price": true,
            
        
    
        
        
            
                "print_price": 130.0,
            
        
    
    },
    
    {
    
        
        
            
                "invoice_number": "INV-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "items": "اشعة وصور",
            
        
    
        
        
            
                "subtotal": 400.0,
            
        
    
        
        
            
                "tax": 20.0,
            
        
    
        
        
            
                "total": 420.0,
            
        
    
        
        
            
                "status": "partial",
            
        
    
        
        
            
                "hide_real_price": true,
            
        
    
        
        
            
                "print_price": 420.0,
            
        
    
    },
    
];



const LedgerEntriesData = [
    
    {
    
        
        
            
                "entry_number": "L-2026001",
            
        
    
        
        
            
                "date": new Date('2026-01-10T00:00:00Z'),
            
        
    
        
        
            
                "account": "الصندوق",
            
        
    
        
        
            
                "debit": 210.0,
            
        
    
        
        
            
                "credit": 0.0,
            
        
    
        
        
            
                "description": "استلام دفعة فاتورة",
            
        
    
    },
    
    {
    
        
        
            
                "entry_number": "L-2026002",
            
        
    
        
        
            
                "date": new Date('2026-01-11T00:00:00Z'),
            
        
    
        
        
            
                "account": "مشتريات",
            
        
    
        
        
            
                "debit": 0.0,
            
        
    
        
        
            
                "credit": 200.0,
            
        
    
        
        
            
                "description": "فاتورة مورد قفازات",
            
        
    
    },
    
    {
    
        
        
            
                "entry_number": "L-2026003",
            
        
    
        
        
            
                "date": new Date('2026-01-12T00:00:00Z'),
            
        
    
        
        
            
                "account": "المخزون",
            
        
    
        
        
            
                "debit": 100.0,
            
        
    
        
        
            
                "credit": 0.0,
            
        
    
        
        
            
                "description": "توريد محاليل",
            
        
    
    },
    
];



const JournalEntriesData = [
    
    {
    
        
        
            
                "journal_number": "J-2026001",
            
        
    
        
        
            
                "date": new Date('2026-01-10T00:00:00Z'),
            
        
    
        
        
            
                "entries": "قيد بيع خدمات",
            
        
    
        
        
            
                "total_debit": 210.0,
            
        
    
        
        
            
                "total_credit": 210.0,
            
        
    
    },
    
    {
    
        
        
            
                "journal_number": "J-2026002",
            
        
    
        
        
            
                "date": new Date('2026-01-11T00:00:00Z'),
            
        
    
        
        
            
                "entries": "قيد مشتريات",
            
        
    
        
        
            
                "total_debit": 200.0,
            
        
    
        
        
            
                "total_credit": 200.0,
            
        
    
    },
    
    {
    
        
        
            
                "journal_number": "J-2026003",
            
        
    
        
        
            
                "date": new Date('2026-01-12T00:00:00Z'),
            
        
    
        
        
            
                "entries": "قيد توريد مخزون",
            
        
    
        
        
            
                "total_debit": 100.0,
            
        
    
        
        
            
                "total_credit": 100.0,
            
        
    
    },
    
];



const TrialBalancesData = [
    
    {
    
        
        
            
                "report_name": "ميزان مراجعة شهر يناير 2026",
            
        
    
        
        
            
                "period_start": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-01-31T23:59:59Z'),
            
        
    
        
        
            
                "notes": "",
            
        
    
    },
    
    {
    
        
        
            
                "report_name": "ميزان مراجعة شهر فبراير 2026",
            
        
    
        
        
            
                "period_start": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-02-28T23:59:59Z'),
            
        
    
        
        
            
                "notes": "",
            
        
    
    },
    
    {
    
        
        
            
                "report_name": "ميزان مراجعة ربع اول 2026",
            
        
    
        
        
            
                "period_start": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-03-31T23:59:59Z'),
            
        
    
        
        
            
                "notes": "",
            
        
    
    },
    
];



const ClosingBalancesData = [
    
    {
    
        
        
            
                "report_name": "ميزان اختتام يناير 2026",
            
        
    
        
        
            
                "period_start": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-01-31T23:59:59Z'),
            
        
    
        
        
            
                "notes": "اغلاق شهري",
            
        
    
    },
    
    {
    
        
        
            
                "report_name": "ميزان اختتام فبراير 2026",
            
        
    
        
        
            
                "period_start": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-02-28T23:59:59Z'),
            
        
    
        
        
            
                "notes": "",
            
        
    
    },
    
    {
    
        
        
            
                "report_name": "ميزان اختتام ربع اول 2026",
            
        
    
        
        
            
                "period_start": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-03-31T23:59:59Z'),
            
        
    
        
        
            
                "notes": "",
            
        
    
    },
    
];



const InpatientRoomsData = [
    
    {
    
        
        
            
                "room_number": "R-101",
            
        
    
        
        
            
                "ward_name": "الجناح الاول",
            
        
    
        
        
            
                "room_type": "double",
            
        
    
        
        
            
                "price_per_day": 200.0,
            
        
    
        
        
            
                "capacity": 1,
            
        
    
        
        
            
                "is_available": true,
            
        
    
    },
    
    {
    
        
        
            
                "room_number": "R-102",
            
        
    
        
        
            
                "ward_name": "الجناح الاول",
            
        
    
        
        
            
                "room_type": "icu",
            
        
    
        
        
            
                "price_per_day": 150.0,
            
        
    
        
        
            
                "capacity": 2,
            
        
    
        
        
            
                "is_available": true,
            
        
    
    },
    
    {
    
        
        
            
                "room_number": "ICU-1",
            
        
    
        
        
            
                "ward_name": "العناية المركزة",
            
        
    
        
        
            
                "room_type": "icu",
            
        
    
        
        
            
                "price_per_day": 1000.0,
            
        
    
        
        
            
                "capacity": 1,
            
        
    
        
        
            
                "is_available": true,
            
        
    
    },
    
];



const RoomBookingsData = [
    
    {
    
        
        
            
                "booking_number": "B-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "admission_date": new Date('2026-01-10T12:00:00Z'),
            
        
    
        
        
            
                "discharge_date": new Date('2026-01-12T12:00:00Z'),
            
        
    
        
        
            
                "days": 2,
            
        
    
        
        
            
                "price_per_day": 200.0,
            
        
    
        
        
            
                "total_price": 400.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "booking_number": "B-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "admission_date": new Date('2026-01-15T08:00:00Z'),
            
        
    
        
        
            
                "discharge_date": new Date('2026-01-18T08:00:00Z'),
            
        
    
        
        
            
                "days": 3,
            
        
    
        
        
            
                "price_per_day": 150.0,
            
        
    
        
        
            
                "total_price": 450.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "booking_number": "B-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "admission_date": new Date('2026-01-20T14:00:00Z'),
            
        
    
        
        
            
                "discharge_date": new Date('2026-01-22T12:00:00Z'),
            
        
    
        
        
            
                "days": 2,
            
        
    
        
        
            
                "price_per_day": 1000.0,
            
        
    
        
        
            
                "total_price": 2000.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RestaurantMealsData = [
    
    {
    
        
        
            
                "name": "غداء خفيف",
            
        
    
        
        
            
                "quantity_received": 100,
            
        
    
        
        
            
                "quantity_kg": 50.0,
            
        
    
        
        
            
                "shortage": 0,
            
        
    
        
        
            
                "estimated_cost": 250.0,
            
        
    
        
        
            
                "distributed_count": 80,
            
        
    
        
        
            
                "drinks_count": 80,
            
        
    
    },
    
    {
    
        
        
            
                "name": "عشاء مغذي",
            
        
    
        
        
            
                "quantity_received": 120,
            
        
    
        
        
            
                "quantity_kg": 60.0,
            
        
    
        
        
            
                "shortage": 0,
            
        
    
        
        
            
                "estimated_cost": 300.0,
            
        
    
        
        
            
                "distributed_count": 100,
            
        
    
        
        
            
                "drinks_count": 100,
            
        
    
    },
    
    {
    
        
        
            
                "name": "فطور صباحي",
            
        
    
        
        
            
                "quantity_received": 90,
            
        
    
        
        
            
                "quantity_kg": 40.0,
            
        
    
        
        
            
                "shortage": 5,
            
        
    
        
        
            
                "estimated_cost": 200.0,
            
        
    
        
        
            
                "distributed_count": 85,
            
        
    
        
        
            
                "drinks_count": 85,
            
        
    
    },
    
];



const RestaurantInventoryData = [
    
    {
    
        
        
            
                "name": "أرز",
            
        
    
        
        
            
                "quantity_received": 200,
            
        
    
        
        
            
                "quantity_kg": 150.0,
            
        
    
        
        
            
                "shortage": 0,
            
        
    
        
        
            
                "last_supply_date": new Date('2026-01-05T00:00:00Z'),
            
        
    
        
        
            
                "unit": "كغم",
            
        
    
    },
    
    {
    
        
        
            
                "name": "لحم دجاج",
            
        
    
        
        
            
                "quantity_received": 100,
            
        
    
        
        
            
                "quantity_kg": 80.0,
            
        
    
        
        
            
                "shortage": 5,
            
        
    
        
        
            
                "last_supply_date": new Date('2026-01-07T00:00:00Z'),
            
        
    
        
        
            
                "unit": "كغم",
            
        
    
    },
    
    {
    
        
        
            
                "name": "خضروات",
            
        
    
        
        
            
                "quantity_received": 150,
            
        
    
        
        
            
                "quantity_kg": 120.0,
            
        
    
        
        
            
                "shortage": 10,
            
        
    
        
        
            
                "last_supply_date": new Date('2026-01-10T00:00:00Z'),
            
        
    
        
        
            
                "unit": "كغم",
            
        
    
    },
    
];



const MaternityCasesData = [
    
    {
    
        
        
            
                "case_number": "M-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "diagnosis": "ولادة طبيعية متوقعة",
            
        
    
        
        
            
                "delivery_type": "csection",
            
        
    
        
        
            
                "admission_date": new Date('2026-01-20T08:00:00Z'),
            
        
    
        
        
            
                "discharge_date": new Date('2026-01-22T12:00:00Z'),
            
        
    
        
        
            
                "price": 1200.0,
            
        
    
    },
    
    {
    
        
        
            
                "case_number": "M-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "diagnosis": "مراقبة حمل عالي المخاطر",
            
        
    
        
        
            
                "delivery_type": "natural",
            
        
    
        
        
            
                "admission_date": new Date('2026-01-25T10:00:00Z'),
            
        
    
        
        
            
                "discharge_date": new Date('2026-01-28T11:00:00Z'),
            
        
    
        
        
            
                "price": 3500.0,
            
        
    
    },
    
    {
    
        
        
            
                "case_number": "M-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "diagnosis": "متابعة حمل طبيعي",
            
        
    
        
        
            
                "delivery_type": "natural",
            
        
    
        
        
            
                "admission_date": new Date('2026-02-01T09:00:00Z'),
            
        
    
        
        
            
                "discharge_date": new Date('2026-02-01T15:00:00Z'),
            
        
    
        
        
            
                "price": 1000.0,
            
        
    
    },
    
];



const PregnancyFollowupsData = [
    
    {
    
        
        
            
                "followup_number": "PF-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "weight": 68.0,
            
        
    
        
        
            
                "blood_pressure": "120/80",
            
        
    
        
        
            
                "delivery_plan": "natural",
            
        
    
        
        
            
                "next_visit_date": new Date('2026-02-10T00:00:00Z'),
            
        
    
        
        
            
                "price": 50.0,
            
        
    
        
        
            
                "notes": "",
            
        
    
    },
    
    {
    
        
        
            
                "followup_number": "PF-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "weight": 72.0,
            
        
    
        
        
            
                "blood_pressure": "125/82",
            
        
    
        
        
            
                "delivery_plan": "csection",
            
        
    
        
        
            
                "next_visit_date": new Date('2026-02-17T00:00:00Z'),
            
        
    
        
        
            
                "price": 70.0,
            
        
    
        
        
            
                "notes": "مراقبة ضغط",
            
        
    
    },
    
    {
    
        
        
            
                "followup_number": "PF-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "weight": 65.0,
            
        
    
        
        
            
                "blood_pressure": "118/78",
            
        
    
        
        
            
                "delivery_plan": "natural",
            
        
    
        
        
            
                "next_visit_date": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "price": 50.0,
            
        
    
        
        
            
                "notes": "",
            
        
    
    },
    
];



const NicuIncubatorsData = [
    
    {
    
        
        
            
                "incubator_number": "NICU-01",
            
        
    
        
        
            
                "baby_name": "يوسف",
            
        
    
        
        
            
                "baby_age": "3 يوم",
            
        
    
        
        
            
                "medications": "مضاد حيوي",
            
        
    
        
        
            
                "devices": "جهاز تنفس",
            
        
    
        
        
            
                "daily_price": 150.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "admission_date": new Date('2026-01-10T12:30:00Z'),
            
        
    
        
        
            
                "discharge_date": new Date('2026-01-15T10:00:00Z'),
            
        
    
        
        
            
                "cancellation_reason": "",
            
        
    
    },
    
    {
    
        
        
            
                "incubator_number": "NICU-02",
            
        
    
        
        
            
                "baby_name": "ليان",
            
        
    
        
        
            
                "baby_age": "1 يوم",
            
        
    
        
        
            
                "medications": "فيتامين",
            
        
    
        
        
            
                "devices": "مراقبة قلب",
            
        
    
        
        
            
                "daily_price": 140.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "admission_date": new Date('2026-01-12T09:00:00Z'),
            
        
    
        
        
            
                "discharge_date": new Date('2026-01-18T09:00:00Z'),
            
        
    
        
        
            
                "cancellation_reason": "",
            
        
    
    },
    
    {
    
        
        
            
                "incubator_number": "NICU-03",
            
        
    
        
        
            
                "baby_name": "عمر",
            
        
    
        
        
            
                "baby_age": "5 يوم",
            
        
    
        
        
            
                "medications": "سحب عينات",
            
        
    
        
        
            
                "devices": "انبوب تغذية",
            
        
    
        
        
            
                "daily_price": 160.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "admission_date": new Date('2026-01-14T08:00:00Z'),
            
        
    
        
        
            
                "discharge_date": new Date('2026-01-20T08:00:00Z'),
            
        
    
        
        
            
                "cancellation_reason": "",
            
        
    
    },
    
];



const DailyFollowupClinicData = [
    
    {
    
        
        
            
                "record_number": "DFC-2026001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "condition_type": "other",
            
        
    
        
        
            
                "route": "iv",
            
        
    
        
        
            
                "notes": "متابعة سكر يومية",
            
        
    
        
        
            
                "send_to_accounting": true,
            
        
    
        
        
            
                "price": 25.0,
            
        
    
    },
    
    {
    
        
        
            
                "record_number": "DFC-2026002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "condition_type": "other",
            
        
    
        
        
            
                "route": "oral",
            
        
    
        
        
            
                "notes": "حقنة وريدي",
            
        
    
        
        
            
                "send_to_accounting": true,
            
        
    
        
        
            
                "price": 40.0,
            
        
    
    },
    
    {
    
        
        
            
                "record_number": "DFC-2026003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "condition_type": "hypertension",
            
        
    
        
        
            
                "route": "oral",
            
        
    
        
        
            
                "notes": "متابعة عامة",
            
        
    
        
        
            
                "send_to_accounting": true,
            
        
    
        
        
            
                "price": 20.0,
            
        
    
    },
    
];



const AuditLogData = [
    
    {
    
        
        
            
                "action": "login",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity": "users",
            
        
    
        
        
            
                "entity_ref": "users:director",
            
        
    
        
        
            
                "action_time": new Date('2026-01-10T09:00:00Z'),
            
        
    
        
        
            
                "details": "دخول المستخدم بنجاح",
            
        
    
    },
    
    {
    
        
        
            
                "action": "create",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity": "patients",
            
        
    
        
        
            
                "entity_ref": "patients:1001987654321",
            
        
    
        
        
            
                "action_time": new Date('2026-01-10T09:35:00Z'),
            
        
    
        
        
            
                "details": "تسجيل مريض جديد",
            
        
    
    },
    
    {
    
        
        
            
                "action": "print",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity": "visits",
            
        
    
        
        
            
                "entity_ref": "visits:V-2026001",
            
        
    
        
        
            
                "action_time": new Date('2026-01-10T10:05:00Z'),
            
        
    
        
        
            
                "details": "طباعة تقرير الزيارة",
            
        
    
    },
    
];



const SettingsData = [
    
    {
    
        
        
            
                "key": "hospital_name",
            
        
    
        
        
            
                "value": "OMAYA HOSPITAL مشفى أمية",
            
        
    
        
        
            
                "theme_color": "#1F2937",
            
        
    
        
        
            
                "rtl": true,
            
        
    
        
        
            
                "hospital_name": "مشفى أمية",
            
        
    
        
        
            
                "phone": "0944123000",
            
        
    
    },
    
    {
    
        
        
            
                "key": "print_header",
            
        
    
        
        
            
                "value": "مشفى أمية – OMAYA HOSPITAL",
            
        
    
        
        
            
                "theme_color": "#1F2937",
            
        
    
        
        
            
                "rtl": true,
            
        
    
        
        
            
                "hospital_name": "مشفى أمية",
            
        
    
        
        
            
                "phone": "0944123000",
            
        
    
    },
    
    {
    
        
        
            
                "key": "default_currency",
            
        
    
        
        
            
                "value": "SYP",
            
        
    
        
        
            
                "theme_color": "#1F2937",
            
        
    
        
        
            
                "rtl": true,
            
        
    
        
        
            
                "hospital_name": "مشفى أمية",
            
        
    
        
        
            
                "phone": "0944123000",
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePatientWithPrimary_doctor() {
            
                const relatedPrimary_doctor0 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const Patient0 = await Patients.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Patient0?.setPrimary_doctor)
                {
                    await
                    Patient0.
                    setPrimary_doctor(relatedPrimary_doctor0);
                }
            
                const relatedPrimary_doctor1 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const Patient1 = await Patients.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Patient1?.setPrimary_doctor)
                {
                    await
                    Patient1.
                    setPrimary_doctor(relatedPrimary_doctor1);
                }
            
                const relatedPrimary_doctor2 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const Patient2 = await Patients.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Patient2?.setPrimary_doctor)
                {
                    await
                    Patient2.
                    setPrimary_doctor(relatedPrimary_doctor2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
            
            async function associateGuarantorWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const Guarantor0 = await Guarantors.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Guarantor0?.setPatient)
                {
                    await
                    Guarantor0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const Guarantor1 = await Guarantors.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Guarantor1?.setPatient)
                {
                    await
                    Guarantor1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const Guarantor2 = await Guarantors.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Guarantor2?.setPatient)
                {
                    await
                    Guarantor2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDoctorWithUser_account() {
            
                const relatedUser_account0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Doctor0 = await Doctors.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Doctor0?.setUser_account)
                {
                    await
                    Doctor0.
                    setUser_account(relatedUser_account0);
                }
            
                const relatedUser_account1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Doctor1 = await Doctors.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Doctor1?.setUser_account)
                {
                    await
                    Doctor1.
                    setUser_account(relatedUser_account1);
                }
            
                const relatedUser_account2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Doctor2 = await Doctors.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Doctor2?.setUser_account)
                {
                    await
                    Doctor2.
                    setUser_account(relatedUser_account2);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateVisitWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const Visit0 = await Visits.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Visit0?.setPatient)
                {
                    await
                    Visit0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const Visit1 = await Visits.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Visit1?.setPatient)
                {
                    await
                    Visit1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const Visit2 = await Visits.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Visit2?.setPatient)
                {
                    await
                    Visit2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    
        
            
            async function associateVisitWithGuarantor() {
            
                const relatedGuarantor0 = await Guarantors.findOne({
                    offset: Math.floor(Math.random() * (await Guarantors.count())),
                });
                const Visit0 = await Visits.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Visit0?.setGuarantor)
                {
                    await
                    Visit0.
                    setGuarantor(relatedGuarantor0);
                }
            
                const relatedGuarantor1 = await Guarantors.findOne({
                    offset: Math.floor(Math.random() * (await Guarantors.count())),
                });
                const Visit1 = await Visits.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Visit1?.setGuarantor)
                {
                    await
                    Visit1.
                    setGuarantor(relatedGuarantor1);
                }
            
                const relatedGuarantor2 = await Guarantors.findOne({
                    offset: Math.floor(Math.random() * (await Guarantors.count())),
                });
                const Visit2 = await Visits.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Visit2?.setGuarantor)
                {
                    await
                    Visit2.
                    setGuarantor(relatedGuarantor2);
                }
            
        }
        
    
        
            
            async function associateVisitWithDoctor() {
            
                const relatedDoctor0 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const Visit0 = await Visits.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Visit0?.setDoctor)
                {
                    await
                    Visit0.
                    setDoctor(relatedDoctor0);
                }
            
                const relatedDoctor1 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const Visit1 = await Visits.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Visit1?.setDoctor)
                {
                    await
                    Visit1.
                    setDoctor(relatedDoctor1);
                }
            
                const relatedDoctor2 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const Visit2 = await Visits.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Visit2?.setDoctor)
                {
                    await
                    Visit2.
                    setDoctor(relatedDoctor2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateOrderWithVisit() {
            
                const relatedVisit0 = await Visits.findOne({
                    offset: Math.floor(Math.random() * (await Visits.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setVisit)
                {
                    await
                    Order0.
                    setVisit(relatedVisit0);
                }
            
                const relatedVisit1 = await Visits.findOne({
                    offset: Math.floor(Math.random() * (await Visits.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setVisit)
                {
                    await
                    Order1.
                    setVisit(relatedVisit1);
                }
            
                const relatedVisit2 = await Visits.findOne({
                    offset: Math.floor(Math.random() * (await Visits.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setVisit)
                {
                    await
                    Order2.
                    setVisit(relatedVisit2);
                }
            
        }
        
    
        
            
            async function associateOrderWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setPatient)
                {
                    await
                    Order0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setPatient)
                {
                    await
                    Order1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setPatient)
                {
                    await
                    Order2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    
        
            
            async function associateOrderWithRequested_by() {
            
                const relatedRequested_by0 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setRequested_by)
                {
                    await
                    Order0.
                    setRequested_by(relatedRequested_by0);
                }
            
                const relatedRequested_by1 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setRequested_by)
                {
                    await
                    Order1.
                    setRequested_by(relatedRequested_by1);
                }
            
                const relatedRequested_by2 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setRequested_by)
                {
                    await
                    Order2.
                    setRequested_by(relatedRequested_by2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateRadiologyStudyWithOrder() {
            
                const relatedOrder0 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const RadiologyStudy0 = await RadiologyStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RadiologyStudy0?.setOrder)
                {
                    await
                    RadiologyStudy0.
                    setOrder(relatedOrder0);
                }
            
                const relatedOrder1 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const RadiologyStudy1 = await RadiologyStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RadiologyStudy1?.setOrder)
                {
                    await
                    RadiologyStudy1.
                    setOrder(relatedOrder1);
                }
            
                const relatedOrder2 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const RadiologyStudy2 = await RadiologyStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RadiologyStudy2?.setOrder)
                {
                    await
                    RadiologyStudy2.
                    setOrder(relatedOrder2);
                }
            
        }
        
    
        
            
            async function associateRadiologyStudyWithStudy_type() {
            
                const relatedStudy_type0 = await RadiologyTypes.findOne({
                    offset: Math.floor(Math.random() * (await RadiologyTypes.count())),
                });
                const RadiologyStudy0 = await RadiologyStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RadiologyStudy0?.setStudy_type)
                {
                    await
                    RadiologyStudy0.
                    setStudy_type(relatedStudy_type0);
                }
            
                const relatedStudy_type1 = await RadiologyTypes.findOne({
                    offset: Math.floor(Math.random() * (await RadiologyTypes.count())),
                });
                const RadiologyStudy1 = await RadiologyStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RadiologyStudy1?.setStudy_type)
                {
                    await
                    RadiologyStudy1.
                    setStudy_type(relatedStudy_type1);
                }
            
                const relatedStudy_type2 = await RadiologyTypes.findOne({
                    offset: Math.floor(Math.random() * (await RadiologyTypes.count())),
                });
                const RadiologyStudy2 = await RadiologyStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RadiologyStudy2?.setStudy_type)
                {
                    await
                    RadiologyStudy2.
                    setStudy_type(relatedStudy_type2);
                }
            
        }
        
    
        
            
            async function associateRadiologyStudyWithTechnician() {
            
                const relatedTechnician0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RadiologyStudy0 = await RadiologyStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RadiologyStudy0?.setTechnician)
                {
                    await
                    RadiologyStudy0.
                    setTechnician(relatedTechnician0);
                }
            
                const relatedTechnician1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RadiologyStudy1 = await RadiologyStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RadiologyStudy1?.setTechnician)
                {
                    await
                    RadiologyStudy1.
                    setTechnician(relatedTechnician1);
                }
            
                const relatedTechnician2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RadiologyStudy2 = await RadiologyStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RadiologyStudy2?.setTechnician)
                {
                    await
                    RadiologyStudy2.
                    setTechnician(relatedTechnician2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateCtStudyWithOrder() {
            
                const relatedOrder0 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const CtStudy0 = await CtStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CtStudy0?.setOrder)
                {
                    await
                    CtStudy0.
                    setOrder(relatedOrder0);
                }
            
                const relatedOrder1 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const CtStudy1 = await CtStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CtStudy1?.setOrder)
                {
                    await
                    CtStudy1.
                    setOrder(relatedOrder1);
                }
            
                const relatedOrder2 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const CtStudy2 = await CtStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CtStudy2?.setOrder)
                {
                    await
                    CtStudy2.
                    setOrder(relatedOrder2);
                }
            
        }
        
    
        
            
            async function associateCtStudyWithCt_type() {
            
                const relatedCt_type0 = await CtTypes.findOne({
                    offset: Math.floor(Math.random() * (await CtTypes.count())),
                });
                const CtStudy0 = await CtStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CtStudy0?.setCt_type)
                {
                    await
                    CtStudy0.
                    setCt_type(relatedCt_type0);
                }
            
                const relatedCt_type1 = await CtTypes.findOne({
                    offset: Math.floor(Math.random() * (await CtTypes.count())),
                });
                const CtStudy1 = await CtStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CtStudy1?.setCt_type)
                {
                    await
                    CtStudy1.
                    setCt_type(relatedCt_type1);
                }
            
                const relatedCt_type2 = await CtTypes.findOne({
                    offset: Math.floor(Math.random() * (await CtTypes.count())),
                });
                const CtStudy2 = await CtStudies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CtStudy2?.setCt_type)
                {
                    await
                    CtStudy2.
                    setCt_type(relatedCt_type2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateLabOrderWithOrder() {
            
                const relatedOrder0 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const LabOrder0 = await LabOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LabOrder0?.setOrder)
                {
                    await
                    LabOrder0.
                    setOrder(relatedOrder0);
                }
            
                const relatedOrder1 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const LabOrder1 = await LabOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LabOrder1?.setOrder)
                {
                    await
                    LabOrder1.
                    setOrder(relatedOrder1);
                }
            
                const relatedOrder2 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const LabOrder2 = await LabOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LabOrder2?.setOrder)
                {
                    await
                    LabOrder2.
                    setOrder(relatedOrder2);
                }
            
        }
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateLabOrderWithLab_technician() {
            
                const relatedLab_technician0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const LabOrder0 = await LabOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LabOrder0?.setLab_technician)
                {
                    await
                    LabOrder0.
                    setLab_technician(relatedLab_technician0);
                }
            
                const relatedLab_technician1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const LabOrder1 = await LabOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LabOrder1?.setLab_technician)
                {
                    await
                    LabOrder1.
                    setLab_technician(relatedLab_technician1);
                }
            
                const relatedLab_technician2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const LabOrder2 = await LabOrders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LabOrder2?.setLab_technician)
                {
                    await
                    LabOrder2.
                    setLab_technician(relatedLab_technician2);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateLabResultWithLab_order() {
            
                const relatedLab_order0 = await LabOrders.findOne({
                    offset: Math.floor(Math.random() * (await LabOrders.count())),
                });
                const LabResult0 = await LabResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LabResult0?.setLab_order)
                {
                    await
                    LabResult0.
                    setLab_order(relatedLab_order0);
                }
            
                const relatedLab_order1 = await LabOrders.findOne({
                    offset: Math.floor(Math.random() * (await LabOrders.count())),
                });
                const LabResult1 = await LabResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LabResult1?.setLab_order)
                {
                    await
                    LabResult1.
                    setLab_order(relatedLab_order1);
                }
            
                const relatedLab_order2 = await LabOrders.findOne({
                    offset: Math.floor(Math.random() * (await LabOrders.count())),
                });
                const LabResult2 = await LabResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LabResult2?.setLab_order)
                {
                    await
                    LabResult2.
                    setLab_order(relatedLab_order2);
                }
            
        }
        
    
        
            
            async function associateLabResultWithTest() {
            
                const relatedTest0 = await LabTests.findOne({
                    offset: Math.floor(Math.random() * (await LabTests.count())),
                });
                const LabResult0 = await LabResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LabResult0?.setTest)
                {
                    await
                    LabResult0.
                    setTest(relatedTest0);
                }
            
                const relatedTest1 = await LabTests.findOne({
                    offset: Math.floor(Math.random() * (await LabTests.count())),
                });
                const LabResult1 = await LabResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LabResult1?.setTest)
                {
                    await
                    LabResult1.
                    setTest(relatedTest1);
                }
            
                const relatedTest2 = await LabTests.findOne({
                    offset: Math.floor(Math.random() * (await LabTests.count())),
                });
                const LabResult2 = await LabResults.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LabResult2?.setTest)
                {
                    await
                    LabResult2.
                    setTest(relatedTest2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateEndoscopyCasWithVisit() {
            
                const relatedVisit0 = await Visits.findOne({
                    offset: Math.floor(Math.random() * (await Visits.count())),
                });
                const EndoscopyCas0 = await EndoscopyCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EndoscopyCas0?.setVisit)
                {
                    await
                    EndoscopyCas0.
                    setVisit(relatedVisit0);
                }
            
                const relatedVisit1 = await Visits.findOne({
                    offset: Math.floor(Math.random() * (await Visits.count())),
                });
                const EndoscopyCas1 = await EndoscopyCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EndoscopyCas1?.setVisit)
                {
                    await
                    EndoscopyCas1.
                    setVisit(relatedVisit1);
                }
            
                const relatedVisit2 = await Visits.findOne({
                    offset: Math.floor(Math.random() * (await Visits.count())),
                });
                const EndoscopyCas2 = await EndoscopyCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EndoscopyCas2?.setVisit)
                {
                    await
                    EndoscopyCas2.
                    setVisit(relatedVisit2);
                }
            
        }
        
    
        
            
            async function associateEndoscopyCasWithDoctor() {
            
                const relatedDoctor0 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const EndoscopyCas0 = await EndoscopyCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EndoscopyCas0?.setDoctor)
                {
                    await
                    EndoscopyCas0.
                    setDoctor(relatedDoctor0);
                }
            
                const relatedDoctor1 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const EndoscopyCas1 = await EndoscopyCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EndoscopyCas1?.setDoctor)
                {
                    await
                    EndoscopyCas1.
                    setDoctor(relatedDoctor1);
                }
            
                const relatedDoctor2 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const EndoscopyCas2 = await EndoscopyCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EndoscopyCas2?.setDoctor)
                {
                    await
                    EndoscopyCas2.
                    setDoctor(relatedDoctor2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateSurgeryCasWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const SurgeryCas0 = await SurgeryCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SurgeryCas0?.setPatient)
                {
                    await
                    SurgeryCas0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const SurgeryCas1 = await SurgeryCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SurgeryCas1?.setPatient)
                {
                    await
                    SurgeryCas1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const SurgeryCas2 = await SurgeryCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SurgeryCas2?.setPatient)
                {
                    await
                    SurgeryCas2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    
        
            
            async function associateSurgeryCasWithSurgeon() {
            
                const relatedSurgeon0 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const SurgeryCas0 = await SurgeryCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SurgeryCas0?.setSurgeon)
                {
                    await
                    SurgeryCas0.
                    setSurgeon(relatedSurgeon0);
                }
            
                const relatedSurgeon1 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const SurgeryCas1 = await SurgeryCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SurgeryCas1?.setSurgeon)
                {
                    await
                    SurgeryCas1.
                    setSurgeon(relatedSurgeon1);
                }
            
                const relatedSurgeon2 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const SurgeryCas2 = await SurgeryCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SurgeryCas2?.setSurgeon)
                {
                    await
                    SurgeryCas2.
                    setSurgeon(relatedSurgeon2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
            
            async function associateSurgeryConsumableWithSurgery_case() {
            
                const relatedSurgery_case0 = await SurgeryCases.findOne({
                    offset: Math.floor(Math.random() * (await SurgeryCases.count())),
                });
                const SurgeryConsumable0 = await SurgeryConsumables.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SurgeryConsumable0?.setSurgery_case)
                {
                    await
                    SurgeryConsumable0.
                    setSurgery_case(relatedSurgery_case0);
                }
            
                const relatedSurgery_case1 = await SurgeryCases.findOne({
                    offset: Math.floor(Math.random() * (await SurgeryCases.count())),
                });
                const SurgeryConsumable1 = await SurgeryConsumables.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SurgeryConsumable1?.setSurgery_case)
                {
                    await
                    SurgeryConsumable1.
                    setSurgery_case(relatedSurgery_case1);
                }
            
                const relatedSurgery_case2 = await SurgeryCases.findOne({
                    offset: Math.floor(Math.random() * (await SurgeryCases.count())),
                });
                const SurgeryConsumable2 = await SurgeryConsumables.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SurgeryConsumable2?.setSurgery_case)
                {
                    await
                    SurgeryConsumable2.
                    setSurgery_case(relatedSurgery_case2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAnesthesiaRecordWithSurgery_case() {
            
                const relatedSurgery_case0 = await SurgeryCases.findOne({
                    offset: Math.floor(Math.random() * (await SurgeryCases.count())),
                });
                const AnesthesiaRecord0 = await AnesthesiaRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AnesthesiaRecord0?.setSurgery_case)
                {
                    await
                    AnesthesiaRecord0.
                    setSurgery_case(relatedSurgery_case0);
                }
            
                const relatedSurgery_case1 = await SurgeryCases.findOne({
                    offset: Math.floor(Math.random() * (await SurgeryCases.count())),
                });
                const AnesthesiaRecord1 = await AnesthesiaRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AnesthesiaRecord1?.setSurgery_case)
                {
                    await
                    AnesthesiaRecord1.
                    setSurgery_case(relatedSurgery_case1);
                }
            
                const relatedSurgery_case2 = await SurgeryCases.findOne({
                    offset: Math.floor(Math.random() * (await SurgeryCases.count())),
                });
                const AnesthesiaRecord2 = await AnesthesiaRecords.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AnesthesiaRecord2?.setSurgery_case)
                {
                    await
                    AnesthesiaRecord2.
                    setSurgery_case(relatedSurgery_case2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateCathlabCasWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const CathlabCas0 = await CathlabCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CathlabCas0?.setPatient)
                {
                    await
                    CathlabCas0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const CathlabCas1 = await CathlabCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CathlabCas1?.setPatient)
                {
                    await
                    CathlabCas1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const CathlabCas2 = await CathlabCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CathlabCas2?.setPatient)
                {
                    await
                    CathlabCas2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    
        
            
            async function associateCathlabCasWithDoctor() {
            
                const relatedDoctor0 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const CathlabCas0 = await CathlabCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CathlabCas0?.setDoctor)
                {
                    await
                    CathlabCas0.
                    setDoctor(relatedDoctor0);
                }
            
                const relatedDoctor1 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const CathlabCas1 = await CathlabCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CathlabCas1?.setDoctor)
                {
                    await
                    CathlabCas1.
                    setDoctor(relatedDoctor1);
                }
            
                const relatedDoctor2 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const CathlabCas2 = await CathlabCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CathlabCas2?.setDoctor)
                {
                    await
                    CathlabCas2.
                    setDoctor(relatedDoctor2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateEcgStressTestWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const EcgStressTest0 = await EcgStressTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EcgStressTest0?.setPatient)
                {
                    await
                    EcgStressTest0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const EcgStressTest1 = await EcgStressTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EcgStressTest1?.setPatient)
                {
                    await
                    EcgStressTest1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const EcgStressTest2 = await EcgStressTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EcgStressTest2?.setPatient)
                {
                    await
                    EcgStressTest2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    
        
            
            async function associateEcgStressTestWithDoctor() {
            
                const relatedDoctor0 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const EcgStressTest0 = await EcgStressTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EcgStressTest0?.setDoctor)
                {
                    await
                    EcgStressTest0.
                    setDoctor(relatedDoctor0);
                }
            
                const relatedDoctor1 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const EcgStressTest1 = await EcgStressTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EcgStressTest1?.setDoctor)
                {
                    await
                    EcgStressTest1.
                    setDoctor(relatedDoctor1);
                }
            
                const relatedDoctor2 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const EcgStressTest2 = await EcgStressTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EcgStressTest2?.setDoctor)
                {
                    await
                    EcgStressTest2.
                    setDoctor(relatedDoctor2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associatePharmacySalesInvoiceWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const PharmacySalesInvoice0 = await PharmacySalesInvoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PharmacySalesInvoice0?.setPatient)
                {
                    await
                    PharmacySalesInvoice0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const PharmacySalesInvoice1 = await PharmacySalesInvoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PharmacySalesInvoice1?.setPatient)
                {
                    await
                    PharmacySalesInvoice1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const PharmacySalesInvoice2 = await PharmacySalesInvoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PharmacySalesInvoice2?.setPatient)
                {
                    await
                    PharmacySalesInvoice2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePharmacySalesInvoiceWithCashier() {
            
                const relatedCashier0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PharmacySalesInvoice0 = await PharmacySalesInvoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PharmacySalesInvoice0?.setCashier)
                {
                    await
                    PharmacySalesInvoice0.
                    setCashier(relatedCashier0);
                }
            
                const relatedCashier1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PharmacySalesInvoice1 = await PharmacySalesInvoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PharmacySalesInvoice1?.setCashier)
                {
                    await
                    PharmacySalesInvoice1.
                    setCashier(relatedCashier1);
                }
            
                const relatedCashier2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const PharmacySalesInvoice2 = await PharmacySalesInvoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PharmacySalesInvoice2?.setCashier)
                {
                    await
                    PharmacySalesInvoice2.
                    setCashier(relatedCashier2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associatePurchasWithSupplier() {
            
                const relatedSupplier0 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Purchas0 = await Purchases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Purchas0?.setSupplier)
                {
                    await
                    Purchas0.
                    setSupplier(relatedSupplier0);
                }
            
                const relatedSupplier1 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Purchas1 = await Purchases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Purchas1?.setSupplier)
                {
                    await
                    Purchas1.
                    setSupplier(relatedSupplier1);
                }
            
                const relatedSupplier2 = await Suppliers.findOne({
                    offset: Math.floor(Math.random() * (await Suppliers.count())),
                });
                const Purchas2 = await Purchases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Purchas2?.setSupplier)
                {
                    await
                    Purchas2.
                    setSupplier(relatedSupplier2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associatePatientInvoiceWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const PatientInvoice0 = await PatientInvoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PatientInvoice0?.setPatient)
                {
                    await
                    PatientInvoice0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const PatientInvoice1 = await PatientInvoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PatientInvoice1?.setPatient)
                {
                    await
                    PatientInvoice1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const PatientInvoice2 = await PatientInvoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PatientInvoice2?.setPatient)
                {
                    await
                    PatientInvoice2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateRoomBookingWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const RoomBooking0 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoomBooking0?.setPatient)
                {
                    await
                    RoomBooking0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const RoomBooking1 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoomBooking1?.setPatient)
                {
                    await
                    RoomBooking1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const RoomBooking2 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoomBooking2?.setPatient)
                {
                    await
                    RoomBooking2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    
        
            
            async function associateRoomBookingWithRoom() {
            
                const relatedRoom0 = await InpatientRooms.findOne({
                    offset: Math.floor(Math.random() * (await InpatientRooms.count())),
                });
                const RoomBooking0 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoomBooking0?.setRoom)
                {
                    await
                    RoomBooking0.
                    setRoom(relatedRoom0);
                }
            
                const relatedRoom1 = await InpatientRooms.findOne({
                    offset: Math.floor(Math.random() * (await InpatientRooms.count())),
                });
                const RoomBooking1 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoomBooking1?.setRoom)
                {
                    await
                    RoomBooking1.
                    setRoom(relatedRoom1);
                }
            
                const relatedRoom2 = await InpatientRooms.findOne({
                    offset: Math.floor(Math.random() * (await InpatientRooms.count())),
                });
                const RoomBooking2 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoomBooking2?.setRoom)
                {
                    await
                    RoomBooking2.
                    setRoom(relatedRoom2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateRoomBookingWithSupervising_nurse() {
            
                const relatedSupervising_nurse0 = await NursingStaff.findOne({
                    offset: Math.floor(Math.random() * (await NursingStaff.count())),
                });
                const RoomBooking0 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoomBooking0?.setSupervising_nurse)
                {
                    await
                    RoomBooking0.
                    setSupervising_nurse(relatedSupervising_nurse0);
                }
            
                const relatedSupervising_nurse1 = await NursingStaff.findOne({
                    offset: Math.floor(Math.random() * (await NursingStaff.count())),
                });
                const RoomBooking1 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoomBooking1?.setSupervising_nurse)
                {
                    await
                    RoomBooking1.
                    setSupervising_nurse(relatedSupervising_nurse1);
                }
            
                const relatedSupervising_nurse2 = await NursingStaff.findOne({
                    offset: Math.floor(Math.random() * (await NursingStaff.count())),
                });
                const RoomBooking2 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoomBooking2?.setSupervising_nurse)
                {
                    await
                    RoomBooking2.
                    setSupervising_nurse(relatedSupervising_nurse2);
                }
            
        }
        
    
        
            
            async function associateRoomBookingWithSupervising_doctor() {
            
                const relatedSupervising_doctor0 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const RoomBooking0 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoomBooking0?.setSupervising_doctor)
                {
                    await
                    RoomBooking0.
                    setSupervising_doctor(relatedSupervising_doctor0);
                }
            
                const relatedSupervising_doctor1 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const RoomBooking1 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoomBooking1?.setSupervising_doctor)
                {
                    await
                    RoomBooking1.
                    setSupervising_doctor(relatedSupervising_doctor1);
                }
            
                const relatedSupervising_doctor2 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const RoomBooking2 = await RoomBookings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoomBooking2?.setSupervising_doctor)
                {
                    await
                    RoomBooking2.
                    setSupervising_doctor(relatedSupervising_doctor2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateMaternityCasWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const MaternityCas0 = await MaternityCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaternityCas0?.setPatient)
                {
                    await
                    MaternityCas0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const MaternityCas1 = await MaternityCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaternityCas1?.setPatient)
                {
                    await
                    MaternityCas1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const MaternityCas2 = await MaternityCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaternityCas2?.setPatient)
                {
                    await
                    MaternityCas2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    
        
            
            async function associateMaternityCasWithDoctor() {
            
                const relatedDoctor0 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const MaternityCas0 = await MaternityCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MaternityCas0?.setDoctor)
                {
                    await
                    MaternityCas0.
                    setDoctor(relatedDoctor0);
                }
            
                const relatedDoctor1 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const MaternityCas1 = await MaternityCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MaternityCas1?.setDoctor)
                {
                    await
                    MaternityCas1.
                    setDoctor(relatedDoctor1);
                }
            
                const relatedDoctor2 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const MaternityCas2 = await MaternityCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MaternityCas2?.setDoctor)
                {
                    await
                    MaternityCas2.
                    setDoctor(relatedDoctor2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associatePregnancyFollowupWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const PregnancyFollowup0 = await PregnancyFollowups.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PregnancyFollowup0?.setPatient)
                {
                    await
                    PregnancyFollowup0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const PregnancyFollowup1 = await PregnancyFollowups.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PregnancyFollowup1?.setPatient)
                {
                    await
                    PregnancyFollowup1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const PregnancyFollowup2 = await PregnancyFollowups.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PregnancyFollowup2?.setPatient)
                {
                    await
                    PregnancyFollowup2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateNicuIncubatorWithAdmitting_doctor() {
            
                const relatedAdmitting_doctor0 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const NicuIncubator0 = await NicuIncubators.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (NicuIncubator0?.setAdmitting_doctor)
                {
                    await
                    NicuIncubator0.
                    setAdmitting_doctor(relatedAdmitting_doctor0);
                }
            
                const relatedAdmitting_doctor1 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const NicuIncubator1 = await NicuIncubators.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (NicuIncubator1?.setAdmitting_doctor)
                {
                    await
                    NicuIncubator1.
                    setAdmitting_doctor(relatedAdmitting_doctor1);
                }
            
                const relatedAdmitting_doctor2 = await Doctors.findOne({
                    offset: Math.floor(Math.random() * (await Doctors.count())),
                });
                const NicuIncubator2 = await NicuIncubators.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (NicuIncubator2?.setAdmitting_doctor)
                {
                    await
                    NicuIncubator2.
                    setAdmitting_doctor(relatedAdmitting_doctor2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateDailyFollowupClinicWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const DailyFollowupClinic0 = await DailyFollowupClinic.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DailyFollowupClinic0?.setPatient)
                {
                    await
                    DailyFollowupClinic0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const DailyFollowupClinic1 = await DailyFollowupClinic.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DailyFollowupClinic1?.setPatient)
                {
                    await
                    DailyFollowupClinic1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const DailyFollowupClinic2 = await DailyFollowupClinic.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DailyFollowupClinic2?.setPatient)
                {
                    await
                    DailyFollowupClinic2.
                    setPatient(relatedPatient2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
            
            async function associateAuditLogWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog0 = await AuditLog.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setUser)
                {
                    await
                    AuditLog0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog1 = await AuditLog.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setUser)
                {
                    await
                    AuditLog1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog2 = await AuditLog.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setUser)
                {
                    await
                    AuditLog2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Patients.bulkCreate(PatientsData);
                
            
            
                
                await Guarantors.bulkCreate(GuarantorsData);
                
            
            
                
                await Doctors.bulkCreate(DoctorsData);
                
            
            
                
                await Visits.bulkCreate(VisitsData);
                
            
            
                
                await Orders.bulkCreate(OrdersData);
                
            
            
                
                await RadiologyTypes.bulkCreate(RadiologyTypesData);
                
            
            
                
                await RadiologyStudies.bulkCreate(RadiologyStudiesData);
                
            
            
                
                await CtTypes.bulkCreate(CtTypesData);
                
            
            
                
                await CtStudies.bulkCreate(CtStudiesData);
                
            
            
                
                await LabTests.bulkCreate(LabTestsData);
                
            
            
                
                await LabOrders.bulkCreate(LabOrdersData);
                
            
            
                
                await LabResults.bulkCreate(LabResultsData);
                
            
            
                
                await EndoscopyCases.bulkCreate(EndoscopyCasesData);
                
            
            
                
                await SurgeryCases.bulkCreate(SurgeryCasesData);
                
            
            
                
                await SurgeryConsumables.bulkCreate(SurgeryConsumablesData);
                
            
            
                
                await AnesthesiaRecords.bulkCreate(AnesthesiaRecordsData);
                
            
            
                
                await CathlabCases.bulkCreate(CathlabCasesData);
                
            
            
                
                await EcgStressTests.bulkCreate(EcgStressTestsData);
                
            
            
                
                await NursingStaff.bulkCreate(NursingStaffData);
                
            
            
                
                await CleaningStaff.bulkCreate(CleaningStaffData);
                
            
            
                
                await InventoryConsumables.bulkCreate(InventoryConsumablesData);
                
            
            
                
                await PharmacyInventory.bulkCreate(PharmacyInventoryData);
                
            
            
                
                await PharmacySalesInvoices.bulkCreate(PharmacySalesInvoicesData);
                
            
            
                
                await Suppliers.bulkCreate(SuppliersData);
                
            
            
                
                await Purchases.bulkCreate(PurchasesData);
                
            
            
                
                await PatientInvoices.bulkCreate(PatientInvoicesData);
                
            
            
                
                await LedgerEntries.bulkCreate(LedgerEntriesData);
                
            
            
                
                await JournalEntries.bulkCreate(JournalEntriesData);
                
            
            
                
                await TrialBalances.bulkCreate(TrialBalancesData);
                
            
            
                
                await ClosingBalances.bulkCreate(ClosingBalancesData);
                
            
            
                
                await InpatientRooms.bulkCreate(InpatientRoomsData);
                
            
            
                
                await RoomBookings.bulkCreate(RoomBookingsData);
                
            
            
                
                await RestaurantMeals.bulkCreate(RestaurantMealsData);
                
            
            
                
                await RestaurantInventory.bulkCreate(RestaurantInventoryData);
                
            
            
                
                await MaternityCases.bulkCreate(MaternityCasesData);
                
            
            
                
                await PregnancyFollowups.bulkCreate(PregnancyFollowupsData);
                
            
            
                
                await NicuIncubators.bulkCreate(NicuIncubatorsData);
                
            
            
                
                await DailyFollowupClinic.bulkCreate(DailyFollowupClinicData);
                
            
            
                
                await AuditLog.bulkCreate(AuditLogData);
                
            
            
                
                await Settings.bulkCreate(SettingsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePatientWithPrimary_doctor(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateGuarantorWithPatient(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDoctorWithUser_account(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateVisitWithPatient(),
                    
                
                    
                        
                        await associateVisitWithGuarantor(),
                    
                
                    
                        
                        await associateVisitWithDoctor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateOrderWithVisit(),
                    
                
                    
                        
                        await associateOrderWithPatient(),
                    
                
                    
                        
                        await associateOrderWithRequested_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateRadiologyStudyWithOrder(),
                    
                
                    
                        
                        await associateRadiologyStudyWithStudy_type(),
                    
                
                    
                        
                        await associateRadiologyStudyWithTechnician(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateCtStudyWithOrder(),
                    
                
                    
                        
                        await associateCtStudyWithCt_type(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateLabOrderWithOrder(),
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateLabOrderWithLab_technician(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateLabResultWithLab_order(),
                    
                
                    
                        
                        await associateLabResultWithTest(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateEndoscopyCasWithVisit(),
                    
                
                    
                        
                        await associateEndoscopyCasWithDoctor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateSurgeryCasWithPatient(),
                    
                
                    
                        
                        await associateSurgeryCasWithSurgeon(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSurgeryConsumableWithSurgery_case(),
                    
                
            
                
                
                    
                        
                        await associateAnesthesiaRecordWithSurgery_case(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateCathlabCasWithPatient(),
                    
                
                    
                        
                        await associateCathlabCasWithDoctor(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateEcgStressTestWithPatient(),
                    
                
                    
                        
                        await associateEcgStressTestWithDoctor(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associatePharmacySalesInvoiceWithPatient(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePharmacySalesInvoiceWithCashier(),
                    
                
            
                
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associatePurchasWithSupplier(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associatePatientInvoiceWithPatient(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateRoomBookingWithPatient(),
                    
                
                    
                        
                        await associateRoomBookingWithRoom(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateRoomBookingWithSupervising_nurse(),
                    
                
                    
                        
                        await associateRoomBookingWithSupervising_doctor(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateMaternityCasWithPatient(),
                    
                
                    
                        
                        await associateMaternityCasWithDoctor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associatePregnancyFollowupWithPatient(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNicuIncubatorWithAdmitting_doctor(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateDailyFollowupClinicWithPatient(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                        
                        await associateAuditLogWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('patients', null, {});
            
            
            await queryInterface.bulkDelete('guarantors', null, {});
            
            
            await queryInterface.bulkDelete('doctors', null, {});
            
            
            await queryInterface.bulkDelete('visits', null, {});
            
            
            await queryInterface.bulkDelete('orders', null, {});
            
            
            await queryInterface.bulkDelete('radiology_types', null, {});
            
            
            await queryInterface.bulkDelete('radiology_studies', null, {});
            
            
            await queryInterface.bulkDelete('ct_types', null, {});
            
            
            await queryInterface.bulkDelete('ct_studies', null, {});
            
            
            await queryInterface.bulkDelete('lab_tests', null, {});
            
            
            await queryInterface.bulkDelete('lab_orders', null, {});
            
            
            await queryInterface.bulkDelete('lab_results', null, {});
            
            
            await queryInterface.bulkDelete('endoscopy_cases', null, {});
            
            
            await queryInterface.bulkDelete('surgery_cases', null, {});
            
            
            await queryInterface.bulkDelete('surgery_consumables', null, {});
            
            
            await queryInterface.bulkDelete('anesthesia_records', null, {});
            
            
            await queryInterface.bulkDelete('cathlab_cases', null, {});
            
            
            await queryInterface.bulkDelete('ecg_stress_tests', null, {});
            
            
            await queryInterface.bulkDelete('nursing_staff', null, {});
            
            
            await queryInterface.bulkDelete('cleaning_staff', null, {});
            
            
            await queryInterface.bulkDelete('inventory_consumables', null, {});
            
            
            await queryInterface.bulkDelete('pharmacy_inventory', null, {});
            
            
            await queryInterface.bulkDelete('pharmacy_sales_invoices', null, {});
            
            
            await queryInterface.bulkDelete('suppliers', null, {});
            
            
            await queryInterface.bulkDelete('purchases', null, {});
            
            
            await queryInterface.bulkDelete('patient_invoices', null, {});
            
            
            await queryInterface.bulkDelete('ledger_entries', null, {});
            
            
            await queryInterface.bulkDelete('journal_entries', null, {});
            
            
            await queryInterface.bulkDelete('trial_balances', null, {});
            
            
            await queryInterface.bulkDelete('closing_balances', null, {});
            
            
            await queryInterface.bulkDelete('inpatient_rooms', null, {});
            
            
            await queryInterface.bulkDelete('room_bookings', null, {});
            
            
            await queryInterface.bulkDelete('restaurant_meals', null, {});
            
            
            await queryInterface.bulkDelete('restaurant_inventory', null, {});
            
            
            await queryInterface.bulkDelete('maternity_cases', null, {});
            
            
            await queryInterface.bulkDelete('pregnancy_followups', null, {});
            
            
            await queryInterface.bulkDelete('nicu_incubators', null, {});
            
            
            await queryInterface.bulkDelete('daily_followup_clinic', null, {});
            
            
            await queryInterface.bulkDelete('audit_log', null, {});
            
            
            await queryInterface.bulkDelete('settings', null, {});
            
        
    },
};