-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `medivault`
--

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

--
-- Table structure for table `access_requests`
--

CREATE TABLE `access_requests` (
  `id` int(11) NOT NULL,
  `doctor_email` varchar(255) NOT NULL,
  `patient_email` varchar(255) NOT NULL,
  `filename` varchar(255) NOT NULL,
  `cid` varchar(255) NOT NULL,
  `status` enum('pending','approved','revoked') DEFAULT 'pending',
  `request_date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `access_requests`
--

INSERT INTO `access_requests` (`id`, `doctor_email`, `patient_email`, `filename`, `cid`, `status`, `request_date`) VALUES
(1, 'dr.sarah@medivault.com', 'pavan.kumar@example.com', 'Kidney_Ultrasound.pdf', 'QmPavanKidney123', 'approved', '2026-01-28 19:55:20'),
(2, 'dr.sarah@medivault.com', 'mary.whitaker@example.com', 'ECG_Cardiac_Scan.pdf', 'QmMaryHeart012', 'pending', '2026-01-28 19:55:20'),
(3, 'mark.lab@citylab.com', 'john.brown@example.com', 'MRI_Knee_Scan.pdf', 'QmJohnKnee012', 'approved', '2026-01-28 19:55:20'),
(4, 'mark.lab@citylab.com', 'pavan.kumar@example.com', 'Blood_Work_Jan.pdf', 'QmPavanBlood456', 'approved', '2026-01-28 19:55:20'),
(5, 'mark.lab@citylab.com', 'tbh@gmail.com', 'Lab_Report.pdf', 'QmLabDefault', 'pending', '2026-02-02 09:06:45'),
(6, 'dr.sarah@medivault.com', 'thbkll@gmail.com', 'Basic_Record.pdf', 'QmDefaultRecord1234567890', 'pending', '2026-02-02 09:07:39'),
(7, 'dr.sarah@medivault.com', 'rtsv@.com', 'Basic_Record.pdf', 'QmDefaultRecord1234567890', 'pending', '2026-02-02 09:25:21'),
(8, 'mark.lab@citylab.com', 'pavan.kumar@example.com', 'Lab_Report.pdf', 'QmLabDefault', 'approved', '2026-02-02 09:26:00');

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

--
-- Table structure for table `doctor_profile`
--

CREATE TABLE `doctor_profile` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `specialization` varchar(255) DEFAULT NULL,
  `hospital` 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 `doctor_profile`
--

INSERT INTO `doctor_profile` (`id`, `name`, `email`, `phone`, `specialization`, `hospital`, `created_at`) VALUES
(1, 'Dr. Sarah Smith', 'dr.sarah@medivault.com', '6543210987', 'General Medicine', 'City General Hospital', '2026-01-28 19:55:20');

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

--
-- Table structure for table `ipfs_uploads`
--

CREATE TABLE `ipfs_uploads` (
  `id` int(11) NOT NULL,
  `email` varchar(255) NOT NULL,
  `filename` varchar(255) NOT NULL,
  `cid` varchar(255) NOT NULL,
  `file_hash` varchar(255) DEFAULT NULL,
  `uploaded_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `ipfs_uploads`
--

INSERT INTO `ipfs_uploads` (`id`, `email`, `filename`, `cid`, `file_hash`, `uploaded_at`) VALUES
(1, 'pavan.kumar@example.com', 'Kidney_Ultrasound.pdf', 'QmPavanKidney123', 'p1', '2026-01-28 19:55:20'),
(2, 'pavan.kumar@example.com', 'Blood_Work_Jan.pdf', 'QmPavanBlood456', 'p2', '2026-01-28 19:55:20'),
(3, 'pavan.kumar@example.com', 'Prescription_Flu.pdf', 'QmPavanFlu789', 'p3', '2026-01-28 19:55:20'),
(4, 'pavan.kumar@example.com', 'Dental_Xray_2025.pdf', 'QmPavanDental001', 'p4', '2026-01-28 19:55:20'),
(5, 'pavan.kumar@example.com', 'COVID_Vax_Cert.pdf', 'QmPavanVax999', 'p5', '2026-01-28 19:55:20'),
(6, 'pavan.kumar@example.com', 'Liver_Function_Test.pdf', 'QmPavanLiver222', 'p6', '2026-01-28 19:55:20'),
(7, 'mary.whitaker@example.com', 'HbA1c_Annual_Report.pdf', 'QmMaryDiabetes789', 'm1', '2026-01-28 19:55:20'),
(8, 'mary.whitaker@example.com', 'ECG_Cardiac_Scan.pdf', 'QmMaryHeart012', 'm2', '2026-01-28 19:55:20'),
(9, 'mary.whitaker@example.com', 'Eye_Exam_Results.pdf', 'QmMaryEye345', 'm3', '2026-01-28 19:55:20'),
(10, 'mary.whitaker@example.com', 'Mammogram_Screening.pdf', 'QmMaryMammo678', 'm4', '2026-01-28 19:55:20'),
(11, 'mary.whitaker@example.com', 'Thyroid_Panel_Test.pdf', 'QmMaryThyroid901', 'm5', '2026-01-28 19:55:20'),
(12, 'mary.whitaker@example.com', 'Bone_Density_Scan.pdf', 'QmMaryBone234', 'm6', '2026-01-28 19:55:20'),
(13, 'john.brown@example.com', 'MRI_Knee_Scan.pdf', 'QmJohnKnee012', 'j1', '2026-01-28 19:55:20'),
(14, 'john.brown@example.com', 'Asthma_Inhaler_Guide.pdf', 'QmJohnAsthma345', 'j2', '2026-01-28 19:55:20'),
(15, 'john.brown@example.com', 'Physical_Therapy_Logs.pdf', 'QmJohnPT678', 'j3', '2026-01-28 19:55:20'),
(16, 'john.brown@example.com', 'Chest_Xray_Report.pdf', 'QmJohnChest901', 'j4', '2026-01-28 19:55:20'),
(17, 'john.brown@example.com', 'Lipid_Profile_Check.pdf', 'QmJohnLipid234', 'j5', '2026-01-28 19:55:20'),
(18, 'john.brown@example.com', 'Allergy_Skin_Test.pdf', 'QmJohnAllergy567', 'j6', '2026-01-28 19:55:20'),
(19, 'dr.sarah@medivault.com', 'Medical_License_2026.pdf', 'QmSarahDocLicense', 'd1', '2026-01-28 19:55:20'),
(20, 'dr.sarah@medivault.com', 'Cardiology_Certification.pdf', 'QmSarahCert', 'd2', '2026-01-28 19:55:20'),
(21, 'mark.lab@citylab.com', 'Lab_Safety_Cert.pdf', 'QmMarkLabSafety', 'l1', '2026-01-28 19:55:20'),
(22, 'mark.lab@citylab.com', 'Technician_ID_Card.pdf', 'QmMarkID', 'l2', '2026-01-28 19:55:20'),
(23, 'mark.lab@citylab.com', 'Microscopy_Specialist_Cert.pdf', 'QmMarkMicro', 'l3', '2026-01-28 19:55:20'),
(24, 'mark.lab@citylab.com', 'Blood_Safety_Protocol.pdf', 'QmMarkBlood', 'l4', '2026-01-28 19:55:20');

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

--
-- Table structure for table `lab_profile`
--

CREATE TABLE `lab_profile` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `lab_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 `lab_profile`
--

INSERT INTO `lab_profile` (`id`, `name`, `email`, `phone`, `lab_name`, `created_at`) VALUES
(1, 'Mark Wilson', 'mark.lab@citylab.com', '5432109876', 'City Medical Lab', '2026-01-28 19:55:20');

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

--
-- Table structure for table `notifications`
--

CREATE TABLE `notifications` (
  `id` int(11) NOT NULL,
  `email` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `role` varchar(50) DEFAULT NULL,
  `is_read` tinyint(1) DEFAULT 0,
  `date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `notifications`
--

INSERT INTO `notifications` (`id`, `email`, `message`, `role`, `is_read`, `date`) VALUES
(1, 'pavan.kumar@example.com', 'Dr. Sarah Smith requested access to your Kidney_Ultrasound.pdf', 'patient', 0, '2026-01-28 19:55:20'),
(2, 'mary.whitaker@example.com', 'Welcome to MediVault! Your profile is ready.', 'patient', 0, '2026-01-28 19:55:20'),
(3, 'john.brown@example.com', 'Mark Wilson (Lab Tech) is now authorized to view your MRI.', 'patient', 0, '2026-01-28 19:55:20'),
(4, 'mark.lab@citylab.com', 'Your access request for Blood_Work_Jan.pdf has been approved.', 'doctor', 0, '2026-02-01 08:37:00'),
(5, 'tbh@gmail.com', 'Doctor mark.lab@citylab.com requested access to file: Lab_Report.pdf', 'patient', 0, '2026-02-02 09:06:45'),
(6, 'thbkll@gmail.com', 'Doctor dr.sarah@medivault.com requested access to file: Basic_Record.pdf', 'patient', 0, '2026-02-02 09:07:39'),
(7, 'rtsv@.com', 'Doctor dr.sarah@medivault.com requested access to file: Basic_Record.pdf', 'patient', 0, '2026-02-02 09:25:21'),
(8, 'pavan.kumar@example.com', 'Doctor mark.lab@citylab.com requested access to file: Lab_Report.pdf', 'patient', 0, '2026-02-02 09:26:00'),
(9, 'mark.lab@citylab.com', 'Your access request for Lab_Report.pdf has been approved.', 'doctor', 0, '2026-02-02 09:26:19'),
(10, 'mark.lab@citylab.com', 'Your access request for Lab_Report.pdf has been approved.', 'doctor', 0, '2026-02-02 09:26:25'),
(11, 'mark.lab@citylab.com', 'Your access request for Lab_Report.pdf has been approved.', 'doctor', 0, '2026-02-02 09:27:19'),
(12, 'mark.lab@citylab.com', 'Your access request for Lab_Report.pdf has been approved.', 'doctor', 0, '2026-02-02 09:27:20'),
(13, 'dr.sarah@medivault.com', 'Your access request for Kidney_Ultrasound.pdf has been approved.', 'doctor', 0, '2026-02-02 10:42:02'),
(14, 'dr.sarah@medivault.com', 'Your access request for Kidney_Ultrasound.pdf has been approved.', 'doctor', 0, '2026-02-02 10:42:03'),
(15, 'mark.lab@citylab.com', 'Your access request for Lab_Report.pdf has been approved.', 'doctor', 0, '2026-02-05 08:22:24');

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

--
-- Table structure for table `patient_profile`
--

CREATE TABLE `patient_profile` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `dob` date DEFAULT NULL,
  `gender` varchar(10) DEFAULT NULL,
  `blood_group` varchar(5) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `patient_profile`
--

INSERT INTO `patient_profile` (`id`, `name`, `email`, `phone`, `dob`, `gender`, `blood_group`, `address`, `created_at`) VALUES
(1, 'Pavan Kumar', 'pavan.kumar@example.com', '765432109335', '2000-01-01', 'Male', 'B+', '789 Pine Rd, Downtown', '2026-01-28 19:55:20'),
(2, 'Mary Whitaker', 'mary.whitaker@example.com', '9876543210', '1985-06-15', 'Female', 'O+', '123 Oak St, Springfield', '2026-01-28 19:55:20'),
(3, 'John Brown', 'john.brown@example.com', '8765432109', '1992-11-22', 'Male', 'A-', '456 Maple Ave, Riverside', '2026-01-28 19:55:20');

--
-- Indexes for dumped tables
--

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

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

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

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

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

