Пример #1
0
 public function getExpertRequestHistory()
 {
     $expertId = Session::get('expert_id');
     if (!isset($expertId)) {
         return json_encode(array('message' => 'not logged'));
     }
     $patientRequests = PatientRequest::where('status', 'completed')->where(function ($query) use($expertId) {
         $query->where('consultant_id', $expertId)->orWhere('expert_id', $expertId);
     })->with('Patient')->with('senderInstitute')->with('receiverInstitute')->get();
     if (isset($patientRequests) && count($patientRequests) > 0) {
         return json_encode(array('message' => 'found', 'patientRequests' => $patientRequests->toArray()));
     } else {
         return json_encode(array('message' => 'empty'));
     }
 }
Пример #2
0
 public function patientRequestHistory($patientId, $page = 1, $status = 'active')
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return json_encode(array('message' => 'not logged'));
     }
     $institute_id = Session::get('institute_id');
     if (isset($institute_id)) {
         $patientRequests = PatientRequest::where('connection_id', $institute_id)->where('patient_id', $patientId)->where('status', $status)->with('Institute')->get();
     } else {
         $patientRequests = PatientRequest::where('status', 'active')->where('patient_id', $patientId)->with('Institute')->get();
     }
     if (isset($patientRequests) && count($patientRequests) > 0) {
         return json_encode(array('message' => 'found', 'patientRequests' => $patientRequests->toArray()));
     } else {
         return json_encode(array('message' => 'empty'));
     }
 }