예제 #1
0
 // loop through subdirectory
 if ($sub_handle = opendir($study_directory . '/' . $entry)) {
     while (false !== ($sub_entry = readdir($sub_handle))) {
         if ($sub_entry != "." && $sub_entry != ".." && is_file($study_directory . '/' . $entry . '/' . $sub_entry)) {
             $process_file = PACS::process($study_directory . '/' . $entry . '/' . $sub_entry);
             if (array_key_exists('PatientID', $process_file)) {
                 $process_file['PatientID'][0] = sanitize($process_file['PatientID'][0]);
             }
             $db = DB::getInstance();
             $logFile .= '**** DB processing ****' . PHP_EOL;
             //get patient id
             $logFile .= 'getting patient id...' . PHP_EOL;
             $logFile .= 'PatientID exists...? -> ' . array_key_exists('PatientID', $process_file) . PHP_EOL;
             $patient_chris_id = -1;
             //$db, $process_file, $patient_chris_id
             $p_success = PACS::AddPatient($db, $process_file, $patient_chris_id);
             if ($p_success == 0) {
                 echo $logFile;
                 return;
             }
             $logFile .= 'patient success: ' . $p_success . PHP_EOL;
             $logFile .= 'patient id: ' . $patient_chris_id . PHP_EOL;
             $logFile .= 'getting data id...' . PHP_EOL;
             //get data id
             $data_chris_id = -1;
             $series_description = '';
             $d_success = PACS::AddData($db, $process_file, $data_chris_id, $series_description);
             if ($d_success == 0) {
                 echo $logFile;
                 return;
             }