upd registration outpatient
This commit is contained in:
69
src/entity/emr/emr_registration.ts
Normal file
69
src/entity/emr/emr_registration.ts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
} from "typeorm";
|
||||||
|
|
||||||
|
import { Status } from "../../types/status";
|
||||||
|
import { RegistrationType } from "../../types/registration_type";
|
||||||
|
import { EmrPatient } from "./emr_patient";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registrasi base: data umum untuk semua tipe (rawat jalan, rawat inap, emergency, hemodialysis).
|
||||||
|
* Detail per tipe ada di tabel terpisah (1:1) agar form dan validasi bisa beda-beda.
|
||||||
|
* Relasi ke detail: query dari tabel emr_outpatient_registrations dll where registration_id = id.
|
||||||
|
*/
|
||||||
|
@Entity("emr_registrations", { schema: "emr" })
|
||||||
|
export class EmrRegistration {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => EmrPatient, { onDelete: "NO ACTION" })
|
||||||
|
@JoinColumn()
|
||||||
|
patient: EmrPatient;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: "varchar",
|
||||||
|
length: 32,
|
||||||
|
nullable: false,
|
||||||
|
})
|
||||||
|
registration_type: RegistrationType;
|
||||||
|
|
||||||
|
@Column({ type: "date", nullable: false })
|
||||||
|
registration_date: Date;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
reason_notes: string;
|
||||||
|
|
||||||
|
@Column({ nullable: false, length: 64 })
|
||||||
|
status: Status;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
60
src/entity/emr/emr_registration_emergency.ts
Normal file
60
src/entity/emr/emr_registration_emergency.ts
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
OneToOne,
|
||||||
|
JoinColumn,
|
||||||
|
} from "typeorm";
|
||||||
|
|
||||||
|
import { EmrRegistration } from "./emr_registration";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detail registrasi gawat darurat (emergency).
|
||||||
|
* Form spesifik: tingkat keparahan, triage, waktu datang, dll.
|
||||||
|
*/
|
||||||
|
@Entity("emr_registration_emergency", { schema: "emr" })
|
||||||
|
export class EmrRegistrationEmergency {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@OneToOne(() => EmrRegistration, { onDelete: "CASCADE" })
|
||||||
|
@JoinColumn()
|
||||||
|
registration: EmrRegistration;
|
||||||
|
|
||||||
|
/** Tingkat keparahan / triage (e.g. merah, kuning, hijau) */
|
||||||
|
@Column({ nullable: true, length: 32 })
|
||||||
|
severity: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 64 })
|
||||||
|
triage_level: string;
|
||||||
|
|
||||||
|
@Column({ type: "timestamp", nullable: true })
|
||||||
|
arrival_time: Date;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
chief_complaint: 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;
|
||||||
|
}
|
||||||
59
src/entity/emr/emr_registration_hemodialysis.ts
Normal file
59
src/entity/emr/emr_registration_hemodialysis.ts
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
OneToOne,
|
||||||
|
JoinColumn,
|
||||||
|
} from "typeorm";
|
||||||
|
|
||||||
|
import { EmrRegistration } from "./emr_registration";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detail registrasi hemodialysis.
|
||||||
|
* Form spesifik: jadwal sesi, mesin, akses vaskular, dll.
|
||||||
|
*/
|
||||||
|
@Entity("emr_registration_hemodialysis", { schema: "emr" })
|
||||||
|
export class EmrRegistrationHemodialysis {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@OneToOne(() => EmrRegistration, { onDelete: "CASCADE" })
|
||||||
|
@JoinColumn()
|
||||||
|
registration: EmrRegistration;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 64 })
|
||||||
|
session_schedule: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 64 })
|
||||||
|
machine_id: string;
|
||||||
|
|
||||||
|
@Column({ type: "date", nullable: true })
|
||||||
|
session_date: Date;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
vascular_access_notes: 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;
|
||||||
|
}
|
||||||
65
src/entity/emr/emr_registration_inpatient.ts
Normal file
65
src/entity/emr/emr_registration_inpatient.ts
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
ManyToOne,
|
||||||
|
OneToOne,
|
||||||
|
JoinColumn,
|
||||||
|
} from "typeorm";
|
||||||
|
|
||||||
|
import { EmrRegistration } from "./emr_registration";
|
||||||
|
import { Room } from "../room";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detail registrasi rawat inap (inpatient).
|
||||||
|
* Form spesifik: ruangan, tempat tidur, tgl masuk, rencana pulang, dll.
|
||||||
|
*/
|
||||||
|
@Entity("emr_registration_inpatient", { schema: "emr" })
|
||||||
|
export class EmrRegistrationInpatient {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@OneToOne(() => EmrRegistration, { onDelete: "CASCADE" })
|
||||||
|
@JoinColumn()
|
||||||
|
registration: EmrRegistration;
|
||||||
|
|
||||||
|
@ManyToOne(() => Room, { onDelete: "NO ACTION" })
|
||||||
|
@JoinColumn()
|
||||||
|
room: Room;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 32 })
|
||||||
|
bed_number: string;
|
||||||
|
|
||||||
|
@Column({ type: "date", nullable: false })
|
||||||
|
admission_date: Date;
|
||||||
|
|
||||||
|
@Column({ type: "date", nullable: true })
|
||||||
|
planned_discharge_date: Date;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
admission_notes: 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;
|
||||||
|
}
|
||||||
72
src/entity/emr/emr_registration_outpatient.ts
Normal file
72
src/entity/emr/emr_registration_outpatient.ts
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
ManyToOne,
|
||||||
|
OneToOne,
|
||||||
|
JoinColumn,
|
||||||
|
} from "typeorm";
|
||||||
|
|
||||||
|
import { EmrRegistration } from "./emr_registration";
|
||||||
|
import { Department } from "../department";
|
||||||
|
import { User } from "../users";
|
||||||
|
import { DoctorSchedule } from "../doctor_schedule";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detail registrasi rawat jalan (outpatient).
|
||||||
|
* Form: patient, registration date, reason/notes, department, doctor, practice hour, visit date.
|
||||||
|
* "Choose from schedule" → isi doctor_schedule_id.
|
||||||
|
*/
|
||||||
|
@Entity("emr_registration_outpatient", { schema: "emr" })
|
||||||
|
export class EmrRegistrationOutpatient {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@OneToOne(() => EmrRegistration, { onDelete: "CASCADE" })
|
||||||
|
@JoinColumn()
|
||||||
|
registration: EmrRegistration;
|
||||||
|
|
||||||
|
@ManyToOne(() => Department, { onDelete: "NO ACTION" })
|
||||||
|
@JoinColumn()
|
||||||
|
department: Department;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, { onDelete: "NO ACTION" })
|
||||||
|
@JoinColumn()
|
||||||
|
doctor: User;
|
||||||
|
|
||||||
|
/** Jika user pilih dari jadwal dokter, link ke slot tersebut */
|
||||||
|
@ManyToOne(() => DoctorSchedule, { onDelete: "SET NULL", nullable: true })
|
||||||
|
@JoinColumn()
|
||||||
|
doctor_schedule: DoctorSchedule | null;
|
||||||
|
|
||||||
|
/** Contoh: "08:00-12:00" atau "Pagi" */
|
||||||
|
@Column({ nullable: true, length: 64 })
|
||||||
|
practice_hour: 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;
|
||||||
|
}
|
||||||
@ -1 +1,8 @@
|
|||||||
export * from "../entity/emr/emr_patient";
|
export * from "../entity/emr/emr_patient";
|
||||||
|
export * from "../entity/emr/emr_registration";
|
||||||
|
export * from "../entity/emr/emr_registration_outpatient";
|
||||||
|
export * from "../entity/emr/emr_registration_inpatient";
|
||||||
|
export * from "../entity/emr/emr_registration_emergency";
|
||||||
|
export * from "../entity/emr/emr_registration_hemodialysis";
|
||||||
|
|
||||||
|
export * from "../types/registration_type";
|
||||||
|
|||||||
10
src/types/registration_type.ts
Normal file
10
src/types/registration_type.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* Jenis registrasi: rawat jalan, rawat inap, emergency, hemodialysis.
|
||||||
|
* Masing-masing punya form dan field yang berbeda.
|
||||||
|
*/
|
||||||
|
export enum RegistrationType {
|
||||||
|
OUTPATIENT = "outpatient", // Rawat jalan
|
||||||
|
INPATIENT = "inpatient", // Rawat inap
|
||||||
|
EMERGENCY = "emergency", // Gawat darurat
|
||||||
|
HEMODIALYSIS = "hemodialysis", // Hemodialysis
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user