feat(emr): enhance EmrSurgerySchedule with new fields and relationships for room, surgery type, and outpatient registration

This commit is contained in:
Sony Surahmn
2026-05-21 02:48:53 +07:00
parent 08129ec2f1
commit c18bb6df96

View File

@ -9,18 +9,29 @@ import {
JoinColumn, JoinColumn,
} from "typeorm"; } from "typeorm";
import { SurgeryRoom } from "../surgery_room"; import { SurgeryRoom } from "../surgery_room";
import { SurgeryType } from "../surgery_type";
import { Room } from "../room";
import { EmrPatient } from "./emr_patient"; import { EmrPatient } from "./emr_patient";
import { EmrBoardingRoom } from "./emr_boarding_rooms"; import { EmrBoardingRoom } from "./emr_boarding_rooms";
import { EmrRegistrationOutpatient } from "./emr_registration_outpatient";
@Entity("emr_surgery_schedules", { schema: "emr" }) @Entity("emr_surgery_schedules", { schema: "emr" })
export class EmrSurgerySchedule { export class EmrSurgerySchedule {
@PrimaryGeneratedColumn("uuid") @PrimaryGeneratedColumn("uuid")
id: string; id: string;
@ManyToOne(() => Room, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
room: Room | null;
@ManyToOne(() => SurgeryRoom, { onDelete: "NO ACTION" }) @ManyToOne(() => SurgeryRoom, { onDelete: "NO ACTION" })
@JoinColumn() @JoinColumn()
surgery_room: SurgeryRoom; surgery_room: SurgeryRoom;
@ManyToOne(() => SurgeryType, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
surgery_type: SurgeryType | null;
@Column({ type: "date", nullable: false }) @Column({ type: "date", nullable: false })
schedule_date: Date; schedule_date: Date;
@ -62,12 +73,28 @@ export class EmrSurgerySchedule {
@Column({ nullable: true, type: "time" }) @Column({ nullable: true, type: "time" })
schedule_time: string; schedule_time: string;
@Column({ nullable: true, type: "time" })
schedule_end_time: string;
@Column({ nullable: false, length: 32, default: "scheduled" }) @Column({ nullable: false, length: 32, default: "scheduled" })
status: string; status: string;
@Column({ nullable: true, length: 32 })
surgery_priority: string;
@Column({ nullable: true, length: 32 })
phone: string;
@Column({ nullable: true, type: "text" })
alkses_bhp: string;
@Column({ nullable: true, type: "text" }) @Column({ nullable: true, type: "text" })
notes: string; notes: string;
@ManyToOne(() => EmrRegistrationOutpatient, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
registration_outpatient: EmrRegistrationOutpatient | null;
@CreateDateColumn() @CreateDateColumn()
created_at: Date; created_at: Date;