diff --git a/src/entity/emr/emr_compounding_medicine.ts b/src/entity/emr/emr_compounding_medicine.ts new file mode 100644 index 0000000..e1a3ee4 --- /dev/null +++ b/src/entity/emr/emr_compounding_medicine.ts @@ -0,0 +1,60 @@ +import { + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + UpdateDateColumn, + DeleteDateColumn, + OneToMany +} from "typeorm"; + +import {EmrCompoundingMedicineItem} from "./emr_compounding_medicine_item"; + +@Entity("emr_compounding_medicine", { schema: "emr" }) +export class EmrCompoundingMedicine { + @PrimaryGeneratedColumn("uuid") + id: string; + + @OneToMany(() => EmrCompoundingMedicineItem, (detail) => detail.compoundingmedicine) + compoundingmedicineitem: EmrCompoundingMedicineItem[]; + + @Column({ nullable: true, type: "text" }) + name: string; + + @Column({ + type: "int", + nullable: false + }) + qty: number; + + @Column({ nullable: true, type: "text" }) + compounding_notes: string; + + @Column({ nullable: true, type: "text" }) + usage_time: string; + + @Column({ nullable: true, type: "text" }) + usage_instructions: string; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true, length: 256 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true, length: 256 }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ nullable: true, length: 256 }) + deleted_by: string; +} + diff --git a/src/entity/emr/emr_compounding_medicine_item.ts b/src/entity/emr/emr_compounding_medicine_item.ts new file mode 100644 index 0000000..f3fb9f8 --- /dev/null +++ b/src/entity/emr/emr_compounding_medicine_item.ts @@ -0,0 +1,54 @@ +import { + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + UpdateDateColumn, + DeleteDateColumn, + ManyToOne, + JoinColumn, +} from "typeorm"; +import { ItemMaster } from "../pharmacy/item_master"; +import { EmrCompoundingMedicine } from "./emr_compounding_medicine"; + +@Entity("emr_compounding_medicine_item", { schema: "emr" }) +export class EmrCompoundingMedicineItem { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => ItemMaster, { onDelete: "CASCADE" }) + @JoinColumn() + itemmaster: ItemMaster; + + @ManyToOne(() => EmrCompoundingMedicine, { onDelete: "CASCADE" }) + @JoinColumn() + compoundingmedicine: EmrCompoundingMedicine; + + @Column({ + type: "int", + nullable: false + }) + dose: number + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true, length: 256 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true, length: 256 }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ nullable: true, length: 256 }) + deleted_by: string; +} + diff --git a/src/schema/emr.ts b/src/schema/emr.ts index 1718a5b..f358db7 100644 --- a/src/schema/emr.ts +++ b/src/schema/emr.ts @@ -19,6 +19,8 @@ export * from "../entity/emr/emr_prescription_orders"; export * from "../entity/emr/emr_prescription_order_items"; export * from "../entity/emr/emr_radiology"; export * from "../entity/emr/emr_radiology_services"; +export * from "../entity/emr/emr_compounding_medicine"; +export * from "../entity/emr/emr_compounding_medicine_item"; export * from "../types/registration_type"; export * from "../types/registration_status";