Merge branch 'dev' into feat/encounter
This commit is contained in:
@@ -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: '',
|
||||
}
|
||||
}
|
||||
@@ -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: '',
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
+29
-8
@@ -40,13 +40,35 @@ export interface genPatientProps {
|
||||
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 genPatientEntity(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 genPatientEntity(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,17 +148,16 @@ export function genPatientEntity(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
|
||||
|
||||
@@ -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(', ')
|
||||
}
|
||||
|
||||
@@ -12,3 +12,4 @@ export interface PersonRelative {
|
||||
occupation_code?: string
|
||||
responsible?: boolean
|
||||
}
|
||||
|
||||
|
||||
+12
-6
@@ -2,12 +2,13 @@ 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
|
||||
@@ -29,9 +30,14 @@ export interface Person extends Base {
|
||||
passportFileUrl?: string
|
||||
drivingLicenseFileUrl?: string
|
||||
familyIdentityFileUrl?: string
|
||||
addresses?: PersonAddress[]
|
||||
contacts?: PersonContact[]
|
||||
relatives?: PersonRelative[]
|
||||
|
||||
// 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 {
|
||||
|
||||
@@ -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: '',
|
||||
}
|
||||
}
|
||||
@@ -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: '',
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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: '',
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user