Comprendre et références · Comprendre

Le cycle de vie du séjour

A discharge used to be a status change on one resource. Everything else carried on as if the patient were still in a bed: the Problems of this stay list still described a stay that was over, the stay's prescriptions were still active, the administration tab still offered to give the next dose. None of it was flagged, which is the worst kind of wrong — a chart that keeps asserting things nobody wrote.

So the discharge now ends three things, and the chart reads differently when no stay is in progress.

What a discharge ends

The stay's treatments stop. What the patient leaves with is the discharge prescription; the inpatient lines end with the stay. They are stopped as of the discharge time, not as of the moment the form was filled: on a back-dated discharge, "now" would produce a stop several days after the stay ended, and an administration plan that contradicts itself.

The problem list is reviewed — see below. This is the half of the four-list model that was missing: without it the on-call clinician's short list survives the stay it described, and the patient comes back six months later carrying the focus of care of a finished hospitalisation.

The encounter closes, as before.

The discharge review

The drawer lists the problems to settle: those of this stay and those of the persistent list (multidisciplinary concerns are not diagnoses and never move between medical lists; past history is already there; ruled-out hypotheses appear in no list at all, and bringing them back into a review would restore the existence just withdrawn).

Two destinations, and the default is not neutral:

Action Destination
ticked resolved past history, resolved
left unticked the persistent list — not the bin

What the clinician ticks is "this is over". Leaving everything unticked sends everything to the persistent list, which is the safe option, and that is deliberate: losing a renal insufficiency discovered during the stay is exactly the omission the persistent list's bidirectional admission test exists to prevent. A problem that is already persistent and not ticked produces no write at all — the audit trail should not fill with non-events.

Ticking a problem that is not part of the review is refused rather than written blind: a desynchronised screen or a forged request both land there.

How a chart reads with no stay in progress

The discriminator is an inpatient stay in progress — not "some encounter". A consultation has no administrations, no targeted handovers and no inpatient regimen either, so it reads like a chart outside a stay (chartMode returns ambulatory, inpatient or closed).

Outside a stay:

  • No Administrations tab, no Transmissions tab. Nothing is being given, and targeted handovers are a ward-team tool.
  • No reconciliation in the background tab: it compares home medication against the stay's lines, and there are none.
  • The Synthesis reads as a journey: the persistent problems, past history, and — new — the past stays with what their focus of care was at the time.

The journey, and why it is a re-reading

After the review, a stay problem has joined the persistent list or past history and has lost its stay context on screen. It keeps it in the data: the problem retains its encounterId. So the journey section groups problems by finished stay and shows each stay's own problems, struck through when resolved. It is a re-reading, never a second source of truth.

Two limits worth stating. A stay with no marked problem does not appear at all — nothing to say about it here. And problems created through the older path carry no encounter reference (that mapper deliberately never wrote one), so a legacy chart shows an empty journey until its stays are marked.

Charts discharged before this existed

Two leftovers, handled differently on purpose.

Treatments are unambiguous: a patient with no stay in progress carrying an active line that is not a discharge prescription is a leftover, full stop. pnpm --filter ehr-lab repair:closed-stays stops those, at the discharge time of the last closed stay, and never touches a discharge prescription. Nothing is written without --write.

Problems are not. "Resolved" or "persists" is a clinical decision, and deducing it from a stay's end date would be taking that decision on the clinician's behalf. So they are flagged, not reclassified: when the stay is over and stay problems remain, the list says so and asks for the call, with the amber rule the rest of the app uses for "a decision is expected here". The edit drawer moves them.