|
@@ -26,8 +26,9 @@ class Dcom extends Controller //Base
|
|
|
$info[$k] = trim($v);
|
|
|
}
|
|
|
$patient = $this->insertPatient($info);
|
|
|
- $exam = $this->insertExam($info,$patient);
|
|
|
- $series = $this->insertSeries($info,$exam);
|
|
|
+ $study = $this->insertStudy($info,$patient);
|
|
|
+ $exam = $this->insertExam($info,$patient,$study);
|
|
|
+ $series = $this->insertSeries($info,$study);
|
|
|
$image = $this->insertImages($info,$series,$path,$patient);
|
|
|
return json_encode(['status'=>'success','code'=>'0000']);
|
|
|
}else{
|
|
@@ -66,33 +67,6 @@ class Dcom extends Controller //Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function insertExam($info,$patient)
|
|
|
- {
|
|
|
- $where = [
|
|
|
- 'patient_num'=>$info['patientId'],
|
|
|
- 'study_id'=>$info['studyId']
|
|
|
- ];
|
|
|
- $exam = DB::table('exams')->where($where)->find();
|
|
|
- if($exam){
|
|
|
- return $exam;
|
|
|
- }else{
|
|
|
- $data = [
|
|
|
- 'id'=>UUIDs::uuid16(),
|
|
|
- 'patient_id'=>$patient['id'],
|
|
|
- 'institution_id'=>$info['institutionCode'],
|
|
|
- 'patient_num'=>$info['patientId'],
|
|
|
- 'accession_num'=>$info['accessionNumber'],
|
|
|
- 'exam_datetime'=>$info['studyDate'],
|
|
|
- 'exam_class'=>$info['modality'],
|
|
|
- 'study_id'=>$info['studyId'],
|
|
|
- 'study_uid'=>$info['studyUid'],
|
|
|
- 'illness_desc'=>$info['studyDescription'],
|
|
|
- 'createdAt'=>date('Y-m-d H:i:s'),
|
|
|
- ];
|
|
|
- DB::table('exams')->insert($data);
|
|
|
- return $data;
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
public function insertStudy($info,$patient)
|
|
|
{
|
|
@@ -122,11 +96,38 @@ class Dcom extends Controller //Base
|
|
|
return $data;
|
|
|
}
|
|
|
}
|
|
|
+ public function insertExam($info,$patient,$study)
|
|
|
+ {
|
|
|
+ $where = [
|
|
|
+ 'study_id'=>$study['id']
|
|
|
+ ];
|
|
|
+ $exam = DB::table('exams')->where($where)->find();
|
|
|
+ if($exam){
|
|
|
+ return $exam;
|
|
|
+ }else{
|
|
|
+ $data = [
|
|
|
+ 'id'=>UUIDs::uuid16(),
|
|
|
+ 'patient_id'=>$patient['id'],
|
|
|
+ 'institution_id'=>$info['institutionCode'],
|
|
|
+ 'patient_num'=>$info['patientId'],
|
|
|
+ 'accession_num'=>$info['accessionNumber'],
|
|
|
+ 'exam_datetime'=>$info['studyDate'],
|
|
|
+ 'exam_class'=>$info['modality'],
|
|
|
+ 'study_id'=>$study['id'],
|
|
|
+ 'study_uid'=>$info['studyUid'],
|
|
|
+ 'illness_desc'=>$info['studyDescription'],
|
|
|
+ 'createdAt'=>date('Y-m-d H:i:s'),
|
|
|
+ ];
|
|
|
+ DB::table('exams')->insert($data);
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- public function insertSeries($info,$exam)
|
|
|
+ public function insertSeries($info,$study)
|
|
|
{
|
|
|
$where = [
|
|
|
- 'study_id'=>$info['studyId'],
|
|
|
+ 'study_id'=>$study['id'],
|
|
|
'seriesuid'=>$info['seriesUid']
|
|
|
];
|
|
|
$series = DB::table('series')->where($where)->find();
|
|
@@ -135,7 +136,7 @@ class Dcom extends Controller //Base
|
|
|
}else{
|
|
|
$data = [
|
|
|
'id'=>UUIDs::uuid16(),
|
|
|
- 'study_id'=>$info['studyId'],
|
|
|
+ 'study_id'=>$study['id'],
|
|
|
'seriesuid'=>$info['seriesUid'],
|
|
|
'series_num'=>$info['seriesNumber'],
|
|
|
'modality'=>$info['modality'],
|