Enhance EmrBoardingRoomDoctorHistory entity with patient relationship and additional fields
This commit is contained in:
@ -1,12 +1,18 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn, Index } from "typeorm";
|
||||
import { User } from "../users";
|
||||
import { EmrBoardingRoom } from "./emr_boarding_rooms";
|
||||
import { EmrPatient } from "./emr_patient";
|
||||
|
||||
@Entity("emr_boarding_room_doctor_histories", { schema: "emr" })
|
||||
@Index("idx_emr_boarding_room_doctor_histories_patient_active", ["patient", "is_active"])
|
||||
export class EmrBoardingRoomDoctorHistory {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@ManyToOne(() => EmrPatient, { onDelete: "NO ACTION" })
|
||||
@JoinColumn()
|
||||
patient: EmrPatient;
|
||||
|
||||
@ManyToOne(() => EmrBoardingRoom, { onDelete: "NO ACTION" })
|
||||
@JoinColumn()
|
||||
boarding_room: EmrBoardingRoom;
|
||||
@ -16,13 +22,25 @@ export class EmrBoardingRoomDoctorHistory {
|
||||
doctor: User;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
nullable: true,
|
||||
})
|
||||
note: string;
|
||||
|
||||
@Column({ nullable: false })
|
||||
@Column({ nullable: true })
|
||||
change_at: Date;
|
||||
|
||||
@Column({ nullable: true, type: "text" })
|
||||
diagnosis: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
start_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
end_at: Date;
|
||||
|
||||
@Column({ nullable: true, default: false })
|
||||
is_active: boolean;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
2
src/types/typeorm.d.ts
vendored
Normal file
2
src/types/typeorm.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
declare module "typeorm";
|
||||
|
||||
Reference in New Issue
Block a user