update readme

do  Ward table missing critical clinical columns
This commit is contained in:
voltsrage
2026-06-23 18:24:49 +08:00
parent 5d46200941
commit dd0fd88731
10 changed files with 365 additions and 26 deletions
@@ -16,9 +16,16 @@ const patients = [
firstName: 'Alice',
lastName: 'A',
mrn: 'M1',
room: '101',
roomBed: '101',
status: 'Active',
news2Score: 3,
sofaScore: 4,
sofaDelta: 0,
gcsScore: 15,
qsofaScore: 0,
attendingPhysician: 'Dr. A',
admittedAt: '2026-06-21T10:00:00Z',
lastObservationAt: '2026-06-23T13:00:00Z',
sepsisActive: false,
openAlertCount: 0,
},
@@ -27,9 +34,16 @@ const patients = [
firstName: 'Bob',
lastName: 'B',
mrn: 'M2',
room: '102',
roomBed: '102',
status: 'Active',
news2Score: 5,
sofaScore: 6,
sofaDelta: 1,
gcsScore: 12,
qsofaScore: 1,
attendingPhysician: 'Dr. B',
admittedAt: '2026-06-22T10:00:00Z',
lastObservationAt: '2026-06-23T10:00:00Z',
sepsisActive: false,
openAlertCount: 1,
},
@@ -38,9 +52,16 @@ const patients = [
firstName: 'Carol',
lastName: 'C',
mrn: 'M3',
room: '103',
roomBed: '103',
status: 'Active',
news2Score: 8,
sofaScore: 10,
sofaDelta: 2,
gcsScore: 8,
qsofaScore: 2,
attendingPhysician: 'Dr. C',
admittedAt: '2026-06-20T10:00:00Z',
lastObservationAt: '2026-06-23T08:00:00Z',
sepsisActive: true,
openAlertCount: 3,
},
@@ -67,4 +88,14 @@ describe('WardTable', () => {
const highRiskRow = wrapper.findAll('tbody tr')[2]
expect(highRiskRow.html()).toContain('text-severity-critical')
})
it('showsExtendedClinicalColumns', () => {
const wrapper = mount(WardTable, { props: { patients } })
const header = wrapper.find('thead').text()
expect(header).toContain('SOFA')
expect(header).toContain('GCS')
expect(header).toContain('Last vitals')
expect(wrapper.text()).toContain('Dr. C')
expect(wrapper.text()).toContain('Δ+2')
})
})
@@ -0,0 +1,41 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
import {
formatLengthOfStay,
observationStaleness,
patientRoom,
stalenessClass,
} from '@/composables/wardFormat'
describe('wardFormat', () => {
beforeEach(() => {
vi.useFakeTimers()
vi.setSystemTime(new Date('2026-06-23T14:00:00Z'))
})
afterEach(() => {
vi.useRealTimers()
})
it('formatsLengthOfStay', () => {
expect(formatLengthOfStay('2026-06-21T14:00:00Z')).toBe('2d')
expect(formatLengthOfStay('2026-06-23T10:00:00Z')).toBe('4h')
})
it('detectsStaleObservations', () => {
expect(observationStaleness('2026-06-23T13:00:00Z', 'Active')).toBe('fresh')
expect(observationStaleness('2026-06-23T10:00:00Z', 'Active')).toBe('stale')
expect(observationStaleness('2026-06-23T08:00:00Z', 'Active')).toBe('critical')
expect(observationStaleness(null, 'Active')).toBe('missing')
expect(observationStaleness('2026-06-23T08:00:00Z', 'Discharged')).toBeNull()
})
it('mapsStalenessClasses', () => {
expect(stalenessClass('stale')).toContain('amber')
expect(stalenessClass('critical')).toContain('red')
})
it('usesRoomBedWithFallback', () => {
expect(patientRoom({ roomBed: 'ICU-1' })).toBe('ICU-1')
expect(patientRoom({ room: '101' })).toBe('101')
})
})