lgy 2 days ago
parent
commit
a4f40262c6

+ 40 - 7
jcjyhr/app/zskk/controller/Api.php

@@ -8,6 +8,7 @@ use app\common\library\Gm;
 use app\zskk\servies\EmpowerServies;
 use app\zskk\servies\HrServies;
 use app\zskk\servies\PatientServies;
+use think\facade\Config;
 
 class Api extends ApiController
 {
@@ -259,17 +260,49 @@ class Api extends ApiController
     public function getAllToken(EmpowerServies $servies, PatientServies $patientServies)
     {
         $params = $this->request->post();
-        $data['clientid'] = '12371600494581158K'; //机构编码
-        $data['clientsecret'] = '837ffb03803b72cd99a941770fb6b2be';  //授权码
-        $data = $servies->getInsToken($data);
+//        $data['clientid'] = '12371600494581158K'; //机构编码
+//        $data['clientsecret'] = '837ffb03803b72cd99a941770fb6b2be';  //授权码
+//        $data = $servies->getInsToken($data);
         $idCard = $patientServies->getIdCard($params['mpi']);
         $medical_information = $patientServies->getMedical($params['mpi']);
         $arr['ID_CARDNUM'] = $idCard;
-        $arr['ORGCODE'] = '12371600494581158K';
-        $arr['ORGNAME'] = '滨州市优抚医院';
-        $arr['DOCTORNAME'] = '贝远';
-        $arr['DOCTORCODE'] = '00010005';
+        $arr['ORGCODE'] = $medical_information['ORGCODE'];
+        $arr['ORGNAME'] = $medical_information['ORGNAME'];
         $return = $servies->getRecogToken($arr);
         $this->success('', ['TOKEN'=>$return]);
     }
+
+    public function getPatientExam(PatientServies $patientServies)
+    {
+        $params = $this->request->post();
+        $arr = $patientServies->getPatientExam($params);
+        $this->success('success', $arr);
+    }
+
+    public function getPatientLab(PatientServies $patientServies)
+    {
+        $params = $this->request->post();
+        $arr = $patientServies->getPatientLab($params);
+        $this->success('success', $arr);
+    }
+
+    public function getLabData(PatientServies $patientServies)
+    {
+        $params = $this->request->post();
+        $arr = $patientServies->getLabData($params);
+        $this->success('success', $arr);
+    }
+
+    public function getPatientJCJYUrl()
+    {
+        $params = $this->request->post();
+        $idCard = $params['cardNum'] ?? '';
+        if(empty($idCard))
+        {
+            $this->error('系统错误');
+        }
+        $data = base64_encode($idCard);
+        $url = '/getPatientCheck?data='.$data;
+        $this->success('success', $url);
+    }
 }

+ 4 - 4
jcjyhr/app/zskk/model/Patient.php

@@ -39,9 +39,9 @@ class Patient extends ZskkModel
         (new Mpi())->save(['MPI'=>$mpi,'ID_CARDNUM'=>$idCard,'MPI_KEY'=>$mpiKey]);
     }
 
-    public function getPatientsByID_CARDNUM($ID_CARDNUM)
+    public function getPatientsByID_CARDNUM($ID_CARDNUM,$where = [])
     {
-        return (new Patient())->where('ID_CARDNUM', $ID_CARDNUM)->field(['NAME','ID_CARD_CODE','ID_CARDNUM','GENDER_CODE','BIRTH_DATE','PATIENT_CODE'])->select();
+        return (new Patient())->where('ID_CARDNUM', $ID_CARDNUM)->where($where)->field(['NAME','ID_CARD_CODE','ID_CARDNUM','GENDER_CODE','BIRTH_DATE','PATIENT_CODE','PHONE'])->select();
     }
     
     /**
@@ -199,7 +199,7 @@ class Patient extends ZskkModel
     public function getExam($patientCode,$where=[])
     {
         // return (new ExamReport())->where('PATIENT_CODE',$patientCode)->field(['NAME','SERIESNUM', 'EXAM_REQUESTID', 'REPORTID', 'EXAM_ITEMNAME', 'BODYSITE_CATEG', 'BODYSITE_CATEG_CODE', 'BODYSITE', 'OBSERVATIONS_COMMENT', 'OBSERVATIONS_RESULT', 'BODYSITE_CATEG_CODE', 'BODYSITE', 'OBSERVATIONS_COMMENT', 'OBSERVATIONS_RESULT', 'IMAGES', 'DICOM_INDEXID', 'DICOM_INDEXID', 'OBSERVATIONS_COMMENT', 'OBSERVATIONS_RESULT', 'IMAGES', 'DICOM_INDEXID', 'EXAM_ITEMNAME','EXAM_APPLICATION_CODE','STUDYTIME','EXAM_ITEMNAME_CODE','EXAM_REPORT_CODE','PRACTITIONERNAME'])->select()->toArray();
-        return (new ExamReport())->where('PATIENT_CODE',$patientCode)->where($where)->field(['REQUESTID','REPORTID','DEVICETYPE_CODE','EXAM_ITEMNAME','EXAM_ITEMNAME_CODE','BODYSITE','OBSERVATIONS_COMMENT','OBSERVATIONS_RESULT','RESULT_STATUS_CODE', 'RESULT_STATUS', 'HR_RANGE','HR_ITEMNAME_CODE', 'HR_ITEMNAME','IMAGES','STUDY_ID', 'ORGNAME','ORGCODE','DEPTNAME','PRACTITIONERNAME','AUDITNAME','REPORTTIME','STUDYTIME','REPORT'])->select()->toArray();
+        return (new ExamReport())->where('PATIENT_CODE',$patientCode)->where($where)->field(['SERIESNUM','REQUESTID','REPORTID','DEVICETYPE_CODE','EXAM_ITEMNAME','EXAM_ITEMNAME_CODE','BODYSITE','OBSERVATIONS_COMMENT','OBSERVATIONS_RESULT','RESULT_STATUS_CODE', 'RESULT_STATUS', 'HR_RANGE','HR_ITEMNAME_CODE', 'HR_ITEMNAME','IMAGES','STUDY_ID', 'ORGNAME','ORGCODE','DEPTNAME','PRACTITIONERNAME','AUDITNAME','REPORTTIME','STUDYTIME','REPORT'])->select()->toArray();
     }
 
     public function saveReportStudy($studyUid,$studyId)
@@ -215,7 +215,7 @@ class Patient extends ZskkModel
     public function getInspect($patientCode,$where=[])
     {
         // return (new InspectReport())->where('PATIENT_CODE',$patientCode)->field(['NAME','SERIESNUM', 'EXAM_REQUESTID', 'REPORTID', 'SPECIMEN_TYPE', 'ORGCODE', 'ORGNAME', 'DEPTNAME', 'PRACTITIONERNAME', 'AUDITNAME', 'REPORTTIME', 'REPORTSTATUS', 'GENDER', 'GENDER_CODE', 'AGE', 'LAB_ITEMNAME', 'LAB_ITEMNAME_CODE', 'LAB_ITEMNAME_NUMBER', 'LAB_HR_STATUS', 'LAB_HR_ITEMNAME', 'LAB_HR_ITEMNAME_CODE','INSPECT_REPORT_CODE'])->select()->toArray();
-        return (new InspectReport())->where('PATIENT_CODE',$patientCode)->where($where)->field(['REPORTID','LAB_ITEMNAME','LAB_ITEMNAME_TYPE_CODE','PRACTITIONERNAME','AUDITNAME','ORGNAME','ORGCODE','DEPTNAME','REPORT_COMMENT','REPORTTIME','REPORT','LAB_HR_ITEMNAME_CODE', 'LAB_HR_ITEMNAME', 'HR_RANGE','SPECIMEN_TYPE','INSPECT_REPORT_CODE','RECOG_STATUS'])->select()->toArray();
+        return (new InspectReport())->where('PATIENT_CODE',$patientCode)->where($where)->field(['SERIESNUM','REPORTID','LAB_ITEMNAME','LAB_ITEMNAME_TYPE_CODE','PRACTITIONERNAME','AUDITNAME','ORGNAME','ORGCODE','DEPTNAME','REPORT_COMMENT','REPORTTIME','REPORT','LAB_HR_ITEMNAME_CODE', 'LAB_HR_ITEMNAME', 'HR_RANGE','SPECIMEN_TYPE','INSPECT_REPORT_CODE','RECOG_STATUS'])->select()->toArray();
     }
 
     public function getInspectData($where,$field)

+ 75 - 0
jcjyhr/app/zskk/servies/PatientServies.php

@@ -1379,4 +1379,79 @@ class PatientServies
         $exam = $this->patientModel->saveReportStudy($studyUid,$study_id);
         return 'success';
     }
+
+    public function getMedical($mpi)
+    {
+        $arr = $this->patientModel->getMedical($mpi);
+        return $arr;
+    }
+
+    public function getPatientExam($params)
+    {
+        $idCard = Gm::encrypt(Config::get('gm.key'),$params['id_card']);
+        $where = [];
+        $time = $params['time'] ?? '';
+        if(!empty($time))
+        {
+            $time = explode(',',$time);
+            $where = "CREATE_TIME BETWEEN '$time[0]' and '$time[1]'";
+        }
+        $patient = $this->patientModel->getPatientsByID_CARDNUM($idCard,$where);
+        $list = [];
+        foreach ($patient as $v)
+        {
+            $exam = $this->patientModel->getExam($v['PATIENT_CODE']);
+            $medical = $this->patientModel->getMedical($v['PATIENT_CODE']);
+            foreach ($exam as $value)
+            {
+                if(!empty($value))
+                {
+                    $value['AGE'] = $medical['AGE'];
+                    $value['GENDER'] = $medical['GENDER'];
+                    $value['PHONE'] = $v['PHONE'];
+                    $list[] = $value;
+                }
+            }
+        }
+        return $list;
+    }
+
+    public function getPatientLab($params)
+    {
+        $idCard = Gm::encrypt(Config::get('gm.key'),$params['id_card']);
+        $where = [];
+        $time = $params['time'] ?? '';
+        if(!empty($time))
+        {
+            $time = explode(',',$time);
+            $where = "CREATE_TIME BETWEEN '$time[0]' and '$time[1]'";
+        }
+        $patient = $this->patientModel->getPatientsByID_CARDNUM($idCard,$where);
+        $list = [];
+        foreach ($patient as $v)
+        {
+            $arr = [];
+            $lab = $this->patientModel->getInspect($v['PATIENT_CODE']);
+            $medical = $this->patientModel->getMedical($v['PATIENT_CODE']);
+            foreach ($lab as $value)
+            {
+                if(!empty($value))
+                {
+                    $value['AGE'] = $medical['AGE'];
+                    $value['GENDER'] = $medical['GENDER'];
+                    $value['PHONE'] = $v['PHONE'];
+                    $list[] = $value;
+                }
+                $list[] = $value;
+            }
+        }
+        return $list;
+    }
+
+    public function getLabData($params)
+    {
+        $lab = $this->patientModel->getLab($params['INSPECT_REPORT_CODE']);
+        return $lab;
+    }
+
 }

+ 1 - 1
jcjyhr/config/log.php

@@ -27,7 +27,7 @@ return [
             // 独立日志级别
             'apart_level'    => ['error','sql'],
             // 最大日志文件数量
-            'max_files'      => 0,
+            'max_files'      => 30,
             // 使用JSON格式记录
             'json'           => false,
             // 日志处理

+ 1 - 0
jcjyhr/route/route.php

@@ -22,6 +22,7 @@ Route::post('api/saveRecogResult', 'app\zskk\controller\Api@saveRecogResult');
 Route::post('basic-api/getRecogToken', 'app\zskk\controller\Api@getRecogToken');
 Route::post('api/getRecogCheck', 'app\zskk\controller\Api@getRecogCheck');
 Route::post('basic-api/getShareToken', 'app\zskk\controller\Api@getShareToken');
+Route::post('getPatientJCJYUrl', 'app\zskk\controller\Api@getPatientJCJYUrl');
 return [
 
 ];