From b3ceda84b81cf7514880b7bce390078066034770 Mon Sep 17 00:00:00 2001 From: Dr Masroor Ehsan Date: Thu, 23 Jan 2025 10:25:25 +0600 Subject: [PATCH] minor improvement --- app/Services/Pacs/OrthancRestClient.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/Services/Pacs/OrthancRestClient.php b/app/Services/Pacs/OrthancRestClient.php index ed10a38..67525fb 100644 --- a/app/Services/Pacs/OrthancRestClient.php +++ b/app/Services/Pacs/OrthancRestClient.php @@ -33,16 +33,26 @@ public function getServerStatistics(): array return json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); } + private static function studyPath(string $study_id, ?string $sub = null): string + { + $parts = ['studies', ltrim($study_id, '/')]; + if (filled($sub)) { + $parts[] = ltrim($sub, '/'); + } + + return implode('/', $parts); + } + public function getStudySeries(string $study_id): array { - $response = $this->getClient()->get('/studies/' . $study_id . '/series?expand'); + $response = $this->getClient()->get(self::studyPath($study_id, 'series?expand')); 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'); + $response = $this->getClient()->get(self::studyPath($study_id, 'instances?expand')); return json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); }