This commit is contained in:
Masroor Ehsan 2024-12-30 20:30:39 +06:00
parent 0ad4a7fe2a
commit b3b63a0791
8 changed files with 169 additions and 44 deletions

View File

@ -1,36 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Models\Study;
use App\Services\Pacs\OrthancRestClient;
use App\Services\Pacs\StudyImporter;
class PacsController extends Controller
{
public function index()
{
$studies = Study::where('is_active', true)
->orderBy('study_date', 'desc')
->paginate(15);
return view('pacs.studies', compact('studies'));
}
public function show($id)
{
$study = (new OrthancRestClient)->getStudy($id);
return view('pacs.study', compact('study'));
}
public function import()
{
$svc = (new StudyImporter);
$svc->scanStudies();
$svc->filterStudies();
$svc->importStudies();
return redirect()->route('studies.index');
}
}

View File

@ -2,11 +2,25 @@
namespace App\Http\Controllers\Staff;
use App\Http\Controllers\Controller;
use App\Http\Controllers\HashidControllerBase;
use App\Models\Study;
class StudiesController extends Controller
class StudiesController extends HashidControllerBase
{
public function index() {}
public function index()
{
$studies = Study::where('is_active', true)
->orderBy('study_date', 'desc')
->paginate(15);
public function series() {}
return view('staff.studies.index', compact('studies'));
}
public function details()
{
$this->decodeKeys();
$study = Study::findOrFail($this->key);
return view('staff.studies.details', compact('study'));
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Http\Controllers\System;
use App\Http\Controllers\Controller;
use App\Services\Pacs\StudyImporter;
class SyncOrthancController extends Controller
{
public function __invoke()
{
$svc = (new StudyImporter);
$svc->scanStudies();
$svc->filterStudies();
$svc->importStudies();
return redirect()->route('studies.index');
}
}

View File

@ -26,6 +26,11 @@ public function attachments(): HasMany
return $this->hasMany(StudyAttachment::class);
}
public function series(): HasMany
{
return $this->hasMany(StudySeries::class);
}
public function reports(): HasMany
{
return $this->hasMany(StudyReport::class);

45
config/hashids.php Normal file
View File

@ -0,0 +1,45 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the connections below you wish to use as
| your default connection for all work. Of course, you may use many
| connections at once using the manager class.
|
*/
'default' => 'main',
/*
|--------------------------------------------------------------------------
| Hashids Connections
|--------------------------------------------------------------------------
|
| Here are each of the connections setup for your application. Example
| configuration has been included, but you may add as many connections as
| you would like.
|
*/
'connections' => [
'main' => [
'salt' => 'Nqy+T6emZLbhzW08gaZqWEtgEv/habWV4zWYWREv2wM=',
'length' => 0,
// 'alphabet' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
],
'alternative' => [
'salt' => 'your-salt-string',
'length' => 'your-length-integer',
// 'alphabet' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
],
],
];

View File

@ -0,0 +1 @@
@dd($study)

View File

@ -0,0 +1,70 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Dashboard') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-9xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg mb-4">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Accession Number</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Patient ID</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Patient Name</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Patient Sex</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Patient Birth Date</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Modality</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Study Date</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Receive Date</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Series</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Institute Name</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">&nbsp;</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@foreach($studies as $study)
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->accession_number }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->patient_id }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900"><a href="{{ route('studies.details', hash_it($study->id)) }}">{{ $study->patient_name }}</a></td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->patient_sex }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->patient_birthdate }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->study_modality }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->study_date }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->receive_date }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->image_count }} / {{ $study->series_count }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $study->institution_name }}</td>
<td>
<a target="_blank" href="{{ \App\Services\Pacs\PacsUrlGen::stoneViewer($study->study_instance_uid) }}" >St</a>
|
<a target="_blank" href="{{ \App\Services\Pacs\PacsUrlGen::ohifViewer($study->study_instance_uid) }}">OHF</a>
@if($study->image_count > 1 && $study->study_modality != 'CR')
|
<a target="_blank" href="{{ \App\Services\Pacs\PacsUrlGen::ohifViewerMpr($study->study_instance_uid) }}">MPR</a>
|
<a target="_blank" class="btn" href="{{ \App\Services\Pacs\PacsUrlGen::ohifSegmentation($study->study_instance_uid) }}">SEG</a>
@endif
|
<a target="_blank" class="btn" href="{{ \App\Services\Pacs\PacsUrlGen::archive($study->orthanc_uid) }}">ZIP</a>
|
<a target="_blank" class="btn" href="{{ route('radiologist.report-write', $study->id) }}">TXT</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="mb-4 me-4">
{!! $studies->links() !!}
</div>
</div>
</div>
</div>
</x-app-layout>

View File

@ -1,7 +1,8 @@
<?php
use App\Http\Controllers\PacsController;
use App\Http\Controllers\Radiologist\ReportWriteController;
use App\Http\Controllers\Staff\StudiesController;
use App\Http\Controllers\System\SyncOrthancController;
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
@ -17,13 +18,19 @@
return view('dashboard');
})->name('dashboard');
Route::get('/studies', [PacsController::class, 'index'])->name('studies.index');
Route::get('/studies/{id}', [PacsController::class, 'show'])->name('studies.show');
Route::get('/cron', [PacsController::class, 'import'])->name('studies.import');
Route::group(['prefix' => 'pacs', 'as' => 'pacs.'], function () {
Route::get('sync', SyncOrthancController::class)->name('sync');
});
Route::group(['prefix' => 'radiologist', 'as' => 'radiologist.'], function () {
Route::get('/report-write/{id}', ReportWriteController::class)->name('report-write');
});
Route::group(['prefix' => '/studies', 'as' => 'studies.'], function () {
Route::get('/', [StudiesController::class, 'index'])->name('index');
Route::get('/details/{id}', [StudiesController::class, 'details'])->name('details');
});
});
Route::view('/ck', 'ck');