-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 25, 2026 at 08:57 PM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12

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

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

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

CREATE TABLE `appointments` (
  `AppointmentId` int(11) NOT NULL,
  `PatientId` int(11) DEFAULT NULL,
  `DoctorId` int(11) DEFAULT NULL,
  `appointmentDate` date NOT NULL,
  `status` varchar(20) DEFAULT 'Pending',
  `prescription` varchar(255) DEFAULT '',
  `consultationFee` int(11) DEFAULT 0,
  `medicationFee` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `appointments`
--

INSERT INTO `appointments` (`AppointmentId`, `PatientId`, `DoctorId`, `appointmentDate`, `status`, `prescription`, `consultationFee`, `medicationFee`) VALUES
(1, 1, 1, '2026-05-24', 'Pending', '', 0, 0),
(2, 2, 1, '2026-05-24', 'Pending', '', 0, 0),
(3, 1, 3, '2026-05-25', 'Pending', 'Amoxicillin', 100, 200),
(4, 3, 3, '2026-05-25', 'Pending', 'pracetamol', 250, 1000),
(5, 4, 4, '2026-05-25', 'Pending', 'confliry', 200, 300);

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

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

CREATE TABLE `doctors` (
  `DoctorId` int(11) NOT NULL,
  `doctorName` varchar(100) NOT NULL,
  `specialization` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `doctors`
--

INSERT INTO `doctors` (`DoctorId`, `doctorName`, `specialization`, `email`) VALUES
(1, 'Dr.joselyne ISUBI', 'pediatricitic', 'joselyne@gmail.com'),
(3, 'UWASE Amma', 'pediatrice', 'uwase@gmail.com'),
(4, 'Dr.Will', 'Cardiological', 'will@gmail.com');

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

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

CREATE TABLE `patients` (
  `PatientId` int(11) NOT NULL,
  `patientName` varchar(100) NOT NULL,
  `age` int(11) NOT NULL,
  `gender` varchar(10) NOT NULL,
  `phoneNumber` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `patients`
--

INSERT INTO `patients` (`PatientId`, `patientName`, `age`, `gender`, `phoneNumber`) VALUES
(1, 'mwiza', 12, 'Female', '0797774323'),
(2, 'Queen', 15, 'Female', '0793345454'),
(3, 'robert', 29, 'Male', '0799343445'),
(4, 'emmima', 21, 'Female', '0783434844');

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

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

CREATE TABLE `users` (
  `UserId` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `role` varchar(20) DEFAULT 'Receptionist'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `users` (`UserId`, `username`, `password`, `role`) VALUES
(1, 'gg', '$2b$10$sRy1CQALqqwkSfcq0Kdzkeb118yQXmxS97is9nUPePnqlwfpb.JOq', 'Admin'),
(2, 'joselyne', '$2b$10$B5aALeWOQUoeurziIUOgA.9.A77Sp/HtxcSOT.988z02W9BW768fq', 'Doctor'),
(3, 'sill', '$2b$10$z7/QR6DgD2YK.CB8KI7ck.KcXM3MZOQsrmy9H/KVIcHhPgVrVgEja', 'Receptionist'),
(4, 'hirwa', '$2b$10$Nq4qyB5IynQKrpd7EPi.k.lCPl4VvUSdWtoP1rf5ync60Ko.leyzO', 'Admin'),
(5, 'murerwa', '$2b$10$0bIpwOYv0oqy8DTOmi9N0eJSNBf7MmQ5ev42.8BdKmBXmDQTRtllK', 'Doctor'),
(6, 'promece', '$2b$10$wlENDTlLeZiSvdgQTlptTO3JYM8tSohbUyufcf7L6XwLJtgc4gIVm', 'Receptionist'),
(7, 'nigihe', '$2b$10$aOktqltiyMnh/9yNolc1IecbMoRqRDIwLURelv7SkjifzJ.Qmc44m', 'Admin');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `appointments`
--
ALTER TABLE `appointments`
  ADD PRIMARY KEY (`AppointmentId`),
  ADD KEY `PatientId` (`PatientId`),
  ADD KEY `DoctorId` (`DoctorId`);

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

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

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

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `appointments`
--
ALTER TABLE `appointments`
  MODIFY `AppointmentId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `doctors`
--
ALTER TABLE `doctors`
  MODIFY `DoctorId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `patients`
--
ALTER TABLE `patients`
  MODIFY `PatientId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `appointments`
--
ALTER TABLE `appointments`
  ADD CONSTRAINT `appointments_ibfk_1` FOREIGN KEY (`PatientId`) REFERENCES `patients` (`PatientId`) ON DELETE CASCADE,
  ADD CONSTRAINT `appointments_ibfk_2` FOREIGN KEY (`DoctorId`) REFERENCES `doctors` (`DoctorId`) 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 */;
