diff --git a/htdocs/app/Http/Controllers/DokterController.php b/htdocs/app/Http/Controllers/DokterController.php index 2798c8ad..f14c51ef 100644 --- a/htdocs/app/Http/Controllers/DokterController.php +++ b/htdocs/app/Http/Controllers/DokterController.php @@ -470,6 +470,7 @@ class DokterController extends Controller 'created_by' => Session('nama') ] ); + $statusdraft = 'Proses Analisis Sampel'; KomponenJawaban::where('accnumber', $nofoto)->where('template', $dlp)->delete(); $data = $request->except(['_token', 'periksa_id', 'val01', 'val10', 'acc_number']); foreach ($data as $key => $value) { @@ -487,6 +488,20 @@ class DokterController extends Controller ] ); } else { + if ($key == 'id_statusmediatamlainnya' AND $value != ''){ + $statusdraft = $value; + } else if ($key == 'id_statusmediasellainnya' AND $value != ''){ + $statusdraft = $value; + } else if ($key == 'id_statusmediasda' AND $value != ''){ + $statusdraft = $value; + } else if ($key == 'id_statusmediamcconkey' AND $value != ''){ + $statusdraft = $value; + } else if ($key == 'id_statusmediacap' AND $value != ''){ + $statusdraft = $value; + } else if ($key == 'id_statusmediabap' AND $value != ''){ + $statusdraft = $value; + } else { + } KomponenJawaban::updateOrCreate( [ 'accnumber' => $nofoto, @@ -581,7 +596,7 @@ class DokterController extends Controller 'nmdrafter' => Session('nama'), 'nmexcutor' => Session('nama'), 'excutor' => Session('id'), - 'status' => 'Proses Analisis Sampel' + 'status' => $statusdraft ]); $surat = self::genSurat($periksa->id, 'dengan kop'); Riwayat::create([ @@ -622,7 +637,7 @@ class DokterController extends Controller 'nmdrafter' => Session('nama'), 'nmexcutor' => Session('nama'), 'excutor' => Session('id'), - 'status' => 'Proses Analisis Sampel' + 'status' => $statusdraft ]); return response()->json(['icon' => 'success', 'status' => 'Success', 'message' => 'Expertise Saved']); } diff --git a/htdocs/app/Http/Controllers/JsonTransferController.php b/htdocs/app/Http/Controllers/JsonTransferController.php index 8839dc18..9d48ccd2 100644 --- a/htdocs/app/Http/Controllers/JsonTransferController.php +++ b/htdocs/app/Http/Controllers/JsonTransferController.php @@ -10,9 +10,7 @@ use ZipArchive; class JsonTransferController extends Controller { protected $exportPath = 'database/seeders/data/'; - - public function index() - { + public function index(){ //POSTGRESS $tables = DB::select("SELECT tablename FROM pg_tables WHERE schemaname = 'public'"); $tableNames = array_map(fn($t) => $t->tablename, $tables); @@ -32,9 +30,7 @@ class JsonTransferController extends Controller } return view('backup', compact('tableInfo')); } - - public function generate() - { + public function generate(){ $exportPath = base_path($this->exportPath); if (!is_dir($exportPath)) { mkdir($exportPath, 0777, true); @@ -74,10 +70,7 @@ class JsonTransferController extends Controller return redirect()->back()->with('success', 'Semua tabel berhasil diekspor tanpa kehabisan memori.'); } - - - public function downloadTable($table) - { + public function downloadTable($table){ $file = base_path($this->exportPath . $table . '.json'); if (!file_exists($file)) { @@ -86,9 +79,7 @@ class JsonTransferController extends Controller return response()->download($file); } - - public function downloadAll() - { + public function downloadAll(){ $zipFile = base_path('database/seeders/data/all_json.zip'); $zip = new ZipArchive; @@ -103,8 +94,7 @@ class JsonTransferController extends Controller return response()->download($zipFile); } - public function importTable($table) - { + public function importTable($table){ $path = base_path($this->exportPath . $table . '.json'); if (!file_exists($path)) { return redirect()->back()->with('error', "File JSON untuk tabel $table tidak ditemukan."); @@ -128,5 +118,21 @@ class JsonTransferController extends Controller return redirect()->back()->with('error', "Gagal import tabel $table: " . $e->getMessage()); } } + public function pull(Request $request){ + if (session('previlage') !== 'developer') { + abort(403, 'Akses ditolak. Anda tidak memiliki izin untuk menjalankan git pull.'); + } + $gitPath = '/var/www/html/lis/'; + + // Jalankan git pull + $output = shell_exec("cd {$gitPath} && git pull 2>&1"); + + // Simpan log siapa yang menjalankan (opsional) + if (auth()->check()) { + Log::info('Git pull executed by user: ' . auth()->user()->email); + } + + return back()->with('git_output', $output); + } } diff --git a/htdocs/app/Http/Controllers/LisController.php b/htdocs/app/Http/Controllers/LisController.php deleted file mode 100644 index 69b64992..00000000 --- a/htdocs/app/Http/Controllers/LisController.php +++ /dev/null @@ -1,116 +0,0 @@ -lisServiceUrl = env('LIS_SERVICE_URL', 'http://localhost:5000'); - } - - /** - * Mengirim perintah untuk mendaftarkan tes pasien baru ke GeneXpert. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse - */ - public function registerPatient(Request $request) - { - // Validasi input dari request (sangat direkomendasikan) - $validatedData = $request->validate([ - 'patient_name' => 'required|string|max:100', - 'patient_id' => 'required|string|max:50', - 'sample_id' => 'required|string|max:50', - 'test_code' => 'required|string|max:20', - 'test_name' => 'sometimes|string|max:50', - 'dob' => 'sometimes|date_format:Ymd', - 'gender' => 'sometimes|string|in:M,F,O,U', - ]); - - // Membangun payload sesuai format yang diharapkan oleh app.py - $payload = [ - 'command' => 'register_patient', - 'data' => $validatedData, - ]; - - try { - // Mengirim request POST ke service Python - $response = Http::timeout(30) // Set timeout 30 detik - ->post($this->lisServiceUrl . '/command', $payload); - - // Cek jika request gagal di level HTTP - if ($response->failed()) { - Log::error('Gagal terhubung ke LIS service saat registrasi.', [ - 'status' => $response->status(), - 'body' => $response->body() - ]); - return response()->json([ - 'error' => 'Tidak dapat terhubung ke LIS service.', - 'details' => $response->body() - ], 503); // Service Unavailable - } - - // Mengembalikan response dari service Python ke client - return response()->json($response->json(), $response->status()); - - } catch (\Illuminate\Http\Client\ConnectionException $e) { - Log::error('Koneksi ke LIS service gagal.', ['exception' => $e->getMessage()]); - return response()->json(['error' => 'Koneksi ke LIS service gagal.'], 504); // Gateway Timeout - } - } - - /** - * Mengirim perintah untuk meminta ulang hasil tes berdasarkan Sample ID. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse - */ - public function requestResult(Request $request) - { - // Validasi input - $validatedData = $request->validate([ - 'sample_id' => 'required|string|max:50', - ]); - - // Membangun payload - $payload = [ - 'command' => 'request_result', - 'data' => $validatedData, - ]; - - try { - // Mengirim request POST ke service Python - $response = Http::timeout(30)->post($this->lisServiceUrl . '/command', $payload); - - if ($response->failed()) { - Log::error('Gagal terhubung ke LIS service saat meminta hasil.', [ - 'status' => $response->status(), - 'body' => $response->body() - ]); - return response()->json([ - 'error' => 'Tidak dapat terhubung ke LIS service.', - 'details' => $response->body() - ], 503); - } - - return response()->json($response->json(), $response->status()); - - } catch (\Illuminate\Http\Client\ConnectionException $e) { - Log::error('Koneksi ke LIS service gagal.', ['exception' => $e->getMessage()]); - return response()->json(['error' => 'Koneksi ke LIS service gagal.'], 504); - } - } -} diff --git a/htdocs/database/migrations/2024_12_28_142050_create_sirab_table.php b/htdocs/database/migrations/2024_12_28_142050_create_sirab_table.php index 5a149af3..c5315792 100644 --- a/htdocs/database/migrations/2024_12_28_142050_create_sirab_table.php +++ b/htdocs/database/migrations/2024_12_28_142050_create_sirab_table.php @@ -18,13 +18,14 @@ return new class extends Migration $table->string('antibiotik', 150)->nullable(); $table->string('subantibiotik', 150)->nullable(); $table->string('diskcontent', 100)->nullable(); - $table->integer('batasatas')->nullable(); + $table->string('batasatas', 150)->nullable(); $table->string('midrange', 150)->nullable(); - $table->integer('batasbawah')->nullable(); + $table->string('batasbawah', 150)->nullable(); $table->string('sumber', 255)->nullable(); $table->string('kodedok', 50)->nullable(); $table->string('atu', 50)->nullable(); $table->string('kelompok', 50)->nullable(); + $table->integer('cek')->nullable(); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent(); }); diff --git a/htdocs/resources/views/backup.blade.php b/htdocs/resources/views/backup.blade.php index 66c9f825..5dee6e0d 100644 --- a/htdocs/resources/views/backup.blade.php +++ b/htdocs/resources/views/backup.blade.php @@ -11,23 +11,44 @@ @if(session('success'))
{{ session('success') }}
@endif + @if (session('git_output')) +
+
{{ session('git_output') }}
+
+ @endif
-
+
@csrf
-
+ -
+
+ @if (session('previlage') === 'developer') +
+ @csrf + +
+ @else +

Anda tidak memiliki izin untuk menjalankan Git Pull.

+ @endif +
+
- + @if (session('previlage') === 'developer') + + @else +

+ @endif
@@ -50,7 +71,12 @@
@csrf - + @if (session('previlage') === 'developer') + + @else +

+ @endif +
diff --git a/htdocs/resources/views/dokter/pemeriksaan.blade.php b/htdocs/resources/views/dokter/pemeriksaan.blade.php index 103e007a..fe013ae5 100644 --- a/htdocs/resources/views/dokter/pemeriksaan.blade.php +++ b/htdocs/resources/views/dokter/pemeriksaan.blade.php @@ -523,9 +523,9 @@ B. Biakan Kultur
- +
-
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
-
- - -
-
- - -
-
- - -
-
- -
diff --git a/htdocs/resources/views/dokter/ppds.blade.php b/htdocs/resources/views/dokter/ppds.blade.php index 6b6f586f..b87c4329 100644 --- a/htdocs/resources/views/dokter/ppds.blade.php +++ b/htdocs/resources/views/dokter/ppds.blade.php @@ -579,9 +579,9 @@ B. Biakan Kultur
- +
-
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
-
- - -
-
- - -
-
- - -
-
- -
diff --git a/htdocs/resources/views/dokter/ppdsdeveloper.blade.php b/htdocs/resources/views/dokter/ppdsdeveloper.blade.php index 4fd364f5..92fe585e 100644 --- a/htdocs/resources/views/dokter/ppdsdeveloper.blade.php +++ b/htdocs/resources/views/dokter/ppdsdeveloper.blade.php @@ -579,9 +579,9 @@ B. Biakan Kultur
- +
-
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
-
- - -
-
- - -
-
- - -
-
- -
diff --git a/htdocs/routes/web.php b/htdocs/routes/web.php index 22273f66..3ee1bd9b 100644 --- a/htdocs/routes/web.php +++ b/htdocs/routes/web.php @@ -171,5 +171,6 @@ Route::group(['middleware' => 'project.ipg'], function() { Route::get('/json-transfer/download-all', [JsonTransferController::class, 'downloadAll'])->name('json.downloadAll'); Route::get('/json-transfer/download/{table}', [JsonTransferController::class, 'downloadTable'])->name('json.downloadTable'); Route::post('/json-transfer/import/{table}', [JsonTransferController::class, 'importTable'])->name('json.importTable'); + Route::post('/git/pull', [JsonTransferController::class, 'pull'])->name('git.pull'); });