-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jul 14, 2026 at 08:49 PM
-- Server version: 11.4.12-MariaDB
-- PHP Version: 8.4.22

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `medicahm_demo_hosp`
--

-- --------------------------------------------------------

--
-- Table structure for table `authorize_bies`
--

CREATE TABLE `authorize_bies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` int(11) NOT NULL,
  `type` tinyint(4) NOT NULL COMMENT '1=>Pathology, 2=>Radiology',
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `cabin_bookings`
--

CREATE TABLE `cabin_bookings` (
  `cabin_booking_id` int(10) UNSIGNED NOT NULL,
  `sale_invoice_id` varchar(191) NOT NULL,
  `hospital_floor_id` int(10) UNSIGNED DEFAULT NULL,
  `hospital_cabin_id` int(10) UNSIGNED DEFAULT NULL,
  `patient_id` int(10) UNSIGNED DEFAULT NULL,
  `booking_date` date DEFAULT NULL,
  `release_date` date DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 = Inactive, 1 = Available, 2 = Booked',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `departments`
--

CREATE TABLE `departments` (
  `department_id` int(10) UNSIGNED NOT NULL,
  `department_name` varchar(191) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `designations`
--

CREATE TABLE `designations` (
  `designation_id` int(10) UNSIGNED NOT NULL,
  `designation_name` varchar(191) NOT NULL,
  `designation_type` tinyint(4) NOT NULL DEFAULT 1,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `diagnostic_tests`
--

CREATE TABLE `diagnostic_tests` (
  `diagnostic_test_id` int(10) UNSIGNED NOT NULL,
  `diagnostic_test_name` varchar(191) NOT NULL,
  `diagnostic_test_price` double(12,3) NOT NULL DEFAULT 0.000,
  `diagnostic_test_sale_price` double(12,3) NOT NULL DEFAULT 0.000,
  `service_category_id` int(11) UNSIGNED DEFAULT NULL,
  `service_sub_category_id` int(11) UNSIGNED DEFAULT NULL,
  `diagnostic_test_result_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1=> Positive/Negative, 2=> Yes/No, 3 => Unit Base, 4 => Radiology, 5=>None',
  `indoor` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1=> Cabin, 2=> Seat',
  `indoor_id` tinyint(4) DEFAULT NULL,
  `diagnostic_test_normal_value` longtext DEFAULT NULL,
  `diagnostic_test_result_unit` varchar(191) DEFAULT NULL,
  `service_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1=>test, 2=>indoor',
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0=>inactive, 1=>active, 2=>booked',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `diagnostic_test_items`
--

CREATE TABLE `diagnostic_test_items` (
  `id` int(10) UNSIGNED NOT NULL,
  `diagnostic_test_id` int(10) UNSIGNED NOT NULL,
  `item_id` int(10) UNSIGNED NOT NULL,
  `ratio` double(12,2) NOT NULL DEFAULT 1.00,
  `created_by` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `diagnostic_test_sale_items`
--

CREATE TABLE `diagnostic_test_sale_items` (
  `id` int(10) UNSIGNED NOT NULL,
  `sale_details_id` int(10) UNSIGNED NOT NULL,
  `diagnostic_test_id` int(10) UNSIGNED NOT NULL,
  `item_id` int(10) UNSIGNED NOT NULL,
  `ratio` double(12,2) NOT NULL DEFAULT 1.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `discharges`
--

CREATE TABLE `discharges` (
  `id` int(10) UNSIGNED NOT NULL,
  `sale_invoice_id` varchar(191) NOT NULL,
  `patient_id` int(10) UNSIGNED NOT NULL,
  `from` date NOT NULL,
  `to` date NOT NULL,
  `doctor_id` int(10) UNSIGNED NOT NULL,
  `duty_doctor_id` int(10) UNSIGNED DEFAULT NULL,
  `duty_nurse_id` int(10) UNSIGNED DEFAULT NULL,
  `reg_no` varchar(191) DEFAULT NULL,
  `findings` text DEFAULT NULL,
  `patient_history` text DEFAULT NULL,
  `investigation` text DEFAULT NULL,
  `treatment_under_admission` text DEFAULT NULL,
  `post_treatment_and_advice` text DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0 => Not Released, 1 => Released',
  `date` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `discount_patients`
--

CREATE TABLE `discount_patients` (
  `id` int(10) UNSIGNED NOT NULL,
  `patient_id` int(10) UNSIGNED NOT NULL,
  `amount` double(12,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `doctors`
--

CREATE TABLE `doctors` (
  `doctor_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `department_id` int(10) UNSIGNED DEFAULT NULL,
  `designation_id` int(10) UNSIGNED DEFAULT NULL,
  `educational_qualification_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `medical_degree_id` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `medical_degree_ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `speciality` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `allow_prescription_fee` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0=>Not Allowed, 1=>Allowed',
  `prescription_fee` decimal(9,3) NOT NULL DEFAULT 0.000,
  `payment_receiving_process` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1=>Received By Hospital With Appointment, 2=>Received By Doctor With Appointment',
  `commission_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1=>Type 1, 2=>Type 2',
  `commission` decimal(9,3) NOT NULL DEFAULT 0.000,
  `commission_distribution_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0 => Own Commission, 1 => Patient Bill Adjustment',
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `doctor_appointments`
--

CREATE TABLE `doctor_appointments` (
  `doctor_appointment_id` int(10) UNSIGNED NOT NULL,
  `doctor_id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `schedule_slot_id` int(11) NOT NULL,
  `schedule_date` date NOT NULL,
  `template_id` int(11) DEFAULT NULL,
  `prescription` longtext DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `doctor_commission`
--

CREATE TABLE `doctor_commission` (
  `commission_id` int(10) UNSIGNED NOT NULL,
  `sale_invoice_id` varchar(191) DEFAULT NULL,
  `doctor_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `patient_user_id` int(10) UNSIGNED NOT NULL,
  `commission` double(12,2) UNSIGNED NOT NULL,
  `commission_taka` double(12,2) UNSIGNED NOT NULL,
  `date` date NOT NULL,
  `paid` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1=>paid, 0=>unpaid',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `doctor_diagnostic_test_commissions`
--

CREATE TABLE `doctor_diagnostic_test_commissions` (
  `id` int(10) UNSIGNED NOT NULL,
  `diagnostic_test_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `commission` double(9,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `due_list`
--

CREATE TABLE `due_list` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `invoice_id` varchar(191) DEFAULT NULL,
  `due_amount` double(12,2) NOT NULL DEFAULT 0.00,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 => inactive, 1=> active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `educational_qualifications`
--

CREATE TABLE `educational_qualifications` (
  `educational_qualification_id` int(10) UNSIGNED NOT NULL,
  `educational_qualification_name` varchar(191) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `employee_infos`
--

CREATE TABLE `employee_infos` (
  `employee_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `designation_id` int(10) UNSIGNED DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0=>Inactive,1=Active,2=Deleted',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (
  `expense_id` int(10) UNSIGNED NOT NULL,
  `expense_invoice_id` varchar(191) NOT NULL,
  `income_expense_head_id` int(10) UNSIGNED NOT NULL,
  `amount` double(12,2) NOT NULL DEFAULT 0.00,
  `comment` text DEFAULT NULL,
  `date` date DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 => Inactive, 1 = > Active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `hospital_cabins`
--

CREATE TABLE `hospital_cabins` (
  `hospital_cabin_id` int(10) UNSIGNED NOT NULL,
  `hospital_floor_id` int(10) UNSIGNED DEFAULT NULL,
  `service_category_id` int(10) UNSIGNED DEFAULT NULL,
  `service_sub_category_id` int(10) UNSIGNED NOT NULL,
  `diagnostic_test_id` tinyint(3) UNSIGNED NOT NULL,
  `cabin_name` varchar(191) NOT NULL,
  `cabin_code` varchar(191) NOT NULL,
  `total_seat` tinyint(4) DEFAULT 1,
  `price` double(12,2) NOT NULL DEFAULT 0.00,
  `cabin_sale_price` double(12,2) NOT NULL DEFAULT 0.00,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 = Inactive, 1 = Available, 2 = Booked',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `hospital_floors`
--

CREATE TABLE `hospital_floors` (
  `hospital_floor_id` int(10) UNSIGNED NOT NULL,
  `service_category_id` int(10) UNSIGNED NOT NULL,
  `floor_name` varchar(191) DEFAULT NULL,
  `floor_code` varchar(191) DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `hospital_seat_bookings`
--

CREATE TABLE `hospital_seat_bookings` (
  `hospital_seat_booking_id` int(10) UNSIGNED NOT NULL,
  `sale_invoice_id` varchar(191) NOT NULL,
  `hospital_floor_id` int(10) UNSIGNED DEFAULT NULL,
  `hospital_ward_id` int(10) UNSIGNED DEFAULT NULL,
  `hospital_ward_seat_id` int(10) UNSIGNED DEFAULT NULL,
  `patient_id` int(10) UNSIGNED DEFAULT NULL,
  `booking_date` date DEFAULT NULL,
  `release_date` date DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 = Inactive, 1 = Available, 2 = Booked',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `hospital_settings`
--

CREATE TABLE `hospital_settings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(191) DEFAULT NULL,
  `address` varchar(191) DEFAULT NULL,
  `copyright` varchar(191) DEFAULT NULL,
  `phone` varchar(191) DEFAULT NULL,
  `email` varchar(191) DEFAULT NULL,
  `logo` varchar(191) DEFAULT NULL,
  `enable_negative_stock` tinyint(4) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `hospital_wards`
--

CREATE TABLE `hospital_wards` (
  `hospital_ward_id` int(10) UNSIGNED NOT NULL,
  `hospital_floor_id` int(10) UNSIGNED DEFAULT NULL,
  `service_sub_category_id` int(10) UNSIGNED NOT NULL,
  `ward_name` varchar(191) NOT NULL,
  `ward_code` varchar(191) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `hospital_ward_seats`
--

CREATE TABLE `hospital_ward_seats` (
  `hospital_ward_seat_id` int(10) UNSIGNED NOT NULL,
  `hospital_floor_id` int(10) UNSIGNED DEFAULT NULL,
  `hospital_ward_id` int(10) UNSIGNED DEFAULT NULL,
  `service_category_id` int(10) UNSIGNED DEFAULT NULL,
  `service_sub_category_id` int(10) UNSIGNED DEFAULT NULL,
  `diagnostic_test_id` tinyint(3) UNSIGNED NOT NULL,
  `seat_name` varchar(191) NOT NULL,
  `seat_number` varchar(191) NOT NULL,
  `seat_price` double(12,2) UNSIGNED NOT NULL,
  `seat_sale_price` double(12,2) UNSIGNED NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `incomes`
--

CREATE TABLE `incomes` (
  `income_id` int(10) UNSIGNED NOT NULL,
  `income_invoice_id` varchar(191) NOT NULL,
  `sale_invoice_id` varchar(191) DEFAULT NULL,
  `income_expense_head_id` int(10) UNSIGNED NOT NULL,
  `amount` double(12,2) NOT NULL DEFAULT 0.00,
  `comment` text DEFAULT NULL,
  `date` date DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 => Inactive, 1 = > Active',
  `refund_date` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `income_expense_heads`
--

CREATE TABLE `income_expense_heads` (
  `income_expense_head_id` int(10) UNSIGNED NOT NULL,
  `head_name` varchar(191) NOT NULL,
  `head_type` tinyint(4) NOT NULL COMMENT '1 => Income, 2 = > Expense',
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 => Inactive, 1 = > Active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `items`
--

CREATE TABLE `items` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `code` varchar(191) NOT NULL,
  `unit_id` int(10) UNSIGNED DEFAULT NULL,
  `price` double(12,2) NOT NULL DEFAULT 0.00,
  `note` varchar(191) DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 => Removed, 1 => Active 2 => Inactive',
  `alert_quantity` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `item_purchases`
--

CREATE TABLE `item_purchases` (
  `id` int(10) UNSIGNED NOT NULL,
  `total_price` double(12,2) NOT NULL DEFAULT 0.00,
  `total_discount` double(12,2) NOT NULL DEFAULT 0.00,
  `total_paid` double(12,2) NOT NULL DEFAULT 0.00,
  `invoice_no` varchar(191) NOT NULL,
  `item_supplier_id` int(10) UNSIGNED NOT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL,
  `date` datetime NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 => Removed, 1 => Pending 2 => Ordered 3 => Received',
  `note` varchar(191) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `item_purchase_details`
--

CREATE TABLE `item_purchase_details` (
  `id` int(10) UNSIGNED NOT NULL,
  `item_purchase_id` int(10) UNSIGNED NOT NULL,
  `item_id` int(10) UNSIGNED NOT NULL,
  `quantity` int(11) NOT NULL DEFAULT 1,
  `unit_price` double(12,2) NOT NULL DEFAULT 0.00,
  `discount` double(12,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `item_suppliers`
--

CREATE TABLE `item_suppliers` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `phone` varchar(191) NOT NULL,
  `email` varchar(191) DEFAULT NULL,
  `address` varchar(191) NOT NULL,
  `company_name` varchar(191) NOT NULL,
  `products` varchar(191) DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 => Removed, 1 => Active 2 => Inactive',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `item_units`
--

CREATE TABLE `item_units` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `medical_degrees`
--

CREATE TABLE `medical_degrees` (
  `medical_degree_id` int(10) UNSIGNED NOT NULL,
  `medical_degree_name` varchar(191) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(191) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `model_has_permissions`
--

CREATE TABLE `model_has_permissions` (
  `permission_id` int(10) UNSIGNED NOT NULL,
  `model_type` varchar(191) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `model_has_roles`
--

CREATE TABLE `model_has_roles` (
  `role_id` int(10) UNSIGNED NOT NULL,
  `model_type` varchar(191) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `monthly_salaries`
--

CREATE TABLE `monthly_salaries` (
  `id` int(10) UNSIGNED NOT NULL,
  `employee_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `month_id` int(10) UNSIGNED NOT NULL,
  `year` int(10) UNSIGNED NOT NULL,
  `amount` int(10) UNSIGNED NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1=>complete, 0=>uncomplete',
  `last_payment_date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `patients`
--

CREATE TABLE `patients` (
  `patient_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `blood_group` varchar(191) DEFAULT NULL,
  `age` tinyint(4) NOT NULL DEFAULT 0,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `payment_records`
--

CREATE TABLE `payment_records` (
  `payment_id` int(10) UNSIGNED NOT NULL,
  `employee_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `payment_amount` double(12,2) NOT NULL DEFAULT 0.00,
  `payment_date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` int(10) UNSIGNED NOT NULL,
  `header` varchar(191) NOT NULL,
  `name` varchar(191) NOT NULL,
  `guard_name` varchar(191) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `prescription_pay_records`
--

CREATE TABLE `prescription_pay_records` (
  `id` int(10) UNSIGNED NOT NULL,
  `patient_user_id` int(11) NOT NULL,
  `doctor_user_id` int(11) NOT NULL,
  `invoice_id` varchar(191) NOT NULL,
  `doctor_appointment_id` int(11) NOT NULL,
  `schedule_date` date NOT NULL,
  `payment` double(12,2) NOT NULL DEFAULT 0.00,
  `date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `prescription_templates`
--

CREATE TABLE `prescription_templates` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `template` longtext DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1=>active, 0=>inactive, 2=>delete',
  `updated_by` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `radiology_templates`
--

CREATE TABLE `radiology_templates` (
  `radiology_template_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `template` longtext DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1=>active, 0=>inactive, 2=>delete',
  `updated_by` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `guard_name` varchar(191) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `role_has_permissions`
--

CREATE TABLE `role_has_permissions` (
  `permission_id` int(10) UNSIGNED NOT NULL,
  `role_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `salary_infos`
--

CREATE TABLE `salary_infos` (
  `salary_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `salary_type` tinyint(4) DEFAULT NULL COMMENT '1=>Full Time,2=>Part Time,3=>Commission based',
  `salary_amount` double(12,2) NOT NULL DEFAULT 0.00,
  `due` double(12,2) NOT NULL DEFAULT 0.00,
  `advanced` double(12,2) NOT NULL DEFAULT 0.00,
  `last_payment_amount` double(12,2) NOT NULL DEFAULT 0.00,
  `last_payment_date` datetime DEFAULT NULL,
  `last_payment_by` int(10) UNSIGNED NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1=>active,0=>inactive,2=>delete',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `sale_invoices`
--

CREATE TABLE `sale_invoices` (
  `sale_id` int(10) UNSIGNED NOT NULL,
  `sale_invoice_id` varchar(191) NOT NULL,
  `cus_id` int(11) DEFAULT NULL,
  `payment_type_id` int(11) DEFAULT NULL,
  `discount` double(12,2) NOT NULL DEFAULT 0.00,
  `discount_note` varchar(191) DEFAULT NULL,
  `amount` double(12,2) NOT NULL DEFAULT 0.00,
  `pay` double(12,2) NOT NULL DEFAULT 0.00,
  `due` double(12,2) NOT NULL DEFAULT 0.00,
  `room_no` varchar(50) DEFAULT NULL,
  `pay_note` int(11) NOT NULL DEFAULT 0,
  `referred_by` varchar(191) DEFAULT NULL,
  `referred_by_commission` int(10) UNSIGNED DEFAULT NULL,
  `date` date DEFAULT NULL,
  `hide_name_invoice` tinyint(4) NOT NULL DEFAULT 0,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'o = > Inactive, 1 = > Active',
  `is_delivered` tinyint(4) NOT NULL DEFAULT 0,
  `delivery_date` datetime DEFAULT NULL,
  `refund_date` datetime DEFAULT NULL,
  `year` smallint(6) NOT NULL DEFAULT 2021,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `sale_invoice_details`
--

CREATE TABLE `sale_invoice_details` (
  `sale_details_id` int(10) UNSIGNED NOT NULL,
  `sale_invoice_id` varchar(191) NOT NULL,
  `package_id` int(11) DEFAULT NULL,
  `group_id` int(11) DEFAULT NULL,
  `diagnostic_test_id` int(10) UNSIGNED NOT NULL,
  `date` date DEFAULT NULL,
  `quantity` int(10) UNSIGNED NOT NULL,
  `discount` double(12,2) NOT NULL DEFAULT 0.00,
  `tax` double(12,2) NOT NULL DEFAULT 0.00,
  `amount` double(12,2) NOT NULL DEFAULT 0.00,
  `due` double NOT NULL DEFAULT 0,
  `commission` double(12,2) NOT NULL DEFAULT 0.00,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 => Inactive, 1 = > Active',
  `year` smallint(6) NOT NULL DEFAULT 2021,
  `service_test_name` varchar(191) DEFAULT NULL,
  `service_category_id` tinyint(4) DEFAULT NULL,
  `service_sub_category_id` tinyint(4) DEFAULT NULL,
  `service_result_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1=> Positive/Negative, 2=> Yes/No, 3 => Unit Base, 4 => Radiology, 5=> None, 6=> Prescription Fee',
  `service_normal_value` varchar(191) DEFAULT NULL,
  `service_result_unit` varchar(191) DEFAULT NULL,
  `template_id` int(11) DEFAULT NULL,
  `service_result` longtext DEFAULT NULL,
  `authorize_by` int(11) DEFAULT NULL,
  `tested_by` int(11) DEFAULT NULL,
  `custom_html_template` longtext DEFAULT NULL,
  `custom_template` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0=>unused, 1=>used',
  `signature_status` tinyint(4) NOT NULL DEFAULT 1,
  `is_sample_collected` tinyint(4) NOT NULL DEFAULT 0,
  `is_delivered` tinyint(4) NOT NULL DEFAULT 0,
  `delivery_datetime` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `schedules`
--

CREATE TABLE `schedules` (
  `schedule_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `schedule_date` varchar(191) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `schedule_blocks`
--

CREATE TABLE `schedule_blocks` (
  `schedule_block_id` int(10) UNSIGNED NOT NULL,
  `schedule_slot_id` int(10) UNSIGNED NOT NULL,
  `schedule_block_date` date NOT NULL,
  `user_id` int(11) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `schedule_slots`
--

CREATE TABLE `schedule_slots` (
  `schedule_slot_id` int(10) UNSIGNED NOT NULL,
  `schedule_id` int(10) UNSIGNED NOT NULL,
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  `visitor_limit` tinyint(4) NOT NULL DEFAULT 10,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `service_categories`
--

CREATE TABLE `service_categories` (
  `service_category_id` int(10) UNSIGNED NOT NULL,
  `service_category_name` varchar(191) NOT NULL,
  `service_category_specimen` varchar(191) DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `type` tinyint(4) DEFAULT NULL COMMENT '1=>test, 2=>floor, 3=>other',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `service_groups`
--

CREATE TABLE `service_groups` (
  `service_group_id` int(10) UNSIGNED NOT NULL,
  `service_group_name` varchar(191) NOT NULL,
  `service_category_id` int(11) NOT NULL,
  `service_sub_category_id` int(11) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `service_group_items`
--

CREATE TABLE `service_group_items` (
  `service_group_item_id` int(10) UNSIGNED NOT NULL,
  `service_group_id` int(11) NOT NULL,
  `diagnostic_test_id` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `service_packages`
--

CREATE TABLE `service_packages` (
  `service_package_id` int(10) UNSIGNED NOT NULL,
  `service_package_name` varchar(191) NOT NULL,
  `service_category_id` int(11) NOT NULL,
  `service_sub_category_id` int(11) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `service_package_items`
--

CREATE TABLE `service_package_items` (
  `service_package_item_id` int(10) UNSIGNED NOT NULL,
  `service_package_id` int(11) NOT NULL,
  `type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1 = > Service, 2 => Service Group, 3 =. Service Package',
  `service_item_id` int(10) UNSIGNED NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `service_sub_categories`
--

CREATE TABLE `service_sub_categories` (
  `service_sub_category_id` int(10) UNSIGNED NOT NULL,
  `service_category_id` int(11) DEFAULT NULL,
  `service_sub_category_name` varchar(191) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `tested_bies`
--

CREATE TABLE `tested_bies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` int(11) NOT NULL,
  `type` tinyint(4) NOT NULL COMMENT '1=>Pathology, 2=>Radiology',
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `user_id` int(10) UNSIGNED NOT NULL,
  `branch_id` int(10) UNSIGNED NOT NULL,
  `full_name` varchar(191) NOT NULL,
  `father_name` varchar(191) DEFAULT NULL,
  `user_name` varchar(191) DEFAULT NULL,
  `mother_name` varchar(191) DEFAULT NULL,
  `profile_image` varchar(191) DEFAULT NULL,
  `present_address` text DEFAULT NULL,
  `permanent_address` text DEFAULT NULL,
  `mobile_no` varchar(15) DEFAULT NULL,
  `signature_details` text DEFAULT NULL,
  `gender` tinyint(4) DEFAULT NULL,
  `dob` date DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(191) DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 => Inactive,1 => Active,2 => Deleted',
  `user_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '0 => Admin 1 => Employee,2 => Doctor,3 => Patient 4 => Customer 5 => HR 6 => Accountant 7 => Pathology 8 => Radiology',
  `remember_token` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `updated_by` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_files`
--

CREATE TABLE `user_files` (
  `file_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(11) NOT NULL,
  `filename` varchar(191) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_signatures`
--

CREATE TABLE `user_signatures` (
  `signature_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(11) NOT NULL,
  `signature` varchar(191) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `authorize_bies`
--
ALTER TABLE `authorize_bies`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `cabin_bookings`
--
ALTER TABLE `cabin_bookings`
  ADD PRIMARY KEY (`cabin_booking_id`),
  ADD KEY `cabin_bookings_sale_invoice_id_index` (`sale_invoice_id`);

--
-- Indexes for table `departments`
--
ALTER TABLE `departments`
  ADD PRIMARY KEY (`department_id`);

--
-- Indexes for table `designations`
--
ALTER TABLE `designations`
  ADD PRIMARY KEY (`designation_id`);

--
-- Indexes for table `diagnostic_tests`
--
ALTER TABLE `diagnostic_tests`
  ADD PRIMARY KEY (`diagnostic_test_id`),
  ADD UNIQUE KEY `diagnostic_tests_diagnostic_test_name_unique` (`diagnostic_test_name`);

--
-- Indexes for table `diagnostic_test_items`
--
ALTER TABLE `diagnostic_test_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `diagnostic_test_items_diagnostic_test_id_index` (`diagnostic_test_id`),
  ADD KEY `diagnostic_test_items_item_id_index` (`item_id`),
  ADD KEY `diagnostic_test_items_created_by_index` (`created_by`);

--
-- Indexes for table `diagnostic_test_sale_items`
--
ALTER TABLE `diagnostic_test_sale_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `diagnostic_test_sale_items_sale_details_id_index` (`sale_details_id`),
  ADD KEY `diagnostic_test_sale_items_diagnostic_test_id_index` (`diagnostic_test_id`),
  ADD KEY `diagnostic_test_sale_items_item_id_index` (`item_id`);

--
-- Indexes for table `discharges`
--
ALTER TABLE `discharges`
  ADD PRIMARY KEY (`id`),
  ADD KEY `discharges_sale_invoice_id_index` (`sale_invoice_id`),
  ADD KEY `discharges_patient_id_index` (`patient_id`),
  ADD KEY `discharges_doctor_id_index` (`doctor_id`),
  ADD KEY `discharges_duty_doctor_id_index` (`duty_doctor_id`),
  ADD KEY `discharges_duty_nurse_id_index` (`duty_nurse_id`);

--
-- Indexes for table `discount_patients`
--
ALTER TABLE `discount_patients`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `doctors`
--
ALTER TABLE `doctors`
  ADD PRIMARY KEY (`doctor_id`);

--
-- Indexes for table `doctor_appointments`
--
ALTER TABLE `doctor_appointments`
  ADD PRIMARY KEY (`doctor_appointment_id`);

--
-- Indexes for table `doctor_commission`
--
ALTER TABLE `doctor_commission`
  ADD PRIMARY KEY (`commission_id`),
  ADD KEY `doctor_commission_sale_invoice_id_index` (`sale_invoice_id`);

--
-- Indexes for table `doctor_diagnostic_test_commissions`
--
ALTER TABLE `doctor_diagnostic_test_commissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `doctor_diagnostic_test_commissions_diagnostic_test_id_index` (`diagnostic_test_id`),
  ADD KEY `doctor_diagnostic_test_commissions_user_id_index` (`user_id`);

--
-- Indexes for table `due_list`
--
ALTER TABLE `due_list`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `educational_qualifications`
--
ALTER TABLE `educational_qualifications`
  ADD PRIMARY KEY (`educational_qualification_id`);

--
-- Indexes for table `employee_infos`
--
ALTER TABLE `employee_infos`
  ADD PRIMARY KEY (`employee_id`);

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`expense_id`),
  ADD KEY `expenses_expense_id_index` (`expense_id`),
  ADD KEY `expenses_expense_invoice_id_index` (`expense_invoice_id`);

--
-- Indexes for table `hospital_cabins`
--
ALTER TABLE `hospital_cabins`
  ADD PRIMARY KEY (`hospital_cabin_id`),
  ADD UNIQUE KEY `hospital_cabins_cabin_code_unique` (`cabin_code`);

--
-- Indexes for table `hospital_floors`
--
ALTER TABLE `hospital_floors`
  ADD PRIMARY KEY (`hospital_floor_id`);

--
-- Indexes for table `hospital_seat_bookings`
--
ALTER TABLE `hospital_seat_bookings`
  ADD PRIMARY KEY (`hospital_seat_booking_id`),
  ADD KEY `hospital_seat_bookings_sale_invoice_id_index` (`sale_invoice_id`);

--
-- Indexes for table `hospital_settings`
--
ALTER TABLE `hospital_settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `hospital_wards`
--
ALTER TABLE `hospital_wards`
  ADD PRIMARY KEY (`hospital_ward_id`);

--
-- Indexes for table `hospital_ward_seats`
--
ALTER TABLE `hospital_ward_seats`
  ADD PRIMARY KEY (`hospital_ward_seat_id`);

--
-- Indexes for table `incomes`
--
ALTER TABLE `incomes`
  ADD PRIMARY KEY (`income_id`),
  ADD KEY `incomes_income_id_index` (`income_id`),
  ADD KEY `incomes_income_invoice_id_index` (`income_invoice_id`),
  ADD KEY `incomes_sale_invoice_id_index` (`sale_invoice_id`);

--
-- Indexes for table `income_expense_heads`
--
ALTER TABLE `income_expense_heads`
  ADD PRIMARY KEY (`income_expense_head_id`),
  ADD KEY `income_expense_heads_income_expense_head_id_index` (`income_expense_head_id`);

--
-- Indexes for table `items`
--
ALTER TABLE `items`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `items_code_unique` (`code`),
  ADD KEY `items_unit_id_foreign` (`unit_id`);

--
-- Indexes for table `item_purchases`
--
ALTER TABLE `item_purchases`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_purchases_updated_by_foreign` (`updated_by`),
  ADD KEY `item_purchases_invoice_no_index` (`invoice_no`),
  ADD KEY `item_purchases_item_supplier_id_index` (`item_supplier_id`),
  ADD KEY `item_purchases_created_by_index` (`created_by`);

--
-- Indexes for table `item_purchase_details`
--
ALTER TABLE `item_purchase_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `item_purchase_details_item_purchase_id_index` (`item_purchase_id`),
  ADD KEY `item_purchase_details_item_id_index` (`item_id`);

--
-- Indexes for table `item_suppliers`
--
ALTER TABLE `item_suppliers`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `item_units`
--
ALTER TABLE `item_units`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `medical_degrees`
--
ALTER TABLE `medical_degrees`
  ADD PRIMARY KEY (`medical_degree_id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  ADD KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Indexes for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  ADD KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Indexes for table `monthly_salaries`
--
ALTER TABLE `monthly_salaries`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `patients`
--
ALTER TABLE `patients`
  ADD PRIMARY KEY (`patient_id`);

--
-- Indexes for table `payment_records`
--
ALTER TABLE `payment_records`
  ADD PRIMARY KEY (`payment_id`);

--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `prescription_pay_records`
--
ALTER TABLE `prescription_pay_records`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `prescription_templates`
--
ALTER TABLE `prescription_templates`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `radiology_templates`
--
ALTER TABLE `radiology_templates`
  ADD PRIMARY KEY (`radiology_template_id`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`role_id`),
  ADD KEY `role_has_permissions_role_id_foreign` (`role_id`);

--
-- Indexes for table `salary_infos`
--
ALTER TABLE `salary_infos`
  ADD PRIMARY KEY (`salary_id`);

--
-- Indexes for table `sale_invoices`
--
ALTER TABLE `sale_invoices`
  ADD PRIMARY KEY (`sale_id`),
  ADD KEY `sale_invoices_sale_invoice_id_index` (`sale_invoice_id`),
  ADD KEY `sale_invoices_referred_by_commission_index` (`referred_by_commission`);

--
-- Indexes for table `sale_invoice_details`
--
ALTER TABLE `sale_invoice_details`
  ADD PRIMARY KEY (`sale_details_id`),
  ADD KEY `sale_invoice_details_sale_details_id_index` (`sale_details_id`),
  ADD KEY `sale_invoice_details_sale_invoice_id_index` (`sale_invoice_id`);

--
-- Indexes for table `schedules`
--
ALTER TABLE `schedules`
  ADD PRIMARY KEY (`schedule_id`);

--
-- Indexes for table `schedule_blocks`
--
ALTER TABLE `schedule_blocks`
  ADD PRIMARY KEY (`schedule_block_id`);

--
-- Indexes for table `schedule_slots`
--
ALTER TABLE `schedule_slots`
  ADD PRIMARY KEY (`schedule_slot_id`);

--
-- Indexes for table `service_categories`
--
ALTER TABLE `service_categories`
  ADD PRIMARY KEY (`service_category_id`);

--
-- Indexes for table `service_groups`
--
ALTER TABLE `service_groups`
  ADD PRIMARY KEY (`service_group_id`);

--
-- Indexes for table `service_group_items`
--
ALTER TABLE `service_group_items`
  ADD PRIMARY KEY (`service_group_item_id`);

--
-- Indexes for table `service_packages`
--
ALTER TABLE `service_packages`
  ADD PRIMARY KEY (`service_package_id`);

--
-- Indexes for table `service_package_items`
--
ALTER TABLE `service_package_items`
  ADD PRIMARY KEY (`service_package_item_id`);

--
-- Indexes for table `service_sub_categories`
--
ALTER TABLE `service_sub_categories`
  ADD PRIMARY KEY (`service_sub_category_id`);

--
-- Indexes for table `tested_bies`
--
ALTER TABLE `tested_bies`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`user_id`),
  ADD UNIQUE KEY `users_email_unique` (`email`);

--
-- Indexes for table `user_files`
--
ALTER TABLE `user_files`
  ADD PRIMARY KEY (`file_id`);

--
-- Indexes for table `user_signatures`
--
ALTER TABLE `user_signatures`
  ADD PRIMARY KEY (`signature_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `authorize_bies`
--
ALTER TABLE `authorize_bies`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `cabin_bookings`
--
ALTER TABLE `cabin_bookings`
  MODIFY `cabin_booking_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `departments`
--
ALTER TABLE `departments`
  MODIFY `department_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `designations`
--
ALTER TABLE `designations`
  MODIFY `designation_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `diagnostic_tests`
--
ALTER TABLE `diagnostic_tests`
  MODIFY `diagnostic_test_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `diagnostic_test_items`
--
ALTER TABLE `diagnostic_test_items`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `diagnostic_test_sale_items`
--
ALTER TABLE `diagnostic_test_sale_items`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `discharges`
--
ALTER TABLE `discharges`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `discount_patients`
--
ALTER TABLE `discount_patients`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `doctors`
--
ALTER TABLE `doctors`
  MODIFY `doctor_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `doctor_appointments`
--
ALTER TABLE `doctor_appointments`
  MODIFY `doctor_appointment_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `doctor_commission`
--
ALTER TABLE `doctor_commission`
  MODIFY `commission_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `doctor_diagnostic_test_commissions`
--
ALTER TABLE `doctor_diagnostic_test_commissions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `due_list`
--
ALTER TABLE `due_list`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `educational_qualifications`
--
ALTER TABLE `educational_qualifications`
  MODIFY `educational_qualification_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `employee_infos`
--
ALTER TABLE `employee_infos`
  MODIFY `employee_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `expenses`
--
ALTER TABLE `expenses`
  MODIFY `expense_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `hospital_cabins`
--
ALTER TABLE `hospital_cabins`
  MODIFY `hospital_cabin_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `hospital_floors`
--
ALTER TABLE `hospital_floors`
  MODIFY `hospital_floor_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `hospital_seat_bookings`
--
ALTER TABLE `hospital_seat_bookings`
  MODIFY `hospital_seat_booking_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `hospital_settings`
--
ALTER TABLE `hospital_settings`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `hospital_wards`
--
ALTER TABLE `hospital_wards`
  MODIFY `hospital_ward_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `hospital_ward_seats`
--
ALTER TABLE `hospital_ward_seats`
  MODIFY `hospital_ward_seat_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `incomes`
--
ALTER TABLE `incomes`
  MODIFY `income_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `income_expense_heads`
--
ALTER TABLE `income_expense_heads`
  MODIFY `income_expense_head_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `items`
--
ALTER TABLE `items`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `item_purchases`
--
ALTER TABLE `item_purchases`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `item_purchase_details`
--
ALTER TABLE `item_purchase_details`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `item_suppliers`
--
ALTER TABLE `item_suppliers`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `item_units`
--
ALTER TABLE `item_units`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `medical_degrees`
--
ALTER TABLE `medical_degrees`
  MODIFY `medical_degree_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `monthly_salaries`
--
ALTER TABLE `monthly_salaries`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `patients`
--
ALTER TABLE `patients`
  MODIFY `patient_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `payment_records`
--
ALTER TABLE `payment_records`
  MODIFY `payment_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `prescription_pay_records`
--
ALTER TABLE `prescription_pay_records`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `prescription_templates`
--
ALTER TABLE `prescription_templates`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `radiology_templates`
--
ALTER TABLE `radiology_templates`
  MODIFY `radiology_template_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `salary_infos`
--
ALTER TABLE `salary_infos`
  MODIFY `salary_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `sale_invoices`
--
ALTER TABLE `sale_invoices`
  MODIFY `sale_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `sale_invoice_details`
--
ALTER TABLE `sale_invoice_details`
  MODIFY `sale_details_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `schedules`
--
ALTER TABLE `schedules`
  MODIFY `schedule_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `schedule_blocks`
--
ALTER TABLE `schedule_blocks`
  MODIFY `schedule_block_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `schedule_slots`
--
ALTER TABLE `schedule_slots`
  MODIFY `schedule_slot_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `service_categories`
--
ALTER TABLE `service_categories`
  MODIFY `service_category_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `service_groups`
--
ALTER TABLE `service_groups`
  MODIFY `service_group_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `service_group_items`
--
ALTER TABLE `service_group_items`
  MODIFY `service_group_item_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `service_packages`
--
ALTER TABLE `service_packages`
  MODIFY `service_package_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `service_package_items`
--
ALTER TABLE `service_package_items`
  MODIFY `service_package_item_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `service_sub_categories`
--
ALTER TABLE `service_sub_categories`
  MODIFY `service_sub_category_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tested_bies`
--
ALTER TABLE `tested_bies`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `user_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_files`
--
ALTER TABLE `user_files`
  MODIFY `file_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_signatures`
--
ALTER TABLE `user_signatures`
  MODIFY `signature_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `diagnostic_test_items`
--
ALTER TABLE `diagnostic_test_items`
  ADD CONSTRAINT `diagnostic_test_items_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `diagnostic_test_items_diagnostic_test_id_foreign` FOREIGN KEY (`diagnostic_test_id`) REFERENCES `diagnostic_tests` (`diagnostic_test_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `diagnostic_test_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `diagnostic_test_sale_items`
--
ALTER TABLE `diagnostic_test_sale_items`
  ADD CONSTRAINT `diagnostic_test_sale_items_diagnostic_test_id_foreign` FOREIGN KEY (`diagnostic_test_id`) REFERENCES `diagnostic_tests` (`diagnostic_test_id`),
  ADD CONSTRAINT `diagnostic_test_sale_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`),
  ADD CONSTRAINT `diagnostic_test_sale_items_sale_details_id_foreign` FOREIGN KEY (`sale_details_id`) REFERENCES `sale_invoice_details` (`sale_details_id`) ON DELETE CASCADE;

--
-- Constraints for table `doctor_diagnostic_test_commissions`
--
ALTER TABLE `doctor_diagnostic_test_commissions`
  ADD CONSTRAINT `doctor_diagnostic_test_commissions_diagnostic_test_id_foreign` FOREIGN KEY (`diagnostic_test_id`) REFERENCES `diagnostic_tests` (`diagnostic_test_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `doctor_diagnostic_test_commissions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE;

--
-- Constraints for table `items`
--
ALTER TABLE `items`
  ADD CONSTRAINT `items_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `item_units` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `item_purchases`
--
ALTER TABLE `item_purchases`
  ADD CONSTRAINT `item_purchases_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `item_purchases_item_supplier_id_foreign` FOREIGN KEY (`item_supplier_id`) REFERENCES `item_suppliers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `item_purchases_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`user_id`) ON DELETE CASCADE;

--
-- Constraints for table `item_purchase_details`
--
ALTER TABLE `item_purchase_details`
  ADD CONSTRAINT `item_purchase_details_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `item_purchase_details_item_purchase_id_foreign` FOREIGN KEY (`item_purchase_id`) REFERENCES `item_purchases` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `sale_invoices`
--
ALTER TABLE `sale_invoices`
  ADD CONSTRAINT `sale_invoices_referred_by_commission_foreign` FOREIGN KEY (`referred_by_commission`) REFERENCES `users` (`user_id`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
