Merge branch 'main' of https://git.shiblysolution.id/SAUDE-TL/entity
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from "typeorm";
|
||||
|
||||
import { Status } from "../types/status";
|
||||
import { DiagnosisType } from "../types/diagnosis_type";
|
||||
|
||||
@Entity("diagnoses")
|
||||
export class Diagnosis {
|
||||
@ -25,6 +26,13 @@ export class Diagnosis {
|
||||
})
|
||||
status: Status;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: DiagnosisType,
|
||||
nullable: true,
|
||||
})
|
||||
type: DiagnosisType | null;
|
||||
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
|
||||
@ -86,6 +86,9 @@ export class PatientEducation {
|
||||
})
|
||||
learning_evaluation: string;
|
||||
|
||||
@CreateDateColumn()
|
||||
education_date: Date;
|
||||
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -45,6 +45,9 @@ export class EmrSoapNotes {
|
||||
@Column({ nullable: true, type: "text" })
|
||||
plan: string | null;
|
||||
|
||||
@Column({ nullable: false, type: "boolean", default: false })
|
||||
tbak: boolean;
|
||||
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
47
src/entity/treatment/treatment_plan_session.ts
Normal file
47
src/entity/treatment/treatment_plan_session.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { TreatmentPlan } from "./treatment_plan";
|
||||
import { TreatmentSessionStatus } from "../../types/treatment_session"
|
||||
|
||||
@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;
|
||||
}
|
||||
@ -29,7 +29,7 @@ export class User {
|
||||
password: string;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
nullable: true,
|
||||
unique: false,
|
||||
length: 64,
|
||||
})
|
||||
|
||||
@ -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";
|
||||
@ -59,3 +62,4 @@ export * from "../types/laboratory_order_status";
|
||||
export * from "../enum/consciousness";
|
||||
export * from "../types/patient_category";
|
||||
export * from "../types/citizen";
|
||||
export * from "../types/treatment_session";
|
||||
|
||||
@ -70,3 +70,4 @@ export * from "../types/status";
|
||||
export * from "../types/email";
|
||||
export * from "../types/telegram";
|
||||
export * from "../types/specialist_form";
|
||||
export * from "../types/diagnosis_type";
|
||||
|
||||
8
src/types/diagnosis_type.ts
Normal file
8
src/types/diagnosis_type.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export enum DiagnosisType {
|
||||
MATERNITY = "maternity",
|
||||
SURGERY = "surgery",
|
||||
MEDICINE = "medicine",
|
||||
TRAFFIC_ACCIDENT = "traffic_accident",
|
||||
VIOLENCE = "violence",
|
||||
OTHER = "other",
|
||||
}
|
||||
@ -7,4 +7,5 @@ export enum RegistrationType {
|
||||
INPATIENT = "inpatient", // Rawat inap
|
||||
EMERGENCY = "emergency", // Gawat darurat
|
||||
HEMODIALYSIS = "hemodialysis", // Hemodialysis
|
||||
TREATMENT = "treatment", // Treatment
|
||||
}
|
||||
|
||||
17
src/types/treatment_session.ts
Normal file
17
src/types/treatment_session.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Status untuk sesi rencana perawatan (treatment plan session status).
|
||||
* Planned: sesi perawatan telah dijadwalkan
|
||||
* Arrived: pasien telah tiba untuk sesi perawatan
|
||||
* Ongoing: sesi perawatan sedang berlangsung
|
||||
* Completed: sesi perawatan telah selesai
|
||||
* Missed: pasien tidak hadir pada sesi perawatan (terlewat)
|
||||
* Rescheduled: sesi perawatan dijadwalkan ulang
|
||||
*/
|
||||
export enum TreatmentSessionStatus {
|
||||
PLANNED = "planned",
|
||||
ARRIVED = "arrived",
|
||||
ONGOING = "ongoing",
|
||||
COMPLETED = "completed",
|
||||
MISSED = "missed",
|
||||
RESCHEDULED = "rescheduled"
|
||||
}
|
||||
Reference in New Issue
Block a user