Mini Kabibi Habibi

Current Path : C:/Users/ITO/Downloads/
Upload File :
Current File : C:/Users/ITO/Downloads/clinic (1).sql

-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 03, 2025 at 08:50 AM
-- Server version: 10.4.28-MariaDB
-- PHP Version: 8.2.4

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

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

--
-- Table structure for table `health_records`
--

CREATE TABLE `health_records` (
  `id` int(11) NOT NULL,
  `log_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `chief_complaint` text DEFAULT NULL,
  `findings_bp` varchar(10) DEFAULT NULL,
  `findings_cr` varchar(10) DEFAULT NULL,
  `findings_rr` varchar(10) DEFAULT NULL,
  `findings_o2sat` varchar(10) DEFAULT NULL,
  `findings_temp` varchar(10) DEFAULT NULL,
  `physical_examination` text NOT NULL,
  `diagnosis` text NOT NULL,
  `treatment` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `logs`
--

CREATE TABLE `logs` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `log_date` date NOT NULL,
  `patient_name` varchar(100) DEFAULT NULL,
  `client_type` varchar(50) NOT NULL,
  `school` varchar(100) DEFAULT NULL,
  `age` varchar(10) DEFAULT NULL,
  `sex` varchar(10) NOT NULL,
  `address` varchar(255) DEFAULT NULL,
  `contact_number` varchar(20) DEFAULT NULL,
  `signature` text DEFAULT NULL,
  `attended_by` 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 `medical_supplies`
--

CREATE TABLE `medical_supplies` (
  `id` int(11) NOT NULL,
  `item` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `unit` varchar(50) NOT NULL,
  `date_received` date NOT NULL,
  `expiration_date` date NOT NULL,
  `quantity` int(11) NOT NULL,
  `issued` int(11) DEFAULT 0,
  `balance` int(11) GENERATED ALWAYS AS (`quantity` - `issued`) STORED
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `medical_supplies`
--

INSERT INTO `medical_supplies` (`id`, `item`, `description`, `unit`, `date_received`, `expiration_date`, `quantity`, `issued`) VALUES
(1, 'Paracetamol', 'Pain Reliver', 'pcs', '2025-09-04', '2025-11-03', 100, 30),
(2, 'Biogesic', 'Pain Reliver', 'Box', '2025-10-02', '2025-10-02', 3, 3),
(3, 'Biogesic', 'Pain Reliver', 'Box', '2025-09-02', '2025-10-02', 1, 0),
(4, 'Biogesic', 'Pain Reliver', 'pcs', '2025-09-02', '2025-10-02', 1, 0),
(5, 'Amlodipine', '5mg', 'Box', '2025-10-03', '2025-12-03', 2, 2),
(6, 'Losartan', '50mg', 'Box', '2025-10-03', '2025-12-30', 3, 0),
(7, 'Losartan', '80mg', 'box', '2025-10-03', '2026-01-03', 2, 0),
(8, 'Mefenamic Acid', '500mg', 'pcs', '2025-10-03', '2025-11-01', 1, 0);

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

--
-- Table structure for table `supply_issuance`
--

CREATE TABLE `supply_issuance` (
  `id` int(11) NOT NULL,
  `date` date NOT NULL,
  `patient_name` varchar(255) NOT NULL,
  `age` int(11) NOT NULL,
  `school` varchar(255) NOT NULL,
  `supply_name` varchar(255) NOT NULL,
  `quantity` int(11) NOT NULL,
  `released_by` varchar(255) NOT NULL,
  `received_by` varchar(255) NOT NULL,
  `remarks` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `supply_issuance`
--

INSERT INTO `supply_issuance` (`id`, `date`, `patient_name`, `age`, `school`, `supply_name`, `quantity`, `released_by`, `received_by`, `remarks`) VALUES
(11, '2025-10-03', 'Maria Magdalena Go', 50, 'Sample', 'Amlodipine', 2, 'Juan Dela Cruz', 'Juana Dela Cruz', ''),
(12, '2025-10-03', 'Dandy G. Ebora', 55, 'SDO', 'Paracetamol', 10, 'Nurse June', 'Dandy G. Ebora', 'Issued'),
(15, '2025-10-03', 'Dandy G. Ebora', 50, 'SDO', 'Biogesic', 3, 'Nurse June', 'Dandy G. Ebora', '');

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

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

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `functional_division` varchar(100) NOT NULL,
  `unit_or_section` varchar(100) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `role` enum('admin','user') NOT NULL DEFAULT 'user',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `users` (`id`, `functional_division`, `unit_or_section`, `username`, `password`, `role`, `created_at`) VALUES
(1, 'SGOD', 'HNU', 'admin', '$2y$10$oR/udxLlmYiHv2nDXwekQetE73PtqtY.Cu59/iC3hcS3/ErtVLwK2', 'admin', '2025-09-15 06:29:25'),
(2, 'Personnel', 'Personnel', 'client', '$2y$10$0cXfV7U2fYm3zgRFB9DgiOmAFOpWPSWERfprnoe9.jHGD./10jXHG', 'user', '2025-09-15 06:33:32');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `health_records`
--
ALTER TABLE `health_records`
  ADD PRIMARY KEY (`id`),
  ADD KEY `log_id` (`log_id`);

--
-- Indexes for table `logs`
--
ALTER TABLE `logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

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

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `health_records`
--
ALTER TABLE `health_records`
  ADD CONSTRAINT `health_records_ibfk_1` FOREIGN KEY (`log_id`) REFERENCES `logs` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `logs`
--
ALTER TABLE `logs`
  ADD CONSTRAINT `logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
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 */;