71 lines
2.0 KiB
PHP
71 lines
2.0 KiB
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 getStudyStatistics(string $study_id): array
|
|
{
|
|
$response = $this->getClient()->get('/studies/'.$study_id.'/statistics');
|
|
|
|
return json_decode($response->getBody()->getContents(), true);
|
|
}
|
|
|
|
public function getServerStatistics(): array
|
|
{
|
|
$response = $this->getClient()->get('/statistics');
|
|
|
|
return json_decode($response->getBody()->getContents(), true);
|
|
}
|
|
|
|
public function getStudySeries(string $study_id): array
|
|
{
|
|
$response = $this->getClient()->get('/studies/'.$study_id.'/series?expand');
|
|
|
|
return json_decode($response->getBody()->getContents(), true);
|
|
}
|
|
|
|
public function getStudyInstances(string $study_id): array
|
|
{
|
|
$response = $this->getClient()->get('/studies/'.$study_id.'/instances?expand');
|
|
|
|
return json_decode($response->getBody()->getContents(), true);
|
|
}
|
|
|
|
public function getStudyDetails(string $study_id): array
|
|
{
|
|
$query = [
|
|
'requested-tags' => implode(';', array_column(DicomTags::cases(), 'value')),
|
|
];
|
|
$response = $this->getClient()->get('/studies/'.$study_id.'?'.http_build_query($query));
|
|
|
|
return json_decode($response->getBody()->getContents(), true);
|
|
}
|
|
|
|
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);
|
|
|
|
return json_decode($response->getBody()->getContents(), true);
|
|
}
|
|
|
|
public function getStudiesIds(): array
|
|
{
|
|
return json_decode($this->getClient()->get('/studies')->getBody()->getContents(), true);
|
|
}
|
|
}
|