workflow_level

This commit is contained in:
Dr Masroor Ehsan 2025-01-29 21:20:42 +06:00
parent b32ebecfaa
commit ef170b5357
2 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@
final readonly class Radiologists
{
public static function worklist_stats(int $days, int $report_status)
public static function worklist_stats(int $days, int $workflow_level)
{
$sql = <<<'SQL'
SELECT
@ -29,7 +29,7 @@ public static function worklist_stats(int $days, int $report_status)
WHERE
--st.received_at :: DATE >= NOW() - INTERVAL '3 DAY'
st.received_at::DATE >= NOW() - INTERVAL '%d DAY'
AND st.report_status < %d
AND st.workflow_level < %d
AND st.read_at IS NULL
GROUP BY
sa.user_id) AS cte ON cte.user_id = users."id"
@ -43,7 +43,7 @@ public static function worklist_stats(int $days, int $report_status)
users.display_name
SQL;
$rows = DB::select(sprintf($sql, $days, $report_status, Role::Radiologist));
$rows = DB::select(sprintf($sql, $days, $workflow_level, Role::Radiologist));
foreach ($rows as $row) {
$row->last_seen = UserService::getLastSeen((int) $row->id);
}

View File

@ -5,7 +5,7 @@
use App\DAL\Radiologists;
use App\Domain\ACL\Permission;
use App\Domain\ACL\Role;
use App\Domain\Report\ReportStatus;
use App\Domain\Study\WorkflowLevel;
use App\Http\Controllers\HashedStudyControllerBase;
use App\Http\Requests\AssignPhysicianRequest;
use App\Models\User;
@ -22,7 +22,7 @@ public function show()
->get(['id', 'display_name', 'profile_photo_path', 'first_name', 'last_name', 'created_at'])
->each(fn ($rad) => $rad->info = ['workload' => '', 'last_seen' => '']);
$stats = Radiologists::worklist_stats(3, ReportStatus::Finalized->value);
$stats = Radiologists::worklist_stats(3, WorkflowLevel::Finalized->value);
foreach ($stats as $rad) {
$found = $rads->where('id', $rad->id)->first();
if ($found) {