Merge branch 'dev' into feat/org-position-134

This commit is contained in:
2025-11-11 08:14:34 +07:00
86 changed files with 6022 additions and 1658 deletions
+461 -322
View File
@@ -1,354 +1,493 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import { toTypedSchema } from '@vee-validate/zod'
// Components
import Block from '~/components/pub/my-ui/doc-entry/block.vue'
import Cell from '~/components/pub/my-ui/doc-entry/cell.vue'
import Field from '~/components/pub/my-ui/doc-entry/field.vue'
import Label from '~/components/pub/my-ui/doc-entry/label.vue'
import { Button } from '~/components/pub/ui/button'
import { Input } from '~/components/pub/ui/input'
import Select from '~/components/pub/ui/select/Select.vue'
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
import { Form } from '~/components/pub/ui/form'
import DatepickerSingle from '~/components/pub/my-ui/datepicker/datepicker-single.vue'
import TreeSelect from '~/components/pub/my-ui/select-tree/tree-select.vue'
import FileUpload from '~/components/pub/my-ui/form/file-field.vue'
import { educationCodes, genderCodes, occupationCodes, religionCodes, relationshipCodes } from '~/lib/constants'
import { mapToComboboxOptList } from '~/lib/utils'
// Types
import { IntegrationEncounterSchema, type IntegrationEncounterFormData } from '~/schemas/integration-encounter.schema'
import type { PatientEntity } from '~/models/patient'
import type { TreeItem } from '~/components/pub/my-ui/select-tree/type'
interface DivisionFormData {
name: string
code: string
parentId: string
}
// Helpers
import { toTypedSchema } from '@vee-validate/zod'
import { useForm } from 'vee-validate'
const props = defineProps<{
division: {
msg: {
placeholder: string
search: string
empty: string
}
}
items: {
value: string
label: string
code: string
}[]
schema: any
initialValues?: Partial<DivisionFormData>
errors?: FormErrors
isLoading?: boolean
isReadonly?: boolean
isSepValid?: boolean
isCheckingSep?: boolean
doctor?: any[]
subSpecialist?: any[]
specialists?: TreeItem[]
payments: any[]
participantGroups?: any[]
seps: any[]
patient?: PatientEntity | null | undefined
objects?: any
}>()
const emit = defineEmits<{
submit: [values: DivisionFormData, resetForm: () => void]
cancel: [resetForm: () => void]
click: (e: Event) => void
(e: 'event', menu: string, value?: any): void
(e: 'fetch', value?: any): void
}>()
const relationshipOpts = mapToComboboxOptList(relationshipCodes)
const educationOpts = mapToComboboxOptList(educationCodes)
const occupationOpts = mapToComboboxOptList(occupationCodes)
const genderOpts = mapToComboboxOptList(genderCodes)
// Validation schema
const { handleSubmit, errors, defineField, meta } = useForm<IntegrationEncounterFormData>({
validationSchema: toTypedSchema(IntegrationEncounterSchema),
})
const formSchema = toTypedSchema(props.schema)
// Bind fields and extract attrs
const [doctorId, doctorIdAttrs] = defineField('doctorId')
const [subSpecialistId, subSpecialistIdAttrs] = defineField('subSpecialistId')
const [registerDate, registerDateAttrs] = defineField('registerDate')
const [paymentType, paymentTypeAttrs] = defineField('paymentType')
const [patientCategory, patientCategoryAttrs] = defineField('patientCategory')
const [cardNumber, cardNumberAttrs] = defineField('cardNumber')
const [sepType, sepTypeAttrs] = defineField('sepType')
const [sepNumber, sepNumberAttrs] = defineField('sepNumber')
const [patientName, patientNameAttrs] = defineField('patientName')
const [nationalIdentity, nationalIdentityAttrs] = defineField('nationalIdentity')
const [medicalRecordNumber, medicalRecordNumberAttrs] = defineField('medicalRecordNumber')
const patientId = ref('')
// Form submission handler
function onSubmitForm(values: any, { resetForm }: { resetForm: () => void }) {
const formData: DivisionFormData = {
name: values.name || '',
code: values.code || '',
parentId: values.parentId || '',
const isLoading = props.isLoading !== undefined ? props.isLoading : false
const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false
// SEP validation state from props
const isSepValid = computed(() => props.isSepValid || false)
const isCheckingSep = computed(() => props.isCheckingSep || false)
const doctorOpts = computed(() => {
// Add default option
const defaultOption = [{ label: 'Pilih', value: '' }]
// Add doctors from props
const doctors = props.doctor || []
return [...defaultOption, ...doctors]
})
const isJKNPayment = computed(() => paymentType.value === 'jkn')
async function onFetchChildren(parentId: string): Promise<void> {
console.log('onFetchChildren', parentId)
}
// Watch specialist/subspecialist selection to fetch doctors
watch(subSpecialistId, async (newValue) => {
if (newValue) {
console.log('SubSpecialist changed:', newValue)
// Reset doctor selection
doctorId.value = ''
// Emit fetch event to parent
emit('fetch', { subSpecialistId: newValue })
}
emit('submit', formData, resetForm)
}
const doctorOpts = ref([
{ label: 'Pilih', value: null },
{ label: 'Dr. A', value: 1 },
])
const paymentOpts = ref([
{ label: 'Umum', value: 'umum' },
{ label: 'BPJS', value: 'bpjs' },
])
const sepOpts = ref([
{ label: 'Rujukan Internal', value: 'ri' },
{ label: 'SEP Rujukan', value: 'sr' },
])
})
// file refs untuk tombol "Pilih Berkas"
const sepFileInput = ref<HTMLInputElement | null>(null)
const sippFileInput = ref<HTMLInputElement | null>(null)
// Watch SEP number changes to notify parent
watch(sepNumber, (newValue) => {
emit('event', 'sep-number-changed', newValue)
})
function pickSepFile() {
sepFileInput.value?.click()
}
function pickSippFile() {
sippFileInput.value?.click()
}
// Sync props to form fields
watch(
() => props.objects,
(objects) => {
if (objects && Object.keys(objects).length > 0) {
patientName.value = objects?.patientName || ''
nationalIdentity.value = objects?.nationalIdentity || ''
medicalRecordNumber.value = objects?.medicalRecordNumber || ''
doctorId.value = objects?.doctorId || ''
subSpecialistId.value = objects?.subSpecialistId || ''
registerDate.value = objects?.registerDate || ''
paymentType.value = objects?.paymentType || ''
patientCategory.value = objects?.patientCategory || ''
cardNumber.value = objects?.cardNumber || ''
sepType.value = objects?.sepType || ''
sepNumber.value = objects?.sepNumber || ''
}
},
{ deep: true, immediate: true },
)
function onSepFileChange(e: Event) {
const f = (e.target as HTMLInputElement).files?.[0]
// set ke form / emit / simpan di state sesuai form library-mu
console.log('sep file', f)
}
function onSippFileChange(e: Event) {
const f = (e.target as HTMLInputElement).files?.[0]
console.log('sipp file', f)
}
watch(
() => props.patient,
(patient) => {
if (patient && Object.keys(patient).length > 0) {
patientId.value = patient?.id ? String(patient.id) : ''
patientName.value = patient?.person?.name || ''
nationalIdentity.value = patient?.person?.residentIdentityNumber || ''
medicalRecordNumber.value = patient?.number || ''
}
},
{ deep: true, immediate: true },
)
function onAddSep() {
// contoh handler tombol "+" di sebelah No. SEP
console.log('open modal tambah SEP')
const formValues = {
patientId: patientId.value || '',
doctorCode: doctorId.value,
subSpecialistCode: subSpecialistId.value,
registerDate: registerDate.value,
cardNumber: cardNumber.value,
paymentType: paymentType.value,
sepType: sepType.value
}
emit('event', 'add-sep', formValues)
}
// Submit handler
const onSubmit = handleSubmit((values) => {
console.log('✅ Validated form values:', JSON.stringify(values, null, 2))
emit('event', 'save', values)
})
// Expose submit method for parent component
const formRef = ref<HTMLFormElement | null>(null)
function submitForm() {
console.log('🔵 submitForm called, formRef:', formRef.value)
console.log('🔵 Form values:', {
doctorId: doctorId.value,
subSpecialistId: subSpecialistId.value,
registerDate: registerDate.value,
paymentType: paymentType.value,
})
console.log('🔵 Form errors:', errors.value)
console.log('🔵 Form meta:', meta.value)
// Trigger form submit using native form submit
// This will trigger validation and onSubmit handler
if (formRef.value) {
console.log('🔵 Calling formRef.value.requestSubmit()')
formRef.value.requestSubmit()
} else {
console.warn('⚠️ formRef.value is null, cannot submit form')
// Fallback: directly call onSubmit handler
// Create a mock event object
const mockEvent = {
preventDefault: () => {},
target: formRef.value || {},
} as SubmitEvent
// Call onSubmit directly
console.log('🔵 Calling onSubmit with mock event')
onSubmit(mockEvent)
}
}
defineExpose({
submitForm,
})
</script>
<template>
<Form
v-slot="{ handleSubmit, resetForm }"
as=""
keep-values
:validation-schema="formSchema"
:initial-values="initialValues"
>
<form id="entry-form" @submit="handleSubmit($event, (values) => onSubmitForm(values, { resetForm }))">
<div class="flex flex-col justify-between">
<div class="mb-2 2xl:mb-3 text-sm 2xl:text-base font-semibold">
Data Pasien
<div class="mx-auto w-full">
<form
ref="formRef"
@submit.prevent="onSubmit"
class="grid gap-6 p-4"
>
<!-- Data Pasien -->
<div class="flex flex-col gap-2">
<h3 class="text-lg font-semibold">Data Pasien</h3>
<div class="flex items-center gap-2">
<span class="text-sm">sudah pernah terdaftar sebagai pasien?</span>
<Button
variant="outline"
type="button"
class="h-[40px] rounded-md border-orange-400 text-orange-400 hover:bg-green-50"
@click="emit('event', 'search')"
>
<Icon
name="i-lucide-search"
class="h-5 w-5"
/>
Cari Pasien
</Button>
<span class="text-sm">belum pernah terdaftar sebagai pasien?</span>
<Button
variant="outline"
type="button"
class="h-[40px] rounded-md border-orange-400 text-orange-400 hover:bg-green-50"
@click="emit('event', 'add')"
>
<Icon
name="i-lucide-plus"
class="h-5 w-5"
/>
Tambah Pasien Baru
</Button>
</div>
<div class="flex gap-6 mb-2 2xl:mb-2">
<span>
Sudah pernah terdaftar sebagai pasien?
<Button class="bg-primary" size="sm" @click.prevent="emit('click', 'search')">
<Icon name="i-lucide-search" class="mr-1" /> Cari Pasien
</Button>
</span>
<span>
Belum pernah terdaftar sebagai pasien?
<Button class="bg-primary" size="sm" @click.prevent="emit('click', 'add')">
<Icon name="i-lucide-plus" class="mr-1" /> Tambah Pasien Baru
</Button>
</span>
</div>
<Block :colCount="3">
<Cell>
<Label label-for="patient_name">Nama Pasien</Label>
<Field id="patient_name" :errors="errors">
<FormField v-slot="{ componentField }" name="patient_name">
<FormItem>
<FormControl>
<Input
id="patient_name"
v-bind="componentField"
disabled
placeholder="Tambah data pasien terlebih dahulu"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
<!-- NIK -->
<Cell :cosSpan="3">
<Label label-for="nik">NIK</Label>
<Field id="nik" :errors="errors">
<FormField v-slot="{ componentField }" name="nik">
<FormItem>
<FormControl>
<Input id="nik" v-bind="componentField" disabled placeholder="Otomatis" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
<Cell>
<Label label-for="rm">No. RM</Label>
<Field id="rm" :errors="errors">
<FormField v-slot="{ componentField }" name="rm">
<FormItem>
<FormControl>
<Input id="rm" v-bind="componentField" disabled placeholder="RM99222" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
</Block>
<Separator class="my-4 2xl:my-5" />
<div class="mb-2 2xl:mb-3 text-sm 2xl:text-base font-semibold">
Data Kunjungan
</div>
<Block :colCount="3">
<!-- Dokter (Combobox) -->
<Cell :cosSpan="3">
<Label label-for="doctor_id">Dokter</Label>
<Field id="doctor_id" :errors="errors">
<FormField v-slot="{ componentField }" name="doctor_id">
<FormItem>
<FormControl>
<Combobox id="doctor_id" v-bind="componentField" :items="doctorOpts" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
<!-- Tanggal Daftar (DatePicker) -->
<Cell :cosSpan="3">
<Label label-for="register_date">Tanggal Daftar</Label>
<Field id="register_date" :errors="errors">
<FormField v-slot="{ componentField }" name="register_date">
<FormItem>
<FormControl>
<DatepickerSingle v-bind="componentField" placeholder="Pilih tanggal" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
<!-- Jenis Pembayaran (Combobox) -->
<Cell :cosSpan="3">
<Label label-for="payment_type">Jenis Pembayaran</Label>
<Field id="payment_type" :errors="errors">
<FormField v-slot="{ componentField }" name="payment_type">
<FormItem>
<FormControl>
<!-- <Combobox id="payment_type" v-bind="componentField" :items="paymentOpts" /> -->
<Select id="payment_type" v-bind="componentField" :items="paymentOpts" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
</Block>
<Block :colCount="3">
<Cell :cosSpan="3">
<Label label-for="bpjs_number">Kelompok Peserta</Label>
<Field id="bpjs_number" :errors="errors">
<FormField v-slot="{ componentField }" name="bpjs_number">
<FormItem>
<FormControl>
<Input
id="bpjs_number"
v-bind="componentField"
placeholder="Pilih jenis pembayaran terlebih dahulu"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
<!-- No. Kartu BPJS -->
<Cell :cosSpan="3">
<Label label-for="bpjs_number">No. Kartu BPJS</Label>
<Field id="bpjs_number" :errors="errors">
<FormField v-slot="{ componentField }" name="bpjs_number">
<FormItem>
<FormControl>
<Input
id="bpjs_number"
v-bind="componentField"
placeholder="Pilih jenis pembayaran terlebih dahulu"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
<!-- Jenis SEP -->
<Cell :cosSpan="3">
<Label label-for="sep_type">Jenis SEP</Label>
<Field id="sep_type" :errors="errors">
<FormField v-slot="{ componentField }" name="sep_type">
<FormItem>
<FormControl>
<Select id="sep_type" v-bind="componentField" :items="sepOpts" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
</Block>
<Block :colCount="3">
<!-- No. SEP (input + tombol +) -->
<Cell :cosSpan="3">
<Label label-for="sep_number">No. SEP</Label>
<Field id="sep_number" :errors="errors">
<FormField v-slot="{ componentField }" name="sep_number">
<FormItem>
<FormControl>
<div class="flex gap-2">
<Input
id="sep_number"
v-bind="componentField"
placeholder="Tambah SEP terlebih dahulu"
class="flex-1"
/>
<Button class="bg-primary" size="sm" variant="outline" @click.prevent="onAddSep">+</Button>
</div>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
<!-- Dokumen SEP (file) -->
<Cell :cosSpan="3">
<Label label-for="sep_file">Dokumen SEP</Label>
<Field id="sep_file" :errors="errors">
<FormField v-slot="{ componentField }" name="sep_file">
<FormItem>
<FormControl>
<div class="flex items-center gap-2">
<input ref="sepFileInput" type="file" class="hidden" @change="onSepFileChange" />
<Button class="bg-primary" size="sm" variant="ghost" @click.prevent="pickSepFile"
>Pilih Berkas</Button
>
<Input readonly v-bind="componentField" placeholder="Unggah dokumen SEP" />
</div>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
<!-- Dokumen SIPP (file) -->
<Cell :cosSpan="3" labelSize="thin">
<Label label-for="sipp_file">Dokumen SIPP</Label>
<Field id="sipp_file" :errors="errors">
<FormField v-slot="{ componentField }" name="sipp_file">
<FormItem>
<FormControl>
<div class="flex items-center gap-2">
<input ref="sippFileInput" type="file" class="hidden" @change="onSippFileChange" />
<Button class="bg-primary" size="sm" variant="ghost" @click.prevent="pickSippFile"
>Pilih Berkas</Button
>
<Input readonly v-bind="componentField" placeholder="Unggah dokumen SIPP" />
</div>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</Cell>
</Block>
</div>
<Block
labelSize="thin"
class="!pt-0"
:colCount="3"
:cellFlex="false"
>
<Cell>
<Label height="compact">Nama Pasien</Label>
<Field :errMessage="errors.patientName">
<Input
id="patientName"
v-model="patientName"
v-bind="patientNameAttrs"
:disabled="true"
/>
</Field>
</Cell>
<Cell>
<Label height="compact">NIK</Label>
<Field :errMessage="errors.nationalIdentity">
<Input
id="nationalIdentity"
v-model="nationalIdentity"
v-bind="nationalIdentityAttrs"
:disabled="true"
/>
</Field>
</Cell>
<Cell>
<Label height="compact">No. RM</Label>
<Field :errMessage="errors.medicalRecordNumber">
<Input
id="medicalRecordNumber"
v-model="medicalRecordNumber"
v-bind="medicalRecordNumberAttrs"
:disabled="true"
/>
</Field>
</Cell>
</Block>
<hr />
<!-- Data Kunjungan -->
<h3 class="text-lg font-semibold">Data Kunjungan</h3>
<Block
labelSize="thin"
class="!pt-0"
:colCount="3"
:cellFlex="false"
>
<Cell>
<Label height="compact">
Dokter
<span class="text-red-500">*</span>
</Label>
<Field :errMessage="errors.doctorId">
<Combobox
id="doctorId"
v-model="doctorId"
v-bind="doctorIdAttrs"
:items="doctorOpts"
:is-disabled="isLoading || isReadonly"
placeholder="Pilih Dokter"
search-placeholder="Cari Dokter"
empty-message="Dokter tidak ditemukan"
/>
</Field>
</Cell>
<Cell>
<Label height="compact">
Spesialis / Subspesialis
<span class="text-red-500">*</span>
</Label>
<Field :errMessage="errors.subSpecialistId">
<TreeSelect
id="subSpecialistId"
v-model="subSpecialistId"
v-bind="subSpecialistIdAttrs"
:data="specialists || []"
:on-fetch-children="onFetchChildren"
/>
</Field>
</Cell>
</Block>
<Block
labelSize="thin"
class="!pt-0"
:colCount="3"
:cellFlex="false"
>
<Cell>
<Label height="compact">
Tanggal Daftar
<span class="text-red-500">*</span>
</Label>
<Field :errMessage="errors.registerDate">
<DatepickerSingle
id="registerDate"
v-model="registerDate"
v-bind="registerDateAttrs"
placeholder="Pilih tanggal"
/>
</Field>
</Cell>
<Cell>
<Label height="compact">
Jenis Pembayaran
<span class="text-red-500">*</span>
</Label>
<Field :errMessage="errors.paymentType">
<Select
id="paymentType"
v-model="paymentType"
v-bind="paymentTypeAttrs"
:items="payments"
:disabled="isLoading || isReadonly"
placeholder="Pilih Jenis Pembayaran"
/>
</Field>
</Cell>
</Block>
<!-- BPJS Fields (conditional) -->
<template v-if="isJKNPayment">
<Block
labelSize="thin"
class="!pt-0"
:colCount="3"
:cellFlex="false"
>
<Cell>
<Label height="compact">
Kelompok Peserta
<span class="text-red-500">*</span>
</Label>
<Field :errMessage="errors.patientCategory">
<Select
id="patientCategory"
v-model="patientCategory"
v-bind="patientCategoryAttrs"
:items="participantGroups || []"
:disabled="isLoading || isReadonly"
placeholder="Pilih Kelompok Peserta"
/>
</Field>
</Cell>
<Cell>
<Label height="compact">
No. Kartu BPJS
<span class="text-red-500">*</span>
</Label>
<Field :errMessage="errors.cardNumber">
<Input
id="cardNumber"
v-model="cardNumber"
v-bind="cardNumberAttrs"
:disabled="isLoading || isReadonly"
placeholder="Masukkan nomor kartu BPJS"
/>
</Field>
</Cell>
<Cell>
<Label height="compact">
Jenis SEP
<span class="text-red-500">*</span>
</Label>
<Field :errMessage="errors.sepType">
<Select
id="sepType"
v-model="sepType"
v-bind="sepTypeAttrs"
:items="seps"
:disabled="isLoading || isReadonly"
placeholder="Pilih Jenis SEP"
/>
</Field>
</Cell>
</Block>
<Block
labelSize="thin"
class="!pt-0"
:colCount="3"
:cellFlex="false"
>
<Cell>
<Label height="compact">
No. SEP
<span class="text-red-500">*</span>
</Label>
<Field :errMessage="errors.sepNumber">
<div class="flex gap-2">
<Input
id="sepNumber"
v-model="sepNumber"
v-bind="sepNumberAttrs"
placeholder="Tambah SEP terlebih dahulu"
class="flex-1"
:disabled="isLoading || isReadonly"
/>
<Button
v-if="!isSepValid"
variant="outline"
type="button"
class="bg-primary"
size="sm"
:disabled="isCheckingSep || isLoading || isReadonly"
@click="onAddSep"
>
<Icon
v-if="isCheckingSep"
name="i-lucide-loader-2"
class="h-4 w-4 animate-spin"
/>
<span v-else>+</span>
</Button>
<Button
v-else
variant="outline"
type="button"
class="bg-green-500 text-white hover:bg-green-600"
size="sm"
disabled
>
<Icon
name="i-lucide-check"
class="h-4 w-4"
/>
</Button>
</div>
</Field>
</Cell>
<FileUpload
field-name="sepFile"
label="Dokumen SEP"
placeholder="Unggah dokumen SEP"
:accept="['pdf', 'jpg', 'png']"
:max-size-mb="1"
/>
<FileUpload
field-name="sippFile"
label="Dokumen SIPP"
placeholder="Unggah dokumen SIPP"
:accept="['pdf', 'jpg', 'png']"
:max-size-mb="1"
/>
</Block>
</template>
</form>
</Form>
</div>
</template>
+4 -80
View File
@@ -7,94 +7,18 @@ const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dr
const statusBadge = defineAsyncComponent(() => import('./status-badge.vue'))
export const config: Config = {
cols: [
{},
{},
{},
{ width: 100 },
{ width: 120 },
{},
{},
{},
{ width: 100 },
{ width: 100 },
{},
{ width: 50 },
],
cols: [{}, {}, {}, {}],
headers: [
[
{ label: 'Nama' },
{ label: 'Rekam Medis' },
{ label: 'KTP' },
{ label: 'Tgl Lahir' },
{ label: 'Umur' },
{ label: 'JK' },
{ label: 'Pendidikan' },
{ label: 'Status' },
{ label: '' },
],
],
headers: [[{ label: 'Kode' }, { label: 'Nama (FHIR)' }, { label: 'Nama (ID)' }, { label: '' }]],
keys: [
'name',
'medicalRecord_number',
'identity_number',
'birth_date',
'patient_age',
'gender',
'education',
'status',
'action',
],
keys: ['code', 'name', 'indName', 'action'],
delKeyNames: [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' },
],
parses: {
name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return `${recX.firstName} ${recX.middleName || ''} ${recX.lastName || ''}`
},
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
if (recX.identity_number?.substring(0, 5) === 'BLANK') {
return '(TANPA NIK)'
}
return recX.identity_number
},
birth_date: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
if (typeof recX.birth_date == 'object' && recX.birth_date) {
return (recX.birth_date as Date).toLocaleDateString()
} else if (typeof recX.birth_date == 'string') {
return (recX.birth_date as string).substring(0, 10)
}
return recX.birth_date
},
patient_age: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.birth_date?.split('T')[0]
},
gender: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
if (typeof recX?.gender_code !== 'number' && recX?.gender_code !== '') {
return 'Tidak Diketahui'
}
return recX.gender_code
},
education: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
if (typeof recX.education_code == 'number' && recX.education_code >= 0) {
return recX.education_code
} else if (typeof recX.education_code) {
return recX.education_code
}
return '-'
},
},
parses: {},
components: {
action(rec, idx) {
@@ -2,7 +2,7 @@
import { config } from './list-cfg'
defineProps<{ data: any[] }>()
const modelValue = defineModel<any | null>()
const modelValue = defineModel<any[]>('modelValue', { default: [] })
</script>
<template>
+13 -9
View File
@@ -1,8 +1,5 @@
<script setup lang="ts">
import { ref } from 'vue'
import { Trash2 } from 'lucide-vue-next'
// import { Button } from '@/components/ui/button'
// import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'
interface Diagnosa {
id: number
@@ -10,10 +7,10 @@ interface Diagnosa {
icd: string
}
const list = ref<Diagnosa[]>([{ id: 1, diagnosa: 'Acute appendicitis', icd: 'K35' }])
const modelValue = defineModel<Diagnosa[]>({ default: [] })
function removeItem(id: number) {
list.value = list.value.filter((item) => item.id !== id)
modelValue.value = modelValue.value.filter((item) => item.id !== id)
}
</script>
@@ -30,12 +27,19 @@ function removeItem(id: number) {
</TableHeader>
<TableBody>
<TableRow v-for="(item, i) in list" :key="item.id">
<TableRow
v-for="(item, i) in modelValue"
:key="item.id"
>
<TableCell class="text-center font-medium">{{ i + 1 }}</TableCell>
<TableCell>{{ item.diagnosa }}</TableCell>
<TableCell>{{ item.icd }}</TableCell>
<TableCell>{{ item.code }}</TableCell>
<TableCell>{{ item.name }}</TableCell>
<TableCell class="text-center">
<Button variant="ghost" size="icon" @click="removeItem(item.id)">
<Button
variant="ghost"
size="icon"
@click="removeItem(item.id)"
>
<Trash2 class="h-4 w-4 text-gray-500 hover:text-red-500" />
</Button>
</TableCell>
@@ -0,0 +1,41 @@
import type { Config } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue'
const SelectedRadio = defineAsyncComponent(() => import('~/components/pub/my-ui/data/select-radio.vue'))
export interface PatientData {
id: string
identity: string
number: string
bpjs: string
name: string
}
export const config: Config = {
cols: [{ width: 50 }, { width: 100 }, { width: 100 }, { width: 100 }, { width: 100 }],
headers: [
[{ label: '' }, { label: 'NO. KTP' }, { label: 'NO. RM' }, { label: 'NO. KARTU BPJS' }, { label: 'NAMA PASIEN' }],
],
keys: ['check', 'identity', 'number', 'bpjs', 'name'],
delKeyNames: [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' },
],
parses: {},
components: {
check(rec, idx) {
return {
idx,
rec: { ...rec as object, menu: 'patient' },
component: SelectedRadio,
}
},
},
htmls: {},
}
@@ -0,0 +1,38 @@
<script setup lang="ts">
// Components
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
// Types
import type { PatientData } from './list-cfg.patient'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs
import { config } from './list-cfg.patient'
const props = defineProps<{
data: PatientData[]
selected?: string
paginationMeta?: PaginationMeta
}>()
const emit = defineEmits<{
pageChange: [page: number]
}>()
function handlePageChange(page: number) {
emit('pageChange', page)
}
</script>
<template>
<PubMyUiDataTable
v-bind="config"
:rows="props.data"
:selected="props.selected"
/>
<PaginationView
v-if="paginationMeta"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"
/>
</template>
+126
View File
@@ -0,0 +1,126 @@
<script setup lang="ts">
import { ref, provide, watch } from 'vue'
// Components
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
DialogFooter,
} from '~/components/pub/ui/dialog'
import { Button } from '~/components/pub/ui/button'
import { Input } from '~/components/pub/ui/input'
import ListPatient from './list-patient.vue'
// Types
import type { PatientData } from './list-cfg.patient'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Helpers
import { refDebounced } from '@vueuse/core'
const props = defineProps<{
open: boolean
patients: Array<PatientData>
selected: string
paginationMeta: PaginationMeta
}>()
const emit = defineEmits<{
(e: 'update:open', value: boolean): void
(e: 'update:selected', value: string): void
(e: 'fetch', value: any): void
(e: 'save'): void
}>()
const search = ref('')
const debouncedSearch = refDebounced(search, 500) // 500ms debounce
// Provide for radio selection - use selected prop directly
const recSelectId = ref<number>(Number(props.selected) || 0)
const recSelectMenu = ref<string>('patient')
provide('rec_select_id', recSelectId)
provide('rec_select_menu', recSelectMenu)
function saveSelection() {
// Validate that a patient is selected
if (!props.selected || props.selected === '') {
console.warn('No patient selected')
return
}
emit('save')
emit('update:open', false)
}
function handlePageChange(page: number) {
emit('fetch', { 'page-number': page })
}
// Watch for changes in recSelectId and emit update:selected
watch(recSelectId, (newValue) => {
if (newValue > 0) {
emit('update:selected', String(newValue))
}
})
// Watch for changes in selected prop
watch(() => props.selected, (newValue) => {
recSelectId.value = Number(newValue) || 0
})
watch(debouncedSearch, (newValue) => {
// Only search if 3+ characters or empty (to clear search)
if (newValue.length === 0 || newValue.length >= 3) {
emit('fetch', { search: newValue })
}
})
</script>
<template>
<Dialog
:open="props.open"
@update:open="emit('update:open', $event)"
>
<DialogTrigger as-child></DialogTrigger>
<DialogContent class="max-w-3xl">
<DialogHeader>
<DialogTitle>Cari Pasien</DialogTitle>
</DialogHeader>
<!-- Input Search -->
<div class="max-w-[50%]">
<Input
v-model="search"
placeholder="Cari berdasarkan No. KTP / No. RM / Nomor Kartu"
/>
</div>
<div class="overflow-x-auto rounded-lg border">
<ListPatient
:data="patients"
:selected="props.selected"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"
/>
</div>
<!-- Footer -->
<DialogFooter>
<Button
variant="default"
class="h-[40px] min-w-[120px] text-white"
@click="saveSelection"
>
<Icon
name="i-lucide-save"
class="h-5 w-5"
/>
Simpan
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</template>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,51 @@
import type { Config } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue'
const SelectedRadio = defineAsyncComponent(() => import('~/components/pub/my-ui/data/select-radio.vue'))
export const config: Config = {
cols: [
{ width: 50 },
{ width: 150 },
{ width: 120 },
{ width: 120 },
{ width: 120 },
{ width: 120 },
{ width: 120 },
{ width: 150 },
],
headers: [
[
{ label: '' },
{ label: 'NO. SURAT KONTROL' },
{ label: 'TANGGAL SURAT KONTROL' },
{ label: 'NO. SEP' },
{ label: 'NAMA PASIEN' },
{ label: 'NO. KARTU BPJS' },
{ label: 'KLINIK TUJUAN' },
{ label: 'DOKTER' },
],
],
keys: ['check', 'letterNumber', 'plannedDate', 'sepNumber', 'patientName', 'bpjsCardNo', 'clinic', 'doctor'],
delKeyNames: [
{ key: 'code', label: 'Code' },
{ key: 'name', label: 'Name' },
],
parses: {},
components: {
check(rec, idx) {
return {
idx,
rec: { ...(rec as object), menu: 'letter' },
component: SelectedRadio,
}
},
},
htmls: {},
}
@@ -0,0 +1,35 @@
import type { Config } from '~/components/pub/my-ui/data-table'
export interface SepHistoryData {
sepNumber: string
sepDate: string
referralNumber: string
diagnosis: string
serviceType: string
careClass: string
}
export const config: Config = {
cols: [{ width: 100 }, { width: 100 }, { width: 100 }, { width: 100 }, { width: 100 }, { width: 100 }],
headers: [
[
{ label: 'NO. SEP' },
{ label: 'TGL. SEP' },
{ label: 'NO. RUJUKAN' },
{ label: 'DIAGNOSIS AWAL' },
{ label: 'JENIS PELAYANAN' },
{ label: 'KELAS RAWAT' },
],
],
keys: ['sepNumber', 'sepDate', 'referralNumber', 'diagnosis', 'serviceType', 'careClass'],
delKeyNames: [{ key: 'code', label: 'Kode' }],
parses: {},
components: {},
htmls: {},
}
+51
View File
@@ -0,0 +1,51 @@
import type { Config } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue'
const SelectedRadio = defineAsyncComponent(() => import('~/components/pub/my-ui/data/select-radio.vue'))
export interface LetterData {
letterNumber: string
plannedDate: string
sepNumber: string
patientName: string
bpjsCardNo: string
clinic: string
doctor?: string
}
export const config: Config = {
cols: [{ width: 50 }, { width: 150 }, { width: 120 }, { width: 120 }, { width: 120 }, { width: 120 }, { width: 120 }],
headers: [
[
{ label: '' },
{ label: 'NO. SURAT RUJUKAN' },
{ label: 'TANGGAL SURAT RUJUKAN' },
{ label: 'NO. SEP' },
{ label: 'NAMA PASIEN' },
{ label: 'NO. KARTU BPJS' },
{ label: 'KLINIK TUJUAN' },
],
],
keys: ['check', 'letterNumber', 'plannedDate', 'sepNumber', 'patientName', 'bpjsCardNo', 'clinic'],
delKeyNames: [
{ key: 'code', label: 'Code' },
{ key: 'name', label: 'Name' },
],
parses: {},
components: {
check(rec, idx) {
return {
idx,
rec: { ...(rec as object), menu: 'letter' },
component: SelectedRadio,
}
},
},
htmls: {},
}
+14 -14
View File
@@ -41,24 +41,24 @@ export const config: Config = {
],
keys: [
'tgl_sep',
'no_sep',
'pelayanan',
'jalur',
'no_rm',
'nama_pasien',
'no_kartu_bpjs',
'no_surat_kontrol',
'tgl_surat_kontrol',
'klinik_tujuan',
'dpjp',
'diagnosis_awal',
'letterDate',
'letterNumber',
'serviceType',
'flow',
'medicalRecordNumber',
'patientName',
'cardNumber',
'controlLetterNumber',
'controlLetterDate',
'clinicDestination',
'attendingDoctor',
'diagnosis',
'action',
],
delKeyNames: [
{ key: 'no_sep', label: 'NO. SEP' },
{ key: 'nama_pasien', label: 'Nama Pasien' },
{ key: 'letterNumber', label: 'NO. SEP' },
{ key: 'patientName', label: 'Nama Pasien' },
],
parses: {},
+50
View File
@@ -0,0 +1,50 @@
import type { Config } from '~/components/pub/my-ui/data-table'
export interface SepVisitData {
letterNumber: string
letterDate: string
sepNumber: string
patientName: string
bpjsNumber: string
poly: string
diagnosis: string
serviceType: string
careClass: string
}
export const config: Config = {
cols: [
{ width: 100 },
{ width: 100 },
{ width: 100 },
{ width: 100 },
{ width: 100 },
{ width: 100 },
{ width: 100 },
{ width: 100 },
{ width: 100 },
],
headers: [
[
{ label: 'NO. SURAT KONTROL' },
{ label: 'TGL RENCANA KONTROL' },
{ label: 'NO. SEP' },
{ label: 'NAMA PASIEN' },
{ label: 'NO. KARTU BPJS' },
{ label: 'DIAGNOSIS AWAL' },
{ label: 'JENIS PELAYANAN' },
{ label: 'KELAS RAWAT' },
],
],
keys: ['letterNumber', 'letterDate', 'sepNumber', 'patientName', 'bpjsNumber', 'diagnosis', 'serviceType', 'careClass'],
delKeyNames: [{ key: 'code', label: 'Kode' }],
parses: {},
components: {},
htmls: {},
}
+36
View File
@@ -0,0 +1,36 @@
<script setup lang="ts">
// Components
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
// Types
import type { SepHistoryData } from './list-cfg.history'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs
import { config } from './list-cfg.history'
const props = defineProps<{
data: SepHistoryData[]
paginationMeta?: PaginationMeta
}>()
const emit = defineEmits<{
pageChange: [page: number]
}>()
function handlePageChange(page: number) {
emit('pageChange', page)
}
</script>
<template>
<PubMyUiDataTable
v-bind="config"
:rows="props.data"
/>
<PaginationView
v-if="paginationMeta"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"
/>
</template>
+43
View File
@@ -0,0 +1,43 @@
<script setup lang="ts">
// Components
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
// Types
import type { LetterData } from './list-cfg.letter'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs
import { config as configControl } from './list-cfg.control'
import { config as configLetter } from './list-cfg.letter'
const props = defineProps<{
data: LetterData[]
menu?: string
selected?: string
paginationMeta?: PaginationMeta
}>()
const menu = props.menu || 'control'
const emit = defineEmits<{
pageChange: [page: number]
}>()
function handlePageChange(page: number) {
emit('pageChange', page)
}
</script>
<template>
<PubMyUiDataTable
v-bind="menu === 'control' ? configControl : configLetter"
:rows="props.data"
:selected="props.selected"
/>
<PaginationView
v-if="paginationMeta"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"
/>
</template>
+36
View File
@@ -0,0 +1,36 @@
<script setup lang="ts">
// Components
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
// Types
import type { SepVisitData } from './list-cfg.visit'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs
import { config } from './list-cfg.history'
const props = defineProps<{
data: SepVisitData[]
paginationMeta?: PaginationMeta
}>()
const emit = defineEmits<{
pageChange: [page: number]
}>()
function handlePageChange(page: number) {
emit('pageChange', page)
}
</script>
<template>
<PubMyUiDataTable
v-bind="config"
:rows="props.data"
/>
<PaginationView
v-if="paginationMeta"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"
/>
</template>
+3 -15
View File
@@ -1,23 +1,11 @@
<script setup lang="ts">
import { config } from './list-cfg'
interface SepData {
tgl_sep: string
no_sep: string
pelayanan: string
jalur: string
no_rm: string
nama_pasien: string
no_kartu_bpjs: string
no_surat_kontrol: string
tgl_surat_kontrol: string
klinik_tujuan: string
dpjp: string
diagnosis_awal: string
}
// Types
import type { VclaimSepData } from '~/models/vclaim'
const props = defineProps<{
data: SepData[]
data: VclaimSepData[]
}>()
</script>
+105
View File
@@ -0,0 +1,105 @@
<script setup lang="ts">
import { ref, onMounted } from "vue"
import { Card, CardContent } from "~/components/pub/ui/card"
import { Separator } from "~/components/pub/ui/separator"
// Simulasi data dari API
const route = useRoute()
const sepData = ref<any>(null)
onMounted(async () => {
// contoh fetch data API (ganti dengan endpoint kamu)
const id = route.params.id
const res = await fetch(`/api/sep/${id}`)
sepData.value = await res.json()
})
</script>
<template>
<div class="max-w-4xl mx-auto p-6 space-y-4">
<div class="flex items-center justify-between">
<h1 class="text-lg font-semibold">Preview SEP</h1>
<p class="text-sm text-muted-foreground">
</p>
</div>
<Card class="p-6">
<CardContent class="space-y-4">
<!-- Header -->
<div class="flex items-start justify-between">
<div class="flex items-center gap-3">
<img
src="/bpjs-logo.png"
alt="BPJS"
class="h-10 w-auto"
/>
<div>
<p class="font-semibold">SURAT ELIGIBILITAS PESERTA</p>
<p>RSUD dr. Saiful Anwar</p>
</div>
</div>
<p class="text-sm text-right">
Peserta: {{ sepData?.peserta?.jenisPeserta || "-" }}
</p>
</div>
<Separator />
<!-- Content -->
<div class="grid grid-cols-2 gap-8 text-sm">
<!-- Left -->
<div class="space-y-1">
<p>No. SEP : {{ sepData?.noSEP }}</p>
<p>Tgl. SEP : {{ sepData?.tglSEP }}</p>
<p>No. Kartu : {{ sepData?.noKartu }}</p>
<p>Nama Peserta : {{ sepData?.nama }}</p>
<p>Tgl. Lahir : {{ sepData?.tglLahir }} Kelamin: {{ sepData?.kelamin }}</p>
<p>No. Telepon : {{ sepData?.telepon }}</p>
<p>Sub/Spesialis : {{ sepData?.spesialis }}</p>
<p>Dokter : {{ sepData?.dokter }}</p>
<p>Faskes Perujuk : {{ sepData?.faskes }}</p>
<p>Diagnosa Awal : {{ sepData?.diagnosa }}</p>
<p>Catatan : {{ sepData?.catatan }}</p>
</div>
<!-- Right -->
<div class="space-y-1">
<p>Jns. Rawat : {{ sepData?.jenisRawat }}</p>
<p>Jns. Kunjungan : {{ sepData?.jenisKunjungan }}</p>
<p>Poli Perujuk : {{ sepData?.poliPerujuk }}</p>
<p>Kls. Hak : {{ sepData?.kelasHak }}</p>
<p>Kls. Rawat : {{ sepData?.kelasRawat }}</p>
<p>Penjamin : {{ sepData?.penjamin }}</p>
<div class="mt-6 text-center">
<p class="font-semibold">Persetujuan</p>
<p>Pasien/Keluarga Pasien</p>
<img
:src="sepData?.qrCodeUrl"
alt="QR Code"
class="h-24 mx-auto mt-2"
/>
<p class="font-semibold mt-2">{{ sepData?.nama }}</p>
</div>
</div>
</div>
<Separator />
<!-- Footer -->
<div class="text-xs text-muted-foreground leading-snug space-y-1">
<p>*Saya menyetujui BPJS Kesehatan untuk:</p>
<ul class="list-disc pl-5">
<li>membuka dan atau menggunakan informasi medis Pasien untuk keperluan administrasi dan pembiayaan</li>
<li>memberikan akses informasi kepada tenaga medis di RSUD Dr. Saiful Anwar</li>
<li>Penjaminan lainnya sesuai ketentuan yang berlaku</li>
</ul>
<p class="pt-2">
Cetakan ke {{ sepData?.cetakanKe || 1 }} |
{{ sepData?.tglCetak }}
</p>
</div>
</CardContent>
</Card>
</div>
</template>
-218
View File
@@ -1,218 +0,0 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import { toTypedSchema } from '@vee-validate/zod'
import Block from '~/components/pub/my-ui/form/block.vue'
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
import FieldGroup from '~/components/pub/my-ui/form/field-group.vue'
import Field from '~/components/pub/my-ui/form/field.vue'
import Label from '~/components/pub/my-ui/form/label.vue'
import { Form } from '~/components/pub/ui/form'
import DatepickerSingle from '~/components/pub/my-ui/datepicker/datepicker-single.vue'
import { educationCodes, genderCodes, occupationCodes, religionCodes, relationshipCodes } from '~/lib/constants'
import { mapToComboboxOptList } from '~/lib/utils'
interface DivisionFormData {
name: string
code: string
parentId: string
}
const props = defineProps<{
division: {
msg: {
placeholder: string
search: string
empty: string
}
}
items: {
value: string
label: string
code: string
}[]
schema: any
initialValues?: Partial<DivisionFormData>
errors?: FormErrors
}>()
const emit = defineEmits<{
submit: [values: DivisionFormData, resetForm: () => void]
cancel: [resetForm: () => void]
}>()
const relationshipOpts = mapToComboboxOptList(relationshipCodes)
const educationOpts = mapToComboboxOptList(educationCodes)
const occupationOpts = mapToComboboxOptList(occupationCodes)
const genderOpts = mapToComboboxOptList(genderCodes)
const formSchema = toTypedSchema(props.schema)
// Form submission handler
function onSubmitForm(values: any, { resetForm }: { resetForm: () => void }) {
const formData: DivisionFormData = {
name: values.name || '',
code: values.code || '',
parentId: values.parentId || '',
}
emit('submit', formData, resetForm)
}
const doctorOpts = ref([
{ label: 'Pilih', value: null },
{ label: 'Dr. A', value: 1 },
])
const paymentOpts = ref([
{ label: 'Umum', value: 'umum' },
{ label: 'BPJS', value: 'bpjs' },
])
const sepOpts = ref([
{ label: 'Rujukan Internal', value: 'ri' },
{ label: 'SEP Rujukan', value: 'sr' },
])
// file refs untuk tombol "Pilih Berkas"
const sepFileInput = ref<HTMLInputElement | null>(null)
const sippFileInput = ref<HTMLInputElement | null>(null)
function pickSepFile() {
sepFileInput.value?.click()
}
function pickSippFile() {
sippFileInput.value?.click()
}
function onSepFileChange(e: Event) {
const f = (e.target as HTMLInputElement).files?.[0]
// set ke form / emit / simpan di state sesuai form library-mu
console.log('sep file', f)
}
function onSippFileChange(e: Event) {
const f = (e.target as HTMLInputElement).files?.[0]
console.log('sipp file', f)
}
function onAddSep() {
// contoh handler tombol "+" di sebelah No. SEP
console.log('open modal tambah SEP')
}
</script>
<template>
<Form
v-slot="{ handleSubmit, resetForm }"
as=""
keep-values
:validation-schema="formSchema"
:initial-values="initialValues"
>
<form id="entry-form" @submit="handleSubmit($event, (values) => onSubmitForm(values, { resetForm }))">
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<div class="flex flex-col justify-between">
<div class="p-2">
<h2 class="text-md font-semibold">Data Kunjungan</h2>
</div>
<Block>
<!-- Tanggal Daftar (DatePicker) -->
<FieldGroup :column="3">
<Label label-for="register_date">Dengan Rujukan</Label>
<Field id="register_date" :errors="errors">
<FormField v-slot="{ componentField }" name="register_date">
<FormItem>
<FormControl>
<Input
id="bpjs_number"
v-bind="componentField"
placeholder="Pilih jenis pembayaran terlebih dahulu"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</FieldGroup>
<!-- Jenis Pembayaran (Combobox) -->
<FieldGroup :column="3">
<Label label-for="payment_type">Rujukan</Label>
<Field id="payment_type" :errors="errors">
<FormField v-slot="{ componentField }" name="payment_type">
<FormItem>
<FormControl>
<!-- <Combobox id="payment_type" v-bind="componentField" :items="paymentOpts" /> -->
<Select id="payment_type" v-bind="componentField" :items="paymentOpts" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</FieldGroup>
<FieldGroup :column="3">
<Label label-for="bpjs_number">No. Rujukan</Label>
<Field id="bpjs_number" :errors="errors">
<FormField v-slot="{ componentField }" name="bpjs_number">
<FormItem>
<FormControl>
<Input
id="bpjs_number"
v-bind="componentField"
placeholder="Pilih jenis pembayaran terlebih dahulu"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</FieldGroup>
<!-- No. Kartu BPJS -->
<FieldGroup :column="2">
<Label label-for="bpjs_number">Tanggal Rujukan</Label>
<Field id="bpjs_number" :errors="errors">
<FormField v-slot="{ componentField }" name="bpjs_number">
<FormItem>
<FormControl>
<DatepickerSingle v-bind="componentField" placeholder="Pilih tanggal" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</FieldGroup>
<!-- Jenis SEP -->
<FieldGroup :column="2">
<Label label-for="sep_type">Diagnosis</Label>
<Field id="sep_type" :errors="errors">
<FormField v-slot="{ componentField }" name="sep_type">
<FormItem>
<FormControl>
<Select id="sep_type" v-bind="componentField" :items="sepOpts" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</FieldGroup>
<!-- No. SEP (input + tombol +) -->
<FieldGroup>
<Label label-for="sep_type">Status Kecelakaan</Label>
<Field id="sep_type" :errors="errors">
<FormField v-slot="{ componentField }" name="sep_type">
<FormItem>
<FormControl>
<Select id="sep_type" v-bind="componentField" :items="sepOpts" />
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</FieldGroup>
</Block>
</div>
</div>
</form>
</Form>
</template>
@@ -1,81 +0,0 @@
<script setup lang="ts">
import { ref } from 'vue'
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
DialogFooter,
} from '~/components/pub/ui/dialog'
import { Input } from '~/components/pub/ui/input'
const props = defineProps<{
open: boolean
histories: Array<{
no_sep: string
tgl_sep: string
no_rujukan: string
diagnosis: string
pelayanan: string
kelas: string
}>
}>()
const emit = defineEmits<{
(e: 'update:open', value: boolean): void
}>()
const search = ref('')
const filteredHistories = computed(() => {
const histories = props.histories || []
return histories.filter((p) => p.no_sep.includes(search.value))
})
</script>
<template>
<Dialog :open="props.open" @update:open="emit('update:open', $event)">
<DialogTrigger as-child></DialogTrigger>
<DialogContent class="max-w-[50%]">
<DialogHeader>
<DialogTitle>History SEP</DialogTitle>
</DialogHeader>
<!-- Input Search -->
<div class="mb-2 max-w-[50%]">
<Input v-model="search" placeholder="Cari berdasarkan No. SEP" />
</div>
<!-- Table -->
<div class="overflow-x-auto rounded-lg border">
<table class="w-full text-sm">
<thead class="bg-gray-100">
<tr class="text-left">
<th class="p-2">NO. SEP</th>
<th class="p-2">TGL. SEP</th>
<th class="p-2">NO. RUJUKAN</th>
<th class="p-2">DIAGNOSIS AWAL</th>
<th class="p-2">JENIS PELAYANAN</th>
<th class="p-2">KELAS RAWAT</th>
</tr>
</thead>
<tbody class="font-normal">
<tr v-for="p in filteredHistories" :key="p.no_sep" class="border-t hover:bg-gray-50">
<td class="p-2">{{ p.no_sep }}</td>
<td class="p-2">{{ p.tgl_sep }}</td>
<td class="p-2">{{ p.no_rujukan }}</td>
<td class="p-2">{{ p.diagnosis }}</td>
<td class="p-2">{{ p.pelayanan }}</td>
<td class="p-2">{{ p.kelas }}</td>
</tr>
</tbody>
</table>
</div>
<!-- Footer -->
<DialogFooter>
</DialogFooter>
</DialogContent>
</Dialog>
</template>
@@ -1,104 +0,0 @@
<script setup lang="ts">
import { ref } from 'vue'
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
DialogFooter,
} from '~/components/pub/ui/dialog'
import { Button } from '~/components/pub/ui/button'
import { Input } from '~/components/pub/ui/input'
import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group'
const props = defineProps<{
open: boolean
letters: Array<{
noSurat: string
tglRencana: string
noSep: string
namaPasien: string
noBpjs: string
klinik: string
dokter: string
}>
selected: string
}>()
const emit = defineEmits<{
(e: 'update:open', value: boolean): void
(e: 'update:selected', value: string): void
(e: 'save'): void
}>()
const search = ref('')
const filteredLetters = computed(() => {
const letters = props.letters || []
return letters.filter((p) => p.noSurat.includes(search.value) || p.noSep.includes(search.value))
})
function saveSelection() {
emit('save')
emit('update:open', false)
}
</script>
<template>
<Dialog :open="props.open" @update:open="emit('update:open', $event)">
<DialogTrigger as-child></DialogTrigger>
<DialogContent class="max-w-[50%]">
<DialogHeader>
<DialogTitle>Cari No. Surat Kontrol</DialogTitle>
</DialogHeader>
<!-- Input Search -->
<div class="mb-2 max-w-[50%]">
<Input v-model="search" placeholder="Cari berdasarkan No. Surat Kontrol / No. SEP" />
</div>
<!-- Table -->
<div class="overflow-x-auto rounded-lg border">
<table class="w-full text-sm">
<thead class="bg-gray-100">
<tr class="text-left">
<th class="p-2"></th>
<th class="p-2">NO. SURAT KONTROL</th>
<th class="p-2">TGL RENCANA KONTROL</th>
<th class="p-2">NO. SEP</th>
<th class="p-2">NAMA PASIEN</th>
<th class="p-2">NO. KARTU BPJS</th>
<th class="p-2">KLINIK</th>
<th class="p-2">DOKTER</th>
</tr>
</thead>
<tbody class="font-normal">
<tr v-for="p in filteredLetters" :key="p.noSurat" class="border-t hover:bg-gray-50">
<td class="p-2">
<RadioGroup :model-value="props.selected" @update:model-value="emit('update:selected', $event)">
<RadioGroupItem :id="p.noSurat" :value="p.noSurat" />
</RadioGroup>
</td>
<td class="p-2">{{ p.noSurat }}</td>
<td class="p-2">{{ p.tglRencana }}</td>
<td class="p-2">{{ p.noSep }}</td>
<td class="p-2">{{ p.namaPasien }}</td>
<td class="p-2">{{ p.noBpjs }}</td>
<td class="p-2">{{ p.klinik }}</td>
<td class="p-2">{{ p.dokter }}</td>
</tr>
</tbody>
</table>
</div>
<!-- Footer -->
<DialogFooter>
<Button variant="default" class="h-[40px] min-w-[120px] text-white" @click="saveSelection">
<Icon name="i-lucide-save" class="h-5 w-5" />
Simpan
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</template>
@@ -1,100 +0,0 @@
<script setup lang="ts">
import { ref } from 'vue'
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
DialogFooter,
} from '~/components/pub/ui/dialog'
import { Button } from '~/components/pub/ui/button'
import { Input } from '~/components/pub/ui/input'
import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group'
const props = defineProps<{
open: boolean
patients: Array<{
ktp: string
rm: string
bpjs: string
nama: string
}>
selected: string
}>()
const emit = defineEmits<{
(e: 'update:open', value: boolean): void
(e: 'update:selected', value: string): void
(e: 'save'): void
}>()
const search = ref('')
const filteredPatients = computed(() => {
const patients = props.patients || []
return patients.filter(
(p) =>
p.ktp.includes(search.value) ||
p.rm.includes(search.value) ||
p.bpjs.includes(search.value) ||
p.nama.toLowerCase().includes(search.value.toLowerCase()),
)
})
function saveSelection() {
emit('save')
emit('update:open', false)
}
</script>
<template>
<Dialog :open="props.open" @update:open="emit('update:open', $event)">
<DialogTrigger as-child></DialogTrigger>
<DialogContent class="max-w-3xl">
<DialogHeader>
<DialogTitle>Cari Pasien</DialogTitle>
</DialogHeader>
<!-- Input Search -->
<div class="mb-2 max-w-[50%]">
<Input v-model="search" placeholder="Cari berdasarkan No. KTP / No. RM / Nomor Kartu" />
</div>
<!-- Table -->
<div class="overflow-x-auto rounded-lg border">
<table class="w-full text-sm">
<thead class="bg-gray-100">
<tr class="text-left">
<th class="p-2"></th>
<th class="p-2">NO. KTP</th>
<th class="p-2">NO. RM</th>
<th class="p-2">NO. KARTU BPJS</th>
<th class="p-2">NAMA PASIEN</th>
</tr>
</thead>
<tbody class="font-normal">
<tr v-for="p in filteredPatients" :key="p.ktp" class="border-t hover:bg-gray-50">
<td class="p-2">
<RadioGroup :model-value="props.selected" @update:model-value="emit('update:selected', $event)">
<RadioGroupItem :id="p.ktp" :value="p.ktp" />
</RadioGroup>
</td>
<td class="p-2">{{ p.ktp }}</td>
<td class="p-2">{{ p.rm }}</td>
<td class="p-2">{{ p.bpjs }}</td>
<td class="p-2">{{ p.nama }}</td>
</tr>
</tbody>
</table>
</div>
<!-- Footer -->
<DialogFooter>
<Button variant="default" class="h-[40px] min-w-[120px] text-white" @click="saveSelection">
<Icon name="i-lucide-save" class="h-5 w-5" />
Simpan
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</template>
+46
View File
@@ -0,0 +1,46 @@
<script setup lang="ts">
// Components
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
DialogFooter,
} from '~/components/pub/ui/dialog'
import ListHistory from './list-history.vue'
// Types
import type { SepHistoryData } from './list-cfg.history'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
const props = defineProps<{
open: boolean
histories: Array<SepHistoryData>
paginationMeta?: PaginationMeta
}>()
const emit = defineEmits<{
(e: 'update:open', value: boolean): void
}>()
</script>
<template>
<Dialog
:open="props.open"
@update:open="emit('update:open', $event)"
>
<DialogTrigger as-child></DialogTrigger>
<DialogContent class="max-w-[50%]">
<DialogHeader>
<DialogTitle>History SEP</DialogTitle>
</DialogHeader>
<div class="overflow-x-auto rounded-lg border">
<ListHistory :data="histories" :pagination-meta="paginationMeta" />
</div>
<DialogFooter></DialogFooter>
</DialogContent>
</Dialog>
</template>
+128
View File
@@ -0,0 +1,128 @@
<script setup lang="ts">
import { ref, provide, watch } from 'vue'
// Components
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
DialogFooter,
} from '~/components/pub/ui/dialog'
import { Button } from '~/components/pub/ui/button'
import { Input } from '~/components/pub/ui/input'
import ListLetter from './list-letter.vue'
// Types
import type { LetterData } from './list-cfg.letter'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Helpers
import { refDebounced } from '@vueuse/core'
const props = defineProps<{
open: boolean
menu?: string
letters: Array<LetterData>
selected: string
paginationMeta?: PaginationMeta
}>()
const emit = defineEmits<{
(e: 'update:open', value: boolean): void
(e: 'update:selected', value: string): void
(e: 'fetch', value: any): void
(e: 'save'): void
}>()
const search = ref('')
const debouncedSearch = refDebounced(search, 500) // 500ms debounce
// Provide for radio selection - use selected prop directly
const recSelectId = ref<string>(props.selected || '')
const recSelectMenu = ref<string>('letter')
provide('rec_select_id', recSelectId)
provide('rec_select_menu', recSelectMenu)
function saveSelection() {
// Validate that a letter is selected
if (!props.selected || props.selected === '') {
console.warn('No letter selected')
return
}
emit('save')
emit('update:open', false)
}
function handlePageChange(page: number) {
emit('fetch', { 'page-number': page })
}
// Watch for changes in recSelectId and emit update:selected
watch(recSelectId, (newValue) => {
if (newValue && newValue !== '') {
emit('update:selected', newValue)
}
})
// Watch for changes in selected prop
watch(() => props.selected, (newValue) => {
recSelectId.value = newValue || ''
})
watch(debouncedSearch, (newValue) => {
// Only search if 3+ characters or empty (to clear search)
if (newValue.length === 0 || newValue.length >= 3) {
emit('fetch', { search: newValue })
}
})
</script>
<template>
<Dialog
:open="props.open"
@update:open="emit('update:open', $event)"
>
<DialogTrigger as-child></DialogTrigger>
<DialogContent class="max-w-3xl">
<DialogHeader>
<DialogTitle>Search Control Letter</DialogTitle>
</DialogHeader>
<!-- Input Search -->
<div class="max-w-[50%]">
<Input
v-model="search"
placeholder="Search by Control Letter No. / SEP No."
/>
</div>
<div class="overflow-x-auto rounded-lg border">
<ListLetter
:data="letters"
:menu="props.menu"
:selected="props.selected"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"
/>
</div>
<!-- Footer -->
<DialogFooter>
<Button
variant="default"
class="h-[40px] min-w-[120px] text-white"
@click="saveSelection"
>
<Icon
name="i-lucide-save"
class="h-5 w-5"
/>
Save
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</template>
+5 -5
View File
@@ -63,13 +63,13 @@ const validate = async () => {
}
defineExpose({ validate })
const icdPreview = inject('icdPreview')
const isExcluded = (key: string) => props.excludeFields?.includes(key)
</script>
<template>
<form id="entry-form">
{{ errors }}
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<Block>
<Cell>
@@ -285,7 +285,7 @@ const isExcluded = (key: string) => props.excludeFields?.includes(key)
<Button
class="rounded bg-orange-100 px-3 py-1 text-orange-600"
type="button"
@click="emits('modal', 'diagnosa')"
@click="emit('modal', 'diagnosa')"
>
+ Pilih Diagnosa
</Button>
@@ -298,7 +298,7 @@ const isExcluded = (key: string) => props.excludeFields?.includes(key)
<Button
class="rounded bg-orange-100 px-3 py-1 text-orange-600"
type="button"
@click="emits('modal', 'prosedur')"
@click="emit('modal', 'prosedur')"
>
+ Pilih Prosedur
</Button>
@@ -307,8 +307,8 @@ const isExcluded = (key: string) => props.excludeFields?.includes(key)
</Block>
<div class="mb-8 grid grid-cols-2 gap-4">
<AppIcdPreview />
<AppIcdPreview />
<AppIcdPreview v-model="icdPreview.diagnoses" />
<AppIcdPreview v-model="icdPreview.procedures" />
</div>
<Block :colCount="3">
+10 -1
View File
@@ -85,6 +85,7 @@ const validate = async () => {
}
defineExpose({ validate })
const icdPreview = inject('icdPreview')
const isExcluded = (key: string) => props.excludeFields?.includes(key)
</script>
@@ -452,10 +453,18 @@ const isExcluded = (key: string) => props.excludeFields?.includes(key)
<div class="my-2">
<h1 class="font-semibold">Diagnosa Fungsional (ICD-X)</h1>
<Button
class="rounded bg-orange-100 px-3 py-1 text-orange-600"
type="button"
@click="emit('click', 'fungsional')"
>
+ Pilih Prosedur
</Button>
</div>
<div class="mb-8 grid grid-cols-2 gap-4">
<AppIcdPreview />
<AppIcdPreview v-model="icdPreview.diagnoses" />
</div>
<div class="my-2">
+1
View File
@@ -43,5 +43,6 @@ defineExpose({ validate })
@click="$emit('click', $event)"
@submit="$emit('submit', $event)"
@cancel="$emit('cancel', $event)"
@modal="$emit('modal', $event)"
/>
</template>
+17 -15
View File
@@ -86,6 +86,8 @@ const validate = async () => {
defineExpose({ validate })
const icdPreview = inject('icdPreview')
const isExcluded = (key: string) => props.excludeFields?.includes(key)
const disorders = ref<string[]>([])
const therapies = ref<string[]>([])
@@ -558,33 +560,33 @@ const therapyOptions = ['Terapi Latihan', 'Modalitas Fisik', 'Protesa/Ortosa', '
<Button
class="my-2 rounded bg-orange-100 px-3 py-1 text-orange-600"
type="button"
@click="emits('click', 'prosedur')"
@click="emit('click', 'diagnosa')"
>
+ Pilih Prosedur
</Button>
<AppIcdPreview />
<AppIcdPreview v-model="icdPreview.diagnoses" />
</div>
<div>
<span class="text-md">Diagnosa Fungsional (ICD-X)</span>
<Button
class="my-2 rounded bg-orange-100 px-3 py-1 text-orange-600"
type="button"
@click="emit('click', 'fungsional')"
>
+ Pilih Prosedur
</Button>
<AppIcdPreview v-model="icdPreview.fungsional" />
</div>
<div>
<span class="text-md">Diagnosa Medis (ICD-X)</span>
<Button
class="my-2 rounded bg-orange-100 px-3 py-1 text-orange-600"
type="button"
@click="emits('click', 'prosedur')"
@click="emit('click', 'prosedur')"
>
+ Pilih Prosedur
</Button>
<AppIcdPreview />
</div>
<div>
<span class="text-md">Diagnosa Medis (ICD-X)</span>
<Button
class="my-2 rounded bg-orange-100 px-3 py-1 text-orange-600"
type="button"
@click="emits('click', 'prosedur')"
>
+ Pilih Prosedur
</Button>
<AppIcdPreview />
<AppIcdPreview v-model="icdPreview.procedures" />
</div>
</div>
+32 -68
View File
@@ -6,46 +6,21 @@ type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
export const config: Config = {
cols: [
{},
{},
{},
{ width: 100 },
{ width: 120 },
{},
{},
{},
{ width: 100 },
{ width: 100 },
{},
{ width: 50 },
],
cols: [{}, {}, {}, { width: 100 }, { width: 120 }, {}, {}, {}, { width: 100 }, { width: 100 }, {}, { width: 50 }],
headers: [
[
{ label: 'Nama' },
{ label: 'Rekam Medis' },
{ label: 'KTP' },
{ label: 'Tgl Lahir' },
{ label: 'Umur' },
{ label: 'JK' },
{ label: 'Pendidikan' },
{ label: 'Tanggal' },
{ label: 'DPJP' },
{ label: 'Keluhan & Riwayat' },
{ label: 'Pemeriksaan' },
{ label: 'Diagnosa' },
{ label: 'Status' },
{ label: '' },
{ label: 'Aksi' },
],
],
keys: [
'name',
'medicalRecord_number',
'identity_number',
'birth_date',
'patient_age',
'gender',
'education',
'status',
'action',
],
keys: ['time', 'employee_id', 'main_complaint', 'encounter_id', 'diagnose', 'status', 'action'],
delKeyNames: [
{ key: 'code', label: 'Kode' },
@@ -53,45 +28,34 @@ export const config: Config = {
],
parses: {
name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return `${recX.firstName} ${recX.middleName || ''} ${recX.lastName || ''}`
time(rec: any) {
return rec.time ? new Date(rec.time).toLocaleDateString() : ''
},
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
if (recX.identity_number?.substring(0, 5) === 'BLANK') {
return '(TANPA NIK)'
main_complaint(rec: any) {
const { value } = rec ?? {}
if (typeof value !== 'string') return '-'
try {
const parsed = JSON.parse(value)
console.log('parsed', parsed)
return parsed?.['prim-compl'] || '-'
} catch {
return '-'
}
return recX.identity_number
},
birth_date: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
if (typeof recX.birth_date === 'object' && recX.birth_date) {
return (recX.birth_date as Date).toLocaleDateString()
} else if (typeof recX.birth_date === 'string') {
return recX.birth_date.substring(0, 10)
diagnose(rec: any) {
const { value } = rec ?? {}
if (typeof value !== 'string') return '-'
try {
const parsed = JSON.parse(value)
const diagnose = parsed?.diagnose || []
return diagnose.map((d: any) => d.name).join(', ')
} catch {
return '-'
}
return recX.birth_date
},
patient_age: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.birth_date?.split('T')[0]
},
gender: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
if (typeof recX?.gender_code !== 'number' && recX?.gender_code !== '') {
return 'Tidak Diketahui'
}
return recX.gender_code
},
education: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
if (typeof recX.education_code === 'number' && recX.education_code >= 0) {
return recX.education_code
} else if (typeof recX.education_code !== 'undefined') {
return recX.education_code
}
return '-'
},
},