-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 12, 2026 at 06:22 AM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.0.30

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: `clinic_system`
--

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

--
-- Table structure for table `appointments`
--

CREATE TABLE `appointments` (
  `appointment_id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `patient_name` varchar(255) NOT NULL,
  `service` varchar(255) NOT NULL,
  `appointment_date` date NOT NULL,
  `appointment_time` time NOT NULL,
  `assigned_staff` varchar(255) DEFAULT NULL,
  `scheduled_by` enum('admin','student') NOT NULL,
  `status` enum('Pending','Confirmed','Completed','Cancelled') DEFAULT 'Pending',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `clinic_inventory`
--

CREATE TABLE `clinic_inventory` (
  `id` int(11) NOT NULL,
  `medicine_name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `quantity` int(11) DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `no_expiration` tinyint(1) DEFAULT 0,
  `generic_name` varchar(255) DEFAULT NULL,
  `brand_name` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `clinic_inventory`
--

INSERT INTO `clinic_inventory` (`id`, `medicine_name`, `description`, `quantity`, `expiry_date`, `no_expiration`, `generic_name`, `brand_name`, `created_at`) VALUES
(28, 'Paracetamol 500mg', 'For fever and mild to moderate pain relief', 120, NULL, 1, 'cetaminophen', 'Biogesic', '2025-11-23 01:01:29'),
(29, 'Ibuprofen 400mg', 'Anti-inflammatory and pain reliever for body pain, swelling, and headaches.', 90, '2026-07-23', 0, 'Mefenamic Acid', 'Ponstan', '2025-11-23 01:01:29'),
(30, 'Guaifenesin Cough Syrup', 'Expectorant for cough with phlegm', 20, '2025-12-23', 0, 'Guaifenesin', 'Robitussin', '2025-11-23 01:01:29'),
(31, 'Betadine Antiseptic Ointment', 'For minor wounds, cuts, and skin infections.', 40, '2028-05-28', 0, 'Povidone-Iodine', 'Betadine', '2025-11-23 01:01:29'),
(32, 'Loperamide 2mg', 'Anti-diarrheal for sudden diarrhea and loose bowel movement.', 70, '2026-12-30', 0, 'Loperamide Hydrochloride', 'Imodium', '2025-11-23 01:12:40'),
(33, 'Multivitamin Tablets', 'Supplement for boosting immunity and maintaining good health.', 300, '2027-10-30', 0, 'Vitamin B Complex + C', 'Centrum', '2025-11-23 01:12:40'),
(34, 'Hydrocortisone 1% Cream', 'Topical steroid cream for skin irritation, redness, and allergic reactions.', 35, '2027-07-23', 0, 'Hydrocortisone', 'Cortaid', '2025-11-23 01:19:29'),
(35, 'Salbutamol Inhaler 100mcg', 'Reliever for asthma attacks and breathing difficulties.', 25, '2026-01-04', 0, 'Salbutamol Sulfate', 'Ventolin', '2025-11-23 01:19:30'),
(36, 'Zinc Sulfate 20mg', 'Immune system booster and supplement for wound healing.', 95, '2027-02-07', 0, 'Zinc Sulfate', 'Zintrak', '2025-11-23 01:21:45'),
(37, 'Hyoscine N-Butylbromide 10mg', 'For stomach cramps, abdominal pain, and spasms.', 50, '2026-01-23', 0, 'Hyoscine', 'Buscopan', '2025-11-23 01:21:45'),
(38, 'Clotrimazole 1% Cream', 'Antifungal cream for skin infections like ringworm and athlete’s foot.', 40, '2028-02-23', 0, 'Clotrimazole', 'Canesten', '2025-11-23 01:21:45'),
(39, 'Diclofenac 1% Gel', 'Topical anti-inflammatory gel for joint pain, muscle pain, and swelling.', 17, '2027-01-23', 0, 'Diclofenac Sodium', 'Voltaren', '2025-11-23 01:23:24'),
(40, 'Omeprazole 20mg', 'Reduces stomach acid; used for GERD, acidity, and ulcers.', 150, '2026-01-11', 0, 'Omeprazole', 'Losec', '2025-11-23 01:23:24'),
(41, 'Betadine Antiseptic Ointment', 'For minor wounds, cuts, and skin infections', 20, '2028-01-24', 0, 'Povidone-Iodine', 'Betadine', '2025-11-24 14:12:28'),
(42, 'Paracetamol 500mg', NULL, 20, '2025-11-23', 0, '', '', '2025-12-23 00:51:14'),
(43, 'Paracetamol 500mg', NULL, 10, '2025-12-23', 0, '', '', '2025-12-23 00:53:35'),
(44, 'Paracetamol 500mg', NULL, 10, '2025-12-23', 0, '', '', '2025-12-23 00:56:25'),
(45, 'Betadine Antiseptic Ointment', NULL, 19, '2025-12-23', 0, '', '', '2025-12-23 00:57:04'),
(46, 'Paracetamol 500mg', NULL, 10, '2025-12-23', 0, '', '', '2025-12-23 00:58:04');

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

--
-- Table structure for table `consultations`
--

CREATE TABLE `consultations` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `consultation_date` date NOT NULL,
  `chief_complaints` text DEFAULT NULL,
  `treatments` text DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `consultationss`
--

CREATE TABLE `consultationss` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `age` int(11) NOT NULL,
  `course` varchar(100) NOT NULL,
  `sex` varchar(255) NOT NULL,
  `datetime` datetime NOT NULL,
  `reason` varchar(255) NOT NULL,
  `complaint` text NOT NULL,
  `temp` varchar(10) DEFAULT NULL,
  `bp` varchar(15) DEFAULT NULL,
  `hr` varchar(10) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `student_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `consultationss`
--

INSERT INTO `consultationss` (`id`, `name`, `age`, `course`, `sex`, `datetime`, `reason`, `complaint`, `temp`, `bp`, `hr`, `created_at`, `student_id`) VALUES
(20, 'Roger  natividad  B', 25, 'BSIT-4', 'male', '2025-11-24 13:02:00', 'treatment', 'fdf', '12', '34', '34', '2025-11-24 00:57:43', 56),
(21, 'M\'J  Taabirna', 20, 'Bachelor Of Science Information Technology', 'female', '2025-11-24 14:09:00', 'medicine', 'vdv', '12', '12', '12', '2025-11-24 01:04:37', 57),
(22, 'Echusera to  the max', 23, 'Bachelor Of Science Information Technology', 'Male', '2025-11-24 02:35:00', 'consultation', 'done', '12', '12', '12', '2025-11-24 14:31:09', 59),
(23, 'angel Loc-sin', 23, 'BSIS', 'Female', '2025-11-26 04:02:00', 'medicine', 'safdf', '12', '12', '12', '2025-11-25 16:00:25', 58),
(24, 'Jhannel  Onia  s', 20, 'Bachelor Of Science Information Technology', 'Female', '2025-12-04 05:17:00', 'consultation', 'FGSFD', '12', '23', '23', '2025-12-03 21:15:31', 769),
(25, 'Jhannel  Onia', 20, 'Bachelor Of Science Information Technology', 'Male', '2025-12-04 07:58:00', 'medicine', 'gdsg', '34', '33', '23', '2025-12-03 21:56:04', 773),
(26, 'angel Loc-sin', 23, 'BSIS', 'Female', '2025-12-25 21:01:00', 'medicine', 'gsgs', '23', '23', '23', '2025-12-25 09:59:28', 777),
(27, 'mark showesssssss', 20, 'Bachelor Of Science Information Technology', 'Male', '2026-01-04 17:44:00', 'medicine', 'fsf', '232', '56', '56', '2026-01-04 06:42:10', 779),
(28, 'angel Loc-sin', 23, 'BSIS', 'Female', '2026-01-08 19:01:00', 'medicine', 'ewtt', '55', '45', '45', '2026-01-08 08:00:34', 781),
(29, 'viper', 22, 'Bachelor Of Science Information Technology', 'Male', '2026-04-12 16:20:00', 'medicine', 'gtgd', '43', '553', '35', '2026-04-12 03:15:28', 782),
(30, 'viper', 24, 'BSIS 4th year', 'Male', '2026-04-12 12:14:00', 'medicine', 'fs', '12', '12', '12', '2026-04-12 04:14:48', 783);

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

--
-- Table structure for table `dental_record`
--

CREATE TABLE `dental_record` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `age` int(11) DEFAULT NULL,
  `gender` varchar(50) DEFAULT NULL,
  `course_year` varchar(100) DEFAULT NULL,
  `dob` date DEFAULT NULL,
  `civil_status` varchar(50) DEFAULT NULL,
  `religion` varchar(100) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `guardian` varchar(255) DEFAULT NULL,
  `cp_no` varchar(50) DEFAULT NULL,
  `decayed` int(11) DEFAULT NULL,
  `missing` int(11) DEFAULT NULL,
  `filled` int(11) DEFAULT NULL,
  `total` int(11) DEFAULT NULL,
  `date_created` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `dental_record`
--

INSERT INTO `dental_record` (`id`, `patient_id`, `age`, `gender`, `course_year`, `dob`, `civil_status`, `religion`, `address`, `guardian`, `cp_no`, `decayed`, `missing`, `filled`, `total`, `date_created`) VALUES
(38, 781, 23, 'Female', 'BSIS', '2002-10-23', '', 'inc', 'gewoigjedo pgkjdrg', 'ROger  NB', '9484858868', 12, 0, 0, 12, '2026-01-08 16:38:05'),
(39, 782, 22, 'Male', 'Bachelor Of Science Information Technology', '2003-06-10', 'Single', 'inc', 'SCHOOL', 'FSF', '9484858868', 12, 12, 12, 36, '2026-04-12 11:50:06'),
(40, 784, 23, 'Male', 'Bachelor Of Science Information Technology', '2002-07-19', 'Single', 'None', 'SCHOOL', 'FSF', '9484858868', 12, 21, 112, 145, '2026-04-12 12:06:09');

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

--
-- Table structure for table `doctor_comments`
--

CREATE TABLE `doctor_comments` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `doctor_title` varchar(50) DEFAULT NULL,
  `comment_date` date DEFAULT NULL,
  `doctor_comments` text DEFAULT NULL,
  `signature` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `doctor_comments`
--

INSERT INTO `doctor_comments` (`id`, `patient_id`, `doctor_title`, `comment_date`, `doctor_comments`, `signature`) VALUES
(50, 761, '', '0000-00-00', '', ''),
(51, 762, '', '0000-00-00', '', ''),
(52, 763, '', '0000-00-00', '', ''),
(53, 764, '', '0000-00-00', '', ''),
(54, 765, '', '0000-00-00', '', ''),
(55, 766, '', '0000-00-00', '', ''),
(56, 767, '', '0000-00-00', '', ''),
(57, 768, '', '0000-00-00', '', ''),
(58, 769, '', '0000-00-00', '', ''),
(59, 770, '', '0000-00-00', '', ''),
(60, 771, '', '0000-00-00', '', ''),
(61, 772, '', '0000-00-00', '', ''),
(62, 773, '', '0000-00-00', '', ''),
(63, 774, '', '0000-00-00', '', ''),
(64, 775, '', '0000-00-00', '', ''),
(65, 776, '', '0000-00-00', '', ''),
(66, 777, '', '0000-00-00', '', ''),
(67, 778, '', '0000-00-00', '', ''),
(68, 779, '', '0000-00-00', '', ''),
(69, 780, '', '0000-00-00', '', ''),
(70, 781, '', '0000-00-00', '', ''),
(71, 782, '', '0000-00-00', '', ''),
(72, 783, '', '0000-00-00', '', ''),
(73, 784, '', '0000-00-00', '', '');

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

--
-- Table structure for table `doctor_consultations`
--

CREATE TABLE `doctor_consultations` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `consultation_date` date NOT NULL,
  `complaints` text DEFAULT NULL,
  `treatment` text DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  `physician_name` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `doctor_consultations`
--

INSERT INTO `doctor_consultations` (`id`, `patient_id`, `consultation_date`, `complaints`, `treatment`, `remarks`, `physician_name`, `created_at`, `updated_at`) VALUES
(4, 769, '2025-12-04', 'fd', 'fsdfd', 'fdf', 'KHARLOU C. TAGO, M.D.', '2025-12-03 21:16:47', '2025-12-03 21:16:47'),
(5, 769, '2025-12-04', 'hdfh', 'fhf', 'dfhf', 'KHARLOU C. TAGO, M.D.', '2025-12-03 21:24:04', '2025-12-03 21:24:04'),
(6, 784, '2026-04-12', 'gyg', 'hfhfd', 'hdfh', 'KHARLOU C. TAGO, M.D.', '2026-04-12 04:15:56', '2026-04-12 04:15:56');

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

--
-- Table structure for table `family_history`
--

CREATE TABLE `family_history` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `cancer` varchar(3) DEFAULT NULL,
  `rel_cancer` varchar(100) DEFAULT NULL,
  `heart_diseases` varchar(3) DEFAULT NULL,
  `rel_heart_disease` varchar(100) DEFAULT NULL,
  `hypertension` varchar(3) DEFAULT NULL,
  `rel_hypertension` varchar(100) DEFAULT NULL,
  `stroke` varchar(3) DEFAULT NULL,
  `rel_stroke` varchar(100) DEFAULT NULL,
  `tuberculosis` varchar(3) DEFAULT NULL,
  `rel_tuberculosis` varchar(100) DEFAULT NULL,
  `kidney_problem` varchar(3) DEFAULT NULL,
  `rel_kidney` varchar(100) DEFAULT NULL,
  `eye_disorders` varchar(3) DEFAULT NULL,
  `rel_eye_disorder` varchar(100) DEFAULT NULL,
  `diabetess` varchar(3) DEFAULT NULL,
  `rel_diabetes` varchar(100) DEFAULT NULL,
  `mental_disorder` varchar(3) DEFAULT NULL,
  `rel_mental_disorder` varchar(100) DEFAULT NULL,
  `asthmas` varchar(3) DEFAULT NULL,
  `rel_asthma` varchar(100) DEFAULT NULL,
  `convulsion` varchar(3) DEFAULT NULL,
  `rel_convulsion` varchar(100) DEFAULT NULL,
  `bleeding` varchar(3) DEFAULT NULL,
  `rel_bleeding` varchar(100) DEFAULT NULL,
  `gastro` varchar(3) DEFAULT NULL,
  `rel_gastro` varchar(100) DEFAULT NULL,
  `skin` varchar(3) DEFAULT NULL,
  `rel_skin` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `family_history`
--

INSERT INTO `family_history` (`id`, `patient_id`, `cancer`, `rel_cancer`, `heart_diseases`, `rel_heart_disease`, `hypertension`, `rel_hypertension`, `stroke`, `rel_stroke`, `tuberculosis`, `rel_tuberculosis`, `kidney_problem`, `rel_kidney`, `eye_disorders`, `rel_eye_disorder`, `diabetess`, `rel_diabetes`, `mental_disorder`, `rel_mental_disorder`, `asthmas`, `rel_asthma`, `convulsion`, `rel_convulsion`, `bleeding`, `rel_bleeding`, `gastro`, `rel_gastro`, `skin`, `rel_skin`) VALUES
(54, 761, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(55, 762, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(56, 763, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(57, 764, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(58, 765, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(59, 766, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(60, 767, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(61, 768, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(62, 769, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(63, 770, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(64, 771, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(65, 772, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(66, 773, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(67, 774, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(68, 775, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(69, 776, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(70, 777, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(71, 778, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(72, 779, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(73, 780, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(74, 781, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(75, 782, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(76, 783, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', ''),
(77, 784, 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '', 'no', '');

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

--
-- Table structure for table `history_logs`
--

CREATE TABLE `history_logs` (
  `id` int(11) NOT NULL,
  `action` varchar(50) NOT NULL,
  `description` text NOT NULL,
  `reference_id` int(11) NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `history_logs`
--

INSERT INTO `history_logs` (`id`, `action`, `description`, `reference_id`, `created_at`) VALUES
(1, 'STOCK_IN', 'Medicine ID 15 STOCK_IN with quantity 10', 15, '2025-12-24 08:06:46'),
(2, 'STOCK_IN', 'Medicine ID 13 STOCK_IN with quantity 20 (Expiry: 2026-02-28)', 13, '2025-12-24 08:17:24'),
(3, 'STOCK_IN', 'Medicine ID 13 STOCK_IN with quantity 10', 13, '2025-12-25 17:43:49'),
(4, 'STOCK_OUT', 'Medicine ID 12 STOCK_OUT with quantity 10 (Expiry: 2025-12-25)', 12, '2025-12-25 17:53:11'),
(5, 'STOCK_IN', 'Medicine ID 15 STOCK_IN with quantity 10 (Expiry: 2025-12-27)', 15, '2025-12-25 17:53:28'),
(6, 'STOCK_OUT', 'Issued 10 of Medicine ID 13 to Student ID 777', 13, '2025-12-25 18:27:24'),
(7, 'STOCK_OUT', 'Issued 10 of Medicine ID 13 to Student ID 777', 13, '2025-12-25 18:28:22'),
(8, 'PRESCRIPTION_ISSUED', 'Issued 10 of Medicine ID 15 to Student ID 777', 15, '2025-12-25 18:32:39'),
(9, 'PRESCRIPTION_ISSUED', 'Issued 10 of Medicine ID 15 to Student ID 777', 15, '2025-12-25 18:33:45'),
(10, 'PRESCRIPTION_ISSUED', 'Issued 5 of Medicine ID 15 to Student ID 777', 15, '2025-12-25 18:39:57'),
(11, 'PRESCRIPTION_ISSUED', 'Issued 5 of Medicine ID 15 to Student ID 777', 15, '2025-12-25 18:40:48'),
(12, 'PRESCRIPTION_ISSUED', 'Issued 5 of Medicine ID 15 to Student ID 777', 15, '2025-12-25 18:43:56'),
(13, 'PRESCRIPTION_ISSUED', 'Issued 5 of Medicine ID 15 to Student ID 777', 15, '2025-12-25 18:44:45'),
(14, 'STOCK_OUT', 'Medicine ID 12 STOCK_OUT with quantity 10 (Expiry: 2025-12-25)', 12, '2025-12-25 18:53:48'),
(15, 'PRESCRIPTION_ISSUED', 'Issued 5 of Medicine ID 13 to angel Loc-sin', 13, '2025-12-25 19:26:10'),
(16, 'PRESCRIPTION_ISSUED', 'Issued 5 of Paracetamol 500mg to angel Loc-sin', 13, '2025-12-25 19:28:23'),
(17, 'STOCK_IN', 'Medicine ID 16 STOCK_IN with quantity 20 (Expiry: 2026-01-25)', 16, '2025-12-25 19:41:39'),
(18, 'STOCK_IN', 'Medicine ID 16 STOCK_IN with quantity 20 (Expiry: 2026-02-25)', 16, '2025-12-25 19:43:32'),
(19, 'STOCK_OUT', 'Medicine ID 14 STOCK_OUT with quantity 10 (Expiry: 2025-12-25)', 14, '2025-12-25 19:44:03'),
(20, 'STOCK_IN', 'Medicine ID 16 STOCK_IN with quantity 10 (Expiry: 2025-12-26)', 16, '2025-12-25 19:44:45'),
(21, 'PRESCRIPTION_ISSUED', 'Issued 20 of Glucophage to angel Loc-sin', 16, '2025-12-25 19:47:36'),
(22, 'PRESCRIPTION_ISSUED', 'Issued 5 of Glucophage to angel Loc-sin', 16, '2025-12-25 22:52:19'),
(23, 'STOCK_IN', 'Medicine ID 15 STOCK_IN with quantity 10 (Expiry: 2026-01-15)', 15, '2025-12-25 23:12:33'),
(24, 'PRESCRIPTION_ISSUED', 'Issued 1 of Advil to Jhannel  Onia  ', 15, '2025-12-25 23:14:11'),
(25, 'PRESCRIPTION_ISSUED', 'Issued 2 of Advil to Jhannel  Onia  ', 15, '2025-12-25 23:14:46'),
(26, 'PRESCRIPTION_ISSUED', 'Issued 1 of Advil to Jhannel  Onia  ', 15, '2025-12-25 23:15:37'),
(27, 'STOCK_OUT', 'Medicine ID 15 STOCK_OUT with quantity 20 (Expiry: 2025-12-26)', 15, '2025-12-26 07:01:57'),
(28, 'STOCK_OUT', 'Medicine ID 14 STOCK_OUT with quantity 5 (Expiry: 2025-12-25)', 14, '2025-12-26 07:04:26'),
(29, 'STOCK_OUT', 'Medicine ID 12 STOCK_OUT with quantity 5 (Expiry: 2025-12-25)', 12, '2025-12-26 07:05:45'),
(30, 'STOCK_IN', 'Medicine ID 13 STOCK_IN with quantity 20 (Expiry: 2026-01-28)', 13, '2025-12-26 07:08:43'),
(31, 'STOCK_OUT', 'Medicine ID 12 STOCK_OUT with quantity 10 (Expiry: 2025-12-23)', 12, '2025-12-26 07:26:00'),
(32, 'STOCK_OUT', 'Medicine ID 16 STOCK_OUT with quantity 5 (Expiry: 2025-12-25)', 16, '2025-12-26 07:30:19'),
(33, 'STOCK_OUT', 'Medicine ID 12 STOCK_OUT with quantity 3 (Expiry: 2025-12-25)', 12, '2025-12-26 07:33:43'),
(34, 'STOCK_OUT', 'Medicine ID 15 STOCK_OUT with quantity 5 (Expiry: 2025-12-25)', 15, '2025-12-26 07:39:28'),
(35, 'STOCK_IN', 'Medicine ID 16 STOCK_IN with quantity 10 (Expiry: 2026-01-23)', 16, '2025-12-26 07:39:57'),
(36, 'STOCK_IN', 'Medicine ID 13 STOCK_IN with quantity 5 (Expiry: 2026-02-28)', 13, '2025-12-26 07:57:09'),
(37, 'STOCK_IN', 'Medicine ID 18 STOCK_IN with quantity 20 (Expiry: 2026-02-28)', 18, '2026-01-04 14:43:06'),
(38, 'STOCK_IN', 'Medicine ID 14 STOCK_IN with quantity 100', 14, '2026-01-04 14:52:58'),
(39, 'STOCK_OUT', 'Medicine ID 18 STOCK_OUT with quantity 20 (Expiry: 2026-01-04)', 18, '2026-01-04 14:56:43'),
(40, 'STOCK_OUT', 'Medicine ID 16 STOCK_OUT with quantity 50 (Expiry: 2026-01-04)', 16, '2026-01-04 19:08:56'),
(41, 'STOCK_OUT', 'Medicine ID 17 STOCK_OUT with quantity 60 (Expiry: 2026-01-03)', 17, '2026-01-04 19:10:23');

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

--
-- Table structure for table `inventory_transactions`
--

CREATE TABLE `inventory_transactions` (
  `id` int(11) NOT NULL,
  `medicine_name` varchar(255) DEFAULT NULL,
  `transaction_type` enum('Stock In','Stock Out (Expired)','Dispensed') DEFAULT NULL,
  `quantity` int(11) DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `generic_name` varchar(255) NOT NULL,
  `brand_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `inventory_transactions`
--

INSERT INTO `inventory_transactions` (`id`, `medicine_name`, `transaction_type`, `quantity`, `remarks`, `created_at`, `generic_name`, `brand_name`) VALUES
(2, 'Betadine Antiseptic Ointment', 'Stock In', 19, 'Batch addition', '2025-12-23 00:57:04', '', ''),
(3, 'Paracetamol 500mg', 'Stock In', 10, 'Batch addition', '2025-12-23 00:58:04', '', '');

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

--
-- Stand-in structure for view `inventory_view`
-- (See below for the actual view)
--
CREATE TABLE `inventory_view` (
`id` int(11)
,`medicine_name` varchar(100)
,`generic_name` varchar(100)
,`brand_name` varchar(100)
,`description` text
,`quantity` decimal(33,0)
);

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

--
-- Table structure for table `laboratory_results`
--

CREATE TABLE `laboratory_results` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `medical_certificate` varchar(100) DEFAULT NULL,
  `chest_xray` varchar(100) DEFAULT NULL,
  `blood_type` varchar(10) DEFAULT NULL,
  `urinalysis` varchar(100) DEFAULT NULL,
  `cbc` varchar(100) DEFAULT NULL,
  `fecalysis` varchar(100) DEFAULT NULL,
  `sgpt` varchar(100) DEFAULT NULL,
  `psych_test` varchar(100) DEFAULT NULL,
  `dental_exam` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `laboratory_results`
--

INSERT INTO `laboratory_results` (`id`, `patient_id`, `medical_certificate`, `chest_xray`, `blood_type`, `urinalysis`, `cbc`, `fecalysis`, `sgpt`, `psych_test`, `dental_exam`) VALUES
(53, 764, 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No'),
(54, 765, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(55, 766, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(56, 767, 'No', 'No', 'No', 'No', 'No', 'No', 'Yes', 'No', 'No'),
(57, 768, 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No'),
(58, 769, 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No'),
(59, 770, 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No'),
(60, 771, 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No'),
(61, 772, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(62, 773, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(63, 774, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(64, 775, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(65, 776, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Yes'),
(66, 777, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(67, 778, 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No'),
(68, 779, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(69, 780, NULL, NULL, NULL, 'Yes', NULL, NULL, NULL, NULL, NULL),
(70, 781, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(71, 782, NULL, NULL, NULL, 'Yes', NULL, NULL, NULL, NULL, NULL),
(72, 783, 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No'),
(73, 784, 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No', 'No');

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

--
-- Table structure for table `medical_examination`
--

CREATE TABLE `medical_examination` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `weight` int(11) DEFAULT NULL,
  `height` int(11) DEFAULT NULL,
  `pulse_rate` int(11) DEFAULT NULL,
  `heart_rate` int(11) DEFAULT NULL,
  `spo2` int(11) DEFAULT NULL,
  `temperature` int(11) DEFAULT NULL,
  `bp_standing_systolic` int(11) DEFAULT NULL,
  `bp_standing_diastolic` int(11) DEFAULT NULL,
  `bp_sitting_systolic` int(11) DEFAULT NULL,
  `bp_sitting_diastolic` int(11) DEFAULT NULL,
  `bp_laying_systolic` int(11) DEFAULT NULL,
  `bp_laying_diastolic` int(11) DEFAULT NULL,
  `remarks_treatment` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `medical_examination`
--

INSERT INTO `medical_examination` (`id`, `patient_id`, `weight`, `height`, `pulse_rate`, `heart_rate`, `spo2`, `temperature`, `bp_standing_systolic`, `bp_standing_diastolic`, `bp_sitting_systolic`, `bp_sitting_diastolic`, `bp_laying_systolic`, `bp_laying_diastolic`, `remarks_treatment`) VALUES
(62, 69, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(63, 761, 12, 0, 0, 12, 12, 0, 12, 12, 21, 12, 12, 12, ''),
(64, 762, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(65, 763, 12, 12, 12, 12, 12, 12, 12, 12, 12, 21, 12, 12, ''),
(66, 764, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(67, 765, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(68, 766, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(69, 767, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(70, 768, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(71, 769, 12, 12, 12, 12, 12, 12, 13, 12, 12, 12, 12, 12, ''),
(72, 770, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(73, 771, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(74, 772, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(75, 773, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(76, 774, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(77, 775, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(78, 776, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(79, 777, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(80, 778, 12, 12, 12, 0, 12, 0, 12, 12, 12, 12, 12, 12, '12'),
(81, 779, 12, 12, 12, 21, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(82, 780, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(83, 781, 23, 53, 45, 54, 545, 545, 545, 54, 45, 54, 545, 54, ''),
(84, 782, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(85, 783, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ''),
(86, 784, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, '');

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

--
-- Table structure for table `medical_questions`
--

CREATE TABLE `medical_questions` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `history` varchar(3) DEFAULT NULL,
  `history_comment` text DEFAULT NULL,
  `medicine` varchar(3) DEFAULT NULL,
  `medicine_comment` text DEFAULT NULL,
  `allergy` varchar(3) DEFAULT NULL,
  `allergy_comment` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `medical_questions`
--

INSERT INTO `medical_questions` (`id`, `patient_id`, `history`, `history_comment`, `medicine`, `medicine_comment`, `allergy`, `allergy_comment`) VALUES
(52, 763, 'no', '', 'no', '', 'no', ''),
(53, 764, 'no', '', 'no', '', 'no', 'checked'),
(54, 765, 'no', '', 'no', '', 'no', ''),
(55, 766, 'no', '', 'no', '', 'no', ''),
(56, 767, 'no', '', 'no', '', 'no', ''),
(57, 768, 'no', '', 'no', '', 'no', 'checked'),
(58, 769, 'no', '', 'no', '', 'no', 'checked'),
(59, 770, 'no', '', 'no', '', 'no', 'checked'),
(60, 771, 'no', '', 'no', '', 'no', 'checked'),
(61, 772, 'no', '', 'no', '', 'no', ''),
(62, 773, 'no', '', 'no', '', 'no', ''),
(63, 774, 'no', '', 'no', '', 'no', ''),
(64, 775, 'no', '', 'no', '', 'no', ''),
(65, 776, 'no', '', 'no', '', 'no', ''),
(66, 777, 'no', '', 'no', '', 'no', ''),
(67, 778, 'no', '', 'no', '', 'no', 'checked'),
(68, 779, 'no', '', 'no', '', 'no', ''),
(69, 780, 'no', '', 'no', '', 'no', ''),
(70, 781, 'no', '', 'no', '', 'no', ''),
(71, 782, 'no', '', 'no', '', 'no', ''),
(72, 783, 'no', '', 'no', '', 'no', 'checked'),
(73, 784, 'no', '', 'no', '', 'no', 'checked');

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

--
-- Table structure for table `medication_profiles`
--

CREATE TABLE `medication_profiles` (
  `id` int(11) NOT NULL,
  `medicine_name` varchar(100) DEFAULT NULL,
  `generic_name` varchar(100) DEFAULT NULL,
  `brand_name` varchar(100) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `medicine_type` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `medication_profiles`
--

INSERT INTO `medication_profiles` (`id`, `medicine_name`, `generic_name`, `brand_name`, `description`, `created_at`, `medicine_type`) VALUES
(12, 'Paracetamol', 'Amoxicillin', 'Amoxicillin', 'fwrff', '2025-12-23 06:49:30', ''),
(13, 'Paracetamol 500mg', 'Amoxicillin', 'Amoxicillin', 'fsdf', '2025-12-23 06:50:07', ''),
(14, 'Amoxicillin	', 'cetaminophen', 'Biogesic', 'ggd', '2025-12-23 08:15:10', ''),
(15, 'Advil', 'cetaminophen', 'Biogesic', 'ggd', '2025-12-23 08:45:57', ''),
(16, 'Glucophage', 'Metformin', 'Glucophage', 'Manages blood sugar in type 2 diabetes patients ', '2025-12-25 11:40:50', ''),
(17, 'Paracetamol', 'cetaminophen', 'Biogesic', 'dghbdhdhd', '2025-12-25 14:08:27', ''),
(18, 'Diclofenac 1% Gel', 'Acetaminophen', 'Amoxicillin', 'fsf', '2026-01-04 06:42:46', '');

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

--
-- Table structure for table `medicines`
--

CREATE TABLE `medicines` (
  `id` int(11) NOT NULL,
  `consultation_id` int(11) NOT NULL,
  `generic_name` varchar(255) DEFAULT NULL,
  `brand_name` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `quantity` varchar(50) DEFAULT NULL,
  `date_received` date DEFAULT NULL,
  `expiration_date` date DEFAULT NULL,
  `no_expiration` tinyint(1) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `oral_health_treatments`
--

CREATE TABLE `oral_health_treatments` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `treatment_date` date NOT NULL,
  `tooth_no` varchar(10) NOT NULL,
  `nature_of_operation` varchar(255) NOT NULL,
  `remarks` text DEFAULT NULL,
  `dentist` varchar(100) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `patient_info`
--

CREATE TABLE `patient_info` (
  `id` int(11) NOT NULL,
  `age` int(11) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `dob` date DEFAULT NULL,
  `birth_place` varchar(100) DEFAULT NULL,
  `course` varchar(100) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `civil_status` varchar(50) DEFAULT NULL,
  `parent_guardian` varchar(100) DEFAULT NULL,
  `contact_no` varchar(20) DEFAULT NULL,
  `gender` varchar(10) DEFAULT NULL,
  `campus` varchar(100) DEFAULT NULL,
  `services` varchar(255) NOT NULL,
  `religion` varchar(255) NOT NULL,
  `student_id` int(11) NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `firstname` varchar(255) NOT NULL,
  `lastname` varchar(255) NOT NULL,
  `middlename` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `patient_info`
--

INSERT INTO `patient_info` (`id`, `age`, `date`, `dob`, `birth_place`, `course`, `address`, `civil_status`, `parent_guardian`, `contact_no`, `gender`, `campus`, `services`, `religion`, `student_id`, `created_at`, `firstname`, `lastname`, `middlename`) VALUES
(782, 22, '2026-04-12', '2003-06-10', 'YESGJSJE', 'Bachelor Of Science Information Technology', 'SCHOOL', 'Single', 'FSF', '09484858868', 'Male', 'Pagadian Annex Campus', '', 'inc', 0, '2026-04-12 11:12:32', 'viper', 'romrk', 'khgkghk'),
(783, 24, '2026-04-12', '2001-05-17', 'YESGJSJE', 'BSIS 4th year', 'SCHOOL', '', 'ROger  NB', '09484858868', 'Male', 'Pagadian Annex Campus', '', 'INC', 17, '2026-04-12 11:17:30', 'viper', 'romrk', 'khgkghk'),
(784, 23, '2026-04-12', '2002-07-19', 'YESGJSJE', 'Bachelor Of Science Information Technology', 'SCHOOL', 'Single', 'FSF', '09484858868', 'Male', 'Pagadian Annex Campus', 'None', 'None', 0, '2026-04-12 12:05:25', 'dark', 'me', 'tansyo');

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

--
-- Table structure for table `personal_history`
--

CREATE TABLE `personal_history` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `primary_complex` tinyint(1) DEFAULT NULL,
  `kidney_disease` tinyint(1) DEFAULT NULL,
  `pneumonia` tinyint(1) DEFAULT NULL,
  `ear_problem` tinyint(1) DEFAULT NULL,
  `diflex` tinyint(1) DEFAULT NULL,
  `asthmad` tinyint(1) DEFAULT NULL,
  `skin_problem` tinyint(1) DEFAULT NULL,
  `dengue` tinyint(1) DEFAULT NULL,
  `mumps` tinyint(1) DEFAULT NULL,
  `typhoid_fever` tinyint(1) DEFAULT NULL,
  `d_flex` tinyint(1) DEFAULT NULL,
  `rheumatic_fever` tinyint(1) DEFAULT NULL,
  `diabetesd` tinyint(1) DEFAULT NULL,
  `measles` tinyint(1) DEFAULT NULL,
  `thyroid_disorder` tinyint(1) DEFAULT NULL,
  `hepatitis` tinyint(1) DEFAULT NULL,
  `chicken_pox` tinyint(1) DEFAULT NULL,
  `eye_disorderd` tinyint(1) DEFAULT NULL,
  `poliomyelitis` tinyint(1) DEFAULT NULL,
  `heart_diseased` tinyint(1) DEFAULT NULL,
  `anemia_leukemia` tinyint(1) DEFAULT NULL,
  `others` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `personal_history`
--

INSERT INTO `personal_history` (`id`, `patient_id`, `primary_complex`, `kidney_disease`, `pneumonia`, `ear_problem`, `diflex`, `asthmad`, `skin_problem`, `dengue`, `mumps`, `typhoid_fever`, `d_flex`, `rheumatic_fever`, `diabetesd`, `measles`, `thyroid_disorder`, `hepatitis`, `chicken_pox`, `eye_disorderd`, `poliomyelitis`, `heart_diseased`, `anemia_leukemia`, `others`) VALUES
(51, 762, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(52, 763, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(53, 764, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(54, 765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(55, 766, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(56, 767, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(57, 768, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(58, 769, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(59, 770, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(60, 771, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(61, 772, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(62, 773, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(63, 774, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(64, 775, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(65, 776, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(66, 777, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(67, 778, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(68, 779, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(69, 780, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ''),
(70, 781, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(71, 782, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(72, 783, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(73, 784, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '');

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

--
-- Table structure for table `prescriptions`
--

CREATE TABLE `prescriptions` (
  `id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `medicine_id` int(11) NOT NULL,
  `dosage` varchar(255) NOT NULL,
  `quantity` int(11) NOT NULL,
  `instructions` text DEFAULT NULL,
  `issued_at` datetime DEFAULT current_timestamp(),
  `pric` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `prescriptions`
--

INSERT INTO `prescriptions` (`id`, `student_id`, `medicine_id`, `dosage`, `quantity`, `instructions`, `issued_at`, `pric`) VALUES
(35, 777, 13, 'ghj', 10, '0', '2025-12-25 18:27:24', 'ghj'),
(36, 777, 13, '256', 10, '0', '2025-12-25 18:28:22', 'fgh'),
(37, 777, 15, 'gdfg', 10, '0', '2025-12-25 18:32:39', 'gdfg'),
(38, 777, 15, 'dbdhb', 10, '0', '2025-12-25 18:33:45', 'gdfg'),
(39, 777, 15, '256', 5, '0', '2025-12-25 18:39:57', 'dgf'),
(40, 777, 15, '256', 5, '0', '2025-12-25 18:40:48', 'hdfhf'),
(41, 777, 15, 'fhf', 5, '0', '2025-12-25 18:43:56', 'gfg'),
(42, 777, 15, 'geg', 5, '0', '2025-12-25 18:44:45', 'gfgdf'),
(43, 777, 13, 'gdg', 5, '0', '2025-12-25 19:26:10', 'fjf'),
(44, 777, 13, 'ggd', 5, '0', '2025-12-25 19:28:23', 'hfh'),
(45, 777, 16, '4yury', 20, '0', '2025-12-25 19:47:36', 'gdg'),
(46, 777, 16, 'dg', 5, '0', '2025-12-25 22:52:19', 'hfh'),
(47, 773, 13, 'dhghh', 5, '0', '2025-12-25 23:09:33', 'hdhf'),
(48, 773, 15, 'ffgs', 5, '0', '2025-12-25 23:12:54', 'gsgsd'),
(49, 773, 15, 'fa', 1, '0', '2025-12-25 23:14:11', 'fgj'),
(50, 773, 15, 'ggdsg', 2, '0', '2025-12-25 23:14:46', 'gdgd'),
(51, 773, 15, 'ggsd', 1, '0', '2025-12-25 23:15:37', 'gsgdc'),
(52, 773, 15, 'gg', 1, '0', '2025-12-25 23:22:23', 'gsgd'),
(53, 773, 16, 'gsg', 5, '0', '2025-12-26 07:40:20', 'dhdf'),
(54, 773, 16, 'stgsg', 5, '0', '2025-12-26 07:42:26', 'dhf'),
(55, 779, 18, 'oroot', 10, '0', '2026-01-04 14:43:41', 'dgd'),
(56, 779, 14, '1  Tablet', 20, '0', '2026-01-04 18:41:40', 'gdg'),
(57, 779, 14, 'dghdfh', 10, '0', '2026-01-04 19:15:40', 'hdfhdf');

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

--
-- Table structure for table `present_illness`
--

CREATE TABLE `present_illness` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `chest_pain` tinyint(1) DEFAULT NULL,
  `indigestion` tinyint(1) DEFAULT NULL,
  `swollen_feet` tinyint(1) DEFAULT NULL,
  `headaches` tinyint(1) DEFAULT NULL,
  `sore_throat` tinyint(1) DEFAULT NULL,
  `dizziness` tinyint(1) DEFAULT NULL,
  `nausea` tinyint(1) DEFAULT NULL,
  `breathing` tinyint(1) DEFAULT NULL,
  `weight_loss` tinyint(1) DEFAULT NULL,
  `insomnia` tinyint(1) DEFAULT NULL,
  `joint_pains` tinyint(1) DEFAULT NULL,
  `urination` tinyint(1) DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `present_illness`
--

INSERT INTO `present_illness` (`id`, `patient_id`, `chest_pain`, `indigestion`, `swollen_feet`, `headaches`, `sore_throat`, `dizziness`, `nausea`, `breathing`, `weight_loss`, `insomnia`, `joint_pains`, `urination`, `created_at`) VALUES
(51, 762, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-04 17:37:19'),
(52, 763, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-04 17:37:19'),
(53, 764, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-04 17:37:19'),
(54, 765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '2026-01-04 17:37:19'),
(55, 766, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-04 17:37:19'),
(56, 767, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '2026-01-04 17:37:19'),
(57, 768, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '2026-01-04 17:37:19'),
(58, 769, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-04 17:37:19'),
(59, 770, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-04 17:37:19'),
(60, 771, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '2026-01-04 17:37:19'),
(61, 772, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-04 17:37:19'),
(62, 773, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '2026-01-04 17:37:19'),
(63, 774, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-04 17:37:19'),
(64, 775, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-04 17:37:19'),
(65, 776, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-04 17:37:19'),
(66, 777, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-04 17:37:19'),
(67, 778, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '2026-01-04 17:37:19'),
(68, 779, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '2026-01-04 17:37:19'),
(69, 780, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, '2026-01-04 18:37:20'),
(70, 781, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-01-08 14:36:17'),
(71, 782, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '2026-04-12 11:12:32'),
(72, 783, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '2026-04-12 11:17:30'),
(73, 784, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, '2026-04-12 12:02:55');

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

--
-- Table structure for table `request_appointments`
--

CREATE TABLE `request_appointments` (
  `request_id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `student_name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(50) NOT NULL,
  `num_students` int(11) NOT NULL,
  `services` text DEFAULT NULL,
  `other_service` varchar(255) DEFAULT NULL,
  `purpose` varchar(255) NOT NULL,
  `preferred_date` date NOT NULL,
  `status` enum('Pending','Approved','Rejected') DEFAULT 'Pending',
  `date_submitted` timestamp NOT NULL DEFAULT current_timestamp(),
  `selected_students` varchar(255) NOT NULL,
  `rejection_reason` text DEFAULT NULL,
  `age` int(11) NOT NULL,
  `created_at` date NOT NULL DEFAULT current_timestamp(),
  `appointment_time` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `request_appointments`
--

INSERT INTO `request_appointments` (`request_id`, `student_id`, `student_name`, `email`, `phone`, `num_students`, `services`, `other_service`, `purpose`, `preferred_date`, `status`, `date_submitted`, `selected_students`, `rejection_reason`, `age`, `created_at`, `appointment_time`) VALUES
(271, 5, 'angel Loc-sin', 'admin3@heroes1979.edu.ph', '09484858868', 0, 'Pregnancy Test', NULL, 'school', '2026-01-08', 'Pending', '2026-01-08 09:14:55', '', NULL, 23, '2026-01-08', '09:00 AM'),
(272, 17, 'viper', 'admin@gmail.com', '09484858868', 0, 'Field Study', NULL, 'school', '2026-04-13', 'Rejected', '2026-04-12 04:12:40', '', 'The doctor/nurse is in an emergency', 24, '2026-04-12', '');

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

--
-- Table structure for table `stock_history`
--

CREATE TABLE `stock_history` (
  `id` int(11) NOT NULL,
  `medication_id` int(11) DEFAULT NULL,
  `type` varchar(255) DEFAULT NULL,
  `quantity` int(11) DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `no_expiry` tinyint(4) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `stock_history`
--

INSERT INTO `stock_history` (`id`, `medication_id`, `type`, `quantity`, `expiry_date`, `no_expiry`, `created_at`) VALUES
(68, 14, 'STOCK_IN', 70, NULL, 1, '2026-01-04 06:52:58'),
(69, 18, 'STOCK_OUT', 20, '2026-01-04', 0, '2026-01-04 06:56:43'),
(70, 14, 'STOCK_OUT', 20, NULL, 1, '2026-01-04 10:41:40'),
(71, 16, 'STOCK_OUT', 50, '2026-01-04', 0, '2026-01-04 11:08:56'),
(72, 17, 'STOCK_OUT', 60, '2026-01-03', 0, '2026-01-04 11:10:23'),
(73, 14, 'STOCK_OUT', 10, NULL, 1, '2026-01-04 11:15:40');

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

--
-- Table structure for table `students`
--

CREATE TABLE `students` (
  `student_id` int(11) NOT NULL,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `course_year` varchar(100) DEFAULT NULL,
  `date_registered` timestamp NOT NULL DEFAULT current_timestamp(),
  `dob` date DEFAULT NULL,
  `birth_place` varchar(255) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `civil_status` varchar(50) DEFAULT NULL,
  `parent` varchar(255) DEFAULT NULL,
  `contact` varchar(20) DEFAULT NULL,
  `gender` enum('Male','Female') DEFAULT NULL,
  `campus` varchar(100) DEFAULT NULL,
  `religion` varchar(255) NOT NULL,
  `age` int(11) NOT NULL,
  `firstname` varchar(255) NOT NULL,
  `lastname` varchar(255) NOT NULL,
  `middlename` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `students`
--

INSERT INTO `students` (`student_id`, `email`, `password`, `course_year`, `date_registered`, `dob`, `birth_place`, `address`, `civil_status`, `parent`, `contact`, `gender`, `campus`, `religion`, `age`, `firstname`, `lastname`, `middlename`) VALUES
(17, 'admin@gmail.com', '$2y$10$o1aCE1100tq8tb/eyiQ.mOpTRb2ZWlPgTEwsH.Nx36Tb7qgxG4MCG', 'BSIS 4th year', '2026-04-12 03:16:52', '2001-05-17', 'YESGJSJE', 'SCHOOL', '', 'ROger  NB', '09484858868', 'Male', 'Pagadian Annex Campus', 'INC', 24, 'viper', 'romrk', 'khgkghk');

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

--
-- Table structure for table `student_archive`
--

CREATE TABLE `student_archive` (
  `archive_id` int(11) NOT NULL,
  `patient_id` int(11) NOT NULL,
  `age` int(11) DEFAULT NULL,
  `course_year` varchar(100) DEFAULT NULL,
  `dob` date DEFAULT NULL,
  `birth_place` varchar(255) DEFAULT NULL,
  `civil_status` varchar(50) DEFAULT NULL,
  `permanent_address` text DEFAULT NULL,
  `parent_name` varchar(255) DEFAULT NULL,
  `parent_contact` varchar(50) DEFAULT NULL,
  `guardian_name` varchar(255) DEFAULT NULL,
  `guardian_contact` varchar(50) DEFAULT NULL,
  `guardian_address` text DEFAULT NULL,
  `weight` varchar(10) DEFAULT NULL,
  `height` varchar(10) DEFAULT NULL,
  `pulse_rate` varchar(10) DEFAULT NULL,
  `heart_rate` varchar(10) DEFAULT NULL,
  `temp_1` varchar(10) DEFAULT NULL,
  `temp_2` varchar(10) DEFAULT NULL,
  `temp_3` varchar(10) DEFAULT NULL,
  `temp_4` varchar(10) DEFAULT NULL,
  `spo2_1` varchar(10) DEFAULT NULL,
  `spo2_2` varchar(10) DEFAULT NULL,
  `spo2_3` varchar(10) DEFAULT NULL,
  `spo2_4` varchar(10) DEFAULT NULL,
  `bp1_systolic` varchar(10) DEFAULT NULL,
  `bp1_diastolic` varchar(10) DEFAULT NULL,
  `bp2_systolic` varchar(10) DEFAULT NULL,
  `bp2_diastolic` varchar(10) DEFAULT NULL,
  `bp3_systolic` varchar(10) DEFAULT NULL,
  `bp3_diastolic` varchar(10) DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  `cancer` tinyint(1) DEFAULT 0,
  `cancer_relationship` varchar(255) DEFAULT NULL,
  `diabetes_family` tinyint(1) DEFAULT 0,
  `diabetes_relationship` varchar(255) DEFAULT NULL,
  `heart_disease` tinyint(1) DEFAULT 0,
  `heart_disease_relationship` varchar(255) DEFAULT NULL,
  `mental_disorder` tinyint(1) DEFAULT 0,
  `mental_disorder_relationship` varchar(255) DEFAULT NULL,
  `hypertension` tinyint(1) DEFAULT 0,
  `hypertension_relationship` varchar(255) DEFAULT NULL,
  `asthma` tinyint(1) DEFAULT 0,
  `asthma_relationship` varchar(255) DEFAULT NULL,
  `stroke` tinyint(1) DEFAULT 0,
  `stroke_relationship` varchar(255) DEFAULT NULL,
  `convulsion` tinyint(1) DEFAULT 0,
  `convulsion_relationship` varchar(255) DEFAULT NULL,
  `tuberculosis` tinyint(1) DEFAULT 0,
  `tuberculosis_relationship` varchar(255) DEFAULT NULL,
  `bleeding_tendencies` tinyint(1) DEFAULT 0,
  `bleeding_tendencies_relationship` varchar(255) DEFAULT NULL,
  `kidney_problem` tinyint(1) DEFAULT 0,
  `kidney_problem_relationship` varchar(255) DEFAULT NULL,
  `gi_disease` tinyint(1) DEFAULT 0,
  `gi_disease_relationship` varchar(255) DEFAULT NULL,
  `eye_disorder` tinyint(1) DEFAULT 0,
  `eye_disorder_relationship` varchar(255) DEFAULT NULL,
  `skin_problem` tinyint(1) DEFAULT 0,
  `skin_problem_relationship` varchar(255) DEFAULT NULL,
  `primary_complex` tinyint(1) DEFAULT 0,
  `rheumatic_fever` tinyint(1) DEFAULT 0,
  `chicken_pox` tinyint(1) DEFAULT 0,
  `kidney_disease` tinyint(1) DEFAULT 0,
  `diabetes` tinyint(1) DEFAULT 0,
  `pneumonia` tinyint(1) DEFAULT 0,
  `dengue` tinyint(1) DEFAULT 0,
  `measles` tinyint(1) DEFAULT 0,
  `poliomyelitis` tinyint(1) DEFAULT 0,
  `ear_problem` tinyint(1) DEFAULT 0,
  `mumps` tinyint(1) DEFAULT 0,
  `thyroid_disorder` tinyint(1) DEFAULT 0,
  `mental_disorder_pers` tinyint(1) DEFAULT 0,
  `typhoid_fever` tinyint(1) DEFAULT 0,
  `hepatitis` tinyint(1) DEFAULT 0,
  `anemia_leukemia` tinyint(1) DEFAULT 0,
  `chest_pain` tinyint(1) DEFAULT 0,
  `headaches` tinyint(1) DEFAULT 0,
  `nausea_vomiting` tinyint(1) DEFAULT 0,
  `insomnia` tinyint(1) DEFAULT 0,
  `indigestion` tinyint(1) DEFAULT 0,
  `sore_throat` tinyint(1) DEFAULT 0,
  `difficult_breathing` tinyint(1) DEFAULT 0,
  `joint_pains` tinyint(1) DEFAULT 0,
  `swollen_feet` tinyint(1) DEFAULT 0,
  `dizziness` tinyint(1) DEFAULT 0,
  `weight_loss` tinyint(1) DEFAULT 0,
  `frequent_urination` tinyint(1) DEFAULT 0,
  `history_hosp` text DEFAULT NULL,
  `taking_meds` text DEFAULT NULL,
  `allergic` text DEFAULT NULL,
  `date_archived` timestamp NOT NULL DEFAULT current_timestamp(),
  `services` varchar(255) DEFAULT NULL,
  `campus` varchar(255) NOT NULL,
  `gender` varchar(255) NOT NULL,
  `contact_no` varchar(255) NOT NULL,
  `parent_guardian` varchar(255) NOT NULL,
  `firstname` varchar(255) NOT NULL,
  `lastname` varchar(255) NOT NULL,
  `middlename` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `student_archive`
--

INSERT INTO `student_archive` (`archive_id`, `patient_id`, `age`, `course_year`, `dob`, `birth_place`, `civil_status`, `permanent_address`, `parent_name`, `parent_contact`, `guardian_name`, `guardian_contact`, `guardian_address`, `weight`, `height`, `pulse_rate`, `heart_rate`, `temp_1`, `temp_2`, `temp_3`, `temp_4`, `spo2_1`, `spo2_2`, `spo2_3`, `spo2_4`, `bp1_systolic`, `bp1_diastolic`, `bp2_systolic`, `bp2_diastolic`, `bp3_systolic`, `bp3_diastolic`, `remarks`, `cancer`, `cancer_relationship`, `diabetes_family`, `diabetes_relationship`, `heart_disease`, `heart_disease_relationship`, `mental_disorder`, `mental_disorder_relationship`, `hypertension`, `hypertension_relationship`, `asthma`, `asthma_relationship`, `stroke`, `stroke_relationship`, `convulsion`, `convulsion_relationship`, `tuberculosis`, `tuberculosis_relationship`, `bleeding_tendencies`, `bleeding_tendencies_relationship`, `kidney_problem`, `kidney_problem_relationship`, `gi_disease`, `gi_disease_relationship`, `eye_disorder`, `eye_disorder_relationship`, `skin_problem`, `skin_problem_relationship`, `primary_complex`, `rheumatic_fever`, `chicken_pox`, `kidney_disease`, `diabetes`, `pneumonia`, `dengue`, `measles`, `poliomyelitis`, `ear_problem`, `mumps`, `thyroid_disorder`, `mental_disorder_pers`, `typhoid_fever`, `hepatitis`, `anemia_leukemia`, `chest_pain`, `headaches`, `nausea_vomiting`, `insomnia`, `indigestion`, `sore_throat`, `difficult_breathing`, `joint_pains`, `swollen_feet`, `dizziness`, `weight_loss`, `frequent_urination`, `history_hosp`, `taking_meds`, `allergic`, `date_archived`, `services`, `campus`, `gender`, `contact_no`, `parent_guardian`, `firstname`, `lastname`, `middlename`) VALUES
(60, 771, 25, 'Bachelor Of Science Information Technology', '2000-12-01', 'Maligaya', 'single', 'gewoigjedo pgkjdrg', '', '', '', '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, '2025-12-02 09:41:25', NULL, 'Main Campus San Miguel', '', '', '', '', '', ''),
(71, 777, 23, 'BSIS', '2002-10-23', 'Maligaya', 'single', 'gewoigjedo pgkjdrg', '', '', '', '', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, '2025-12-25 15:07:49', NULL, 'Pagadian Annex Campus', 'Female', '09484858868', 'ROger  NB', '', '', '');

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

--
-- Table structure for table `treatment_records`
--

CREATE TABLE `treatment_records` (
  `id` int(11) NOT NULL,
  `record_id` int(11) DEFAULT NULL,
  `treatment_date` date DEFAULT NULL,
  `tooth_no` varchar(50) DEFAULT NULL,
  `operation` text DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  `dentist` varchar(255) DEFAULT NULL,
  `created_at` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `treatment_records`
--

INSERT INTO `treatment_records` (`id`, `record_id`, `treatment_date`, `tooth_no`, `operation`, `remarks`, `dentist`, `created_at`) VALUES
(50, 38, '2026-01-08', '18', 'O', 'done', 'Doctor KHARLOU C. TAGO M.D', '2026-04-12'),
(51, 38, '2026-01-08', '16', 'RF', 'done', 'Doctor KHARLOU C. TAGO M.D', '2026-04-12'),
(52, 39, '2026-04-12', '18', 'RF', 'done', 'Doctor KHARLOU C. TAGO M.D', '2026-04-12'),
(53, 40, '2026-04-12', '18', 'RF', 'done', 'Doctor KHARLOU C. TAGO M.D', '2026-04-12');

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

--
-- Table structure for table `treatment_recordss`
--

CREATE TABLE `treatment_recordss` (
  `id` int(11) NOT NULL,
  `patient_id` int(11) DEFAULT NULL,
  `treatment_date` date DEFAULT NULL,
  `symptoms` text DEFAULT NULL,
  `first_aid` text DEFAULT NULL,
  `medication` text DEFAULT NULL,
  `nurse_signature` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `treatment_recordss`
--

INSERT INTO `treatment_recordss` (`id`, `patient_id`, `treatment_date`, `symptoms`, `first_aid`, `medication`, `nurse_signature`) VALUES
(76, 782, '0000-00-00', '', '', '', '');

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

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

CREATE TABLE `users` (
  `user_id` int(11) NOT NULL,
  `username` varchar(50) DEFAULT NULL,
  `password_hash` varchar(255) DEFAULT NULL,
  `full_name` varchar(100) DEFAULT NULL,
  `role` enum('clinic in charge') DEFAULT NULL,
  `contact_number` varchar(20) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `date_created` timestamp NOT NULL DEFAULT current_timestamp(),
  `profile` varchar(255) NOT NULL,
  `campus` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`user_id`, `username`, `password_hash`, `full_name`, `role`, `contact_number`, `email`, `date_created`, `profile`, `campus`) VALUES
(9, 'admin', '$2y$10$94WosipCJFab.O4VNbtr8e4MSlmCfNqdhTP.es3YTJAJGiha4L7WG', 'No Names', 'clinic in charge', '09599595444', 'riobiala802@gmail.com', '2025-10-05 21:59:51', 'mabini-2.jpg', 'Pagadian Annex Campus');

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

--
-- Table structure for table `utilization_reports`
--

CREATE TABLE `utilization_reports` (
  `id` int(11) NOT NULL,
  `patient_name` varchar(255) NOT NULL,
  `patient_id` varchar(100) NOT NULL,
  `report_type` varchar(50) NOT NULL,
  `clinical_notes` text NOT NULL,
  `services_used` text DEFAULT NULL,
  `doctor_name` varchar(255) NOT NULL,
  `date_reported` date NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Structure for view `inventory_view`
--
DROP TABLE IF EXISTS `inventory_view`;

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `inventory_view`  AS SELECT `m`.`id` AS `id`, `m`.`medicine_name` AS `medicine_name`, `m`.`generic_name` AS `generic_name`, `m`.`brand_name` AS `brand_name`, `m`.`description` AS `description`, ifnull(sum(case when `s`.`type` = 'STOCK_IN' then `s`.`quantity` when `s`.`type` = 'STOCK_OUT' then -`s`.`quantity` end),0) AS `quantity` FROM (`medication_profiles` `m` left join `stock_history` `s` on(`s`.`medication_id` = `m`.`id`)) GROUP BY `m`.`id` ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `appointments`
--
ALTER TABLE `appointments`
  ADD PRIMARY KEY (`appointment_id`);

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

--
-- Indexes for table `consultations`
--
ALTER TABLE `consultations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_consult_patient` (`patient_id`);

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

--
-- Indexes for table `dental_record`
--
ALTER TABLE `dental_record`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

--
-- Indexes for table `doctor_comments`
--
ALTER TABLE `doctor_comments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

--
-- Indexes for table `doctor_consultations`
--
ALTER TABLE `doctor_consultations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_doctor_patient` (`patient_id`);

--
-- Indexes for table `family_history`
--
ALTER TABLE `family_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

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

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

--
-- Indexes for table `laboratory_results`
--
ALTER TABLE `laboratory_results`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

--
-- Indexes for table `medical_examination`
--
ALTER TABLE `medical_examination`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

--
-- Indexes for table `medical_questions`
--
ALTER TABLE `medical_questions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

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

--
-- Indexes for table `medicines`
--
ALTER TABLE `medicines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `consultation_id` (`consultation_id`);

--
-- Indexes for table `oral_health_treatments`
--
ALTER TABLE `oral_health_treatments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

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

--
-- Indexes for table `personal_history`
--
ALTER TABLE `personal_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

--
-- Indexes for table `prescriptions`
--
ALTER TABLE `prescriptions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `medicine_id` (`medicine_id`);

--
-- Indexes for table `present_illness`
--
ALTER TABLE `present_illness`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

--
-- Indexes for table `request_appointments`
--
ALTER TABLE `request_appointments`
  ADD PRIMARY KEY (`request_id`),
  ADD KEY `student_id` (`student_id`);

--
-- Indexes for table `stock_history`
--
ALTER TABLE `stock_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `medication_id` (`medication_id`);

--
-- Indexes for table `students`
--
ALTER TABLE `students`
  ADD PRIMARY KEY (`student_id`),
  ADD UNIQUE KEY `email` (`email`);

--
-- Indexes for table `student_archive`
--
ALTER TABLE `student_archive`
  ADD PRIMARY KEY (`archive_id`);

--
-- Indexes for table `treatment_records`
--
ALTER TABLE `treatment_records`
  ADD PRIMARY KEY (`id`),
  ADD KEY `record_id` (`record_id`);

--
-- Indexes for table `treatment_recordss`
--
ALTER TABLE `treatment_recordss`
  ADD PRIMARY KEY (`id`),
  ADD KEY `patient_id` (`patient_id`);

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

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

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `appointments`
--
ALTER TABLE `appointments`
  MODIFY `appointment_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `clinic_inventory`
--
ALTER TABLE `clinic_inventory`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=47;

--
-- AUTO_INCREMENT for table `consultations`
--
ALTER TABLE `consultations`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36;

--
-- AUTO_INCREMENT for table `consultationss`
--
ALTER TABLE `consultationss`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;

--
-- AUTO_INCREMENT for table `dental_record`
--
ALTER TABLE `dental_record`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;

--
-- AUTO_INCREMENT for table `doctor_comments`
--
ALTER TABLE `doctor_comments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=74;

--
-- AUTO_INCREMENT for table `doctor_consultations`
--
ALTER TABLE `doctor_consultations`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `family_history`
--
ALTER TABLE `family_history`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=78;

--
-- AUTO_INCREMENT for table `history_logs`
--
ALTER TABLE `history_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;

--
-- AUTO_INCREMENT for table `inventory_transactions`
--
ALTER TABLE `inventory_transactions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `laboratory_results`
--
ALTER TABLE `laboratory_results`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=74;

--
-- AUTO_INCREMENT for table `medical_examination`
--
ALTER TABLE `medical_examination`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=87;

--
-- AUTO_INCREMENT for table `medical_questions`
--
ALTER TABLE `medical_questions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=74;

--
-- AUTO_INCREMENT for table `medication_profiles`
--
ALTER TABLE `medication_profiles`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT for table `medicines`
--
ALTER TABLE `medicines`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `oral_health_treatments`
--
ALTER TABLE `oral_health_treatments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `patient_info`
--
ALTER TABLE `patient_info`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=785;

--
-- AUTO_INCREMENT for table `personal_history`
--
ALTER TABLE `personal_history`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=74;

--
-- AUTO_INCREMENT for table `prescriptions`
--
ALTER TABLE `prescriptions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=58;

--
-- AUTO_INCREMENT for table `present_illness`
--
ALTER TABLE `present_illness`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=74;

--
-- AUTO_INCREMENT for table `request_appointments`
--
ALTER TABLE `request_appointments`
  MODIFY `request_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=273;

--
-- AUTO_INCREMENT for table `stock_history`
--
ALTER TABLE `stock_history`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=74;

--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
  MODIFY `student_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;

--
-- AUTO_INCREMENT for table `student_archive`
--
ALTER TABLE `student_archive`
  MODIFY `archive_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=73;

--
-- AUTO_INCREMENT for table `treatment_records`
--
ALTER TABLE `treatment_records`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=54;

--
-- AUTO_INCREMENT for table `treatment_recordss`
--
ALTER TABLE `treatment_recordss`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=79;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `utilization_reports`
--
ALTER TABLE `utilization_reports`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `medicines`
--
ALTER TABLE `medicines`
  ADD CONSTRAINT `medicines_ibfk_1` FOREIGN KEY (`consultation_id`) REFERENCES `consultations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_history`
--
ALTER TABLE `stock_history`
  ADD CONSTRAINT `stock_history_ibfk_1` FOREIGN KEY (`medication_id`) REFERENCES `medication_profiles` (`id`);

--
-- Constraints for table `treatment_records`
--
ALTER TABLE `treatment_records`
  ADD CONSTRAINT `treatment_records_ibfk_1` FOREIGN KEY (`record_id`) REFERENCES `dental_record` (`id`);

--
-- Constraints for table `treatment_recordss`
--
ALTER TABLE `treatment_recordss`
  ADD CONSTRAINT `treatment_recordss_ibfk_1` FOREIGN KEY (`patient_id`) REFERENCES `patient_info` (`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 */;
