From 18a858013a8ac49b9a5194764f5e040115bcd011 Mon Sep 17 00:00:00 2001 From: Rayhan Ardiansyah Date: Fri, 6 Mar 2026 13:30:50 +0700 Subject: [PATCH] add patient group --- src/entity/patient_group.ts | 41 ++++++++++++++++++ src/entity/patient_guarantor.ts | 74 +++++++++++++++++++++++++++++++++ src/entity/user_to_room.ts | 52 +++++++++++++++++++++++ src/schema/public.ts | 3 ++ 4 files changed, 170 insertions(+) create mode 100644 src/entity/patient_group.ts create mode 100644 src/entity/patient_guarantor.ts create mode 100644 src/entity/user_to_room.ts diff --git a/src/entity/patient_group.ts b/src/entity/patient_group.ts new file mode 100644 index 0000000..271a569 --- /dev/null +++ b/src/entity/patient_group.ts @@ -0,0 +1,41 @@ +import { + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + UpdateDateColumn, + DeleteDateColumn, + } from "typeorm"; + + @Entity("patient_group") + export class PatientGroup { + @PrimaryGeneratedColumn("uuid") + id!: string; + + @Column({ type: "text", nullable: false }) + patient_group_name!: string; + + // Tanggal pembuatan grup pasien + @CreateDateColumn() + created_at!: Date; + + // Kolom untuk tracking siapa yang membuat data ini + @Column({ nullable: true, length: 256 }) + created_by?: string; + + // Tanggal pembaruan data grup pasien + @UpdateDateColumn({ nullable: true }) + updated_at?: Date; + + // Kolom untuk tracking siapa yang memperbarui data ini + @Column({ nullable: true, length: 256 }) + updated_by?: string; + + // Tanggal penghapusan grup pasien + @DeleteDateColumn({ nullable: true }) + deleted_at?: Date; + + // Kolom untuk tracking siapa yang menghapus data ini + @Column({ nullable: true, length: 256 }) + deleted_by?: string; + } \ No newline at end of file diff --git a/src/entity/patient_guarantor.ts b/src/entity/patient_guarantor.ts new file mode 100644 index 0000000..be9ef9c --- /dev/null +++ b/src/entity/patient_guarantor.ts @@ -0,0 +1,74 @@ +import { + Entity, + PrimaryGeneratedColumn, + Column, + ManyToOne, + JoinColumn, + CreateDateColumn, + UpdateDateColumn, + DeleteDateColumn, + } from "typeorm"; + import { PatientGroup } from "./patient_group"; // Import entity PatientGroup + + @Entity("patient_guarantor") + export class PatientGuarantor { + @PrimaryGeneratedColumn("uuid") + id!: string; + + // Nama penjamin pasien + @Column({ type: "text", nullable: false }) + guarantor_name!: string; + + // Nomor telepon penjamin pasien + @Column({ type: "text", nullable: false }) + phone!: string; + + // Provinsi tempat tinggal penjamin pasien + @Column({ type: "text", nullable: false }) + province!: string; + + // Kota tempat tinggal penjamin pasien + @Column({ type: "text", nullable: false }) + city!: string; + + // Kode pos tempat tinggal penjamin pasien + @Column({ type: "text", nullable: false }) + zip_code!: string; + + // Nomor perjanjian atau kontrak + @Column({ type: "text", nullable: false }) + agreement_no!: string; + + // Deskripsi perjanjian atau kontrak + @Column({ type: "text", nullable: true }) + agreement_desc?: string; + + // Relasi ke PatientGroup, setiap penjamin dapat terhubung dengan satu grup pasien + @ManyToOne(() => PatientGroup, { nullable: false }) + @JoinColumn({ name: "patient_group_id" }) + patient_group!: PatientGroup; + + // Tanggal pembuatan + @CreateDateColumn() + created_at!: Date; + + // Kolom untuk tracking siapa yang membuat + @Column({ nullable: true, length: 256 }) + created_by?: string; + + // Tanggal pembaruan + @UpdateDateColumn({ nullable: true }) + updated_at?: Date; + + // Kolom untuk tracking siapa yang memperbarui + @Column({ nullable: true, length: 256 }) + updated_by?: string; + + // Tanggal penghapusan + @DeleteDateColumn({ nullable: true }) + deleted_at?: Date; + + // Kolom untuk tracking siapa yang menghapus + @Column({ nullable: true, length: 256 }) + deleted_by?: string; + } \ No newline at end of file diff --git a/src/entity/user_to_room.ts b/src/entity/user_to_room.ts new file mode 100644 index 0000000..6e84f4a --- /dev/null +++ b/src/entity/user_to_room.ts @@ -0,0 +1,52 @@ +import { + Entity, + PrimaryGeneratedColumn, + ManyToOne, + JoinColumn, + Column, + CreateDateColumn, + UpdateDateColumn, + DeleteDateColumn, + } from "typeorm"; + import { User } from "./users"; // Import entity Service + import { Room } from "./room"; // Import entity Room + + @Entity("user_to_room") + export class UserToRoom { + @PrimaryGeneratedColumn("uuid") + id!: string; + + // Relasi ke Service, tiap service bisa terkait dengan banyak room + @ManyToOne(() => User, { nullable: false }) + @JoinColumn({ name: "service_id" }) + user!: User; + + // Relasi ke Room, tiap room bisa terkait dengan banyak service + @ManyToOne(() => Room, { nullable: false }) + @JoinColumn({ name: "room_id" }) + room!: Room; + + // Tanggal pembuatan + @CreateDateColumn() + created_at!: Date; + + // Kolom untuk tracking siapa yang membuat + @Column({ nullable: true, length: 256 }) + created_by?: string; + + // Tanggal pembaruan + @UpdateDateColumn({ nullable: true }) + updated_at?: Date; + + // Kolom untuk tracking siapa yang memperbarui + @Column({ nullable: true, length: 256 }) + updated_by?: string; + + // Tanggal penghapusan + @DeleteDateColumn({ nullable: true }) + deleted_at?: Date; + + // Kolom untuk tracking siapa yang menghapus + @Column({ nullable: true, length: 256 }) + deleted_by?: string; + } \ No newline at end of file diff --git a/src/schema/public.ts b/src/schema/public.ts index 7e647ed..63520bd 100644 --- a/src/schema/public.ts +++ b/src/schema/public.ts @@ -28,6 +28,9 @@ export * from "../entity/examination_type" export * from "../entity/examination_detail" export * from "../entity/measurement_unit" export * from "../entity/hospital_information" +export * from "../entity/patient_group" +export * from "../entity/patient_guarantor" +export * from "../entity/user_to_room" export * from "../types/action"; export * from "../types/error";