feature: Improve dashboard functionality

This commit is contained in:
voltsrage
2026-06-23 20:19:32 +08:00
parent dd0fd88731
commit 79b6d9d85e
60 changed files with 2857 additions and 164 deletions
+20
View File
@@ -12,6 +12,26 @@ export function fetchAllAlerts(status) {
return api.get(`/api/v1/alerts?${params}`)
}
export async function fetchAllOpenAlerts() {
const items = []
let page = 1
let totalCount = 0
do {
const params = new URLSearchParams({
status: 'OPEN',
page: String(page),
pageSize: '100',
})
const data = await api.get(`/api/v1/alerts?${params}`)
items.push(...(data.items ?? []))
totalCount = data.totalCount ?? items.length
page += 1
} while (items.length < totalCount)
return items
}
export function acknowledgeAlert(alertId, note) {
return api.post(`/api/v1/alerts/${alertId}/acknowledge`, { note })
}
+11
View File
@@ -0,0 +1,11 @@
import { api } from './client'
export function fetchAlertSummary({ severity, department, from, to } = {}) {
const params = new URLSearchParams()
if (severity) params.set('severity', severity)
if (department) params.set('department', department)
if (from) params.set('from', from)
if (to) params.set('to', to)
const qs = params.toString()
return api.get(`/api/v1/analytics/alerts/summary${qs ? `?${qs}` : ''}`)
}
+21 -2
View File
@@ -1,11 +1,30 @@
import { api } from './client'
export function fetchActiveEncounters(department) {
const params = new URLSearchParams({ status: 'ACTIVE' })
export function fetchActiveEncounters(department, { page = 1, pageSize = 20 } = {}) {
const params = new URLSearchParams({
status: 'ACTIVE',
page: String(page),
pageSize: String(pageSize),
})
if (department) params.set('department', department)
return api.get(`/api/v1/encounters?${params}`)
}
export async function fetchAllActiveEncounters(department) {
const items = []
let page = 1
let totalCount = 0
do {
const data = await fetchActiveEncounters(department, { page, pageSize: 100 })
items.push(...(data.items ?? []))
totalCount = data.totalCount ?? items.length
page += 1
} while (items.length < totalCount)
return items
}
export function fetchEncounter(id) {
return api.get(`/api/v1/encounters/${id}`)
}
+10
View File
@@ -0,0 +1,10 @@
import { api } from './client'
export function fetchSepsisBundles({ status = 'IN_PROGRESS', page = 1, pageSize = 100 } = {}) {
const params = new URLSearchParams({
page: String(page),
pageSize: String(pageSize),
})
if (status) params.set('status', status)
return api.get(`/api/v1/sepsis-bundles?${params}`)
}