diff --git a/src/entity/emr/emr_boarding_room_doctor_amls.ts b/src/entity/emr/emr_boarding_room_doctor_amls.ts new file mode 100644 index 0000000..b6d29c2 --- /dev/null +++ b/src/entity/emr/emr_boarding_room_doctor_amls.ts @@ -0,0 +1,46 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm"; +import { User } from "../users"; +import { EmrBoardingRoom } from "./emr_boarding_rooms"; + +@Entity("emr_boarding_room_doctor_amls", { schema: "emr" }) +export class EmrBoardingRoomDoctorAml { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => EmrBoardingRoom, { onDelete: "NO ACTION" }) + @JoinColumn() + boarding_room: EmrBoardingRoom; + + @ManyToOne(() => User, { onDelete: "NO ACTION" }) + @JoinColumn() + doctor: User; + + @Column({ + nullable: false, + }) + note: number; + + @Column({ nullable: false }) + change_at: Date; + + @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_boarding_rooms.ts b/src/entity/emr/emr_boarding_rooms.ts index a609968..69652f0 100644 --- a/src/entity/emr/emr_boarding_rooms.ts +++ b/src/entity/emr/emr_boarding_rooms.ts @@ -1,39 +1,19 @@ import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm"; -import { EmrPatient } from "./emr_patient"; -import { EmrDiagnosis } from "./emr_diagnosis"; +import { EmrRegistration } from "./emr_registration"; import { User } from "../users"; -import { InpatientRoom } from "../inpatient_rooms"; @Entity("emr_boarding_rooms", { schema: "emr" }) export class EmrBoardingRoom { @PrimaryGeneratedColumn("uuid") id: string; - @ManyToOne(() => EmrPatient, { onDelete: "NO ACTION" }) + @ManyToOne(() => EmrRegistration, { onDelete: "NO ACTION" }) @JoinColumn() - patient: EmrPatient; - - @ManyToOne(() => EmrDiagnosis, { onDelete: "NO ACTION" }) - @JoinColumn() - diagnosis: EmrDiagnosis; + registration: EmrRegistration; @ManyToOne(() => User, { onDelete: "NO ACTION" }) @JoinColumn() - user: User; - - @ManyToOne(() => InpatientRoom, { onDelete: "NO ACTION" }) - @JoinColumn() - inpatient_room: InpatientRoom; - - @Column({ - nullable: true, - }) - no_reg: string; - - @Column({ - nullable: true, - }) - mrn: string; + doctor: User; @Column({ nullable: false }) boarding_at: Date; diff --git a/src/entity/emr/emr_inpatient_room_beds.ts b/src/entity/emr/emr_inpatient_room_beds.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/entity/emr/emr_registration_inpatient.ts b/src/entity/emr/emr_registration_inpatient.ts index b235c1b..aafae1f 100644 --- a/src/entity/emr/emr_registration_inpatient.ts +++ b/src/entity/emr/emr_registration_inpatient.ts @@ -2,12 +2,14 @@ import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateCol import { EmrRegistration } from "./emr_registration"; import { Room } from "../room"; -import { EmrBoardingRoom } from "./emr_boarding_rooms"; +import { InpatientRoom } from "../inpatient_rooms"; +import { EmrPatient } from "./emr_patient"; +import { InpatientRoomBed } from "../inpatient_room_beds"; +import { Province } from "../province"; +import { City } from "../city"; +import { Subdistrict } from "../subdistrict"; +import { Ward } from "../ward"; -/** - * Detail registrasi rawat inap (inpatient). - * Form spesifik: ruangan, tempat tidur, tgl masuk, rencana pulang, dll. - */ @Entity("emr_registration_inpatient", { schema: "emr" }) export class EmrRegistrationInpatient { @PrimaryGeneratedColumn("uuid") @@ -17,19 +19,61 @@ export class EmrRegistrationInpatient { @JoinColumn() registration: EmrRegistration; - @ManyToOne(() => EmrBoardingRoom, { onDelete: "NO ACTION" }) + @ManyToOne(() => InpatientRoom, { onDelete: "NO ACTION" }) @JoinColumn() - boarding_room: EmrBoardingRoom; + inpatient_room: InpatientRoom; + + @ManyToOne(() => InpatientRoomBed, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn() + inpatient_room_bed: InpatientRoomBed | null; + + @ManyToOne(() => EmrPatient, { onDelete: "NO ACTION" }) + @JoinColumn() + patient: EmrPatient; + + @Column({ nullable: true }) + registration_number: string; + + @Column({ nullable: true, length: 32 }) + bed_number: string; @Column({ type: "date", nullable: false }) admission_date: Date; - @Column({ type: "date", nullable: true }) - planned_discharge_date: Date; - @Column({ type: "text", nullable: true }) admission_notes: string; + @Column({ nullable: true, type: "text" }) + responsible_fullname: string; + + @Column({ nullable: true, type: "text" }) + responsible_relation: string; + + @Column({ nullable: true, type: "text" }) + responsible_idnumber: string; + + @Column({ nullable: true, type: "text" }) + responsible_phone: string; + + @Column({ nullable: true, type: "text" }) + responsible_address: string; + + @ManyToOne(() => Province, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn({ referencedColumnName: "code" }) + responsible_province: Province | null; + + @ManyToOne(() => City, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn({ referencedColumnName: "code" }) + responsible_city: City | null; + + @ManyToOne(() => Subdistrict, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn({ referencedColumnName: "code" }) + responsible_subdistrict: Subdistrict | null; + + @ManyToOne(() => Ward, { onDelete: "NO ACTION", nullable: true }) + @JoinColumn({ referencedColumnName: "code" }) + responsible_ward: Ward | null; + @Column() @CreateDateColumn() created_at: Date; diff --git a/src/schema/emr.ts b/src/schema/emr.ts index af33f2a..0a69b09 100644 --- a/src/schema/emr.ts +++ b/src/schema/emr.ts @@ -9,6 +9,7 @@ export * from "../entity/emr/emr_vital_signs"; export * from "../entity/emr/emr_physical_examination"; export * from "../entity/emr/emr_diet"; export * from "../entity/emr/emr_boarding_rooms"; +export * from "../entity/emr/emr_boarding_room_doctor_amls"; export * from "../entity/emr/emr_diagnosis"; export * from "../entity/emr/emr_diagnostic_procedure"; export * from "../entity/emr/emr_doctor_procedure";