wip
This commit is contained in:
parent
103d8cfb7f
commit
e98a88e27d
22
app/Http/Controllers/PacsController.php
Normal file
22
app/Http/Controllers/PacsController.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Services\Pacs;
|
||||||
|
|
||||||
|
class PacsController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$studies = (new Pacs)->getStudies();
|
||||||
|
|
||||||
|
return view('pacs.studies', compact('studies'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$study = (new Pacs)->getStudy($id);
|
||||||
|
|
||||||
|
return view('pacs.study', compact('study'));
|
||||||
|
}
|
||||||
|
}
|
35
app/Services/Pacs.php
Normal file
35
app/Services/Pacs.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use GuzzleHttp\Client;
|
||||||
|
|
||||||
|
final class Pacs
|
||||||
|
{
|
||||||
|
public function getClient(): Client
|
||||||
|
{
|
||||||
|
return new Client([
|
||||||
|
'base_uri' => 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;
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,7 @@
|
|||||||
"laravel/jetstream": "^5.3",
|
"laravel/jetstream": "^5.3",
|
||||||
"laravel/sanctum": "^4.0",
|
"laravel/sanctum": "^4.0",
|
||||||
"laravel/tinker": "^2.9",
|
"laravel/tinker": "^2.9",
|
||||||
|
"league/url": "^3.3",
|
||||||
"livewire/livewire": "^3.0",
|
"livewire/livewire": "^3.0",
|
||||||
"propaganistas/laravel-phone": "^5.3",
|
"propaganistas/laravel-phone": "^5.3",
|
||||||
"spatie/laravel-permission": "^6.10",
|
"spatie/laravel-permission": "^6.10",
|
||||||
|
113
composer.lock
generated
113
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "365478437927a521db41a974981ba916",
|
"content-hash": "3007185579b2e8489eae9546920efd9e",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bacon/bacon-qr-code",
|
"name": "bacon/bacon-qr-code",
|
||||||
@ -2573,6 +2573,66 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-12-08T08:18:47+00:00"
|
"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",
|
"name": "livewire/livewire",
|
||||||
"version": "v3.5.18",
|
"version": "v3.5.18",
|
||||||
@ -6918,6 +6978,57 @@
|
|||||||
},
|
},
|
||||||
"time": "2024-12-21T16:25:41+00:00"
|
"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",
|
"name": "vinkla/hashids",
|
||||||
"version": "12.0.0",
|
"version": "12.0.0",
|
||||||
|
50
resources/views/pacs/studies.blade.php
Normal file
50
resources/views/pacs/studies.blade.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<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-7xl mx-auto sm:px-6 lg:px-8">
|
||||||
|
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Patient ID</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Sex</th>
|
||||||
|
<th>Study Dt</th>
|
||||||
|
<th>Uploaded</th>
|
||||||
|
<th>Institution</th>
|
||||||
|
</tr>
|
||||||
|
@foreach($studies as $study)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="{{ route('studies.show', [$study['ID']]) }}">{{ $study['ID'] }}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ $study['PatientMainDicomTags']['PatientID'] }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ $study['PatientMainDicomTags']['PatientName'] }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ $study['PatientMainDicomTags']['PatientSex'] }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ $study['StudyDateTime'] }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ $study['LastUpdate'] }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ $study['MainDicomTags']['InstitutionName'] }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</x-app-layout>
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Http\Controllers\PacsController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
@ -14,4 +15,8 @@
|
|||||||
Route::get('/dashboard', function () {
|
Route::get('/dashboard', function () {
|
||||||
return view('dashboard');
|
return view('dashboard');
|
||||||
})->name('dashboard');
|
})->name('dashboard');
|
||||||
|
|
||||||
|
Route::get('/studies', [PacsController::class, 'index'])->name('studies.index');
|
||||||
|
Route::get('/studies/{id}', [PacsController::class, 'show'])->name('studies.show');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user