diff --git a/src/entity/emr/emr_registration_emergency.ts b/src/entity/emr/emr_registration_emergency.ts index 01fe4e5..045e6fb 100644 --- a/src/entity/emr/emr_registration_emergency.ts +++ b/src/entity/emr/emr_registration_emergency.ts @@ -7,14 +7,13 @@ import { DeleteDateColumn, OneToOne, JoinColumn, + ManyToOne, } from "typeorm"; import { EmrRegistration } from "./emr_registration"; +import { User } from "../users"; +import { Diagnosis } from "../diagnosis"; -/** - * Detail registrasi gawat darurat (emergency). - * Form spesifik: tingkat keparahan, triage, waktu datang, dll. - */ @Entity("emr_registration_emergency", { schema: "emr" }) export class EmrRegistrationEmergency { @PrimaryGeneratedColumn("uuid") @@ -24,13 +23,111 @@ export class EmrRegistrationEmergency { @JoinColumn() registration: EmrRegistration; - /** Tingkat keparahan / triage (e.g. merah, kuning, hijau) */ - @Column({ nullable: true, length: 32 }) - severity: string; + @ManyToOne(() => Diagnosis, { onDelete: "CASCADE" }) + @JoinColumn() + diagnosis: Diagnosis; - @Column({ nullable: true, length: 64 }) + @ManyToOne(() => User, { onDelete: "CASCADE" }) + @JoinColumn() + user: User; + + @Column({ nullable: true, type: "text" }) + trauma: string; + + @Column({ nullable: true, type: "text" }) + registration_number: string; + + @Column({ nullable: true, type: "text" }) + fullname: string; + + @Column({ nullable: true, type: "text" }) + nik: string; + + @Column({ type: "date", nullable: true }) + birthdate: Date; + + @Column({ nullable: true, type: "text" }) + additionalcomplaint: string; + + @Column({ nullable: true, type: "text" }) + medicalhistory: string; + + @Column({ nullable: true, type: "text" }) + bloodpressure: string; + + @Column({ nullable: true, type: "text" }) + heartrate: string; + + @Column({ nullable: true, type: "text" }) + respiratoryrate: string; + + @Column({ nullable: true, type: "text" }) + temperature: string; + + @Column({ nullable: true, type: "text" }) + howtocome: string; + + @Column({ nullable: true, type: "text" }) + casedefinition: string; + + @Column({ + type: 'text', + nullable: true, + array: true, + }) + consciousness: string[]; + + @Column({ + type: 'text', + nullable: true, + array: true, + }) + airway: string[]; + + @Column({ + type: 'text', + nullable: true, + array: true, + }) + breathing: string[]; + + @Column({ + type: 'text', + nullable: true, + array: true, + }) + circulation: string[]; + + @Column({ nullable: true, type: "text" }) + resuscitation: string; + + @Column({ nullable: true, type: "text" }) + observation: string; + + @Column({ nullable: true, type: "text" }) + polycliniccontrol: string; + + @Column({ nullable: true, type: "text" }) + gohome: string; + + @Column({ nullable: true, type: "text" }) + other: string; + + @Column({ type: "timestamp", nullable: true }) + changeshift: Date; + + @Column({ nullable: true, type: "text" }) triage_level: string; + @Column({ type: "boolean", default: true }) + falseemergency: boolean; + + @Column({ nullable: true, type: "text" }) + status: string; + + @Column({ nullable: true, type: "text" }) + color: string | null; + @Column({ type: "timestamp", nullable: true }) arrival_time: Date; diff --git a/src/entity/emr/emr_registration_emergency_responsible.ts b/src/entity/emr/emr_registration_emergency_responsible.ts new file mode 100644 index 0000000..6cc9e59 --- /dev/null +++ b/src/entity/emr/emr_registration_emergency_responsible.ts @@ -0,0 +1,92 @@ +import { + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + UpdateDateColumn, + DeleteDateColumn, + OneToOne, + JoinColumn, + OneToMany, + ManyToMany, + ManyToOne, +} from "typeorm"; + +import { Room } from "../room"; +import { PatientGuarantor } from "../patient_guarantor"; +import { Province } from "../province"; +import { City } from "../city"; +import { Subdistrict } from "../subdistrict"; +import { Ward } from "../ward"; +import { EmrRegistration } from "./emr_registration"; + +@Entity("emr_registration_emergency_responsible", { schema: "emr" }) +export class EmrRegistrationEmergencyResponsible { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => EmrRegistration, { onDelete: "CASCADE" }) + @JoinColumn() + emrregistration: EmrRegistration; + + @ManyToOne(() => Room, { onDelete: "CASCADE" }) + @JoinColumn() + room: Room; + + @ManyToOne(() => PatientGuarantor, { onDelete: "CASCADE" }) + @JoinColumn() + guarantor: PatientGuarantor; + + @ManyToOne(() => Province, { onDelete: "CASCADE" }) + @JoinColumn({ referencedColumnName: "code" }) + province: Province; + + @ManyToOne(() => City, { onDelete: "CASCADE" }) + @JoinColumn({ referencedColumnName: "code" }) + city: City; + + @ManyToOne(() => Subdistrict, { onDelete: "CASCADE" }) + @JoinColumn({ referencedColumnName: "code" }) + subdistrict: Subdistrict; + + @ManyToOne(() => Ward, { onDelete: "CASCADE" }) + @JoinColumn({ referencedColumnName: "code" }) + ward: Ward; + + /** Tingkat keparahan / triage (e.g. merah, kuning, hijau) */ + @Column({ nullable: true, type: "text" }) + fullname: string; + + @Column({ nullable: true, type: "text" }) + relation: string; + + @Column({ nullable: true, type: "text" }) + idnumber: string; + + @Column({ nullable: true, type: "text" }) + phone: string; + + @Column({ nullable: true, type: "text" }) + address: 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/user_to_room.ts b/src/entity/user_to_room.ts index 6e84f4a..f76ac06 100644 --- a/src/entity/user_to_room.ts +++ b/src/entity/user_to_room.ts @@ -18,7 +18,7 @@ import { // Relasi ke Service, tiap service bisa terkait dengan banyak room @ManyToOne(() => User, { nullable: false }) - @JoinColumn({ name: "service_id" }) + @JoinColumn({ name: "user_id" }) user!: User; // Relasi ke Room, tiap room bisa terkait dengan banyak service diff --git a/src/schema/emr.ts b/src/schema/emr.ts index 281fa58..cb3963c 100644 --- a/src/schema/emr.ts +++ b/src/schema/emr.ts @@ -24,6 +24,7 @@ export * from "../entity/emr/emr_room_medical_equipment"; export * from "../entity/emr/emr_external_consultation"; export * from "../entity/emr/emr_pharmacy_order"; export * from "../entity/emr/emr_pharmacy_order_activity"; +export * from "../entity/emr/emr_registration_emergency_responsible"; export * from "../types/registration_type"; export * from "../types/registration_status";