feature: Digitization Workstation UI
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<div class="min-h-screen lg:h-screen flex flex-col">
|
||||
<AppHeader title="Data Entry">
|
||||
<template #subtitle>
|
||||
<span v-if="currentBatch" class="text-sm text-gray-500">
|
||||
Batch: {{ currentBatch.id.substring(0, 8) }}...
|
||||
| Type: {{ currentBatch.batchType.replace(/_/g, ' ') }}
|
||||
</span>
|
||||
</template>
|
||||
</AppHeader>
|
||||
|
||||
<!-- Queue view (no batch selected) -->
|
||||
<div v-if="!batchId" class="flex-1 p-4 sm:p-6">
|
||||
<h2 class="text-xl font-semibold mb-4">Entry Queue</h2>
|
||||
<BatchList
|
||||
:batches="batchStore.batches"
|
||||
:loading="batchStore.loading"
|
||||
@select="openBatch"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Split pane (batch selected) -->
|
||||
<div v-else class="flex-1 split-pane">
|
||||
<ScanViewer
|
||||
v-if="documentUrl"
|
||||
:url="documentUrl"
|
||||
/>
|
||||
<div v-else class="flex items-center justify-center bg-gray-100 rounded-lg">
|
||||
<p class="text-gray-500">Loading document...</p>
|
||||
</div>
|
||||
|
||||
<EntryForm
|
||||
:batch="currentBatch"
|
||||
:batch-id="batchId"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useAuthStore } from '../stores/auth'
|
||||
import { useBatchStore } from '../stores/batches'
|
||||
import { usePresignedUrl } from '../composables/usePresignedUrl'
|
||||
import AppHeader from '../components/AppHeader.vue'
|
||||
import ScanViewer from '../components/ScanViewer.vue'
|
||||
import EntryForm from '../components/EntryForm.vue'
|
||||
import BatchList from '../components/BatchList.vue'
|
||||
|
||||
const props = defineProps<{ batchId?: string }>()
|
||||
|
||||
const auth = useAuthStore()
|
||||
const batchStore = useBatchStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const batchId = computed(() => props.batchId ?? (route.params.batchId as string | undefined))
|
||||
const currentBatch = computed(() => batchStore.currentBatch)
|
||||
const { documentUrl } = usePresignedUrl(batchId)
|
||||
|
||||
async function openBatch(id: string) {
|
||||
router.push(`/entry/${id}`)
|
||||
}
|
||||
|
||||
watch(
|
||||
batchId,
|
||||
async (id) => {
|
||||
if (id) {
|
||||
await batchStore.getDraft(id)
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
if (!batchId.value) {
|
||||
await batchStore.listBatches({
|
||||
assignedTo: auth.userId,
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,179 @@
|
||||
<template>
|
||||
<div class="min-h-screen flex flex-col">
|
||||
<AppHeader title="Intake" />
|
||||
|
||||
<div class="page-container flex-1">
|
||||
<h1 class="text-2xl font-bold mb-6">Upload Scanned Document</h1>
|
||||
|
||||
<!-- Upload form -->
|
||||
<div class="card mb-6">
|
||||
<h2 class="text-lg font-semibold mb-4">New Batch</h2>
|
||||
|
||||
<form @submit.prevent="handleUpload" class="space-y-4">
|
||||
<!-- File input -->
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Scanned Document (PDF, JPEG, PNG — max 25 MB)
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
ref="fileInput"
|
||||
@change="onFileChange"
|
||||
accept=".pdf,.jpg,.jpeg,.png"
|
||||
class="block w-full text-sm text-gray-500
|
||||
file:mr-4 file:py-2 file:px-4
|
||||
file:rounded-md file:border-0
|
||||
file:text-sm file:font-semibold
|
||||
file:bg-primary-50 file:text-primary-700
|
||||
hover:file:bg-primary-100"
|
||||
/>
|
||||
<p v-if="selectedFile" class="text-sm text-gray-500 mt-2">
|
||||
{{ selectedFile.name }} ({{ (selectedFile.size / 1024 / 1024).toFixed(2) }} MB)
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Batch type -->
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Batch Type</label>
|
||||
<select v-model="batchType" class="form-input" required>
|
||||
<option value="">Select batch type...</option>
|
||||
<option value="PATIENT_REGISTRATION">Patient Registration</option>
|
||||
<option value="ENCOUNTER_SUMMARY">Encounter Summary</option>
|
||||
<option value="VITALS_SHEET">Vitals Sheet</option>
|
||||
<option value="LAB_RESULTS">Lab Results</option>
|
||||
<option value="MEDICATION_LIST">Medication List</option>
|
||||
<option value="ALLERGY_UPDATE">Allergy Update</option>
|
||||
<option value="MIXED">Mixed</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Track -->
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Track</label>
|
||||
<select v-model="track" class="form-input">
|
||||
<option value="BACKFILL">Backfill (Track A)</option>
|
||||
<option value="LIVE_CAPTURE">Live Capture (Track B)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Patient search -->
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Patient (optional — can link later)
|
||||
</label>
|
||||
<PatientSearch v-model="patientId" />
|
||||
</div>
|
||||
|
||||
<div v-if="uploadError" class="text-clinical-danger text-sm">
|
||||
{{ uploadError }}
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="btn-primary"
|
||||
:disabled="!selectedFile || !batchType || batchStore.loading"
|
||||
>
|
||||
{{ batchStore.loading ? 'Uploading...' : 'Upload and Create Batch' }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Recent uploads -->
|
||||
<div class="card">
|
||||
<h2 class="text-lg font-semibold mb-4">Recent Uploads</h2>
|
||||
<div v-if="assignError" class="text-clinical-danger text-sm mb-4">
|
||||
{{ assignError }}
|
||||
</div>
|
||||
<BatchList
|
||||
:batches="batchStore.batches"
|
||||
:loading="batchStore.loading"
|
||||
show-assign
|
||||
@assign="openAssignDialog"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<AssignClerkDialog
|
||||
:show="assignDialogOpen"
|
||||
:batch-id="assignBatchId"
|
||||
@close="closeAssignDialog"
|
||||
@assigned="handleAssign"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useBatchStore } from '../stores/batches'
|
||||
import AppHeader from '../components/AppHeader.vue'
|
||||
import PatientSearch from '../components/PatientSearch.vue'
|
||||
import BatchList from '../components/BatchList.vue'
|
||||
import AssignClerkDialog from '../components/AssignClerkDialog.vue'
|
||||
|
||||
const batchStore = useBatchStore()
|
||||
|
||||
const selectedFile = ref<File | null>(null)
|
||||
const batchType = ref('')
|
||||
const track = ref('BACKFILL')
|
||||
const patientId = ref<string | undefined>(undefined)
|
||||
const uploadError = ref('')
|
||||
const assignError = ref('')
|
||||
const assignDialogOpen = ref(false)
|
||||
const assignBatchId = ref<string | null>(null)
|
||||
|
||||
function onFileChange(event: Event) {
|
||||
const input = event.target as HTMLInputElement
|
||||
selectedFile.value = input.files?.[0] ?? null
|
||||
}
|
||||
|
||||
async function handleUpload() {
|
||||
if (!selectedFile.value || !batchType.value) return
|
||||
|
||||
uploadError.value = ''
|
||||
try {
|
||||
const batch = await batchStore.uploadBatch(
|
||||
selectedFile.value,
|
||||
batchType.value,
|
||||
track.value,
|
||||
patientId.value
|
||||
)
|
||||
if (batch) {
|
||||
selectedFile.value = null
|
||||
batchType.value = ''
|
||||
track.value = 'BACKFILL'
|
||||
patientId.value = undefined
|
||||
await loadRecent()
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
uploadError.value = e instanceof Error ? e.message : 'Upload failed'
|
||||
}
|
||||
}
|
||||
|
||||
function openAssignDialog(batchId: string) {
|
||||
assignError.value = ''
|
||||
assignBatchId.value = batchId
|
||||
assignDialogOpen.value = true
|
||||
}
|
||||
|
||||
function closeAssignDialog() {
|
||||
assignDialogOpen.value = false
|
||||
assignBatchId.value = null
|
||||
}
|
||||
|
||||
async function handleAssign(batchId: string, clerkUserId: string) {
|
||||
assignError.value = ''
|
||||
try {
|
||||
await batchStore.assignBatch(batchId, clerkUserId)
|
||||
closeAssignDialog()
|
||||
await loadRecent()
|
||||
} catch (e: unknown) {
|
||||
assignError.value = e instanceof Error ? e.message : 'Assignment failed'
|
||||
}
|
||||
}
|
||||
|
||||
async function loadRecent() {
|
||||
await batchStore.listBatches({ status: 'UPLOADED', page: 1, pageSize: 20 })
|
||||
}
|
||||
|
||||
onMounted(loadRecent)
|
||||
</script>
|
||||
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div class="min-h-screen flex items-center justify-center bg-gray-50 px-4 py-8">
|
||||
<div class="max-w-md w-full bg-white rounded-lg shadow-md p-6 sm:p-8">
|
||||
<div class="text-center mb-8">
|
||||
<h1 class="text-2xl font-bold text-gray-900">VigilCare Records</h1>
|
||||
<p class="text-gray-600 mt-2">Digitization Workstation</p>
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="handleLogin" class="space-y-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Username</label>
|
||||
<input
|
||||
v-model="username"
|
||||
type="text"
|
||||
class="form-input"
|
||||
placeholder="e.g. intake1, entry1, verifier1"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Password</label>
|
||||
<input
|
||||
v-model="password"
|
||||
type="password"
|
||||
class="form-input"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="errorMessage" class="text-clinical-danger text-sm">
|
||||
{{ errorMessage }}
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn-primary w-full" :disabled="loading">
|
||||
{{ loading ? 'Signing in...' : 'Sign In' }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useAuthStore } from '../stores/auth'
|
||||
|
||||
const auth = useAuthStore()
|
||||
const username = ref('')
|
||||
const password = ref('')
|
||||
const loading = ref(false)
|
||||
const errorMessage = ref('')
|
||||
|
||||
async function handleLogin() {
|
||||
loading.value = true
|
||||
errorMessage.value = ''
|
||||
try {
|
||||
await auth.login({ username: username.value, password: password.value })
|
||||
} catch (e: unknown) {
|
||||
errorMessage.value = e instanceof Error ? e.message : 'Login failed'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<div class="min-h-screen lg:h-screen flex flex-col">
|
||||
<AppHeader title="Supervisor Dashboard">
|
||||
<template #actions>
|
||||
<button
|
||||
type="button"
|
||||
@click="refreshData"
|
||||
class="text-sm text-primary-600 hover:text-primary-800"
|
||||
>
|
||||
Refresh
|
||||
</button>
|
||||
</template>
|
||||
</AppHeader>
|
||||
|
||||
<div class="flex-1 overflow-y-auto p-4 sm:p-6 lg:p-8 space-y-6 lg:space-y-8">
|
||||
<!-- Summary cards -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4 lg:gap-8">
|
||||
<div class="card">
|
||||
<p class="text-sm text-gray-500">Pending Entry</p>
|
||||
<p class="text-3xl font-bold text-yellow-600">
|
||||
{{ overview?.statusCounts?.UPLOADED ?? 0 }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<p class="text-sm text-gray-500">In Entry</p>
|
||||
<p class="text-3xl font-bold text-blue-600">
|
||||
{{ overview?.statusCounts?.IN_ENTRY ?? 0 }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<p class="text-sm text-gray-500">Pending Verification</p>
|
||||
<p class="text-3xl font-bold text-orange-600">
|
||||
{{ overview?.statusCounts?.PENDING_VERIFICATION ?? 0 }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<p class="text-sm text-gray-500">Reject Rate</p>
|
||||
<p
|
||||
class="text-3xl font-bold"
|
||||
:class="(overview?.rejectRate ?? 0) > 15
|
||||
? 'text-clinical-danger'
|
||||
: 'text-clinical-safe'"
|
||||
>
|
||||
{{ ((overview?.rejectRate ?? 0) * 100).toFixed(1) }}%
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Queue age and throughput -->
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-8">
|
||||
<div class="card">
|
||||
<h3 class="text-sm font-medium text-gray-700 mb-2">Average Time in Queue</h3>
|
||||
<p class="text-2xl font-bold">
|
||||
{{ formatMinutes(overview?.averageTimeInQueueMinutes ?? 0) }}
|
||||
</p>
|
||||
<p class="text-xs text-gray-500 mt-2">
|
||||
Target: < 24 hours
|
||||
</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3 class="text-sm font-medium text-gray-700 mb-2">
|
||||
Oldest Pending Verification
|
||||
</h3>
|
||||
<p
|
||||
class="text-2xl font-bold"
|
||||
:class="(overview?.oldestPendingVerificationMinutes ?? 0) > 1440
|
||||
? 'text-clinical-danger'
|
||||
: 'text-gray-900'"
|
||||
>
|
||||
{{ formatMinutes(overview?.oldestPendingVerificationMinutes ?? 0) }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Status breakdown -->
|
||||
<div class="card">
|
||||
<h3 class="text-sm font-medium text-gray-700 mb-4">Batches by Status</h3>
|
||||
<div class="space-y-2">
|
||||
<div
|
||||
v-for="(count, status) in overview?.statusCounts ?? {}"
|
||||
:key="status"
|
||||
class="flex items-center gap-4"
|
||||
>
|
||||
<span class="w-40 shrink-0 text-sm text-gray-600">
|
||||
{{ String(status).replace(/_/g, ' ') }}
|
||||
</span>
|
||||
<div class="flex-1 bg-gray-100 rounded-full h-4">
|
||||
<div
|
||||
class="h-4 rounded-full bg-primary-500"
|
||||
:style="{ width: `${(Number(count) / maxCount) * 100}%` }"
|
||||
/>
|
||||
</div>
|
||||
<span class="text-sm font-medium w-8 text-right">{{ count }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Recent activity -->
|
||||
<div class="card">
|
||||
<h3 class="text-sm font-medium text-gray-700 mb-4">All Batches</h3>
|
||||
<BatchList
|
||||
:batches="batchStore.batches"
|
||||
:loading="batchStore.loading"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useBatchStore } from '../stores/batches'
|
||||
import { get } from '../api/client'
|
||||
import AppHeader from '../components/AppHeader.vue'
|
||||
import BatchList from '../components/BatchList.vue'
|
||||
import type { WorkQueueOverview } from '../types'
|
||||
|
||||
const batchStore = useBatchStore()
|
||||
const overview = ref<WorkQueueOverview | null>(null)
|
||||
|
||||
const maxCount = computed(() => {
|
||||
if (!overview.value?.statusCounts) return 1
|
||||
return Math.max(...Object.values(overview.value.statusCounts).map(Number), 1)
|
||||
})
|
||||
|
||||
function formatMinutes(minutes: number): string {
|
||||
if (minutes < 60) return `${Math.round(minutes)}m`
|
||||
if (minutes < 1440) return `${(minutes / 60).toFixed(1)}h`
|
||||
return `${(minutes / 1440).toFixed(1)}d`
|
||||
}
|
||||
|
||||
async function refreshData() {
|
||||
const response = await get<WorkQueueOverview>('work-queue/overview')
|
||||
if (response.success && response.data) {
|
||||
overview.value = response.data
|
||||
}
|
||||
await batchStore.listBatches({ page: 1, pageSize: 50 })
|
||||
}
|
||||
|
||||
onMounted(refreshData)
|
||||
</script>
|
||||
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<div class="min-h-screen lg:h-screen flex flex-col">
|
||||
<AppHeader title="Verification">
|
||||
<template #subtitle>
|
||||
<span v-if="currentBatch" class="text-sm text-gray-500">
|
||||
Batch: {{ currentBatch.id.substring(0, 8) }}...
|
||||
| Entered by: {{ currentBatch.enteredByUserId?.substring(0, 8) }}...
|
||||
</span>
|
||||
</template>
|
||||
</AppHeader>
|
||||
|
||||
<!-- Queue view (no batch selected) -->
|
||||
<div v-if="!batchId" class="flex-1 p-4 sm:p-6">
|
||||
<h2 class="text-xl font-semibold mb-4">Verification Queue</h2>
|
||||
<p class="text-sm text-gray-500 mb-4">
|
||||
Batches pending verification, sorted by submission time (oldest first).
|
||||
</p>
|
||||
<BatchList
|
||||
:batches="batchStore.batches"
|
||||
:loading="batchStore.loading"
|
||||
@select="openBatch"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Split pane (batch selected) -->
|
||||
<div v-else class="flex-1 split-pane">
|
||||
<ScanViewer
|
||||
v-if="documentUrl"
|
||||
:url="documentUrl"
|
||||
/>
|
||||
<div v-else class="flex items-center justify-center bg-gray-100 rounded-lg">
|
||||
<p class="text-gray-500">Loading document...</p>
|
||||
</div>
|
||||
|
||||
<VerificationForm
|
||||
:batch="currentBatch"
|
||||
:batch-id="batchId"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useBatchStore } from '../stores/batches'
|
||||
import { usePresignedUrl } from '../composables/usePresignedUrl'
|
||||
import AppHeader from '../components/AppHeader.vue'
|
||||
import ScanViewer from '../components/ScanViewer.vue'
|
||||
import VerificationForm from '../components/VerificationForm.vue'
|
||||
import BatchList from '../components/BatchList.vue'
|
||||
|
||||
const props = defineProps<{ batchId?: string }>()
|
||||
|
||||
const batchStore = useBatchStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const batchId = computed(() => props.batchId ?? (route.params.batchId as string | undefined))
|
||||
const currentBatch = computed(() => batchStore.currentBatch)
|
||||
const { documentUrl } = usePresignedUrl(batchId)
|
||||
|
||||
function openBatch(id: string) {
|
||||
router.push(`/verification/${id}`)
|
||||
}
|
||||
|
||||
watch(
|
||||
batchId,
|
||||
async (id) => {
|
||||
if (id) {
|
||||
await batchStore.getDraft(id)
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
if (!batchId.value) {
|
||||
await batchStore.listBatches({
|
||||
status: 'PENDING_VERIFICATION',
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user