table('stt_LastJournalHistoryEntry as lj') ->join('stt_MedicalHistory as mh', 'mh.MedicalHistoryID', '=', 'lj.rf_MedicalHistoryID') ->join('stt_MigrationPatient as mp', 'mp.MigrationPatientID', '=', 'lj.rf_MigrationPatientID') ->leftJoin('stt_StationarBranch as sb', 'sb.StationarBranchID', '=', 'mp.rf_StationarBranchID') ->leftJoin('oms_Department as d', 'd.DepartmentID', '=', 'sb.rf_DepartmentID') ->select($this::JOURNAL_SELECT) ->where('lj.rf_ExtractMigrationPatientId', '=', 0) ->where('d.DepartmentID', '=', $departmentId) ->orderBy('mh.DateRecipient'); $results = Cache::remember($this::TTL_KEY . $departmentId, $this::TTL, function () use ($query) { return $query->get(); }); return $results; } public function getById(int $patientId) { // TODO: Implement getById() method. } }