TIF_Nganjuk_E41220879/README.md

214 lines
5.6 KiB
Markdown

# MedData — Sistem Pendataan Obat Puskesmas
Aplikasi web untuk pencatatan, pengelolaan, dan monitoring obat di Puskesmas. Dilengkapi dengan manajemen resep, laporan, monitoring kadaluarsa, dan dashboard interaktif.
![Laravel](https://img.shields.io/badge/Laravel-12-red?logo=laravel)
![PHP](https://img.shields.io/badge/PHP-8.2+-blue?logo=php)
![MySQL](https://img.shields.io/badge/MySQL-8.0+-orange?logo=mysql)
![Tests](https://img.shields.io/badge/Tests-159%20passed-brightgreen?logo=phpunit)
---
## 📋 Fitur Utama
### 🏠 Dashboard
- Statistik: total jenis obat, obat masuk/keluar bulan ini, obat mendekati kadaluarsa
- Grafik tren harian obat masuk vs keluar (filter per bulan/tahun)
- Pie chart distribusi obat masuk (top 5)
- Notifikasi real-time obat mendekati kadaluarsa
### 📥 Obat Masuk
- CRUD lengkap data penerimaan obat
- Field: nama obat, kode batch, kategori, satuan, supplier, stok, harga, tanggal penerimaan & kadaluarsa
- Search dan filter status stok (tersedia/habis)
- Chart distribusi obat per bulan
### 📤 Obat Keluar
- Pencatatan pengeluaran obat terhubung ke data obat masuk
- Pemotongan stok otomatis saat pengeluaran, pemulihan saat dihapus
- Validasi stok tidak boleh melebihi yang tersedia
- Filter berdasarkan status, tujuan pemakaian, barcode
### 📝 Resep
- Pembuatan resep oleh Dokter (multi-item per resep)
- Stok obat otomatis berkurang saat resep dibuat
- Alur status: `proses``selesai` / `dibatalkan` (dikonfirmasi Apoteker)
- Update status resep sekaligus memperbarui status Obat Keluar terkait
- No. resep otomatis: `RSP-YYYYMMDD-NNNN`
### ⏰ Monitoring Kadaluarsa
- Tampilan obat yang sudah/mendekati kadaluarsa (≤ 60 hari)
- Filter: Semua, Sudah Kadaluarsa, Awas (≤ 30 hari), Waspada (≤ 60 hari)
- Badge status berwarna (Aman / Waspada / Awas)
### 📊 Laporan
- Laporan obat masuk dan keluar
- Filter berdasarkan jenis dan rentang tanggal
- Export ke **PDF** (DomPDF) dan **Excel** (Maatwebsite)
### 🗂️ Master Data
- Manajemen Kategori Obat
- Manajemen Satuan Obat
### 👤 Profil
- Update profil: nama, email, NIP, gender, nomor telepon, divisi, jabatan, alamat
- Ubah password
- Upload foto profil
---
## 🔐 Sistem Peran (Role)
| Role | Akses |
|------|-------|
| **Dokter** | Buat/edit/hapus Resep |
| **Apoteker** | Obat Masuk, Obat Keluar, konfirmasi status Resep, Laporan, Master Data |
| **Semua** | Dashboard, Monitoring Kadaluarsa, lihat Resep, Profil |
---
## 🛠️ Tech Stack
| Komponen | Teknologi |
|----------|-----------|
| Backend | Laravel 12, PHP 8.2+ |
| Frontend | Blade Templates, Tailwind CSS v4, Alpine.js |
| Grafik | Chart.js |
| Database | MySQL 8.0+ |
| Export | DomPDF, Maatwebsite Excel |
| Testing | PHPUnit (159 tests) |
---
## ⚙️ Instalasi
### Prasyarat
- PHP ≥ 8.2
- Composer
- Node.js ≥ 18
- MySQL ≥ 8.0
### Langkah Instalasi
```bash
# 1. Clone repository
git clone <repository-url>
cd pencatatanobat
# 2. Install dependencies
composer install
npm install
# 3. Konfigurasi environment
cp .env.example .env
php artisan key:generate
```
**4. Konfigurasi database di `.env`:**
```env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=pencatatanobat
DB_USERNAME=root
DB_PASSWORD=
```
```bash
# 5. Migrasi & seeder
php artisan migrate --seed
# 6. Build assets
npm run build
# 7. Jalankan server
php artisan serve
```
Akses aplikasi di `http://127.0.0.1:8000`
---
## 🔑 Akun Default
| Email | Password | Role |
|-------|----------|------|
| `dokter@dokter.com` | `password` | Dokter |
| `admin@admin.com` | `password` | Apoteker |
| `superadmin@meddata.com` | `password` | Superadmin |
---
## 🧪 Testing
Aplikasi memiliki **159 test** (unit + feature) yang mencakup semua controller dan model utama.
```bash
# Jalankan semua test
php artisan test
# Hanya unit test
php artisan test --testsuite=Unit
# Hanya feature test
php artisan test --testsuite=Feature
```
> **Catatan:** Test menggunakan SQLite in-memory via custom `DatabaseTestCase` untuk menghindari konflik dengan migrasi MySQL-specific.
---
## 📁 Struktur Direktori
```
pencatatanobat/
├── app/
│ ├── Exports/ # Export Excel (Maatwebsite)
│ ├── Http/
│ │ ├── Controllers/ # DashboardController, ObatMasuk, ObatKeluar,
│ │ │ # Resep, Kadaluarsa, Laporan, Kategori, Satuan
│ │ └── Middleware/
│ │ └── CheckRole.php # Middleware role-based access
│ └── Models/ # User, ObatMasuk, ObatKeluar, Resep,
│ # ResepItem, Kategori, Satuan
├── database/
│ ├── migrations/ # Migrasi MySQL
│ ├── migrations/safe/ # Migrasi SQLite-compatible (untuk testing)
│ └── seeders/
├── resources/views/
│ ├── dashboard/
│ ├── obat-masuk/
│ ├── obat-keluar/
│ ├── resep/
│ ├── kadaluarsa/
│ ├── laporan/
│ ├── kategori/
│ ├── satuan/
│ └── layouts/
├── routes/
│ └── web.php
└── tests/
├── DatabaseTestCase.php # Base class dengan SQLite-compatible schema
├── Unit/ # Model unit tests
└── Feature/ # Controller feature tests
```
---
## 🎨 Skema Warna
| Komponen | Hex |
|----------|-----|
| Sidebar | `#4A538F` |
| Background Konten | `#F4F6FF` |
| Teks Utama | `#2F347A` |
| Badge Aman | `#1F9254` |
| Badge Waspada | `#B78103` |
| Badge Awas | `#C0392B` |
---
## 📝 Lisensi
Proyek ini dikembangkan untuk keperluan internal Puskesmas Doko.