132 lines
3.0 KiB
TypeScript
132 lines
3.0 KiB
TypeScript
import type {
|
|
Col,
|
|
KeyLabel,
|
|
RecComponent,
|
|
RecStrFuncComponent,
|
|
RecStrFuncUnknown,
|
|
Th,
|
|
} from '~/components/pub/my-ui/data/types'
|
|
import { defineAsyncComponent } from 'vue'
|
|
|
|
type SmallDetailDto = any
|
|
|
|
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
|
|
const statusBadge = defineAsyncComponent(() => import('./status-badge.vue'))
|
|
|
|
export const cols: Col[] = [
|
|
{},
|
|
{},
|
|
{},
|
|
{ width: 100 },
|
|
{ width: 120 },
|
|
{},
|
|
{},
|
|
{},
|
|
{ width: 100 },
|
|
{ width: 100 },
|
|
{},
|
|
{ width: 50 },
|
|
]
|
|
|
|
export const header: Th[][] = [
|
|
[
|
|
{ label: 'Nama' },
|
|
{ label: 'Rekam Medis' },
|
|
{ label: 'KTP' },
|
|
{ label: 'Tgl Lahir' },
|
|
{ label: 'Umur' },
|
|
{ label: 'JK' },
|
|
{ label: 'Pendidikan' },
|
|
{ label: 'Status' },
|
|
{ label: '' },
|
|
],
|
|
]
|
|
|
|
export const keys = [
|
|
'name',
|
|
'medicalRecord_number',
|
|
'identity_number',
|
|
'birth_date',
|
|
'patient_age',
|
|
'gender',
|
|
'education',
|
|
'status',
|
|
'action',
|
|
]
|
|
|
|
export const delKeyNames: KeyLabel[] = [
|
|
{ key: 'code', label: 'Kode' },
|
|
{ key: 'name', label: 'Nama' },
|
|
]
|
|
|
|
export const funcParsed: RecStrFuncUnknown = {
|
|
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 '-'
|
|
},
|
|
}
|
|
|
|
export const funcComponent: RecStrFuncComponent = {
|
|
action(rec, idx) {
|
|
const res: RecComponent = {
|
|
idx,
|
|
rec: rec as object,
|
|
component: action,
|
|
}
|
|
return res
|
|
},
|
|
status(rec, idx) {
|
|
if (rec.status === null) {
|
|
rec.status_code = 0
|
|
}
|
|
const res: RecComponent = {
|
|
idx,
|
|
rec: rec as object,
|
|
component: statusBadge,
|
|
}
|
|
return res
|
|
},
|
|
}
|
|
|
|
export const funcHtml: RecStrFuncUnknown = {
|
|
patient_address(_rec) {
|
|
return '-'
|
|
},
|
|
}
|