radfusion/app/Services/Pacs/OrthancRestClient.php
2024-12-28 20:02:28 +06:00

30 lines
649 B
PHP

<?php
namespace App\Services\Pacs;
use GuzzleHttp\Client;
final class OrthancRestClient
{
public function getClient(): Client
{
return new Client([
'base_uri' => config('pacs.api.endpoint'),
]);
}
public function getStudies(): array
{
$query = [
'expand' => '1',
'requested-tags' => implode(';', array_column(DicomTags::cases(), 'value')),
];
$url = '/studies?'.http_build_query($query);
$response = $this->getClient()->get($url);
$studies = json_decode($response->getBody()->getContents(), true);
return $studies;
}
}