refx
This commit is contained in:
parent
6ba22397a4
commit
a20ff58614
@ -9,12 +9,19 @@
|
||||
|
||||
class Study extends BaseModel
|
||||
{
|
||||
protected $casts = [
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_locked' => 'boolean',
|
||||
'is_archived' => 'boolean',
|
||||
'study_status' => StudyLevelStatus::class,
|
||||
'report_status' => ReportStatus::class,
|
||||
'received_at' => 'datetime',
|
||||
'reported_at' => 'datetime',
|
||||
'assigned_at' => 'datetime',
|
||||
'study_date' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function details(): HasOne
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ private function prepareData(mixed $orthanc_src): array
|
||||
'body_part_examined' => data_get($orthanc_src, 'RequestedTags.BodyPartExamined'),
|
||||
|
||||
'study_date' => DicomUtils::dateTimeToCarbon($orthanc_src['MainDicomTags']['StudyDate'], $orthanc_src['MainDicomTags']['StudyTime']),
|
||||
'receive_date' => Carbon::parse($orthanc_src['LastUpdate'], 'UTC'),
|
||||
'received_at' => Carbon::parse($orthanc_src['LastUpdate'], 'UTC'),
|
||||
|
||||
'image_count' => data_get($orthanc_src, 'Statistics.CountInstances'),
|
||||
'series_count' => data_get($orthanc_src, 'Statistics.CountSeries'),
|
||||
@ -175,7 +175,7 @@ private function prepareData(mixed $orthanc_src): array
|
||||
$params = [
|
||||
'orthanc_uuid' => strtolower($ser['ID']),
|
||||
'series_instance_uid' => data_get($ser, 'MainDicomTags.SeriesInstanceUID'),
|
||||
'series_date' => DicomUtils::dateTimeToCarbon($ser['MainDicomTags']['SeriesDate'], $ser['MainDicomTags']['SeriesTime']),
|
||||
'series_date' => DicomUtils::dateTimeToCarbon(data_get($ser, 'MainDicomTags.SeriesDate'), data_get($ser, 'MainDicomTags.SeriesTime')),
|
||||
'series_number' => data_get($ser, 'MainDicomTags.SeriesNumber'),
|
||||
'series_description' => data_get($ser, 'MainDicomTags.SeriesDescription'),
|
||||
'protocol_name' => data_get($ser, 'MainDicomTags.ProtocolName'),
|
||||
@ -193,6 +193,9 @@ private function prepareData(mixed $orthanc_src): array
|
||||
|
||||
if (empty($series)) {
|
||||
$series = null;
|
||||
} else {
|
||||
// $series = array_multisort(array_column($series, 'series_number'), SORT_ASC, $series);
|
||||
usort($series, fn ($a, $b): int => (int) $a['series_number'] <=> (int) $b['series_number']);
|
||||
}
|
||||
if (empty($properties)) {
|
||||
$properties = null;
|
||||
|
@ -34,8 +34,10 @@ public function up(): void
|
||||
$table->string('referring_physician_name')->nullable();
|
||||
$table->string('study_modality', 4)->nullable();
|
||||
$table->dateTime('study_date');
|
||||
$table->dateTime('receive_date');
|
||||
$table->dateTime('report_date')->nullable();
|
||||
|
||||
$table->dateTime('received_at');
|
||||
$table->dateTime('reported_at')->nullable();
|
||||
$table->dateTime('assigned_at')->nullable();
|
||||
$table->foreignIdFor(Institute::class)->constrained()->onDelete('cascade');
|
||||
$table->unsignedTinyInteger('study_status')->default(StudyLevelStatus::Pending->value);
|
||||
$table->unsignedTinyInteger('report_status')->default(ReportStatus::Pending->value);
|
||||
@ -50,11 +52,6 @@ public function up(): void
|
||||
$table->foreignIdFor(User::class, 'reading_physician_id')->nullable()->constrained()->onDelete('set null');
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['referring_physician_id', 'receive_date']);
|
||||
$table->index(['institute_id', 'receive_date', 'is_archived']);
|
||||
$table->index(['institute_id', 'report_status', 'study_priority', 'receive_date']);
|
||||
$table->index(['assigned_physician_id', 'report_status', 'study_priority', 'receive_date']);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ public function up(): void
|
||||
$table->text('clinical_diagnosis')->nullable();
|
||||
$table->jsonb('properties')->nullable();
|
||||
$table->jsonb('series')->nullable();
|
||||
$table->jsonb('assignment_log')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user