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.
This commit is contained in:
Khafid Prayoga
2025-10-10 15:35:12 +07:00
parent ea04f33ad1
commit 7f6e0cc1fd
6 changed files with 81 additions and 43 deletions
+4 -4
View File
@@ -21,7 +21,7 @@ export interface PatientBase extends Base {
number?: string
}
export interface PatientEntity extends PatientBase {
export interface Patient extends PatientBase {
person: Person
personAddresses: PersonAddress[]
personContacts: PersonContact[]
@@ -37,16 +37,16 @@ export interface genPatientProps {
responsible: PersonRelativeFormData
}
export function genPatient(props: genPatientProps): PatientEntity {
export function genPatient(props: genPatientProps): Patient {
const { patient, residentAddress, cardAddress, familyData, contacts, responsible } = props
const addresses: PersonAddress[] = [{ ...genBase(), person_id: 0, locationType: '', ...residentAddress }]
const addresses: PersonAddress[] = [{ ...genBase(), person_id: 0, ...residentAddress }]
const familiesContact: PersonRelative[] = []
const personContacts: PersonContact[] = []
// jika alamat ktp sama dengan domisili saat ini
if (cardAddress.isSameAddress) {
addresses.push({ ...genBase(), person_id: 0, locationType: '', ...residentAddress })
addresses.push({ ...genBase(), ...residentAddress, person_id: 0, locationType: 'identity' })
}
// add data orang tua
+1
View File
@@ -12,3 +12,4 @@ export interface PersonRelative {
occupation_code?: string
responsible?: boolean
}