diff --git a/app/Http/Controllers/PacsController.php b/app/Http/Controllers/PacsController.php new file mode 100644 index 0000000..2d7eaf6 --- /dev/null +++ b/app/Http/Controllers/PacsController.php @@ -0,0 +1,22 @@ +getStudies(); + + return view('pacs.studies', compact('studies')); + } + + public function show($id) + { + $study = (new Pacs)->getStudy($id); + + return view('pacs.study', compact('study')); + } +} diff --git a/app/Services/Pacs.php b/app/Services/Pacs.php new file mode 100644 index 0000000..7654e78 --- /dev/null +++ b/app/Services/Pacs.php @@ -0,0 +1,35 @@ + config('pacs.api.endpoint'), + ]); + } + + public function getStudies(): array + { + $url = '/studies?'.http_build_query(['expand' => '1']); + $response = $this->getClient()->get($url); + + $studies = json_decode($response->getBody()->getContents(), true); + $result = []; + foreach ($studies as $study) { + $study['LastUpdate'] = Carbon::parse($study['LastUpdate'], 'UTC')->tz(config('app.timezone'))->toDateTimeString(); + $sdt = $study['MainDicomTags']['StudyDate'].' '.$study['MainDicomTags']['StudyTime']; + $study_date = Carbon::createFromFormat('Ymd His.u', $study['MainDicomTags']['StudyDate'].' '.$study['MainDicomTags']['StudyTime'], 'UTC'); + $study['StudyDateTime'] = $study_date->tz(config('app.timezone'))->toDateTimeString(); + + $result[] = $study; + } + + return $result; + } +} diff --git a/composer.json b/composer.json index 0f282cc..6241eaa 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "laravel/jetstream": "^5.3", "laravel/sanctum": "^4.0", "laravel/tinker": "^2.9", + "league/url": "^3.3", "livewire/livewire": "^3.0", "propaganistas/laravel-phone": "^5.3", "spatie/laravel-permission": "^6.10", diff --git a/composer.lock b/composer.lock index 350ec03..95f4931 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "365478437927a521db41a974981ba916", + "content-hash": "3007185579b2e8489eae9546920efd9e", "packages": [ { "name": "bacon/bacon-qr-code", @@ -2573,6 +2573,66 @@ ], "time": "2024-12-08T08:18:47+00:00" }, + { + "name": "league/url", + "version": "3.3.5", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/url.git", + "reference": "1ae2c3ce29a7c5438339ff6388225844e6479da8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/url/zipball/1ae2c3ce29a7c5438339ff6388225844e6479da8", + "reference": "1ae2c3ce29a7c5438339ff6388225844e6479da8", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0", + "true/punycode": "^2.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Url\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://github.com/nyamsprod/", + "role": "Developer" + } + ], + "description": "League/url is a lightweight PHP Url manipulating library", + "homepage": "http://url.thephpleague.com", + "keywords": [ + "parse_url", + "php", + "url" + ], + "support": { + "forum": "https://groups.google.com/forum/#!forum/thephpleague", + "issues": "https://github.com/thephpleague/url/issues", + "source": "https://github.com/thephpleague/url/tree/3.x" + }, + "abandoned": "league/uri", + "time": "2015-07-15T08:24:12+00:00" + }, { "name": "livewire/livewire", "version": "v3.5.18", @@ -6918,6 +6978,57 @@ }, "time": "2024-12-21T16:25:41+00:00" }, + { + "name": "true/punycode", + "version": "v2.1.1", + "source": { + "type": "git", + "url": "https://github.com/true/php-punycode.git", + "reference": "a4d0c11a36dd7f4e7cd7096076cab6d3378a071e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/true/php-punycode/zipball/a4d0c11a36dd7f4e7cd7096076cab6d3378a071e", + "reference": "a4d0c11a36dd7f4e7cd7096076cab6d3378a071e", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/polyfill-mbstring": "^1.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.7", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "TrueBV\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Renan Gonçalves", + "email": "renan.saddam@gmail.com" + } + ], + "description": "A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)", + "homepage": "https://github.com/true/php-punycode", + "keywords": [ + "idna", + "punycode" + ], + "support": { + "issues": "https://github.com/true/php-punycode/issues", + "source": "https://github.com/true/php-punycode/tree/master" + }, + "abandoned": true, + "time": "2016-11-16T10:37:54+00:00" + }, { "name": "vinkla/hashids", "version": "12.0.0", diff --git a/resources/views/pacs/studies.blade.php b/resources/views/pacs/studies.blade.php new file mode 100644 index 0000000..41517d1 --- /dev/null +++ b/resources/views/pacs/studies.blade.php @@ -0,0 +1,50 @@ + + +

+ {{ __('Dashboard') }} +

+
+ +
+
+
+ + + + + + + + + + + @foreach($studies as $study) + + + + + + + + + + @endforeach +
IDPatient IDNameSexStudy DtUploadedInstitution
+ {{ $study['ID'] }} + + {{ $study['PatientMainDicomTags']['PatientID'] }} + + {{ $study['PatientMainDicomTags']['PatientName'] }} + + {{ $study['PatientMainDicomTags']['PatientSex'] }} + + {{ $study['StudyDateTime'] }} + + {{ $study['LastUpdate'] }} + + {{ $study['MainDicomTags']['InstitutionName'] }} +
+
+
+
+
diff --git a/routes/web.php b/routes/web.php index 0b90255..99811c5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,6 @@ name('dashboard'); + + Route::get('/studies', [PacsController::class, 'index'])->name('studies.index'); + Route::get('/studies/{id}', [PacsController::class, 'show'])->name('studies.show'); + });