|
@@ -8,6 +8,7 @@
|
|
|
|
|
|
namespace app\inter\controller;
|
|
namespace app\inter\controller;
|
|
|
|
|
|
|
|
+use EasyWeChat\Core\Exception;
|
|
use think\Controller;
|
|
use think\Controller;
|
|
use think\Request;
|
|
use think\Request;
|
|
use think\Db;
|
|
use think\Db;
|
|
@@ -114,6 +115,7 @@ class Dcquery extends Controller
|
|
*")
|
|
*")
|
|
**/
|
|
**/
|
|
public function get_studiesinfo(){
|
|
public function get_studiesinfo(){
|
|
|
|
+<<<<<<< HEAD
|
|
$study_id = $_REQUEST['study_id'];
|
|
$study_id = $_REQUEST['study_id'];
|
|
if(isset($_REQUEST['address']) && !empty($_REQUEST['address'])){
|
|
if(isset($_REQUEST['address']) && !empty($_REQUEST['address'])){
|
|
$url = $_REQUEST['address'];
|
|
$url = $_REQUEST['address'];
|
|
@@ -152,12 +154,64 @@ class Dcquery extends Controller
|
|
$file = ROOT_PATH . 'public' . DS . 'get_studiesinfo/'.date('Ymd').'-fail.log';
|
|
$file = ROOT_PATH . 'public' . DS . 'get_studiesinfo/'.date('Ymd').'-fail.log';
|
|
$log = 'url错误,传值为--'.$url;
|
|
$log = 'url错误,传值为--'.$url;
|
|
file_put_contents($file, $log,FILE_APPEND);
|
|
file_put_contents($file, $log,FILE_APPEND);
|
|
|
|
+=======
|
|
|
|
+ try{
|
|
|
|
+ $study_id = $_REQUEST['study_id'];
|
|
|
|
+ if(isset($_REQUEST['address']) && !empty($_REQUEST['address'])){
|
|
|
|
+ $url = $_REQUEST['address'];
|
|
|
|
+ }else{
|
|
|
|
+ $url = '';
|
|
|
|
+ }
|
|
|
|
+ $info = array();
|
|
|
|
+ if(strlen($study_id) == '16'){
|
|
|
|
+ $study_info = DB::table('studies')->where('id',$study_id)->field('id,studyuid,studyid,patient_id')->find();
|
|
|
|
+ }else{
|
|
|
|
+ $study_info = DB::table('studies')->where('studyuid',$study_id)->field('id,studyuid,studyid,patient_id')->find();
|
|
|
|
+ }
|
|
|
|
+ $info['studyInstanceUid'] = $study_info['studyuid'];
|
|
|
|
+ $patient_info = DB::table('patient_infos')->where('id',$study_info['patient_id'])->field('birthday,institution_id,temp_patient_id,name,age,sex')->find();
|
|
|
|
+ $date = DB::table('exams')->where('patient_id',$study_info['patient_id'])->field('exam_datetime')->find();
|
|
|
|
+ $institution = DB::table('institution')->where('id',$patient_info['institution_id'])->field('name')->find();
|
|
|
|
+ $info['patientName'] = $patient_info['name'];
|
|
|
|
+ // 根据series_num排序
|
|
|
|
+ $series_list = DB::table('series')->where('study_id',$study_info['id'])->where('modality','not in','PR,SR')->field('id,series_num,seriesuid,description')->order('series_num asc')->select();
|
|
|
|
+ $series = array();
|
|
|
|
+ $error = 1;
|
|
|
|
+ foreach($series_list as $k=>$v){
|
|
|
|
+ // image_number排序
|
|
|
|
+ $image = DB::table('images')->where('series_id',$v['id'])->field('remote_url,local_url,status,columns,image_number as instanceNumber,rows,image_id as sopInstanceUid,metadata,url')->order('image_number asc')->select();
|
|
|
|
+ if(empty($image)){
|
|
|
|
+>>>>>>> dfb61aa0cde67811d87676a8f24f7ceb2f3acf4b
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- $image[$key]['url'] = $imageUrl;
|
|
|
|
- $image[$key]['imageNumber'] = $value['instanceNumber'];
|
|
|
|
|
|
+ $error = 2;
|
|
|
|
+ foreach($image as $key=>$value){
|
|
|
|
+ /*if(empty($url)){
|
|
|
|
+ if(substr($value['metadata'], 0, strlen('group')) === 'group'){
|
|
|
|
+ $image[$key]['url'] = "dicomweb://dcm.pacsonline.cn/".$value['metadata'];
|
|
|
|
+ }else{
|
|
|
|
+ $image[$key]['url'] = "dicomweb://static.dcm.pacsonline.cn/".$value['metadata'];
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ $image[$key]['url'] = $url.$value['metadata'];
|
|
|
|
+ }*/
|
|
|
|
+ $imageUrl = $this->generateUrl($value['url'],$url,$value['remote_url'],$value['local_url'],$value['status'],$value['metadata']);
|
|
|
|
+ if(!$imageUrl){
|
|
|
|
+ $file = ROOT_PATH . 'public' . DS . 'get_studiesinfo/'.date('Ymd').'-fail.log';
|
|
|
|
+ $log = 'url错误,传值为--'.$url;
|
|
|
|
+ file_put_contents($file, $log,FILE_APPEND);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ $image[$key]['url'] = $imageUrl;
|
|
|
|
+ $image[$key]['imageNumber'] = $value['instanceNumber'];
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ $series[$k]['instances'] = $image;
|
|
|
|
+ $series[$k]['seriesInstanceUid'] = $v['seriesuid'];
|
|
|
|
+ $series[$k]['seriesDescription'] = $v['description'];
|
|
|
|
+ $series[$k]['seriesNumber'] = $v['series_num'];
|
|
}
|
|
}
|
|
|
|
+<<<<<<< HEAD
|
|
$series[$k]['instances'] = $image;
|
|
$series[$k]['instances'] = $image;
|
|
$series[$k]['seriesInstanceUid'] = $v['seriesuid'];
|
|
$series[$k]['seriesInstanceUid'] = $v['seriesuid'];
|
|
$series[$k]['seriesDescription'] = $v['description'];
|
|
$series[$k]['seriesDescription'] = $v['description'];
|
|
@@ -177,14 +231,33 @@ class Dcquery extends Controller
|
|
$info['patientAge'] = $age;
|
|
$info['patientAge'] = $age;
|
|
}else{
|
|
}else{
|
|
$info['patientAge'] = '';
|
|
$info['patientAge'] = '';
|
|
|
|
+=======
|
|
|
|
+ if($error == 1){
|
|
|
|
+ throw new Exception('series列表为空');
|
|
|
|
+ }
|
|
|
|
+ $info['seriesList'] = $series;
|
|
|
|
+ $return = array();
|
|
|
|
+ $return['transactionId'] = $study_info['studyuid'];
|
|
|
|
+ if(!empty($patient_info['age'])){
|
|
|
|
+ $info['patientAge'] = $patient_info['age'];
|
|
|
|
+ }elseif(!empty($patient_info['birthday'])){
|
|
|
|
+ $time = date('Ymd',time());
|
|
|
|
+ $age = floor(($time - $patient_info['birthday'])/10000);
|
|
|
|
+ $info['patientAge'] = $age;
|
|
|
|
+ }else{
|
|
|
|
+ $info['patientAge'] = '';
|
|
|
|
+ }
|
|
|
|
+ $info['patientSex'] = $patient_info['sex'];
|
|
|
|
+ $info['studyDate'] = $date['exam_datetime'];
|
|
|
|
+ $info['studyid'] = $study_info['studyid'];
|
|
|
|
+ $info['patientId'] = $patient_info['temp_patient_id'];
|
|
|
|
+ $info['institution'] = $institution['name'];
|
|
|
|
+ $return['studies'][] = $info;
|
|
|
|
+ return json_encode($return);
|
|
|
|
+ }catch(Exception $e){
|
|
|
|
+ echo $e->getMessage();
|
|
|
|
+>>>>>>> dfb61aa0cde67811d87676a8f24f7ceb2f3acf4b
|
|
}
|
|
}
|
|
- $info['patientSex'] = $patient_info['sex'];
|
|
|
|
- $info['studyDate'] = $date['exam_datetime'];
|
|
|
|
- $info['studyid'] = $study_info['studyid'];
|
|
|
|
- $info['patientId'] = $patient_info['temp_patient_id'];
|
|
|
|
- $info['institution'] = $institution['name'];
|
|
|
|
- $return['studies'][] = $info;
|
|
|
|
- return json_encode($return);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|