|
@@ -132,11 +132,11 @@ class Reciveremote extends Base
|
|
|
$sql3 = "SELECT e.exam_status,e.exam_class,e.body_part,e.device,e.exam_sub_class,e.exam_datetime,p.name,p.sex,p.temp_patient_id,p.age,ra.*,r.report_doctor_id,r.report_datetime,r.report_result,e.id from exams as e,remote_application as ra,patient_infos as p,report as r where ra.exam_id=e.id and e.patient_id=p.id and r.exam_id=e.id and ra.remote_institution_id='" . $doctor['institution_id'] . "'and e.exam_status not in (".$dclass['doctor_class'].")";
|
|
|
$sql = '('.$sql1.') union ('.$sql2.') union ('.$sql3.')'.$limit;
|
|
|
}else{*/
|
|
|
- $sql = "SELECT e.id,e.exam_status,e.exam_class,e.exam_sub_class,e.body_part,e.device,e.exam_datetime,p.name,p.sex,p.temp_patient_id,p.age,ra.id as ra_id,ra.*,r.id as report_id,r.report_doctor_id,r.report_datetime,r.report_result,e.id from exams as e,remote_application as ra,patient_infos as p,report as r where (ra.remote_doctor_id='".$doctor['id']."' or ra.remote_doctor_id='') and ra.exam_id=e.id and e.patient_id=p.id and r.exam_id=e.id and r.remote_application_id=ra.id and ra.remote_institution_id='" . $doctor['institution_id']."'".$where." order by field(e.exam_status,6,7,8,4,9,5),ra.is_urgent desc,ra.req_date_time desc";
|
|
|
+ $sql = "SELECT e.id,e.exam_status,e.exam_class,e.exam_sub_class,e.body_part,e.device,e.exam_datetime,p.name,p.sex,p.temp_patient_id,p.age,ra.id as ra_id,ra.*,r.id as report_id,r.report_doctor_id,r.report_datetime,r.report_result,e.id from exams as e,remote_application as ra,patient_infos as p,report as r where (ra.remote_doctor_id='".$doctor['id']."' or ra.remote_doctor_id='') and ra.exam_id=e.id and e.patient_id=p.id and r.exam_id=e.id and r.remote_application_id=ra.id and ra.report_status !='' and ra.remote_institution_id='" . $doctor['institution_id']."'".$where." order by field(e.exam_status,6,7,8,4,9,5),ra.is_urgent desc,ra.req_date_time desc";
|
|
|
// }
|
|
|
log::record($sql);
|
|
|
$list = DB::query($sql);
|
|
|
- $csql = "SELECT count(1) from exams as e,remote_application as ra,patient_infos as p,report as r where (ra.remote_doctor_id='".$doctor['id']."' or ra.remote_doctor_id='') and r.remote_application_id=ra.id and ra.exam_id=e.id and e.patient_id=p.id and r.exam_id=e.id and ra.remote_institution_id='" . $doctor['institution_id']."'".$where;
|
|
|
+ $csql = "SELECT count(1) from exams as e,remote_application as ra,patient_infos as p,report as r where (ra.remote_doctor_id='".$doctor['id']."' or ra.remote_doctor_id='') and r.remote_application_id=ra.id and ra.exam_id=e.id and ra.report_status !='' and e.patient_id=p.id and r.exam_id=e.id and ra.remote_institution_id='" . $doctor['institution_id']."'".$where;
|
|
|
$count = DB::query($csql);
|
|
|
foreach ($list as $k => $v) {
|
|
|
$cache_key = $doctor['id'].'_'.$v['id'];
|