diff --git a/app/Http/Controllers/DocumentTypeController.php b/app/Http/Controllers/DocumentTypeController.php deleted file mode 100644 index e883833..0000000 --- a/app/Http/Controllers/DocumentTypeController.php +++ /dev/null @@ -1,61 +0,0 @@ -validate([ - 'name' => 'required|string|max:255', - ]); - - DocumentType::create($request->all()); - - return redirect()->route('doc-types-management.index') - ->with('success', 'Jenis surat berhasil ditambahkan.'); - } - - /** - * Update the specified resource in storage. - */ - public function update(Request $request, $id) - { - $request->validate([ - 'name' => 'required|string|max:255', - ]); - - $documentType = DocumentType::findOrFail($id); - $documentType->update($request->all()); - - return redirect()->route('doc-types-management.index') - ->with('success', 'Jenis surat berhasil diperbarui.'); - } - - /** - * Remove the specified resource from storage. - */ - public function destroy($id) - { - $documentType = DocumentType::findOrFail($id); - $documentType->delete(); - - return redirect()->route('doc-types-management.index') - ->with('success', 'Jenis surat berhasil dihapus.'); - } -} diff --git a/app/Http/Controllers/InsuranceController.php b/app/Http/Controllers/InsuranceController.php new file mode 100644 index 0000000..6da30ac --- /dev/null +++ b/app/Http/Controllers/InsuranceController.php @@ -0,0 +1,61 @@ +validate([ + 'name' => 'required|string|max:255', + ]); + + Insurance::create($request->all()); + + return redirect()->route('insurance.index') + ->with('success', 'Jenis Asuransi berhasil ditambahkan.'); + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, $id) + { + $request->validate([ + 'name' => 'required|string|max:255', + ]); + + $insurance = insurance::findOrFail($id); + $insurance->update($request->all()); + + return redirect()->route('insurance.index') + ->with('success', 'Jenis Asuransi berhasil diperbarui.'); + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + $insurance = insurance::findOrFail($id); + $insurance->delete(); + + return redirect()->route('insurance.index') + ->with('success', 'Jenis Asuransi berhasil dihapus.'); + } +} diff --git a/app/Http/Controllers/PatienRegistrationController.php b/app/Http/Controllers/PatienRegistrationController.php new file mode 100644 index 0000000..48c856c --- /dev/null +++ b/app/Http/Controllers/PatienRegistrationController.php @@ -0,0 +1,10 @@ + - */ - - protected $table = "document_types"; + protected $table = "insurances"; protected $guarded = ["id"]; } diff --git a/app/Models/PatienRegistration.php b/app/Models/PatienRegistration.php new file mode 100644 index 0000000..99de599 --- /dev/null +++ b/app/Models/PatienRegistration.php @@ -0,0 +1,12 @@ +id(); + + // Personal Information + $table->string('identity_number', 16)->unique(); // (NIK) + $table->string('medical_record_number', 16)->unique(); // (No. Rekam Medis) + $table->string('first_name'); + $table->string('last_name'); + $table->date('birth_date'); + $table->enum('gender', ['P', 'L']); // (Laki-laki, Perempuan) + $table->string('phone_number', 15); + $table->string('email'); + $table->string('address'); + + // Medical Information + $table->string('blood_type', 10); // (Golongan Darah) + $table->string('allergies'); + $table->string('current_medicines'); + $table->text('medical_history'); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('patients'); + } +}; diff --git a/database/migrations/2025_04_27_015126_create_insurances_table.php b/database/migrations/2025_04_27_015126_create_insurances_table.php new file mode 100644 index 0000000..233ef21 --- /dev/null +++ b/database/migrations/2025_04_27_015126_create_insurances_table.php @@ -0,0 +1,29 @@ +id(); + $table->string('name', 100); // (BPJS, Asuransi Swasta, dll) + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('insurances'); + } +}; diff --git a/database/migrations/2025_04_27_015147_create_service_rooms_table.php b/database/migrations/2025_04_27_015147_create_service_rooms_table.php new file mode 100644 index 0000000..4e00fba --- /dev/null +++ b/database/migrations/2025_04_27_015147_create_service_rooms_table.php @@ -0,0 +1,29 @@ +id(); + $table->string('name', 100)->unique(); // (Laboratorium, Radiologi, Ruang Operasi, Ruang Rawat Inap, UGD, IGD) + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('service_rooms'); + } +}; diff --git a/database/migrations/2025_04_27_015157_create_patien_registrations_table.php b/database/migrations/2025_04_27_015157_create_patien_registrations_table.php new file mode 100644 index 0000000..bffa9ed --- /dev/null +++ b/database/migrations/2025_04_27_015157_create_patien_registrations_table.php @@ -0,0 +1,41 @@ +id(); + $table->date('registration_date'); + $table->string('insurance_number', 20)->unique(); // (No. Asuransi) + $table->string('responsible_person_name'); + $table->string('responsible_person_phone', 15); + $table->string('responsible_email'); + $table->string('responsible_person_relationship'); // (Hubungan dengan Pasien) + $table->string('responsible_person_address'); + + // Foreign keys + $table->foreignId('patient_id')->constrained('patients')->onDelete('cascade'); + $table->foreignId('insurance_id')->constrained('insurances')->onDelete('cascade'); + $table->foreignId('service_room_id')->constrained('service_rooms')->onDelete('cascade'); + $table->foreignId('user_id')->constrained('users')->onDelete('cascade'); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('patien_registrations'); + } +}; diff --git a/database/migrations/2024_10_15_003346_create_document_types_table.php b/database/migrations/2025_04_27_015212_create_treatments_table.php similarity index 75% rename from database/migrations/2024_10_15_003346_create_document_types_table.php rename to database/migrations/2025_04_27_015212_create_treatments_table.php index a24539a..3754931 100644 --- a/database/migrations/2024_10_15_003346_create_document_types_table.php +++ b/database/migrations/2025_04_27_015212_create_treatments_table.php @@ -11,11 +11,12 @@ return new class extends Migration */ public function up(): void { - Schema::create('document_types', function (Blueprint $table) { + Schema::create('treatments', function (Blueprint $table) { $table->id(); $table->string('name'); - $table->softDeletes(); + $table->integer('fee')->default(0); $table->timestamps(); + $table->softDeletes(); }); } @@ -24,6 +25,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('document_types'); + Schema::dropIfExists('treatments'); } }; diff --git a/database/migrations/2025_04_27_015218_create_transactions_table.php b/database/migrations/2025_04_27_015218_create_transactions_table.php new file mode 100644 index 0000000..26a5108 --- /dev/null +++ b/database/migrations/2025_04_27_015218_create_transactions_table.php @@ -0,0 +1,32 @@ +id(); + $table->integer('amount')->default(0); + $table->foreignId('treatment_id')->constrained('treatments')->onDelete('cascade'); + $table->foreignId('patien_registration_id')->constrained('patien_registrations')->onDelete('cascade'); + $table->foreignId('user_id')->constrained('users')->onDelete('cascade'); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('transactions'); + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index fbf2564..5a0e555 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -14,7 +14,6 @@ class DatabaseSeeder extends Seeder { $this->call([ AdminSeeder::class, - DocumentTypeSeeder::class, ]); } } diff --git a/database/seeders/DocumentTypeSeeder.php b/database/seeders/DocumentTypeSeeder.php deleted file mode 100644 index a0318ea..0000000 --- a/database/seeders/DocumentTypeSeeder.php +++ /dev/null @@ -1,27 +0,0 @@ - 'Surat Biasa'], - ['name' => 'Surat Rahasia'], - ['name' => 'Surat Izin'], - ['name' => 'Surat Keputusan'], - ]; - - foreach ($documentTypes as $documentType) { - DocumentType::create($documentType); - } - } -} diff --git a/resources/views/doc-types-management/index.blade.php b/resources/views/insurance/index.blade.php similarity index 81% rename from resources/views/doc-types-management/index.blade.php rename to resources/views/insurance/index.blade.php index 9070981..0761bbf 100644 --- a/resources/views/doc-types-management/index.blade.php +++ b/resources/views/insurance/index.blade.php @@ -12,12 +12,12 @@