feat: add laboratory orders entity

This commit is contained in:
avicenan
2026-02-22 23:03:38 +07:00
parent 61343609cb
commit 44c56a936f
3 changed files with 35 additions and 0 deletions

View File

@ -31,6 +31,22 @@ export class EmrLaboratoryOrderItemResult {
@JoinColumn() @JoinColumn()
examination_detail: ExaminationDetail; examination_detail: ExaminationDetail;
/** Denormalized: examination type name from examination_type.name */
@Column({ type: "text", nullable: true })
examination_type: string;
/** Denormalized: examination detail name from examination_detail.name */
@Column({ type: "text", nullable: true })
examination_detail_name: string;
/** Denormalized: measurement unit from measurement_unit.unit */
@Column({ nullable: true, length: 256 })
measurement_unit: string;
/** Denormalized: reference range as flat string from reference_range */
@Column({ type: "text", nullable: true })
reference_range: string;
/** The actual examination result value that can be filled */ /** The actual examination result value that can be filled */
@Column({ type: "text", nullable: true }) @Column({ type: "text", nullable: true })
examination_result: string; examination_result: string;

View File

@ -15,6 +15,7 @@ import { Room } from "../room";
import { User } from "../users"; import { User } from "../users";
import { Department } from "../department"; import { Department } from "../department";
import { EmrLaboratoryOrderItem } from "./emr_laboratory_order_items"; import { EmrLaboratoryOrderItem } from "./emr_laboratory_order_items";
import { LaboratoryOrderStatus } from "../../enum/laboratoryOrderStatus";
/** /**
* Laboratory orders entity. * Laboratory orders entity.
@ -42,6 +43,10 @@ export class EmrLaboratoryOrder {
@JoinColumn() @JoinColumn()
referring_room: Room | null; referring_room: Room | null;
@ManyToOne(() => Room, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
order_room: Room | null;
@ManyToOne(() => User, { onDelete: "NO ACTION", nullable: true }) @ManyToOne(() => User, { onDelete: "NO ACTION", nullable: true })
@JoinColumn() @JoinColumn()
referring_doctor: User | null; referring_doctor: User | null;
@ -50,6 +55,14 @@ export class EmrLaboratoryOrder {
@JoinColumn() @JoinColumn()
department: Department | null; department: Department | null;
@Column({
type: "enum",
enum: LaboratoryOrderStatus,
nullable: false,
default: LaboratoryOrderStatus.PENDING,
})
status: LaboratoryOrderStatus;
@OneToMany(() => EmrLaboratoryOrderItem, (item) => item.laboratory_order, { cascade: true }) @OneToMany(() => EmrLaboratoryOrderItem, (item) => item.laboratory_order, { cascade: true })
order_items: EmrLaboratoryOrderItem[]; order_items: EmrLaboratoryOrderItem[];

View File

@ -0,0 +1,6 @@
export enum LaboratoryOrderStatus {
PENDING = "pending",
VERIFIED = "verified",
COMPLETED = "completed",
CANCELED = "canceled",
}