Merge branch 'dev' of https://github.com/dikstub-rssa/simrs-fe into feat/integrasi-assessment-medis-114

This commit is contained in:
Abizrh
2025-10-20 20:09:39 +07:00
163 changed files with 5909 additions and 1662 deletions
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from './_base'
export interface DiagnoseSrc extends Base {
code: string
name: string
indName: string
}
export function genDiagnoseSrc(): DiagnoseSrc {
return {
...genBase(),
code: '',
name: '',
indName: '',
}
}
+20
View File
@@ -0,0 +1,20 @@
import { type Base, genBase } from './_base'
import type { Regency } from './regency'
export interface District extends Base {
regency_code: string
code: string
name: string
// preload
regency?: Regency | null
}
export function genDistrict(): District {
return {
...genBase(),
regency_code: '',
name: '',
code: '',
}
}
+12 -2
View File
@@ -1,15 +1,23 @@
import { type Doctor, genDoctor } from "./doctor"
import { genEmployee, type Employee } from "./employee"
import { type Patient, genPatient } from "./patient"
import type { Specialist } from "./specialist"
import type { Subspecialist } from "./subspecialist"
import { genUnit, type Unit } from "./unit"
export interface Encounter {
id: number
patient_id: number
patient: Patient
registeredAt: string
class_code: string
unit_id: number
unit: Unit
specialist_id?: number
specilist?: Specialist
subspecialist_id?: number
visitdate: string
subspecialist?: Subspecialist
visitDate: string
adm_employee_id: number
adm_employee: Employee
appointment_doctor_id: number
@@ -30,10 +38,12 @@ export function genEncounter(): Encounter {
return {
id: 0,
patient_id: 0,
patient: genPatient(),
registeredAt: '',
class_code: '',
unit_id: 0,
visitdate: '',
unit: genUnit(),
visitDate: '',
adm_employee_id: 0,
adm_employee: genEmployee(),
appointment_doctor_id: 0,
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from './_base'
export interface MedicalActionSrcItem extends Base {
medicalActionSrc_id: number
procedureSrc_id: number
item_id: number
}
export function genMedicalActionSrcItem(): MedicalActionSrcItem {
return {
...genBase(),
medicalActionSrc_id: 0,
procedureSrc_id: 0,
item_id: 0,
}
}
+19
View File
@@ -0,0 +1,19 @@
import { type Base, genBase } from './_base'
import type { medicalActionTypeCodeKey } from '~/lib/constants'
export interface MedicalActionSrc extends Base {
code: string
name: string
type_code: medicalActionTypeCodeKey
item_id: number
}
export function genMedicalActionSrc(): MedicalActionSrc {
return {
...genBase(),
code: '',
name: '',
type_code: '',
item_id: 0,
}
}
+53 -9
View File
@@ -6,7 +6,7 @@ import type { PersonFamiliesFormData } from '~/schemas/person-family.schema'
import type { PersonContactFormData } from '~/schemas/person-contact.schema'
import type { PersonRelativeFormData } from '~/schemas/person-relative.schema'
import type { Person } from './person'
import { genPerson, type Person } from './person'
import type { PersonAddress } from './person-address'
import type { PersonContact } from './person-contact'
import type { PersonRelative } from './person-relative'
@@ -37,16 +37,38 @@ export interface genPatientProps {
responsible: PersonRelativeFormData
}
export function genPatient(props: genPatientProps): PatientEntity {
export function genPatientEntity(props: genPatientProps): PatientEntity {
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 === '1') {
addresses.push({ ...genBase(), person_id: 0, locationType: '', ...residentAddress })
if (cardAddress.isSameAddress) {
addresses.push({
...genBase(),
...residentAddress,
person_id: 0,
locationType_code: cardAddress.locationType_code || 'identity'
})
} else {
// jika alamat berbeda, tambahkan alamat relatif
// Pastikan semua field yang diperlukan ada
const relativeAddress = {
...genBase(),
person_id: 0,
locationType_code: cardAddress.locationType_code || 'identity',
address: cardAddress.address || '',
province_code: cardAddress.province_code || '',
regency_code: cardAddress.regency_code || '',
district_code: cardAddress.district_code || '',
village_code: cardAddress.village_code || '',
postalRegion_code: cardAddress.postalRegion_code || '',
rt: cardAddress.rt,
rw: cardAddress.rw,
}
addresses.push(relativeAddress)
}
// add data orang tua
@@ -97,7 +119,7 @@ export function genPatient(props: genPatientProps): PatientEntity {
person: {
id: 0,
name: patient.fullName,
alias: patient.alias,
// alias: patient.alias,
birthDate: patient.birthDate,
birthRegency_code: patient.birthPlace,
gender_code: patient.gender,
@@ -111,7 +133,7 @@ export function genPatient(props: genPatientProps): PatientEntity {
ethnic_code: patient.ethnicity,
language_code: patient.language,
communicationIssueStatus: patient.communicationBarrier,
disability: patient.disability,
disability: patient.disabilityType || '',
nationality: patient.nationality,
// residentIdentityFileUrl: patient.residentIdentityFileUrl,
// passportFileUrl: patient.passportFileUrl,
@@ -126,12 +148,34 @@ export function genPatient(props: genPatientProps): PatientEntity {
personRelatives: familiesContact,
registeredAt: new Date(),
status_code: 'active',
newBornStatus: false,
newBornStatus: patient.isNewBorn,
person_id: 0,
id: 0,
number: '0x000000000000000000000000000000',
number: '',
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
deletedAt: null,
}
}
// New model
export interface Patient extends Base {
person_id?: number
person: Person
newBornStatus?: boolean
registeredAt?: Date | string | null
status_code?: string
number?: string
}
export function genPatient(): Patient {
return {
...genBase(),
person_id: 0,
registeredAt: '',
status_code: '',
number: '',
newBornStatus: false,
person: genPerson(),
}
}
+31 -5
View File
@@ -1,21 +1,47 @@
import { type Base, genBase } from "./_base"
import { type Base, genBase } from './_base'
import type { AddressLocationTypeCode } from '~/lib/constants'
import type { PostalRegion } from './postal-region'
import { toTitleCase } from '~/lib/utils'
export interface PersonAddress extends Base {
person_id: number
locationType: string
locationType_code: AddressLocationTypeCode
address: string
rt?: string
rw?: string
postalCode?: string
postalRegion_code?: string
village_code: string
// preload
postalRegion?: PostalRegion | null
locationType?: AddressLocationTypeCode
}
export function genPersonAddress(): PersonAddress {
return {
...genBase(),
person_id: 0,
locationType: '',
locationType_code: '',
address: '',
village_code: '',
}
}
export function formatAddress(builder?: PersonAddress) {
if (!builder) return ''
const village = builder?.postalRegion?.village
const district = village?.district
const regency = district?.regency
const province = regency?.province
const parts = [
builder?.address,
village?.name,
district?.name,
toTitleCase(regency?.name || ''),
toTitleCase(province?.name || ''),
builder?.postalRegion_code,
].filter(Boolean)
return parts.join(', ')
}
+1
View File
@@ -12,3 +12,4 @@ export interface PersonRelative {
occupation_code?: string
responsible?: boolean
}
+16 -4
View File
@@ -1,13 +1,17 @@
import { type Base, genBase } from "./_base"
import type { PersonAddress } from "./person-address"
import type { PersonContact } from "./person-contact"
import type { PersonRelative } from "./person-relative"
import type { Ethnic } from './ethnic'
import type { Language } from './language'
import type { Regency } from './regency'
export interface Person extends Base {
// todo: awaiting approve from stake holder: buat field sapaan
// todo: adjust field ketika person Balita
name: string
alias?: string
// alias?: string
frontTitle?: string
endTitle?: string
birthDate?: Date | string
birthDate?: string
birthRegency_code?: string
gender_code?: string
residentIdentityNumber?: string
@@ -26,6 +30,14 @@ export interface Person extends Base {
passportFileUrl?: string
drivingLicenseFileUrl?: string
familyIdentityFileUrl?: string
// preload data for detail patient
birthRegency?: Regency | null
addresses?: PersonAddress[] | null
contacts?: PersonContact[] | null
relatives?: PersonRelative[] | null
ethnic?: Ethnic | null
language?: Language | null
}
export function genPerson(): Person {
+18
View File
@@ -0,0 +1,18 @@
import { type Base, genBase } from './_base'
import type { Village } from './village'
export interface PostalRegion extends Base {
code: string
village_code: string
// preload
village?: Village | null
}
export function genPostalRegion(): PostalRegion {
return {
...genBase(),
code: '',
village_code: '',
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from './_base'
export interface ProcedureSrc extends Base {
code: string
name: string
indName: string
}
export function genProcedureSrc(): ProcedureSrc {
return {
...genBase(),
code: '',
name: '',
indName: '',
}
}
+4 -1
View File
@@ -1,9 +1,12 @@
import { type Base, genBase } from "./_base"
import { type Base, genBase } from './_base'
import type { Province } from './province'
export interface Regency extends Base {
code: string
name: string
province_code: string
province?: Province | null
}
export function genRegency(): Regency {
+20
View File
@@ -0,0 +1,20 @@
import { type Base, genBase } from './_base'
import type { District } from './district'
export interface Village extends Base {
district_code: string
code: string
name: string
// preload
district?: District | null
}
export function genVillage(): Village {
return {
...genBase(),
district_code: '',
code: '',
name: '',
}
}