From 8e45f17f10bc4deb9921672fe85b1b873307ab9e Mon Sep 17 00:00:00 2001 From: Dr Masroor Ehsan Date: Sun, 19 Jan 2025 10:10:18 +0600 Subject: [PATCH] use dicomserver --- app/Services/Pacs/OrthancRestClient.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/Services/Pacs/OrthancRestClient.php b/app/Services/Pacs/OrthancRestClient.php index 01bc272..ed10a38 100644 --- a/app/Services/Pacs/OrthancRestClient.php +++ b/app/Services/Pacs/OrthancRestClient.php @@ -11,8 +11,11 @@ public function __construct(private readonly DicomServer $orthancHost) {} public function getClient(): Client { + $endpoint = $this->orthancHost->rest_api_endpoint; + return new Client([ - 'base_uri' => config('pacs.api.endpoint'), + 'base_uri' => $endpoint, + // 'base_uri' => config('pacs.api.endpoint'), ]); } @@ -20,28 +23,28 @@ public function getStudyStatistics(string $study_id): array { $response = $this->getClient()->get('/studies/' . $study_id . '/statistics'); - return json_decode($response->getBody()->getContents(), true); + return json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); } public function getServerStatistics(): array { $response = $this->getClient()->get('/statistics'); - return json_decode($response->getBody()->getContents(), true); + return json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); } public function getStudySeries(string $study_id): array { $response = $this->getClient()->get('/studies/' . $study_id . '/series?expand'); - return json_decode($response->getBody()->getContents(), true); + return json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); } public function getStudyInstances(string $study_id): array { $response = $this->getClient()->get('/studies/' . $study_id . '/instances?expand'); - return json_decode($response->getBody()->getContents(), true); + return json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); } public function getStudyDetails(string $study_id): array @@ -51,7 +54,7 @@ public function getStudyDetails(string $study_id): array ]; $response = $this->getClient()->get('/studies/' . $study_id . '?' . http_build_query($query)); - return json_decode($response->getBody()->getContents(), true); + return json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); } public function getStudies(): array @@ -63,11 +66,11 @@ public function getStudies(): array $url = '/studies?' . http_build_query($query); $response = $this->getClient()->get($url); - return json_decode($response->getBody()->getContents(), true); + return json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); } public function getStudiesIds(): array { - return json_decode($this->getClient()->get('/studies')->getBody()->getContents(), true); + return json_decode($this->getClient()->get('/studies')->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); } }