This commit is contained in:
Masroor Ehsan 2025-01-08 18:17:02 +06:00
parent 93850de7e3
commit ef82c77e0d

View File

@ -2,6 +2,7 @@
namespace App\Services\Pacs\Sync; namespace App\Services\Pacs\Sync;
use App\Domain\Study\Priority;
use App\Domain\Study\StudyLevelStatus; use App\Domain\Study\StudyLevelStatus;
use App\Services\Pacs\DicomUtils; use App\Services\Pacs\DicomUtils;
use App\Services\Pacs\InstituteMapper; use App\Services\Pacs\InstituteMapper;
@ -103,6 +104,8 @@ public function transformData(mixed $orthanc_src): array
$inst_name = data_get($orthanc_src, 'MainDicomTags.InstitutionName'); $inst_name = data_get($orthanc_src, 'MainDicomTags.InstitutionName');
$inst_id = InstituteMapper::map($inst_name); $inst_id = InstituteMapper::map($inst_name);
$patient_name = data_get($orthanc_src, 'PatientMainDicomTags.PatientName');
$study = [ $study = [
'orthanc_uuid' => strtolower($orthanc_src['ID']), 'orthanc_uuid' => strtolower($orthanc_src['ID']),
'institution_name' => $inst_name, 'institution_name' => $inst_name,
@ -110,7 +113,7 @@ public function transformData(mixed $orthanc_src): array
'patient_uuid' => strtolower($orthanc_src['ParentPatient']), 'patient_uuid' => strtolower($orthanc_src['ParentPatient']),
'patient_id' => data_get($orthanc_src, 'PatientMainDicomTags.PatientID'), 'patient_id' => data_get($orthanc_src, 'PatientMainDicomTags.PatientID'),
'patient_name' => data_get($orthanc_src, 'PatientMainDicomTags.PatientName'), 'patient_name' => $patient_name,
'patient_sex' => data_get($orthanc_src, 'PatientMainDicomTags.PatientSex'), 'patient_sex' => data_get($orthanc_src, 'PatientMainDicomTags.PatientSex'),
'accession_number' => data_get($orthanc_src, 'MainDicomTags.AccessionNumber'), 'accession_number' => data_get($orthanc_src, 'MainDicomTags.AccessionNumber'),
@ -152,6 +155,11 @@ public function transformData(mixed $orthanc_src): array
} }
$this->setValue($study, 'study_description', trim($descr)); $this->setValue($study, 'study_description', trim($descr));
// check for priority in patient name or description
if (preg_match('/\b(urgent|stat)\b/i', implode(' ', [$descr, $patient_name]))) {
$this->setValue($study, 'priority', Priority::Stat->value);
}
$properties = [ $properties = [
'other_patient_names' => data_get($orthanc_src, 'RequestedTags.OtherPatientNames'), 'other_patient_names' => data_get($orthanc_src, 'RequestedTags.OtherPatientNames'),
'other_patient_ids' => data_get($orthanc_src, 'RequestedTags.OtherPatientIDs'), 'other_patient_ids' => data_get($orthanc_src, 'RequestedTags.OtherPatientIDs'),