study importer
This commit is contained in:
parent
3d6eb1543e
commit
3a9b27ef19
@ -29,9 +29,10 @@ public function show($id)
|
||||
|
||||
public function import()
|
||||
{
|
||||
$studies = (new OrthancRestClient)->getStudies();
|
||||
|
||||
(new StudyImporter)->import($studies);
|
||||
$svc = (new StudyImporter);
|
||||
$svc->scanStudies();
|
||||
$svc->filterStudies();
|
||||
$svc->importStudies();
|
||||
|
||||
return redirect()->route('studies.index');
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ 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));
|
||||
$response = $this->getClient()->get('/studies/'.$study_id.'?'.http_build_query($query));
|
||||
|
||||
return json_decode($response->getBody()->getContents(), true);
|
||||
}
|
||||
|
@ -22,13 +22,6 @@ public function __construct(?OrthancRestClient $client = null)
|
||||
$this->client = $client ?? new OrthancRestClient;
|
||||
}
|
||||
|
||||
public function import(array $studies): void
|
||||
{
|
||||
foreach ($studies as $study) {
|
||||
$this->importStudy($study);
|
||||
}
|
||||
}
|
||||
|
||||
public function scanStudies()
|
||||
{
|
||||
$this->study_ids = $this->client->getStudiesIds();
|
||||
@ -38,8 +31,10 @@ private function checkUpdate(string $orthanc_uid): void
|
||||
{
|
||||
$row = DB::table('studies')->where('orthanc_uid', $orthanc_uid)->first(['id', 'study_status']);
|
||||
|
||||
if ($row == null) {
|
||||
if ($row === null) {
|
||||
$this->insert_queue[] = $orthanc_uid;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($row->study_status < StudyLevelStatus::StudyArrived->value) {
|
||||
@ -140,7 +135,7 @@ private function prepareData(mixed $study): array
|
||||
if ($descr != null) {
|
||||
$descr = data_get($study, 'RequestedTags.AcquisitionDeviceProcessingDescription');
|
||||
}
|
||||
$data['study_description'] = trim($descr);
|
||||
$data['study_descrip¶tion'] = trim($descr);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public function up(): void
|
||||
|
||||
$table->unsignedSmallInteger('image_count')->nullable();
|
||||
$table->unsignedSmallInteger('series_count')->nullable();
|
||||
$table->unsignedSmallInteger('disk_size')->nullable();
|
||||
$table->unsignedInteger('disk_size')->nullable();
|
||||
|
||||
$table->foreignIdFor(User::class, 'assigned_physician_id')->nullable()->constrained()->onDelete('set null');
|
||||
$table->foreignIdFor(User::class, 'interpreting_physician_id')->nullable()->constrained()->onDelete('set null');
|
||||
|
Loading…
Reference in New Issue
Block a user