Dev cleaning (#106)

This commit is contained in:
Munawwirul Jamal
2025-10-08 00:03:36 +07:00
committed by GitHub
parent 7fdd5c61f0
commit 3eb9dde21d
892 changed files with 51326 additions and 1 deletions
+30
View File
@@ -0,0 +1,30 @@
Based on the following information:
Template
code varchar 10 notnull
name varchar 10
Original_SrcCode_Id int notnull
dateTime datetime notnull
date date
I created the following typescript:
import { type Base, genBase } from "./_base"
export interface Template extends Base {
code: string
name?: string
original_srcCode_id: number
dateTime: string
date?: string
}
export function genTemplate(): Template {
return {
...genBase(),
code: '',
original_srcCode_id: 0,
dateTime: '',
}
}
With similar method, create typescript based on the following information:
[copy from excel]
+49
View File
@@ -0,0 +1,49 @@
export interface Base {
id: number
createdAt: string | null
updatedAt: string | null
deletedAt?: string | null
}
export interface CodeName {
name: string
code: string
}
export interface TreeItem {
value: string
label: string
hasChildren: boolean
children?: TreeItem[]
}
export function genBase(): Base {
return {
id: 0,
createdAt: '',
updatedAt: '',
}
}
export type WithBase<T extends Base> = Omit<T, keyof Base> & Required<Base>
/**
* The function `withBase` sets default values for item properties if not provided.
* @param item - The `withBase` function takes in an optional parameter `item`, which is a
* partial object of type `T`. The function merges the properties of `item` with default values for
* `id`, `createdAt`, `updatedAt`, and `deletedAt`. The function then returns an object of type
* @returns The `withBase` function returns an object with default values for the properties
* `id`, `createdAt`, `updatedAt`, and `deletedAt`, along with any additional properties provided in
* the `item` parameter. The returned object has a type `WithBase<T>`, which extends `T` and
* includes the default properties.
*/
export function withBase<T extends Base>(item: Partial<T> = {}): WithBase<T> {
return {
id: 0,
createdAt: null,
updatedAt: null,
deletedAt: null,
...item,
} as WithBase<T>
}
+18
View File
@@ -0,0 +1,18 @@
import { type Base, genBase } from "./_base"
export interface Adime extends Base {
encounter_id: number
employee_id: number
time?: string
value: unknown
}
export function genAdime(): Adime {
return {
...genBase(),
encounter_id: 0,
employee_id: 0,
value: ''
}
}
+14
View File
@@ -0,0 +1,14 @@
import { type Base, genBase } from "./_base"
export interface Ambulatory extends Base {
encounter_id: number
class_code: string
}
export function genAmbulatory(): Ambulatory {
return {
...genBase(),
encounter_id: 0,
class_code: '',
}
}
+24
View File
@@ -0,0 +1,24 @@
import { type Base, genBase } from "./_base"
export interface Appointment extends Base {
practiceSchedule_id: number
patient_id: number
person_residentIdentitynumber: string
person_name: string
person_phoneNumber: string
paymentMethod_code: string
refNumber: string
}
export function genAppointment(): Appointment {
return {
...genBase(),
practiceSchedule_id: 0,
patient_id: 0,
person_residentIdentitynumber: '',
person_name: '',
person_phoneNumber: '',
paymentMethod_code: '',
refNumber: '',
}
}
+20
View File
@@ -0,0 +1,20 @@
import { type Base, genBase } from "./_base"
export interface Chemo extends Base {
encounter_id: number
status_code: string
verified_at: string
verified_by_user_id: number
src_unit_id: number
}
export function genChemo(): Chemo {
return {
...genBase(),
encounter_id: 0,
status_code: '',
verified_at: '',
verified_by_user_id: 0,
src_unit_id: 0,
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface DeviceOrderItem extends Base {
deviceOrder_id: number
device_id: number
count: number
}
export function genDeviceOrderItem(): DeviceOrderItem {
return {
...genBase(),
deviceOrder_id: 0,
device_id: 0,
count: 0,
}
}
+15
View File
@@ -0,0 +1,15 @@
import { type Base, genBase } from "./_base"
export interface DeviceOrder extends Base {
encounter_id: number
doctor_id: number
status_code?: string
}
export function genDeviceOrder(): DeviceOrder {
return {
...genBase(),
encounter_id: 0,
doctor_id: 0,
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface Device extends Base {
code: string
name: string
uom_code: string
}
export function genDevice(): Device {
return {
...genBase(),
code: '',
name: '',
uom_code: '',
}
}
+18
View File
@@ -0,0 +1,18 @@
import { type Base, genBase } from "./_base"
export interface DivisionPosition extends Base {
code: string
name: string
division_id: number
employee_id?: number
}
export function genDivisionPosition(): DivisionPosition {
return {
...genBase(),
code: '',
name: '',
division_id: 0,
employee_id: 0,
}
}
+18
View File
@@ -0,0 +1,18 @@
import { type Base, genBase } from "./_base"
export interface Division extends Base {
code: string
name: string
parent_id?: number | null
childrens?: Division[] | null
}
export function genDivision(): Division {
return {
...genBase(),
code: '',
name: '',
parent_id: null,
childrens: null,
}
}
+18
View File
@@ -0,0 +1,18 @@
import { type Base, genBase } from "./_base"
export interface DoctorFee extends Base {
doctor_id: number
feeType_code: string
price: number
item_id: number
}
export function genDoctorFee(): DoctorFee {
return {
...genBase(),
doctor_id: 0,
feeType_code: '',
price: 0,
item_id: 0,
}
}
+57
View File
@@ -0,0 +1,57 @@
import { type Base, genBase } from "./_base"
import { type Employee, genEmployee } from "./employee"
import type { Specialist } from "./specialist"
import type { Subspecialist } from "./subspecialist"
export interface Doctor extends Base {
employee_id: number
employee: Employee
ihs_number: string
sip_number: string
unit_id?: number
specialist_id?: number
specialist?: Specialist
subspecialist_id?: number
subspecialist?: Subspecialist
bpjs_code?: string
}
// use one dto for both create and update
export interface CreateDto {
employee_id: number
ihs_number: string
sip_number: string
unit_id?: number
specialist_id?: number
subspecialist_id?: number
bpjs_code: string
}
export interface GetListDto {
name?: string
identity_number?: string
sip_no?: string
ihs_number?: string
}
export interface GetDetailDto {
id?: string
}
export interface UpdateDto extends CreateDto {
id?: number
}
export interface DeleteDto {
id?: string
}
export function genDoctor(): Doctor {
return {
...genBase(),
employee_id: 0,
employee: genEmployee(),
ihs_number: '',
sip_number: '',
}
}
+15
View File
@@ -0,0 +1,15 @@
import { type Base, genBase } from "./_base"
export interface Emergency extends Base {
encounter_id: number
class_code: string
}
export function genEmergency(): Emergency {
return {
...genBase(),
encounter_id: 0,
class_code: '',
}
}
+46
View File
@@ -0,0 +1,46 @@
import { type Base, genBase } from "./_base"
import { type Person, genPerson } from "./person"
export interface Employee extends Base {
user_id: number
person_id: number
person: Person
position_code: string
division_code?: string
number?: string
status_code: string
}
export interface CreateDto extends Employee {
user_id: number
person_id: number
position_code: string
division_code: string
number: string
status_code: string
}
export interface GetListDto {
position_code?: string
division_code?: string
number?: string
}
export interface UpdateDto extends Employee {
id: number
}
export interface DeleteDto {
id: number
}
export function genEmployee(): Employee {
return {
...genBase(),
user_id: 0,
person_id: 0,
person: genPerson(),
position_code: '',
status_code: '',
}
}
+18
View File
@@ -0,0 +1,18 @@
import { type Base, genBase } from "./_base"
export interface EncounterPayment extends Base {
encounter_id: number
paymentMethod_code: string
insuranceCompany_id?: number
member_number?: string
ref_number?: string
trx_number?: string
}
export function genEncounterPayment(): EncounterPayment {
return {
...genBase(),
encounter_id: 0,
paymentMethod_code: '',
}
}
+39
View File
@@ -0,0 +1,39 @@
import { type Doctor, genDoctor } from "./doctor"
export interface Encounter {
id: number
patient_id: number
registeredAt: string
class_code: string
unit_id: number
specialist_id?: number
subspecialist_id?: number
visitdate: string
appointment_doctor_id: number
appointment_doctor: Doctor
responsible_doctor_id?: number
responsible_doctor?: Doctor
refSource_name?: string
appointment_id?: number
earlyEducation?: string
medicalDischargeEducation: string
admDischargeEducation?: string
dischargeMethod_code?: string
discharge_reason?: string
status_code: string
}
export function genEncounter(): Encounter {
return {
id: 0,
patient_id: 0,
registeredAt: '',
class_code: '',
unit_id: 0,
visitdate: '',
appointment_doctor_id: 0,
appointment_doctor: genDoctor(),
medicalDischargeEducation: '',
status_code: ''
}
}
+14
View File
@@ -0,0 +1,14 @@
import { type Base, genBase } from "./_base"
export interface Ethnic extends Base {
code: string
name: string
}
export function genEthnic(): Ethnic {
return {
...genBase(),
code: '',
name: '',
}
}
+10
View File
@@ -0,0 +1,10 @@
export interface Infra {
id?: number
code: string
name: string
infraGroup_code: string
parent_id?: number | string | null
specialist_id?: number | string | null
subspecialist_id?: number | string | null
unit_id?: number | string | null
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface Template extends Base {
encounter_id: number
class_code: string
infra_id: number
}
export function genTemplate(): Template {
return {
...genBase(),
encounter_id: 0,
class_code: '',
infra_id: 0,
}
}
+42
View File
@@ -0,0 +1,42 @@
import { type Base, genBase } from "./_base"
export interface Installation extends Base {
code: string
name: string
encounterClass_code?: string | null
}
export interface CreateDto {
name: string
code: string
encounterClass_code?: string | null
}
export interface GetListDto {
page: number
size: number
name?: string
code?: string
encounterClass_code?: string
}
export interface GetDetailDto {
id?: string
}
export interface UpdateDto extends CreateDto {
id?: number
}
export interface DeleteDto {
id?: string
}
export function genInstallation(): Installation {
return {
...genBase(),
name: 'name',
code: 'code',
encounterClass_code: null,
}
}
+20
View File
@@ -0,0 +1,20 @@
import { type Base, genBase } from "./_base"
export interface InsuranceCompany extends Base {
code: string
name: string
regency_code: string
address: string
phoneNumber: string
}
export function genInsuranceCompany(): InsuranceCompany {
return {
...genBase(),
code: '',
name: '',
regency_code: '',
address: '',
phoneNumber: '',
}
}
+41
View File
@@ -0,0 +1,41 @@
import { type Base, genBase } from "./_base"
export interface ItemPrice extends Base {
item_id: number
price: number
insuranceCompany_code: string
}
export interface CreateDto {
item_id: number
price: number
insuranceCompany_code: string
}
export interface GetListDto {
page: number
size: number
name?: string
code?: string
}
export interface GetDetailDto {
id?: string
}
export interface UpdateDto extends CreateDto {
id?: number
}
export interface DeleteDto {
id?: string
}
export function genItemPrice(): ItemPrice {
return {
...genBase(),
item_id: 1,
price: 1,
insuranceCompany_code: 'test',
}
}
+50
View File
@@ -0,0 +1,50 @@
import { type Base, genBase } from "./_base"
export interface Item extends Base {
name: string
code: string
itemGroup_code: string
uom_code: string
infra_id: number
stock: number
}
export interface CreateDto {
name: string
code: string
itemGroup_code: string
uom_code: string
infra_id: number
stock: number
}
export interface GetListDto {
page: number
size: number
name?: string
code?: string
}
export interface GetDetailDto {
id: number
}
export interface UpdateDto extends CreateDto {
id: number
}
export interface DeleteDto {
id: string
}
export function genItem(): Item {
return {
...genBase(),
name: '',
code: '',
itemGroup_code: '',
uom_code: '',
infra_id: 1,
stock: 1,
}
}
+13
View File
@@ -0,0 +1,13 @@
import { type Base, genBase } from "./_base"
export interface laborant extends Base {
employee_id: number
ihs_number?: string
}
export function genlaborant(): laborant {
return {
...genBase(),
employee_id: 0,
}
}
+14
View File
@@ -0,0 +1,14 @@
import { type Base, genBase } from "./_base"
export interface Language extends Base {
code: string
name: string
}
export function genMcuSrc(): Language {
return {
...genBase(),
code: '',
name: '',
}
}
+15
View File
@@ -0,0 +1,15 @@
import { type Base, genBase } from "./_base"
export interface MaterialOrderItem extends Base {
materialOrder_id: number
material_id: number
count?: number
}
export function genMaterialOrderItem(): MaterialOrderItem {
return {
...genBase(),
materialOrder_id: 0,
material_id: 0,
}
}
+15
View File
@@ -0,0 +1,15 @@
import { type Base, genBase } from "./_base"
export interface MaterialOrder extends Base {
encounter_id: number
doctor_id: number
status_code?: string
}
export function genMaterialOrder(): MaterialOrder {
return {
...genBase(),
encounter_id: 0,
doctor_id: 0,
}
}
+18
View File
@@ -0,0 +1,18 @@
import { type Base, genBase } from "./_base"
export interface Material extends Base {
code: string
name: string
uom_code: string
stock: number
}
export function genMaterial(): Material {
return {
...genBase(),
code: '',
name: '',
uom_code: '',
stock: 0,
}
}
+17
View File
@@ -0,0 +1,17 @@
import { type Base, genBase } from "./_base"
export interface McuOrderItem extends Base {
mcuOrder_id: number
mcuSrc_id: number
examinationDate?: string
result?: string
status_code?: string
}
export function genMcuOrderItem(): McuOrderItem {
return {
...genBase(),
mcuOrder_id: 0,
mcuSrc_id: 0,
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface McuOrderSubItem extends Base {
mcuSubSrc_id: number
mcuOrderItem_id: number
result?: string
status_code?: string
}
export function genMcuOrderSubItem(): McuOrderSubItem {
return {
...genBase(),
mcuSubSrc_id: 0,
mcuOrderItem_id: 0,
}
}
+23
View File
@@ -0,0 +1,23 @@
import { type Base, genBase } from "./_base"
export interface McuOrder extends Base {
encounter_id: number
doctor_id: number
status_code?: string
specimenPickTime: string
examinationDate: string
number?: number
temperature?: number
mcuUrgencyLevel_code?: string
}
export function genMcuOrder(): McuOrder {
return {
...genBase(),
encounter_id: 0,
doctor_id: 0,
specimenPickTime: '',
examinationDate: ''
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface McuSrcCategory extends Base {
code: string
name: string
scope_code: string
}
export function genMcuSrcCategory(): McuSrcCategory {
return {
...genBase(),
code: '',
name: '',
scope_code: '',
}
}
+18
View File
@@ -0,0 +1,18 @@
import { type Base, genBase } from "./_base"
export interface McuSrc extends Base {
code: string
name: string
mcuSrcCategory_code: string
item_id: number
}
export function genMcuSrc(): McuSrc {
return {
...genBase(),
code: '',
name: '',
mcuSrcCategory_code: '',
item_id: 0
}
}
+18
View File
@@ -0,0 +1,18 @@
import { type Base, genBase } from "./_base"
export interface McuSubSrcCategory extends Base {
code: string
name: string
mcuSrc_id: number
item_id: number
}
export function genMcuSubSrcCategory(): McuSubSrcCategory {
return {
...genBase(),
code: '',
name: '',
mcuSrc_id: 0,
item_id: 0
}
}
+17
View File
@@ -0,0 +1,17 @@
import { type Base, genBase } from "./_base"
export interface MedicationItemDist extends Base {
medicationItem_id: number
nurse_id: number
dateTime: string
remain?: number
}
export function genMedicationItemDist(): MedicationItemDist {
return {
...genBase(),
medicationItem_id: 0,
nurse_id: 0,
dateTime: '',
}
}
+28
View File
@@ -0,0 +1,28 @@
import { type Base, genBase } from "./_base"
export interface MedicationItem extends Base {
medication_id: number
isMix?: boolean
medicine_id?: number
medicineMix_id?: number
frequency: number
dose: number
interval: number
intervalUnit_code: string
usage?: string
intervalMultplier?: number
quantity?: number
isRedeemed?: boolean
note?: string
}
export function genMedicationItem(): MedicationItem {
return {
...genBase(),
medication_id: 0,
frequency: 0,
dose: 0,
interval: 0,
intervalUnit_code: '',
}
}
+17
View File
@@ -0,0 +1,17 @@
import { type Base, genBase } from "./_base"
export interface Medication extends Base {
encounter_id: number
pharmachist_id: number
issuedAt?: string
status_code?: string
}
export function genMedication(): Medication {
return {
...genBase(),
encounter_id: 0,
pharmachist_id: 0,
}
}
+38
View File
@@ -0,0 +1,38 @@
import { type Base, genBase } from "./_base"
export interface MedicineGroup extends Base {
name: string
code: string
}
export interface CreateDto {
name: string
code: string
}
export interface GetListDto {
page: number
size: number
name?: string
code?: string
}
export interface GetDetailDto {
id?: string
}
export interface UpdateDto extends CreateDto {
id?: number
}
export interface DeleteDto {
id?: string
}
export function genMedicine(): MedicineGroup {
return {
...genBase(),
name: 'name',
code: 'code',
}
}
+38
View File
@@ -0,0 +1,38 @@
import { type Base, genBase } from "./_base"
export interface MedicineMethod extends Base {
name: string
code: string
}
export interface CreateDto {
name: string
code: string
}
export interface GetListDto {
page: number
size: number
name?: string
code?: string
}
export interface GetDetailDto {
id?: string
}
export interface UpdateDto extends CreateDto {
id?: number
}
export interface DeleteDto {
id?: string
}
export function genMedicine(): MedicineMethod {
return {
...genBase(),
name: 'name',
code: 'code',
}
}
+65
View File
@@ -0,0 +1,65 @@
import { type Base, genBase } from "./_base"
export interface Medicine extends Base {
code: string
name: string
medicineGroup_code: string
medicineMethod_code: string
uom_code: string
infra_id?: string | null
stock: number
}
export interface CreateDto {
code: string
name: string
medicineGroup_code: string
medicineMethod_code: string
uom_code: string
infra_id?: string | null
stock: number
}
export interface UpdateDto extends CreateDto {
id: number
}
export interface GetListDto {
page: number
size: number
name?: string
code?: string
medicineGroup_code?: string
medicineMethod_code?: string
uom_code?: string
type?: string
dose?: string
infra_id?: string
stock?: string
status?: string
}
export interface GetDetailDto {
id: number
}
export interface UpdateDto extends CreateDto {
id: number
}
export interface DeleteDto {
id: number
}
export function genMedicine(): Medicine {
return {
...genBase(),
name: 'name',
code: 'code',
medicineGroup_code: 'medicineGroup_code',
medicineMethod_code: 'medicineMethod_code',
uom_code: 'uom_code',
infra_id: null,
stock: 0
}
}
+47
View File
@@ -0,0 +1,47 @@
import { type Base, genBase } from "./_base"
import { type Medicine, genMedicine } from "./medicine";
interface MedicinemixItem extends Base {
id: number
medicineMix_id: number
medicine_id: number
medicine: Medicine
dose: number
uom_code: string
}
export interface CreateDto {
medicineMix_id: number
medicine_id: number
medicine: Medicine
dose: number
uom_code: string
}
export interface GetListDto {
page: number
size: number
}
export interface GetDetailDto {
id: number
}
export interface UpdateDto extends CreateDto {
id: number
}
export interface DeleteDto {
id: number
}
export function MedicinemixItem(): MedicinemixItem {
return {
...genBase(),
medicineMix_id: 0,
medicine_id: 0,
medicine: genMedicine(),
dose: 0,
uom_code: ''
}
}
+37
View File
@@ -0,0 +1,37 @@
import { type Base, genBase } from "./_base"
export interface Medicinemix extends Base {
name: string
uom_code: string
}
export interface CreateDto {
name: string
uom_code: string
}
export interface GetListDto {
page: number
size: number
name?: string
}
export interface GetDetailDto {
id: number
}
export interface UpdateDto extends CreateDto {
id: number
}
export interface DeleteDto {
id: number
}
export function genMedicinemix(): Medicinemix {
return {
...genBase(),
name: '',
uom_code: '',
}
}
+13
View File
@@ -0,0 +1,13 @@
import { type Base, genBase } from "./_base"
export interface Midwife extends Base {
employee_id: number
ihs_number?: string
}
export function genMidwife(): Midwife {
return {
...genBase(),
employee_id: 0,
}
}
+17
View File
@@ -0,0 +1,17 @@
import { type Base, genBase } from "./_base"
export interface Nurse extends Base {
employee_id: number
ihs_number?: string
unit_id: number
infra_id: number
}
export function genNurse(): Nurse {
return {
...genBase(),
employee_id: 0,
unit_id: 0,
infra_id: 0,
}
}
+15
View File
@@ -0,0 +1,15 @@
import { type Base, genBase } from "./_base"
export interface NutritionExam extends Base {
encounter_id: number
nutritionist_id: number
status_code?: string
}
export function genNutritionExam(): NutritionExam {
return {
...genBase(),
encounter_id: 0,
nutritionist_id: 0,
}
}
+17
View File
@@ -0,0 +1,17 @@
import { type Base, genBase } from "./_base"
export interface Nurse extends Base {
employee_id: number
ihs_number?: string
unit_id: number
infra_id: number
}
export function genNurse(): Nurse {
return {
...genBase(),
employee_id: 0,
unit_id: 0,
infra_id: 0,
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface PatientInsurance extends Base {
patient_id: number
insuranceCompany_id: number
member_number: string
}
export function genPatientInsurance(): PatientInsurance {
return {
...genBase(),
patient_id: 0,
insuranceCompany_id: 0,
member_number: ''
}
}
+137
View File
@@ -0,0 +1,137 @@
import { type Base, genBase } from './_base'
import type { PatientFormData } from '~/schemas/patient.schema'
import type { PersonAddressFormData } from '~/schemas/person-address.schema'
import type { PersonAddressRelativeFormData } from '~/schemas/person-address-relative.schema'
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 type { PersonAddress } from './person-address'
import type { PersonContact } from './person-contact'
import type { PersonRelative } from './person-relative'
import { contactTypeMapping } from '~/lib/constants'
export interface PatientBase extends Base {
person_id?: number
newBornStatus?: boolean
registeredAt?: Date | string | null
status_code?: string
number?: string
}
export interface PatientEntity extends PatientBase {
person: Person
personAddresses: PersonAddress[]
personContacts: PersonContact[]
personRelatives: PersonRelative[]
}
export interface genPatientProps {
patient: PatientFormData
residentAddress: PersonAddressFormData
cardAddress: PersonAddressRelativeFormData
familyData: PersonFamiliesFormData
contacts: PersonContactFormData
responsible: PersonRelativeFormData
}
export function genPatient(props: genPatientProps): PatientEntity {
const { patient, residentAddress, cardAddress, familyData, contacts, responsible } = props
const addresses: PersonAddress[] = [{ ...genBase(), person_id: 0, locationType: '', ...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 })
}
// add data orang tua
if (familyData.shareFamilyData === '1') {
for (const family of familyData.families) {
familiesContact.push({
id: 0,
relationship_code: family.relation,
name: family.name,
education_code: family.education,
occupation_name: family.occupation,
occupation_code: family.occupation,
responsible: false,
})
}
}
// add kontak pasien
if (contacts && contacts.contacts.length > 0) {
for (const contact of contacts.contacts) {
// Convert UI contactType to backend type_code using mapping
const mappedContactType = contactTypeMapping[contact.contactType]
personContacts.push({
...genBase(),
person_id: 0,
type_code: mappedContactType || '',
value: contact.contactNumber,
})
}
}
// add penanggung jawab
if (responsible) {
for (const contact of responsible.contacts) {
familiesContact.push({
id: 0,
relationship_code: contact.relation,
name: contact.name,
address: contact.address,
phoneNumber: contact.phone,
responsible: true,
})
}
}
return {
person: {
id: 0,
name: patient.fullName,
alias: patient.alias,
birthDate: patient.birthDate,
birthRegency_code: patient.birthPlace,
gender_code: patient.gender,
residentIdentityNumber: patient.identityNumber,
passportNumber: patient.passportNumber,
drivingLicenseNumber: patient.drivingLicenseNumber,
religion_code: patient.religion,
education_code: patient.education,
occupation_code: patient.job,
occupation_name: patient.job,
ethnic_code: patient.ethnicity,
language_code: patient.language,
communicationIssueStatus: patient.communicationBarrier,
disability: patient.disability,
nationality: patient.nationality,
// residentIdentityFileUrl: patient.residentIdentityFileUrl,
// passportFileUrl: patient.passportFileUrl,
// drivingLicenseFileUrl: patient.drivingLicenseFileUrl,
// familyIdentityFileUrl: patient.familyIdentityFileUrl,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
deletedAt: null,
},
personAddresses: addresses,
personContacts: personContacts,
personRelatives: familiesContact,
registeredAt: new Date(),
status_code: 'active',
newBornStatus: false,
person_id: 0,
id: 0,
number: '0x000000000000000000000000000000',
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
deletedAt: null,
}
}
+21
View File
@@ -0,0 +1,21 @@
import { type Base, genBase } from "./_base"
export interface PersonAddress extends Base {
person_id: number
locationType: string
address: string
rt?: string
rw?: string
postalCode?: string
village_code: string
}
export function genPersonAddress(): PersonAddress {
return {
...genBase(),
person_id: 0,
locationType: '',
address: '',
village_code: '',
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface PersonContact extends Base {
person_id: number
type_code: string
value: string
}
export function genPersonContact(): PersonContact {
return {
...genBase(),
person_id: 0,
type_code: '',
value: '',
}
}
+14
View File
@@ -0,0 +1,14 @@
export interface PersonRelative {
id: number
person_id?: number
relationship_code?: string
name?: string
address?: string
village_code?: string
gender_code?: string
phoneNumber?: string
education_code?: string
occupation_name?: string
occupation_code?: string
responsible?: boolean
}
+36
View File
@@ -0,0 +1,36 @@
import { type Base, genBase } from "./_base"
export interface Person extends Base {
// todo: awaiting approve from stake holder: buat field sapaan
// todo: adjust field ketika person Balita
name: string
alias?: string
frontTitle?: string
endTitle?: string
birthDate?: Date | string
birthRegency_code?: string
gender_code?: string
residentIdentityNumber?: string
passportNumber?: string
drivingLicenseNumber?: string
religion_code?: string
education_code?: string
occupation_code?: string
occupation_name?: string
ethnic_code?: string
language_code?: string
nationality?: string
communicationIssueStatus?: boolean
disability?: string
residentIdentityFileUrl?: string
passportFileUrl?: string
drivingLicenseFileUrl?: string
familyIdentityFileUrl?: string
}
export function genPerson(): Person {
return {
...genBase(),
name: '',
}
}
+13
View File
@@ -0,0 +1,13 @@
import { type Base, genBase } from "./_base"
export interface Pharmachist extends Base {
employee_id: number
ihs_number?: string
}
export function genPharmachist(): Pharmachist {
return {
...genBase(),
employee_id: 0,
}
}
+23
View File
@@ -0,0 +1,23 @@
import { type Base, genBase } from "./_base"
import { type Doctor, genDoctor } from "./doctor"
export interface PracticeSchedule extends Base {
doctor_id: number
doctor: Doctor
unit_code: number
day_code: number
starttime: string
endtime: string
}
export function genPracticeSchedule(): PracticeSchedule {
return {
...genBase(),
doctor_id: 0,
doctor: genDoctor(),
unit_code: 0,
day_code: 0,
starttime: '',
endtime: '',
}
}
+69
View File
@@ -0,0 +1,69 @@
import { genMedicine, type Medicine } from "./medicine";
import { genMedicinemix, type Medicinemix } from "./medicinemix";
export interface PrescriptionItem {
id: number;
prescription_id: number;
isMix: boolean;
medicine_id: number;
medicine: Medicine;
medicineMix_id: number;
medicineMix: Medicinemix
frequency: number;
dose: number;
interval: number;
intervalUnit_code: string;
quantity: number;
usage: string;
}
export interface CreateDto {
prescription_Id: number;
isMix: boolean;
medicine_Id: number;
medicineMix_id: number;
frequency: number;
multiplier: number;
interval: number;
intervalUnit_code: string;
quantity: number;
usage: string;
}
export interface GetListDto {
page: number
size: number
name?: string
// code?: string
}
export interface GetDetailDto {
id?: string
}
export interface UpdateDto extends CreateDto {
id?: number
}
export interface DeleteDto {
id?: string
}
export function genPresciptionItem(): PrescriptionItem {
return {
id: 0,
prescription_id: 0,
isMix: false,
medicine_id: 0,
medicine: genMedicine(),
medicineMix_id: 0,
medicineMix: genMedicinemix(),
frequency: 0,
dose: 0,
interval: 0,
intervalUnit_code: '',
quantity: 0,
usage: ''
}
}
+56
View File
@@ -0,0 +1,56 @@
import { type Encounter, genEncounter } from "./encounter";
import { type Doctor, genDoctor } from "./doctor";
import { type PrescriptionItem } from "./prescription-item";
import type { SpecialistIntern } from "./specialist-intern";
export interface Prescription {
id: number
encounter_id: number
encounter: Encounter
doctor_id: number
doctor: Doctor
specialistIntern_id?: number
specialistIntern?: SpecialistIntern
issuedAt: string
status_code: string
items: PrescriptionItem[]
}
export interface CreateDto {
encounter_id: number
doctor_id: number
issuedAt: string
status_code: string
}
export interface GetListDto {
encounter_id: number
doctor_id: number
issuedAt: string
status_code: string
}
export interface GetDetailDto {
id?: string
}
export interface UpdateDto extends CreateDto {
id?: number
}
export interface DeleteDto {
id?: string
}
export function genPresciption(): Prescription {
return {
id: 0,
encounter_id: 0,
encounter: genEncounter(),
doctor_id: 0,
doctor: genDoctor(),
issuedAt: '',
status_code: '',
items: [],
}
}
+14
View File
@@ -0,0 +1,14 @@
import { type Base, genBase } from "./_base"
export interface Province extends Base {
code: string
name: string
}
export function genProvince(): Province {
return {
...genBase(),
code: '',
name: '',
}
}
+22
View File
@@ -0,0 +1,22 @@
import { type Base, genBase } from "./_base"
export interface Queue extends Base {
appointment_id: number
counter_id: number
status_code: string
waitTimeStamp: number
startTimeStamp: number
endTimeStamp: number
}
export function genQueue(): Queue {
return {
...genBase(),
appointment_id: 0,
counter_id: 0,
status_code: '',
waitTimeStamp: 0,
startTimeStamp: 0,
endTimeStamp: 0,
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface Regency extends Base {
code: string
name: string
province_code: string
}
export function genRegency(): Regency {
return {
...genBase(),
code: '',
name: '',
province_code: '',
}
}
+22
View File
@@ -0,0 +1,22 @@
import type { PAGE_PERMISSIONS } from '~/lib/page-permission'
export interface User {
id: string
name: string
email: string
}
export interface AuthState {
user: User | null
roles: string[]
token: string | null
}
export type Permission = 'C' | 'R' | 'U' | 'D'
export interface RoleAccess {
[role: string]: Permission[]
}
export type PagePath = keyof typeof PAGE_PERMISSIONS
export type PagePermission = (typeof PAGE_PERMISSIONS)[PagePath]
+17
View File
@@ -0,0 +1,17 @@
import { type Base, genBase } from "./_base"
export interface Sbar extends Base {
encounter_id: number
employee_id: number
time?: string
value: unknown
}
export function genSbar(): Sbar {
return {
...genBase(),
encounter_id: 0,
employee_id: 0,
value: '',
}
}
+18
View File
@@ -0,0 +1,18 @@
import { type Base, genBase } from "./_base"
export interface Soapi extends Base {
encounter_id: number
employee_id: number
time?: string
typeCode?: string
value: unknown
}
export function genSoapi(): Soapi {
return {
...genBase(),
encounter_id: 0,
employee_id: 0,
value: '',
}
}
+25
View File
@@ -0,0 +1,25 @@
import { type Base, genBase } from "./_base"
import { type Person, genPerson } from "./person";
import { type Specialist, genSpecialist } from "./specialist";
import { type Subspecialist } from "./subspecialist";
export interface SpecialistIntern extends Base {
person_id: number
person: Person
specialist_id: number
specialist: Specialist
subspecialist_id?: number
subspecialist?: Subspecialist
user_id: number
}
export function genSpecialistIntern(): SpecialistIntern {
return {
...genBase(),
person_id: 0,
person: genPerson(),
specialist_id: 0,
specialist: genSpecialist(),
user_id: 0,
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface Specialist extends Base {
code: string
name: string
unit_id?: number | string | null
}
export function genSpecialist(): Specialist {
return {
...genBase(),
code: '',
name: '',
unit_id: 0
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface Subspecialist extends Base {
code: string
name: string
specialist_id?: number | string | null
}
export function genSubspecialist(): Subspecialist {
return {
...genBase(),
code: '',
name: '',
specialist_id: 0
}
}
+32
View File
@@ -0,0 +1,32 @@
import { type Base, genBase } from "./_base"
export interface triage extends Base {
encounter_id: number
arrival_time: string
arrival_condition_code: string
arrival_transporation_code: string
patient_name: string
patient_id: number
patient_residentIdentityNumber: string
patient_birthDate: string
patient_gender_code: string
diagnosis: string
doctor_id: number
}
export function gentriage(): triage {
return {
...genBase(),
encounter_id: 0,
arrival_time: '',
arrival_condition_code: '',
arrival_transporation_code: '',
patient_name: '',
patient_id: 0,
patient_residentIdentityNumber: '',
patient_birthDate: '',
patient_gender_code: '',
diagnosis: '',
doctor_id: 0,
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface Unit extends Base {
code: string
name: string
installation_id?: number | string | null
}
export function genUnit(): Unit {
return {
...genBase(),
code: '',
name: '',
installation_id: 0,
}
}
+16
View File
@@ -0,0 +1,16 @@
import { type Base, genBase } from "./_base"
export interface Uom extends Base {
code: string
name: string
erp_id: string
}
export function genUom(): Uom {
return {
...genBase(),
code: '',
name: '',
erp_id: '',
}
}
+17
View File
@@ -0,0 +1,17 @@
import { type Base, genBase } from "./_base"
export interface User extends Base {
name: string
// password: string // not returning password from API
status_code: string
position_code: string
}
export function genUser(): User {
return {
...genBase(),
name: '',
status_code: '',
position_code: ''
}
}