123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- namespace app\inter\controller;
- use think\Controller;
- use think\Request;
- use think\Db;
- class Dcquery extends Controller
- {
- public function index(){
- // 将来要添加Session控制
- // 不登录不能访问
- $request= Request::instance();
- $params=$request->param();
- if(!empty($params["studyid"]) && !empty($params["pid"])){
- //
- $whereArr=array();
- $whereArr["id"]=$params["studyid"];
- $whereArr["patient_id"]=$params["pid"];
- $study=Db::table("studies")->where($whereArr)->field("id,studyuid")->find();
- if(empty($study)){
- // 没有找到片子
- echo "empty!";
- return;
- }else{
- // 找到了片子,再去查询图像
- // 先找series
- $data=array();
- $studyListData=array();
- $studyData=array();
- $studyData["transactionId"]=$study["studyuid"];
- $studyData["patientName"]="userName";
- $series=Db::table("series")->where("study_id",$study["id"])->field("id,seriesuid,description")->select();
- if(count($series)>0){
- $seriesListData=array();
- foreach($series as $key=>$val){
- $seriesData=array();
-
- $seriesData["seriesInstanceUid"]=$val["seriesuid"];
- $seriesData["seriesDescription"]=$val["description"];
- $imgs=Db::table("images")->where("series_id",$val["id"])->field("id,columns,image_number,rows,sop_uid,url,metadata")->select();
- $imgsListData=array();
- foreach($imgs as $ikey=>$ival){
- $imgsData=array();
- $imgsData["columns"]=$ival["columns"];
- $imgsData["instanceNumber"]=$ival["image_number"];
- $imgsData["rows"]=$ival["rows"];
- $imgsData["sopInstanceUid"]=$ival["sop_uid"];
- $imgsData["url"]="dicomweb://dcm.pacsonline.cn/" . $ival["metadata"];
- array_push($imgsListData, $imgsData);
- }
- $seriesData["instances"]=$imgsListData;
- array_push($seriesListData, $seriesData);
- }
- $studyData["seriesList"]=$seriesListData;
- }
- array_push($studyListData, $studyData);
- }
- $data["transactionId"]=$study["studyuid"];
- $data["studies"]=$studyListData;
- echo json_encode($data);
- }else{
- echo "error param!";
- }
- }
-
-
- }
|