From 7f6e0cc1fdacbf06a2d08249d99b31d38cba287a Mon Sep 17 00:00:00 2001 From: Khafid Prayoga Date: Fri, 10 Oct 2025 15:35:12 +0700 Subject: [PATCH] refactor(patient): rename PatientEntity to Patient and update related components Update interface name from PatientEntity to Patient for better clarity and consistency. Modify all related components and models to use the new interface name. Also includes minor improvements to address handling in patient forms. --- app/components/app/patient/list-cfg.ts | 14 ++-- app/components/app/patient/preview.vue | 91 ++++++++++++++++------- app/components/content/patient/detail.vue | 6 +- app/components/content/patient/entry.vue | 4 +- app/models/patient.ts | 8 +- app/models/person-relative.ts | 1 + 6 files changed, 81 insertions(+), 43 deletions(-) diff --git a/app/components/app/patient/list-cfg.ts b/app/components/app/patient/list-cfg.ts index 4fbdf694..fa91ba23 100644 --- a/app/components/app/patient/list-cfg.ts +++ b/app/components/app/patient/list-cfg.ts @@ -6,7 +6,7 @@ import type { RecStrFuncUnknown, Th, } from '~/components/pub/my-ui/data/types' -import type { PatientEntity } from '~/models/patient' +import type { Patient } from '~/models/patient' import { defineAsyncComponent } from 'vue' import { educationCodes, genderCodes } from '~/lib/constants' import { calculateAge } from '~/lib/utils' @@ -36,11 +36,11 @@ export const delKeyNames: KeyLabel[] = [ export const funcParsed: RecStrFuncUnknown = { name: (rec: unknown): unknown => { - const { person } = rec as PatientEntity + const { person } = rec as Patient return person.name.trim() }, identity_number: (rec: unknown): unknown => { - const { person } = rec as PatientEntity + const { person } = rec as Patient if (person?.residentIdentityNumber?.substring(0, 5) === 'BLANK') { return '(TANPA NIK)' @@ -48,7 +48,7 @@ export const funcParsed: RecStrFuncUnknown = { return person.residentIdentityNumber }, birth_date: (rec: unknown): unknown => { - const { person } = rec as PatientEntity + const { person } = rec as Patient if (typeof person.birthDate == 'object' && person.birthDate) { return (person.birthDate as Date).toLocaleDateString() @@ -58,11 +58,11 @@ export const funcParsed: RecStrFuncUnknown = { return person.birthDate }, patient_age: (rec: unknown): unknown => { - const { person } = rec as PatientEntity + const { person } = rec as Patient return calculateAge(person.birthDate) }, gender: (rec: unknown): unknown => { - const { person } = rec as PatientEntity + const { person } = rec as Patient if (typeof person.gender_code == 'number' && person.gender_code >= 0) { return person.gender_code @@ -72,7 +72,7 @@ export const funcParsed: RecStrFuncUnknown = { return '-' }, education: (rec: unknown): unknown => { - const { person } = rec as PatientEntity + const { person } = rec as Patient if (typeof person.education_code == 'number' && person.education_code >= 0) { return person.education_code } else if (typeof person.education_code === 'string' && person.education_code) { diff --git a/app/components/app/patient/preview.vue b/app/components/app/patient/preview.vue index ef24c771..a7e174b1 100644 --- a/app/components/app/patient/preview.vue +++ b/app/components/app/patient/preview.vue @@ -1,8 +1,8 @@