feat(treatment): per-case operators, shown on the list and searchable

A treatment case said which doctor supervised it but never who actually did the
work, so the list could not answer the first question a manager asks about a
course: who performed it.

Two separate things now travel with the case. `performed_by` is history —
derived from the sessions' performedBy, so it only ever reports what happened.
`assigned_staff` is plan — a new treatment_case_staff table, editable from the
modal, saying who is meant to handle this patient's course. The card shows the
first and falls back to the second while nothing has been performed yet.

Search matches both. A manager typing an operator's name wants that person's
work, and work already done is part of it.

Assignment also narrows the operator queue: a case with assigned staff shows its
sessions only to those people, because a patient who started a multi-session
course with one operator should keep them. An unassigned case keeps the existing
protocol rule, and an empty list means "anyone the protocol allows" rather than
"nobody" — the same "no rows is not a restriction" convention used elsewhere.

Unlike areas, removing an operator erases nothing: a finished session carries its
real operator on itself and never consults this list.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-08-07 14:55:01 +03:30
co-authored by Claude Opus 5
parent 12c0d57e1a
commit b78f7311cf
13 changed files with 416 additions and 6 deletions
+4
View File
@@ -1341,6 +1341,10 @@ export interface TreatmentCaseSummary {
record_number: string | null;
};
areas: Array<{ uuid: string; name: string; category_uuid: string | null }>;
/** اپراتورهای اختصاص‌یافته — برنامه. خالی یعنی «هر کسی که پروتکل مجاز دانسته». */
assigned_staff: Array<{ uuid: string; name: string }>;
/** اپراتورهایی که واقعاً جلسه‌ای از این پرونده را انجام داده‌اند — سابقه. */
performed_by: Array<{ uuid: string; name: string }>;
sessions?: TreatmentSessionSummary[];
}