feat/prescription-56: merapikan models

This commit is contained in:
Andrian Roshandy
2025-09-28 07:10:32 +07:00
parent e7851f4dc2
commit 4fbd8ee757
9 changed files with 186 additions and 22 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
export interface ItemPrice { export interface ItemPrice {
id: string id: number
item_id: number item_id: number
price: number price: number
insuranceCompany_code: string insuranceCompany_code: string
@@ -30,8 +30,9 @@ export interface DeleteDto {
id?: string id?: string
} }
export function genMedicine(): CreateDto { export function genItemPrice(): ItemPrice {
return { return {
id: 0,
item_id: 1, item_id: 1,
price: 1, price: 1,
insuranceCompany_code: 'test', insuranceCompany_code: 'test',
+3 -2
View File
@@ -1,5 +1,5 @@
export interface Item { export interface Item {
id: string id: number
name: string name: string
code: string code: string
itemGroup_code: string itemGroup_code: string
@@ -36,8 +36,9 @@ export interface DeleteDto {
id?: string id?: string
} }
export function genMedicine(): CreateDto { export function genItem(): Item {
return { return {
id: 0,
name: 'test', name: 'test',
code: 'test', code: 'test',
itemGroup_code: 'test', itemGroup_code: 'test',
+5 -4
View File
@@ -1,5 +1,5 @@
export interface MedicineGroup { export interface MedicineGroup {
id: string id: number
name: string name: string
code: string code: string
} }
@@ -28,9 +28,10 @@ export interface DeleteDto {
id?: string id?: string
} }
export function genMedicine(): CreateDto { export function genMedicineGroup(): MedicineGroup {
return { return {
name: 'name', id: 0,
code: 'code', name: '',
code: '',
} }
} }
+3 -2
View File
@@ -1,5 +1,5 @@
export interface MedicineMethod { export interface MedicineMethod {
id: string id: number
name: string name: string
code: string code: string
} }
@@ -28,8 +28,9 @@ export interface DeleteDto {
id?: string id?: string
} }
export function genMedicine(): CreateDto { export function genMedicineMethod(): MedicineMethod {
return { return {
id: 0,
name: 'name', name: 'name',
code: 'code', code: 'code',
} }
+13 -12
View File
@@ -4,7 +4,7 @@ export interface MedicineBase {
} }
export interface Medicine { export interface Medicine {
id: string id: number
name: string name: string
code: string code: string
medicineGroup_code: string medicineGroup_code: string
@@ -57,17 +57,18 @@ export interface DeleteDto {
id?: string id?: string
} }
export function genMedicine(): CreateDto { export function genMedicine(): Medicine {
return { return {
name: 'name', id: 0,
code: 'code', name: '',
medicineGroup_code: 'medicineGroup_code', code: '',
medicineMethod_code: 'medicineMethod_code', medicineGroup_code: '',
uom_code: 'uom_code', medicineMethod_code: '',
type: 'type', uom_code: '',
dose: 'dose', type: '',
infra_id: 'infra_id', dose: '',
stock: 'stock', infra_id: '',
status: 'status', stock: '',
status: '',
} }
} }
+46
View File
@@ -0,0 +1,46 @@
import { type Medicine, genMedicine } from "./medicine";
interface MedicinemixItem {
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 {
id: 0,
medicineMix_id: 0,
medicine_id: 0,
medicine: genMedicine(),
dose: 0,
uom_code: ''
}
}
+36
View File
@@ -0,0 +1,36 @@
export interface Medicinemix {
id: number
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 {
id: 0,
name: '',
uom_code: '',
}
}
+69
View File
@@ -0,0 +1,69 @@
import { genMedicine, type Medicine } from "./medicine";
import { genMedicinemix, type Medicinemix } from "./medicinemix";
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: ''
}
}
+8
View File
@@ -3,3 +3,11 @@ export interface Uom {
name: string name: string
erp_id: string erp_id: string
} }
export function genUom(): Uom {
return {
code: '',
name: '',
erp_id: '',
}
}