add new entity: laboratory orders
This commit is contained in:
58
src/entity/emr/emr_laboratory_order_item_results.ts
Normal file
58
src/entity/emr/emr_laboratory_order_item_results.ts
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
} from "typeorm";
|
||||||
|
|
||||||
|
import { EmrLaboratoryOrderItem } from "./emr_laboratory_order_items";
|
||||||
|
import { ExaminationDetail } from "../examination_detail";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Laboratory order item results entity.
|
||||||
|
* Stores examination results for each examination_detail of a service.
|
||||||
|
* Each examination_detail has fixed reference_range and measurement_unit.
|
||||||
|
* Only the examination_result value is stored here and can be filled.
|
||||||
|
*/
|
||||||
|
@Entity("emr_laboratory_order_item_results", { schema: "emr" })
|
||||||
|
export class EmrLaboratoryOrderItemResult {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => EmrLaboratoryOrderItem, (item) => item.examination_results, { onDelete: "CASCADE" })
|
||||||
|
@JoinColumn()
|
||||||
|
order_item: EmrLaboratoryOrderItem;
|
||||||
|
|
||||||
|
@ManyToOne(() => ExaminationDetail, { onDelete: "NO ACTION" })
|
||||||
|
@JoinColumn()
|
||||||
|
examination_detail: ExaminationDetail;
|
||||||
|
|
||||||
|
/** The actual examination result value that can be filled */
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
examination_result: 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;
|
||||||
|
}
|
||||||
61
src/entity/emr/emr_laboratory_order_items.ts
Normal file
61
src/entity/emr/emr_laboratory_order_items.ts
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
ManyToOne,
|
||||||
|
OneToMany,
|
||||||
|
JoinColumn,
|
||||||
|
} from "typeorm";
|
||||||
|
|
||||||
|
import { EmrLaboratoryOrder } from "./emr_laboratory_orders";
|
||||||
|
import { Service } from "../service";
|
||||||
|
import { EmrLaboratoryOrderItemResult } from "./emr_laboratory_order_item_results";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Laboratory order items entity.
|
||||||
|
* Contains individual lab services ordered for each laboratory order.
|
||||||
|
* Each service has examination_details, and results are stored in emr_laboratory_order_item_results.
|
||||||
|
*/
|
||||||
|
@Entity("emr_laboratory_order_items", { schema: "emr" })
|
||||||
|
export class EmrLaboratoryOrderItem {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => EmrLaboratoryOrder, (order) => order.order_items, { onDelete: "CASCADE" })
|
||||||
|
@JoinColumn()
|
||||||
|
laboratory_order: EmrLaboratoryOrder;
|
||||||
|
|
||||||
|
@ManyToOne(() => Service, { onDelete: "NO ACTION" })
|
||||||
|
@JoinColumn()
|
||||||
|
service: Service;
|
||||||
|
|
||||||
|
@Column({ type: "timestamp", nullable: true })
|
||||||
|
examination_time: Date;
|
||||||
|
|
||||||
|
@OneToMany(() => EmrLaboratoryOrderItemResult, (result) => result.order_item, { cascade: true })
|
||||||
|
examination_results: EmrLaboratoryOrderItemResult[];
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
76
src/entity/emr/emr_laboratory_orders.ts
Normal file
76
src/entity/emr/emr_laboratory_orders.ts
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
ManyToOne,
|
||||||
|
OneToMany,
|
||||||
|
JoinColumn,
|
||||||
|
} from "typeorm";
|
||||||
|
|
||||||
|
import { EmrPatient } from "./emr_patient";
|
||||||
|
import { Room } from "../room";
|
||||||
|
import { User } from "../users";
|
||||||
|
import { Department } from "../department";
|
||||||
|
import { EmrLaboratoryOrderItem } from "./emr_laboratory_order_items";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Laboratory orders entity.
|
||||||
|
* Contains order header information: order number, patient, referring room/doctor, schedule, registration info.
|
||||||
|
*/
|
||||||
|
@Entity("emr_laboratory_orders", { schema: "emr" })
|
||||||
|
export class EmrLaboratoryOrder {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ nullable: false, length: 128, unique: true })
|
||||||
|
order_lab_no: string;
|
||||||
|
|
||||||
|
@Column({ type: "date", nullable: true })
|
||||||
|
schedule_date: Date;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
notes: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => EmrPatient, { onDelete: "NO ACTION" })
|
||||||
|
@JoinColumn()
|
||||||
|
patient: EmrPatient;
|
||||||
|
|
||||||
|
@ManyToOne(() => Room, { onDelete: "NO ACTION", nullable: true })
|
||||||
|
@JoinColumn()
|
||||||
|
referring_room: Room | null;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, { onDelete: "NO ACTION", nullable: true })
|
||||||
|
@JoinColumn()
|
||||||
|
referring_doctor: User | null;
|
||||||
|
|
||||||
|
@ManyToOne(() => Department, { onDelete: "NO ACTION", nullable: true })
|
||||||
|
@JoinColumn()
|
||||||
|
department: Department | null;
|
||||||
|
|
||||||
|
@OneToMany(() => EmrLaboratoryOrderItem, (item) => item.laboratory_order, { cascade: true })
|
||||||
|
order_items: EmrLaboratoryOrderItem[];
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
@ -12,6 +12,9 @@ export * from "../entity/emr/emr_diagnosis";
|
|||||||
export * from "../entity/emr/emr_diagnostic_procedure";
|
export * from "../entity/emr/emr_diagnostic_procedure";
|
||||||
export * from "../entity/emr/emr_doctor_procedure";
|
export * from "../entity/emr/emr_doctor_procedure";
|
||||||
export * from "../entity/emr/emr_internal_consultation";
|
export * from "../entity/emr/emr_internal_consultation";
|
||||||
|
export * from "../entity/emr/emr_laboratory_orders";
|
||||||
|
export * from "../entity/emr/emr_laboratory_order_items";
|
||||||
|
export * from "../entity/emr/emr_laboratory_order_item_results";
|
||||||
|
|
||||||
export * from "../types/registration_type";
|
export * from "../types/registration_type";
|
||||||
export * from "../types/registration_status";
|
export * from "../types/registration_status";
|
||||||
|
|||||||
Reference in New Issue
Block a user