report = $reportModel; $this->institution = $institutionModel; $this->exam = $examModel; $this->reportKeyword = $keywordreportModel; $this->visitKeyword = $keywordvisitModel; $this->visitModel = $visitModel; $this->smsLogModel = $smsLogModel; $this->analysisModel = $analysisModel; } public function getAllExamCount($where, $whereTime) { $all = $this->exam->where($where)->where($whereTime)->count(); return $all; } public function getAllNum($dateWhere,$where,$anotherWhere=[]) { return $this->exam->where($dateWhere)->where($where)->where($anotherWhere)->count(); } public function getExamGroupByIns($dateWhere,$where = [],$anotherWhere=[]) { return $this->exam->where($dateWhere)->where($where)->where($anotherWhere)->field('institution_id, count(*) as num')->group('institution_id')->select(); } public function getSmsNum($dateWhere,$where) { return $this->smsLogModel->where($dateWhere)->where($where)->count(); } public function getSmsNumGroupByIns($dateWhere,$where = [],$anotherWhere=[]) { return $this->smsLogModel->where($dateWhere)->where($where)->where($anotherWhere)->field('institution_id, count(*) as num')->group('institution_id')->select(); } public function saveAnalysis($arr) { $this->analysisModel->saveAll($arr); } public function getPvWechatVisit($where, $whereTime) { $all = $this->visitModel->where($where)->where($whereTime)->count(); return $all; } public function getUvWechatVisit($where, $whereTime) { $all = $this->visitModel ->where($where) ->where($whereTime) ->count('DISTINCT exam_id'); return $all; } function getPvUvWechatVisitGroupByIns($dateWhere, $where = [],$anotherWhere=[]) { $all = $this->visitModel ->where($dateWhere) ->where($where) ->where($anotherWhere) ->field('institution_id, count(*) as pv, count(DISTINCT exam_id) as uv') ->group('institution_id') ->select(); return $all; } public function getReportInfo($examId) { $info = $this->report->getReportInfo($examId); return $info; } public function getRemoteReportInfo($ra_id) { $info = $this->report->getRemoteReportInfo($ra_id); return $info; } public function getInstitutionData($where, $field) { $info = $this->report->getInstitutionData($where, $field); return $info; } public function getReportStatus($id) { $status = $this->report->getStatus($id); return $status; } public function getDoctorsName($id) { $doctorNames = $this->report->getDoctorName($id); if(empty($doctorNames)){ return null; } return $doctorNames; } public function getInstitution($dcotorId) { $info = $this->report->getInstitutionInfo($dcotorId); return $info; } public function getUser($token) { $user = $this->getCache($token); if(!$user){ $this->throwError('登陆信息失效,请重新进行登陆','0099'); } return $user; } public function saveBbs($info) { $info = $this->report->saveBbs($info); return $info; } public function getUserId($token) { $user = $this->getCache($token); if(!$user){ $this->throwError('登陆信息失效,请重新进行登陆','0099'); } return $user['id']; } public function getTrace($reportId) { $trace = $this->report->getTrace($reportId); return $trace; } public function remoteStage($token) { $trace = $this->getCache($token); if($trace){ Cache::rm($token); } } public function getOrderMoney($id) { $money = $this->report->getOrderMoney($id); return $money; } public function getStage($cacheToken) { $trace = $this->getCache($cacheToken); return $trace; } public function updateInstititonMoney($id,$money) { $info = $this->report->updateInstititonMoney($id,$money); return $info; } public function getCurrentMoney($id) { $money = $this->report->getCurrentMoney($id); return $money; } public function updateOrder($id,$status) { $info = $this->report->updateOrder($id,$status); return $info; } public function getExam($id) { $info = $this->report->getExam($id); return $info; } public function getOrderId($id) { $info = $this->report->getOrderId($id); return $info; } public function insertReport($data) { $info = $this->report->insertReport($data); return $info; } public function getMiddle($where) { $info = $this->report->getMiddle($where); return $info; } public function saveRmiddle($middle,$middleWhere = []) { $info = $this->report->saveRmiddle($middle,$middleWhere); return $info; } public function delStage($key) { $info = $this->delCache($key); return $info; } public function insertShare($data) { $info = $this->report->insertShare($data); return $info; } public function insertSMSLog($data) { $info = $this->smsLogModel->insert($data); return $info; } public function updateExamMsg($examId, $patientId, $examUp) { $info = $this->report->updateExam($examId, $patientId, $examUp); return $info; } public function updateRemote($id,$update) { $info = $this->report->updateRemote($id,$update); return $info; } public function getReportId($examId,$reportType) { $id = $this->report->getReportId($examId,$reportType); return $id; } public function getRemoteReportId($id) { $id = $this->report-> getRemoteReportId($id); return $id; } public function getInstitutionSms($id) { $sms = $this->report->getInstitutionSms($id); return $sms; } public function getInstitutionName($id) { $name = $this->report->getInstitutionName($id); return $name; } public function getApplicationId($examId) { $id = $this->report->getApplicationId($examId); return $id; } public function saveCache($key,$value,$time) { $this->setCache($key,$value,$time); } public function getDoctorInfo($id,$field) { $info = $this->report->getDoctorInfo($id,$field); return $info; } public function getPrintInfo($reportId,$is_remote) { $info = $this->report->getPrintInfo($reportId,$is_remote); return $info; } public function updateReport($examId,$type,$update) { $info = $this->report->updateReport($examId,$type,$update); return $info; } public function readMessage($id) { $info = $this->report->readMessage($id); return $info; } public function updateRemoteReport($id,$update) { $info = $this->report->updateRemoteReport($id,$update); return $info; } public function updateExamStatus($examId,$status) { $info = $this->report->updateExamStauts($examId,$status); return $info; } public function updateExamInfo($id,$update) { $info = $this->report->updateExamInfo($update,$id); return $info; } public function insertMessage($data) { $info = $this->report->insertMessage($data); return $info; } public function updateRemoteStauts($examId,$status) { $info = $this->report->updateRemoteStauts($examId,$status); return $info; } public function updateremoteExamStatus($examId,$status) { $info = $this->report->updateremoteExamStatus($examId,$status); return $info; } public function insertReportRecord($info) { $info = $this->report->insertRecord($info); return $info; } public function getDoctorClass($userId) { $info = $this->report->getDoctorClass($userId); return $info; } public function getReportById($id,$field) { $info = $this->report->getReportById($id,$field); return $info; } public function getReport($examId,$type,$ra_id=null) { $info = $this->report->getReport($examId,$type,$ra_id); return $info; } public function deleteAiReport($examId,$type) { $info = $this->report->deleteAiReport($examId,$type); return $info; } public function getXzData($id) { $info = $this->report->getXzData($id); return $info; } public function getDoctorName($id) { $info = $this->report->getDoctorRealName($id); return $info; } public function getUid($id) { $uid = $this->report->getUid($id); return $uid; } public function getAccession($id) { $info = $this->report->getAccession($id); return $info; } public function savePregressLog($log) { $this->report->savePregressLog($log); } public function saveVideo($data,$where) { $info = $this->report->saveVideo($data,$where); return $info; } public function cancel_video($id) { $info = $this->report->cancel_video($id); return $info; } public function getVideo($id) { $info = $this->report->getVideo($id); return $info; } public function insertDcmPath($data) { $info = $this->report->insertDcmPath($data); return $info; } public function updateDcmPath($where,$update) { $info = $this->report->updateDcmPath($where,$update); return $info; } public function getDcmPath($where,$study) { $info = $this->report->getDcmPath($where,$study); return $info; } public function getDcmPathData($where,$study) { $info = $this->report->getDcmPathData($where,$study); return $info; } public function insertReject($data) { $info = $this->report->insertReject($data); return $info; } public function checkLock($id) { $info = $this->report->checkLock($id); return $info; } public function updateEmailStatus($study, $email) { $info = $this->report->updateEmailStatus($study, $email); return $info; } public function getPatientName($study) { $name = $this->report->getPatientName($study); return $name; } public function insertNote($data) { $id = $this->report->insertNote($data); return $id; } public function saveDcmReportData($data,$exam,$type,$tsTime) { $info = $this->report->saveDcmReportData($data,$exam,$type,$tsTime); return $info; } public function getExamByStudy($study) { $info = $this->report->getExamByStudy($study); return $info; } public function getDmReport($date1, $date2) { $info = $this->report->getDmReport($date1, $date2); return $info; } public function getInsReport($date1, $date2,$ins,$remote,$page,$num) { $info = $this->report->getInsReport($date1, $date2,$ins,$remote,$page,$num); return $info; } public function insertDcmCompress($data) { $info = $this->report->insertDcmCompress($data); return $info; } public function updateDcmCompress($where,$data) { $info = $this->report->updateDcmCompress($where,$data); return $info; } public function getWechatData($openid) { $info = $this->report->getWechatData($openid); return $info; } public function getInsKeywordIds() { return $this->institution->where('keyword_switch',1)->column('id'); } public function getExamCount($where,$insWhere) { return $this->exam->where($where)->where($insWhere)->count(); } public function getAllPush($where) { return $this->reportKeyword->where($where)->select(); } public function getAllVisit($where,$where2 = []) { return $this->visitKeyword->where($where)->where($where2)->select(); } public function getLwSyncExam($institution, $num,$field) { $data = $this->exam->where('institution_id', $institution)->field($field)->limit(0, $num)->select(); return $data; } public function changeLwSyncStatus($id) { return $this->exam->where('id',$id)->update(['lw_sync_status'=>2]); } public function changeLwSyncReportStatus($id) { return $this->exam->where('id',$id)->update(['lw_report_sync_status'=>2]); } public function getAllIns() { return $this->institution->column('id,name'); } public function getExamList($where) { $exam = $this->exam->where($where)->field('id,name,card_num,patient_num,accession_num,exam_class,exam_datetime,sex,age,birthday,body_part_text')->select(); return $exam; } public function getExamReport($where) { $data = $this->exam->alias('e') ->join(['report'=>'r'],'r.exam_id = e.id and r.type=1','left') ->where($where) ->field('e.study_id,e.name,e.sex,e.age,e.exam_datetime,e.exam_class,e.body_part,e.body_part_text,r.impression,r.description,r.report_doctor_name,r.review_doctor_name,r.confirm_doctor_name,r.review_datetime,r.report_datetime,r.confirm_datetime,r.report_result') ->find(); return $data; } }