feat(treatment): add new modules of treatment
This commit is contained in:
@ -10,6 +10,7 @@ import { EmrRegistrationEmergencyResponsible } from "./emr_registration_emergenc
|
||||
import { RefferalHospital } from "../refferal_hospital";
|
||||
import { EmrDiagnosis } from "./emr_diagnosis";
|
||||
import { OneToMany } from "typeorm";
|
||||
import { EmrRegistrationTreatment } from "./emr_registration_treatment";
|
||||
|
||||
/**
|
||||
* Registrasi base: data umum untuk semua tipe (rawat jalan, rawat inap, emergency, hemodialysis).
|
||||
@ -30,6 +31,9 @@ export class EmrRegistration {
|
||||
@OneToOne(() => EmrRegistrationEmergency, (emergency) => emergency.registration)
|
||||
emergency: EmrRegistrationEmergency;
|
||||
|
||||
@OneToOne(() => EmrRegistrationTreatment, (treatment) => treatment.registration)
|
||||
treatment: EmrRegistrationTreatment;
|
||||
|
||||
@ManyToOne(() => EmrPatient, { onDelete: "NO ACTION" })
|
||||
@JoinColumn()
|
||||
patient: EmrPatient;
|
||||
|
||||
69
src/entity/emr/emr_registration_treatment.ts
Normal file
69
src/entity/emr/emr_registration_treatment.ts
Normal file
@ -0,0 +1,69 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
DeleteDateColumn,
|
||||
ManyToOne,
|
||||
OneToOne,
|
||||
JoinColumn,
|
||||
} from "typeorm";
|
||||
|
||||
import { EmrRegistration } from "./emr_registration";
|
||||
import { Room } from "../room";
|
||||
import { User } from "../users";
|
||||
import { TreatmentPlanSession } from "../treatment/treatment_plan_session";
|
||||
import { EmrPatient } from "./emr_patient";
|
||||
|
||||
@Entity("emr_registration_treatment", { schema: "emr" })
|
||||
export class EmrRegistrationTreatment {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@OneToOne(() => EmrRegistration, (reg) => reg.treatment, { onDelete: "CASCADE" })
|
||||
@JoinColumn()
|
||||
registration: EmrRegistration;
|
||||
|
||||
@ManyToOne(() => TreatmentPlanSession, { onDelete: "SET NULL", nullable: true })
|
||||
@JoinColumn()
|
||||
treatment_plan_session: TreatmentPlanSession;
|
||||
|
||||
@ManyToOne(() => Room, { onDelete: "NO ACTION", nullable: true })
|
||||
@JoinColumn()
|
||||
room: Room;
|
||||
|
||||
@ManyToOne(() => User, { onDelete: "NO ACTION", nullable: true })
|
||||
@JoinColumn()
|
||||
doctor: User;
|
||||
|
||||
@Column({ nullable: true, length: 64 })
|
||||
registration_status: string;
|
||||
|
||||
@Column({ nullable: true, length: 256 })
|
||||
registration_number: string;
|
||||
|
||||
@Column({ type: "date", nullable: true })
|
||||
visit_date: Date;
|
||||
|
||||
@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;
|
||||
}
|
||||
89
src/entity/treatment/treatment_plan.ts
Normal file
89
src/entity/treatment/treatment_plan.ts
Normal file
@ -0,0 +1,89 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EmrPatient } from "../emr/emr_patient";
|
||||
import { User } from "../users";
|
||||
import { EmrRegistration } from "../emr/emr_registration";
|
||||
import { TreatmentPlanSession } from "./treatment_plan_session";
|
||||
|
||||
export enum TreatmentIntervalType {
|
||||
DAY = "day",
|
||||
WEEK = "week",
|
||||
MONTH = "month",
|
||||
CUSTOM = "custom"
|
||||
}
|
||||
|
||||
export enum TreatmentStatus {
|
||||
ACTIVE = "active",
|
||||
COMPLETED = "completed",
|
||||
CANCELLED = "cancelled"
|
||||
}
|
||||
|
||||
@Entity("treatment_plans", { schema: "emr" })
|
||||
export class TreatmentPlan {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@ManyToOne(() => EmrPatient, { onDelete: "NO ACTION" })
|
||||
@JoinColumn()
|
||||
patient: EmrPatient;
|
||||
|
||||
@ManyToOne(() => EmrRegistration, { onDelete: "SET NULL", nullable: true })
|
||||
@JoinColumn()
|
||||
registration: EmrRegistration;
|
||||
|
||||
@ManyToOne(() => User, { onDelete: "SET NULL", nullable: true })
|
||||
@JoinColumn()
|
||||
doctor: User;
|
||||
|
||||
@Column({ nullable: true, length: 256 })
|
||||
treatment_type: string;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
start_date: Date;
|
||||
|
||||
@Column({ type: "int", nullable: false })
|
||||
sessions_count: number;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: TreatmentIntervalType,
|
||||
default: TreatmentIntervalType.WEEK,
|
||||
})
|
||||
interval_type: TreatmentIntervalType;
|
||||
|
||||
@Column({ type: "int", nullable: true })
|
||||
interval_value: number;
|
||||
|
||||
@Column({ type: "jsonb", nullable: true })
|
||||
weekdays: number[];
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: TreatmentStatus,
|
||||
default: TreatmentStatus.ACTIVE,
|
||||
})
|
||||
status: TreatmentStatus;
|
||||
|
||||
@OneToMany(() => TreatmentPlanSession, (session) => session.treatment_plan, { cascade: true })
|
||||
sessions: TreatmentPlanSession[];
|
||||
|
||||
@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;
|
||||
}
|
||||
55
src/entity/treatment/treatment_plan_session.ts
Normal file
55
src/entity/treatment/treatment_plan_session.ts
Normal file
@ -0,0 +1,55 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { TreatmentPlan } from "./treatment_plan";
|
||||
|
||||
export enum TreatmentSessionStatus {
|
||||
PLANNED = "planned",
|
||||
ARRIVED = "arrived",
|
||||
IN_PROGRESS = "in_progress",
|
||||
DONE = "done",
|
||||
MISSED = "missed",
|
||||
RESCHEDULED = "rescheduled"
|
||||
}
|
||||
|
||||
@Entity("treatment_plan_sessions", { schema: "emr" })
|
||||
export class TreatmentPlanSession {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@ManyToOne(() => TreatmentPlan, (plan) => plan.sessions, { onDelete: "CASCADE" })
|
||||
@JoinColumn({ name: "treatment_plan_id" })
|
||||
treatment_plan: TreatmentPlan;
|
||||
|
||||
@Column({ type: "int", nullable: false })
|
||||
session_no: number;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
planned_date: Date;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: TreatmentSessionStatus,
|
||||
default: TreatmentSessionStatus.PLANNED,
|
||||
})
|
||||
status: TreatmentSessionStatus;
|
||||
|
||||
@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;
|
||||
}
|
||||
@ -49,6 +49,9 @@ export * from "../entity/emr/emr_soap_notes";
|
||||
export * from "../entity/emr/emr_surgery_schedules";
|
||||
export * from "../entity/emr/emr_odontogram";
|
||||
export * from "../entity/emr/emr_odontogram_teeth";
|
||||
export * from "../entity/treatment/treatment_plan";
|
||||
export * from "../entity/treatment/treatment_plan_session";
|
||||
export * from "../entity/emr/emr_registration_treatment";
|
||||
|
||||
export * from "../types/registration_type";
|
||||
export * from "../types/registration_status";
|
||||
|
||||
@ -7,4 +7,5 @@ export enum RegistrationType {
|
||||
INPATIENT = "inpatient", // Rawat inap
|
||||
EMERGENCY = "emergency", // Gawat darurat
|
||||
HEMODIALYSIS = "hemodialysis", // Hemodialysis
|
||||
TREATMENT = "treatment", // Treatment
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user