-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Waktu pembuatan: 27 Apr 2025 pada 16.57
-- Versi server: 8.0.28
-- Versi PHP: 8.1.10

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: `billing-rsabhk`
--

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

--
-- Struktur dari tabel `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint UNSIGNED NOT NULL,
  `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `migrations`
--

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

--
-- Dumping data untuk tabel `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_reset_tokens_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(5, '2025_04_25_105208_create_ms_pasien_table', 1),
(6, '2025_04_25_105726_create_ms_asuransi_table', 1),
(7, '2025_04_25_105818_create_ms_pegawai_table', 1),
(8, '2025_04_25_105951_create_ms_tindakan_table', 1),
(9, '2025_04_25_110230_create_ms_ruang_pelayanan_table', 1),
(10, '2025_04_25_110234_create_tr_registrasi_table', 1),
(11, '2025_04_25_110251_create_tr_transaksi_table', 1),
(12, '2025_04_27_152843_add_column_status_tr_registrasi', 2);

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

--
-- Struktur dari tabel `ms_asuransi`
--

CREATE TABLE `ms_asuransi` (
  `id_asuransi` bigint UNSIGNED NOT NULL,
  `nama_asuransi` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `ms_asuransi`
--

INSERT INTO `ms_asuransi` (`id_asuransi`, `nama_asuransi`, `created_at`, `updated_at`) VALUES
(1, 'BPJS Kesehatan', '2025-04-27 07:37:08', '2025-04-27 07:37:08'),
(2, 'BPJS Ketenagakerjaan', '2025-04-27 08:16:20', '2025-04-27 08:16:20');

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

--
-- Struktur dari tabel `ms_pasien`
--

CREATE TABLE `ms_pasien` (
  `mr_pasien` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nama_pasien` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tanggal_lahir` date NOT NULL,
  `jenis_kelamin` enum('L','P') COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `ms_pasien`
--

INSERT INTO `ms_pasien` (`mr_pasien`, `nama_pasien`, `tanggal_lahir`, `jenis_kelamin`, `created_at`, `updated_at`) VALUES
('00000001', 'Budi', '2002-02-11', 'L', '2025-04-27 07:36:59', '2025-04-27 07:36:59'),
('00000002', 'Berlian', '1999-09-09', 'P', '2025-04-27 08:14:49', '2025-04-27 08:14:49');

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

--
-- Struktur dari tabel `ms_pegawai`
--

CREATE TABLE `ms_pegawai` (
  `id_pegawai` bigint UNSIGNED NOT NULL,
  `nama_pegawai` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tanggal_lahir` date DEFAULT NULL,
  `jenis_kelamin` enum('L','P') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `posisi` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `ms_pegawai`
--

INSERT INTO `ms_pegawai` (`id_pegawai`, `nama_pegawai`, `tanggal_lahir`, `jenis_kelamin`, `posisi`, `created_at`, `updated_at`) VALUES
(1, 'dr. Andi', '1991-01-01', 'L', 'doctor', '2025-04-27 07:19:29', '2025-04-27 07:19:29');

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

--
-- Struktur dari tabel `ms_ruang_pelayanan`
--

CREATE TABLE `ms_ruang_pelayanan` (
  `id_ruang_pelayanan` bigint UNSIGNED NOT NULL,
  `nama_ruang_pelayanan` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `ms_ruang_pelayanan`
--

INSERT INTO `ms_ruang_pelayanan` (`id_ruang_pelayanan`, `nama_ruang_pelayanan`, `created_at`, `updated_at`) VALUES
(1, 'Poli Penyakit Dalam', '2025-04-27 07:18:49', '2025-04-27 07:18:49');

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

--
-- Struktur dari tabel `ms_tindakan`
--

CREATE TABLE `ms_tindakan` (
  `id_tindakan` bigint UNSIGNED NOT NULL,
  `nama_tindakan` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tarif` decimal(15,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `ms_tindakan`
--

INSERT INTO `ms_tindakan` (`id_tindakan`, `nama_tindakan`, `tarif`, `created_at`, `updated_at`) VALUES
(1, 'Konsultasi', 100000.00, '2025-04-27 07:19:01', '2025-04-27 07:19:01');

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

--
-- Struktur dari tabel `password_reset_tokens`
--

CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `personal_access_tokens`
--

CREATE TABLE `personal_access_tokens` (
  `id` bigint UNSIGNED NOT NULL,
  `tokenable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tokenable_id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `abilities` text COLLATE utf8mb4_unicode_ci,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `tr_registrasi`
--

CREATE TABLE `tr_registrasi` (
  `id_registrasi` bigint UNSIGNED NOT NULL,
  `mr_pasien` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `id_asuransi` bigint UNSIGNED NOT NULL,
  `no_asuransi` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `id_ruang_pelayanan` bigint UNSIGNED NOT NULL,
  `id_pegawai` bigint UNSIGNED NOT NULL,
  `tanggal_registrasi` date NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `tr_registrasi`
--

INSERT INTO `tr_registrasi` (`id_registrasi`, `mr_pasien`, `id_asuransi`, `no_asuransi`, `id_ruang_pelayanan`, `id_pegawai`, `tanggal_registrasi`, `status`, `created_at`, `updated_at`) VALUES
(3, '00000002', 1, '009812731', 1, 1, '2002-09-22', 'active', '2025-04-27 08:23:37', '2025-04-27 08:23:37'),
(4, '00000001', 1, '09876543', 1, 1, '2025-04-27', 'active', '2025-04-27 08:27:19', '2025-04-27 08:27:19');

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

--
-- Struktur dari tabel `tr_transaksi`
--

CREATE TABLE `tr_transaksi` (
  `id_transaksi` bigint UNSIGNED NOT NULL,
  `id_registrasi` bigint UNSIGNED NOT NULL,
  `id_tindakan` bigint UNSIGNED NOT NULL,
  `jumlah_tindakan` int NOT NULL,
  `id_pegawai` bigint UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `tr_transaksi`
--

INSERT INTO `tr_transaksi` (`id_transaksi`, `id_registrasi`, `id_tindakan`, `jumlah_tindakan`, `id_pegawai`, `created_at`, `updated_at`) VALUES
(1, 3, 1, 1, 1, '2025-04-27 09:06:45', '2025-04-27 09:06:45'),
(2, 3, 1, 2, 1, '2025-04-27 09:38:57', '2025-04-27 09:38:57');

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

--
-- Struktur dari tabel `users`
--

CREATE TABLE `users` (
  `id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `role` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'manajemen',
  `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `users`
--

INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `role`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Admin', 'admin@example.com', '2025-04-27 05:12:46', '$2y$12$UT9ld.cBtWMCwJzx0orG5.8DK0N.a64eNeGQJFMZLNqDnKKKLDLBy', 'admin', 'kanmKOrO63enLOynN8apBCgljoCDLZSPYMnJwQj73KtcZ1VTtia4lFhn468C', '2025-04-27 05:12:47', '2025-04-27 05:12:47'),
(2, 'Manager', 'manager@example.com', '2025-04-27 05:12:47', '$2y$12$I6DJV6BalmuKAT3QlJR0Se20YVKYN618hhokDIIHixUa78aIO06pC', 'manajemen', 'qhfshikpfwFygJ43ULA0ASDsuoSNDm0FshekY1WrmIAL74dGSrxWseEB8Z8b', '2025-04-27 05:12:47', '2025-04-27 05:12:47');

--
-- Indexes for dumped tables
--

--
-- Indeks untuk tabel `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indeks untuk tabel `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `ms_asuransi`
--
ALTER TABLE `ms_asuransi`
  ADD PRIMARY KEY (`id_asuransi`);

--
-- Indeks untuk tabel `ms_pasien`
--
ALTER TABLE `ms_pasien`
  ADD PRIMARY KEY (`mr_pasien`);

--
-- Indeks untuk tabel `ms_pegawai`
--
ALTER TABLE `ms_pegawai`
  ADD PRIMARY KEY (`id_pegawai`);

--
-- Indeks untuk tabel `ms_ruang_pelayanan`
--
ALTER TABLE `ms_ruang_pelayanan`
  ADD PRIMARY KEY (`id_ruang_pelayanan`);

--
-- Indeks untuk tabel `ms_tindakan`
--
ALTER TABLE `ms_tindakan`
  ADD PRIMARY KEY (`id_tindakan`);

--
-- Indeks untuk tabel `password_reset_tokens`
--
ALTER TABLE `password_reset_tokens`
  ADD PRIMARY KEY (`email`);

--
-- Indeks untuk tabel `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);

--
-- Indeks untuk tabel `tr_registrasi`
--
ALTER TABLE `tr_registrasi`
  ADD PRIMARY KEY (`id_registrasi`),
  ADD KEY `tr_registrasi_mr_pasien_foreign` (`mr_pasien`),
  ADD KEY `tr_registrasi_id_asuransi_foreign` (`id_asuransi`),
  ADD KEY `tr_registrasi_id_ruang_pelayanan_foreign` (`id_ruang_pelayanan`),
  ADD KEY `tr_registrasi_id_pegawai_foreign` (`id_pegawai`);

--
-- Indeks untuk tabel `tr_transaksi`
--
ALTER TABLE `tr_transaksi`
  ADD PRIMARY KEY (`id_transaksi`),
  ADD KEY `tr_transaksi_id_registrasi_foreign` (`id_registrasi`),
  ADD KEY `tr_transaksi_id_tindakan_foreign` (`id_tindakan`),
  ADD KEY `tr_transaksi_id_pegawai_foreign` (`id_pegawai`);

--
-- Indeks untuk tabel `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_email_unique` (`email`);

--
-- AUTO_INCREMENT untuk tabel yang dibuang
--

--
-- AUTO_INCREMENT untuk tabel `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT untuk tabel `ms_asuransi`
--
ALTER TABLE `ms_asuransi`
  MODIFY `id_asuransi` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT untuk tabel `ms_pegawai`
--
ALTER TABLE `ms_pegawai`
  MODIFY `id_pegawai` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT untuk tabel `ms_ruang_pelayanan`
--
ALTER TABLE `ms_ruang_pelayanan`
  MODIFY `id_ruang_pelayanan` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT untuk tabel `ms_tindakan`
--
ALTER TABLE `ms_tindakan`
  MODIFY `id_tindakan` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT untuk tabel `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT untuk tabel `tr_registrasi`
--
ALTER TABLE `tr_registrasi`
  MODIFY `id_registrasi` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT untuk tabel `tr_transaksi`
--
ALTER TABLE `tr_transaksi`
  MODIFY `id_transaksi` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT untuk tabel `users`
--
ALTER TABLE `users`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables)
--

--
-- Ketidakleluasaan untuk tabel `tr_registrasi`
--
ALTER TABLE `tr_registrasi`
  ADD CONSTRAINT `tr_registrasi_id_asuransi_foreign` FOREIGN KEY (`id_asuransi`) REFERENCES `ms_asuransi` (`id_asuransi`) ON DELETE CASCADE,
  ADD CONSTRAINT `tr_registrasi_id_pegawai_foreign` FOREIGN KEY (`id_pegawai`) REFERENCES `ms_pegawai` (`id_pegawai`) ON DELETE CASCADE,
  ADD CONSTRAINT `tr_registrasi_id_ruang_pelayanan_foreign` FOREIGN KEY (`id_ruang_pelayanan`) REFERENCES `ms_ruang_pelayanan` (`id_ruang_pelayanan`) ON DELETE CASCADE,
  ADD CONSTRAINT `tr_registrasi_mr_pasien_foreign` FOREIGN KEY (`mr_pasien`) REFERENCES `ms_pasien` (`mr_pasien`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `tr_transaksi`
--
ALTER TABLE `tr_transaksi`
  ADD CONSTRAINT `tr_transaksi_id_pegawai_foreign` FOREIGN KEY (`id_pegawai`) REFERENCES `ms_pegawai` (`id_pegawai`) ON DELETE CASCADE,
  ADD CONSTRAINT `tr_transaksi_id_registrasi_foreign` FOREIGN KEY (`id_registrasi`) REFERENCES `tr_registrasi` (`id_registrasi`) ON DELETE CASCADE,
  ADD CONSTRAINT `tr_transaksi_id_tindakan_foreign` FOREIGN KEY (`id_tindakan`) REFERENCES `ms_tindakan` (`id_tindakan`) 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 */;
