wip
This commit is contained in:
parent
51095f716f
commit
d03583493b
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Models\Traits\Active;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Uri;
|
||||
|
||||
class OrthancHost extends BaseModel
|
||||
{
|
||||
@ -18,4 +19,19 @@ public function facility(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Facility::class);
|
||||
}
|
||||
|
||||
private function restEndpoint(string $path): Uri
|
||||
{
|
||||
return Uri::of($this->rest_api_endpoint)->withPath($path);
|
||||
}
|
||||
|
||||
public function stoneViewerUrl(): Uri
|
||||
{
|
||||
return $this->restEndpoint($this->stone_viewer_path);
|
||||
}
|
||||
|
||||
public function ohifViewerUrl(): Uri
|
||||
{
|
||||
return $this->restEndpoint($this->ohif_viewer_path);
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public function getReportStatusLedAttribute(): string
|
||||
public function getArchiveLink(): ?string
|
||||
{
|
||||
if (me()->may(Permission::StudyDownload)) {
|
||||
return PacsUrlGen::archive($this->study_instance_uid);
|
||||
return PacsUrlGen::archive($this->orthancHost, $this->study_instance_uid);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -166,7 +166,7 @@ public function getArchiveLink(): ?string
|
||||
public function getStoneLink(): ?string
|
||||
{
|
||||
if (me()->may(Permission::StudyDownload)) {
|
||||
return PacsUrlGen::stoneViewer($this->study_instance_uid);
|
||||
return PacsUrlGen::stoneViewer($this->orthancHost, $this->study_instance_uid);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -175,7 +175,7 @@ public function getStoneLink(): ?string
|
||||
public function getOhifLink(): ?string
|
||||
{
|
||||
if (me()->may(Permission::StudyDownload)) {
|
||||
return PacsUrlGen::ohifViewer($this->study_instance_uid);
|
||||
return PacsUrlGen::ohifViewer($this->orthancHost, $this->study_instance_uid);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -184,7 +184,7 @@ public function getOhifLink(): ?string
|
||||
public function getOhifSegmentationLink(): ?string
|
||||
{
|
||||
if (me()->may(Permission::StudyDownload)) {
|
||||
return PacsUrlGen::ohifSegmentation($this->study_instance_uid);
|
||||
return PacsUrlGen::ohifSegmentation($this->orthancHost, $this->study_instance_uid);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -193,7 +193,7 @@ public function getOhifSegmentationLink(): ?string
|
||||
public function getOhifMprLink(): ?string
|
||||
{
|
||||
if (me()->may(Permission::StudyDownload)) {
|
||||
return PacsUrlGen::ohifViewerMpr($this->study_instance_uid);
|
||||
return PacsUrlGen::ohifViewerMpr($this->orthancHost, $this->study_instance_uid);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -2,53 +2,51 @@
|
||||
|
||||
namespace App\Services\Pacs;
|
||||
|
||||
use App\Models\OrthancHost;
|
||||
use App\Models\Study;
|
||||
use Uri;
|
||||
|
||||
final class PacsUrlGen
|
||||
{
|
||||
public static function stoneViewer(string $study_uid): string
|
||||
public static function stoneViewer(OrthancHost $host, Study $study): string
|
||||
{
|
||||
$url = Uri::of(config('pacs.viewer.stone.endpoint'))
|
||||
->withPath('/stone-webviewer/index.html')
|
||||
->withQuery(['study' => $study_uid]);
|
||||
$url = $host->stoneViewerUrl()->withQuery(['study' => $study->study_instance_uid]);
|
||||
|
||||
return (string) $url;
|
||||
}
|
||||
|
||||
public static function ohifViewer(string $study_uid): string
|
||||
public static function ohifViewer(OrthancHost $host, Study $study): string
|
||||
{
|
||||
$url = Uri::of(config('pacs.viewer.ohif.endpoint'))
|
||||
->withPath('/ohif/viewer')
|
||||
->withQuery(['StudyInstanceUIDs' => $study_uid]);
|
||||
$url = $host->ohifViewerUrl()
|
||||
->withQuery(['StudyInstanceUIDs' => $study->study_instance_uid]);
|
||||
|
||||
return (string) $url;
|
||||
}
|
||||
|
||||
public static function ohifViewerMpr(string $study_uid): string
|
||||
public static function ohifViewerMpr(OrthancHost $host, Study $study): string
|
||||
{
|
||||
$url = Uri::of(config('pacs.viewer.ohif.endpoint'))
|
||||
->withPath('/ohif/viewer')
|
||||
$url = $host->ohifViewerUrl()
|
||||
->withQuery([
|
||||
'hangingprotocolId' => 'mprAnd3DVolumeViewport',
|
||||
'StudyInstanceUIDs' => $study_uid,
|
||||
'StudyInstanceUIDs' => $study->study_instance_uid,
|
||||
]);
|
||||
|
||||
return (string) $url;
|
||||
}
|
||||
|
||||
public static function ohifSegmentation(string $study_uid): string
|
||||
public static function ohifSegmentation(OrthancHost $host, Study $study): string
|
||||
{
|
||||
$url = Uri::of(config('pacs.viewer.ohif.endpoint'))
|
||||
$url = $host->ohifViewerUrl()
|
||||
->withPath('/ohif/segmentation')
|
||||
->withQuery(['StudyInstanceUIDs' => $study_uid]);
|
||||
->withQuery(['StudyInstanceUIDs' => $study->study_instance_uid]);
|
||||
|
||||
return (string) $url;
|
||||
}
|
||||
|
||||
public static function archive(string $study_uid): string
|
||||
public static function archive(OrthancHost $host, Study $study): string
|
||||
{
|
||||
$url = Uri::of(config('pacs.api.endpoint'))
|
||||
->withPath('/studies/' . $study_uid . '/archive');
|
||||
$url = Uri::of($host->rest_api_endpoint)
|
||||
->withPath('/studies/' . $study->study_instance_uid . '/archive');
|
||||
|
||||
return (string) $url;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user