add entity for hemodialysis_schedule and emr_hemodialysis_visits
This commit is contained in:
62
src/entity/emr/emr_hemodialysis_schedule.ts
Normal file
62
src/entity/emr/emr_hemodialysis_schedule.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
DeleteDateColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
} from "typeorm";
|
||||
import { EmrPatient } from "./emr_patient";
|
||||
import { HemodialysisPlan } from "./emr_hemodialysis_plan";
|
||||
|
||||
export enum HemodialysisScheduleStatus {
|
||||
SCHEDULED = "SCHEDULED",
|
||||
CHECKED_IN = "CHECKED_IN",
|
||||
COMPLETED = "COMPLETED",
|
||||
CANCELLED = "CANCELLED",
|
||||
}
|
||||
|
||||
@Entity("emr_hemodialysis_schedules", { schema: "emr" })
|
||||
export class HemodialysisSchedule {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@ManyToOne(() => HemodialysisPlan, { onDelete: "NO ACTION", nullable: false })
|
||||
@JoinColumn({ name: "plan_id" })
|
||||
plan: HemodialysisPlan;
|
||||
|
||||
@ManyToOne(() => EmrPatient, { onDelete: "NO ACTION", nullable: false })
|
||||
@JoinColumn({ name: "patient_id" })
|
||||
patient: EmrPatient;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
scheduled_date: string;
|
||||
|
||||
/** ISO weekday: 1 = Monday … 7 = Sunday (recurring weekly slot) */
|
||||
@Column({ type: "smallint", nullable: true })
|
||||
day_of_week: number | null;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: HemodialysisScheduleStatus,
|
||||
default: HemodialysisScheduleStatus.SCHEDULED,
|
||||
})
|
||||
status: HemodialysisScheduleStatus;
|
||||
|
||||
@Column({ nullable: true, length: 256 })
|
||||
assigned_by: string | null;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@DeleteDateColumn()
|
||||
deleted_at: Date;
|
||||
}
|
||||
77
src/entity/emr/emr_hemodialysis_visit.ts
Normal file
77
src/entity/emr/emr_hemodialysis_visit.ts
Normal file
@ -0,0 +1,77 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
DeleteDateColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
} from "typeorm";
|
||||
import { EmrPatient } from "./emr_patient";
|
||||
import { EmrRegistration } from "./emr_registration";
|
||||
import { HemodialysisSchedule } from "./emr_hemodialysis_schedule";
|
||||
|
||||
export enum HemodialysisVisitStatus {
|
||||
WAITING_NURSING = "WAITING_NURSING",
|
||||
IN_PROGRESS = "IN_PROGRESS",
|
||||
COMPLETED = "COMPLETED",
|
||||
}
|
||||
|
||||
export enum HemodialysisCheckinMethod {
|
||||
SCAN = "SCAN",
|
||||
MANUAL = "MANUAL",
|
||||
}
|
||||
|
||||
@Entity("emr_hemodialysis_visits", { schema: "emr" })
|
||||
export class HemodialysisVisit {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@ManyToOne(() => HemodialysisSchedule, { onDelete: "NO ACTION", nullable: false })
|
||||
@JoinColumn({ name: "schedule_id" })
|
||||
schedule: HemodialysisSchedule;
|
||||
|
||||
@ManyToOne(() => EmrPatient, { onDelete: "NO ACTION", nullable: false })
|
||||
@JoinColumn({ name: "patient_id" })
|
||||
patient: EmrPatient;
|
||||
|
||||
@ManyToOne(() => EmrRegistration, { onDelete: "NO ACTION", nullable: true })
|
||||
@JoinColumn({ name: "registration_id" })
|
||||
registration: EmrRegistration | null;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
visit_date: string;
|
||||
|
||||
@Column({ type: "timestamptz", nullable: true })
|
||||
checkin_time: Date | null;
|
||||
|
||||
@Column({ type: "timestamptz", nullable: true })
|
||||
checkout_time: Date | null;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: HemodialysisVisitStatus,
|
||||
default: HemodialysisVisitStatus.WAITING_NURSING,
|
||||
})
|
||||
status: HemodialysisVisitStatus;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: HemodialysisCheckinMethod,
|
||||
nullable: true,
|
||||
})
|
||||
checkin_method: HemodialysisCheckinMethod | null;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@DeleteDateColumn()
|
||||
deleted_at: Date;
|
||||
}
|
||||
@ -6,6 +6,8 @@ export * from "../entity/emr/emr_registration_emergency";
|
||||
export * from "../entity/emr/emr_registration_hemodialysis";
|
||||
export * from "../entity/emr/emr_hemodialysis_settings";
|
||||
export * from "../entity/emr/emr_hemodialysis_plan";
|
||||
export * from "../entity/emr/emr_hemodialysis_schedule";
|
||||
export * from "../entity/emr/emr_hemodialysis_visit";
|
||||
export * from "../entity/emr/emr_anamnesis";
|
||||
export * from "../entity/emr/emr_vital_signs";
|
||||
export * from "../entity/emr/emr_physical_examination";
|
||||
|
||||
Reference in New Issue
Block a user