#2 — Don't-miss tooltip (encounters HPI + sick visit, max 5) - New POST /api/dont-miss returning {points: [{point, why}]} capped at 5 (cap defended both in the prompt and server-side .slice(0,5)) - New dontMissTooltip prompt in prompts.js - New suggestDontMiss() helper in app.js mirroring suggestBillingCodes; inserts an orange-bordered card next to the note output, silent on empty - Wired into liveEncounter.js (encounter HPI) and sickVisit.js. Not added to wellvisit/soap/hospital/chart per spec. #1 — Bedside suture selector - New ES module public/js/bedside/sutures.js (~300L) following the burns.js pattern: site × age × tension × cosmetic × contamination × hours-since-injury → material, size, technique, removal day range, glue/Steri-strip alternative, warnings, tetanus reminder. - 15 anatomic sites covered (face, eyelid, lip vermilion, intraoral, ear, scalp, neck, trunk, upper/lower ext, hand, foot, joint surface, genitalia, fingertip). - Bites: cat/human → don't-close-primarily warning; dog bite to hand → loose-approximation note. Heavy contamination → delayed primary closure. >12h non-face/scalp → judgment call note. - Removal days shown as ranges (3–5, 7–10, 10–14) per source norms, not single midpoints. - Subungual hematoma trephination guidance corrected: any painful hematoma with intact nail and no displaced fracture (especially if 25–50% or more), per current UpToDate guidance. - Inline citation: Roberts & Hedges 7e (2019), Fleisher & Ludwig 8e, AAP Section on EM, UpToDate (Pope JV). - Pill registered in sub-nav SECTIONS + bedside/index.js. Persists active state via existing UIState helper. All 46 tests pass.
43 lines
1.8 KiB
JavaScript
43 lines
1.8 KiB
JavaScript
// ============================================================
|
|
// bedside/sub-nav.js
|
|
// EMERGENCIES SUB-NAV — data-em pill switching.
|
|
// Persists the active pill so reloads / sign-out-sign-in land on the
|
|
// same sub-section the user was last looking at.
|
|
// ============================================================
|
|
|
|
var SECTIONS = ['neonatal','airway','cardiac','respiratory','ventilation','seizure','sepsis','anaphylaxis','sedation','agitation','antiemetics','antimicrobials','burns','toxicology','trauma','sutures'];
|
|
|
|
function activate(emKey) {
|
|
var pill = document.querySelector('[data-em="' + emKey + '"]');
|
|
if (!pill) return false;
|
|
document.querySelectorAll('[data-em]').forEach(function(p) { p.classList.remove('active'); });
|
|
pill.classList.add('active');
|
|
SECTIONS.forEach(function(s) {
|
|
var el = document.getElementById('em-' + s);
|
|
if (el) el.style.display = emKey === s ? '' : 'none';
|
|
});
|
|
return true;
|
|
}
|
|
|
|
export function init() {
|
|
document.addEventListener('click', function(e) {
|
|
var pill = e.target.closest('[data-em]');
|
|
if (!pill) return;
|
|
activate(pill.dataset.em);
|
|
if (window.UIState) window.UIState.set('bedside.pill', pill.dataset.em);
|
|
});
|
|
// Restore on load. The bedside component is lazily injected the first time
|
|
// the tab is activated, so try both an immediate pass (harness where the
|
|
// DOM is synchronously ready) and a tabChanged listener (live app where
|
|
// the component HTML arrives async). Either path reaches the same
|
|
// activate(saved) call — whichever fires first wins; the other is a noop.
|
|
function applySaved() {
|
|
if (!window.UIState) return;
|
|
var saved = window.UIState.get('bedside.pill');
|
|
if (saved) activate(saved);
|
|
}
|
|
applySaved();
|
|
document.addEventListener('tabChanged', function(e) {
|
|
if (e.detail && e.detail.tab === 'bedside') applySaved();
|
|
});
|
|
}
|