123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace app\api\model\api;
- use app\api\model\application\ApplicationModel;
- use app\api\model\doctor\DoctorModel;
- use app\api\model\message\MessageModel;
- use app\api\model\ZskkDefaultModel;
- use think\facade\Log;
- class ApiModel extends ZskkDefaultModel {
- protected $table= 'apis';
- protected $logName = "ApiModel";
- public function getRemoteExamList($institutionId, $fuzzyWhere, $moreWhere,$class_where, $params,$doctor_where)
- {
- try{
- $field = [
- 'a.name', 'a.sex', 'a.age',
- 'a.exam_id', 'a.patient_num', 'a.exam_class', 'a.exam_datetime', 'a.study_id', 'a.accession_num', 'a.exam_project','a.remote_institution_name',
- 'r.report_result', 'r.report_datetime','r.id AS rid',
- 'r.report_doctor_name',
- 'r.review_doctor_name',
- 'a.report_status',
- 'r.remote_application_id',
- 'a.id AS ra_id',
- 'ro.status','ro.id AS order_id'
- ];
- $list = ApplicationModel::alias('a')
- ->join(['remote_order'=>'ro'],'a.id=ro.application_id','left')
- ->join(['report'=>'r'],'r.remote_application_id=a.id','LEFT')
- ->where($fuzzyWhere)
- ->where($moreWhere)
- ->where($class_where)
- ->where($doctor_where)
- ->where('a.status',0)
- ->where('a.local_institution_id', $institutionId)
- ->field($field)
- ->page($params['page'],$params['num'])
- ->order('a.req_date_time desc')
- ->select();
- $total = ApplicationModel::alias('a')
- ->join(['report'=>'r'],'r.remote_application_id=a.id','LEFT')
- ->where($fuzzyWhere)
- ->where($moreWhere)
- ->where($class_where)
- ->where($doctor_where)
- ->where('a.status',0)
- ->where('a.local_institution_id', $institutionId)
- ->count();
- return ['total'=>$total, 'list'=>$list];
- } catch (Exception $exception){
- $this->throwError($exception->getMessage(),0001);
- }
- }
- public function updateAutograph($url,$id)
- {
- $info = DoctorModel::where('id',$id)->update(['autograph'=>$url,'autograph_type'=>2]);
- return $info;
- }
- public function autograph_switch($switch,$id)
- {
- $info = DoctorModel::where('id',$id)->update(['is_use_autograph'=>$switch]);
- return $info;
- }
- public function insertMessage($data)
- {
- $info = MessageModel::insert($data);
- return $info;
- }
- public function getAutograph($id)
- {
- $data = DoctorModel::where('id',$id)->field('is_use_autograph,autograph,autograph_type')->find();
- return $data;
- }
- }
|