add frontend

This commit is contained in:
voltsrage
2026-06-19 17:42:09 +08:00
parent 49973271e5
commit 5f69ce1a95
53 changed files with 6591 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import { api } from './client'
export function fetchActiveEncounters(department) {
const params = new URLSearchParams({ status: 'ACTIVE' })
if (department) params.set('department', department)
return api.get(`/api/v1/encounters?${params}`)
}
export function fetchEncounter(id) {
return api.get(`/api/v1/encounters/${id}`)
}
export async function fetchObservations(encounterId, { limit = 50 } = {}) {
const all = []
let cursor = null
do {
const params = new URLSearchParams({ limit: String(limit) })
if (cursor) params.set('cursor', cursor)
const page = await api.get(`/api/v1/encounters/${encounterId}/observations?${params}`)
all.push(...(page.items ?? []))
cursor = page.hasMore ? page.nextCursor : null
} while (cursor)
return all
}