This commit is contained in:
Shibly Teknologi Solusi
2026-05-15 13:51:36 +07:00
6 changed files with 105 additions and 66 deletions

29
src/entity/counter.ts Normal file
View File

@ -0,0 +1,29 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from "typeorm";
@Entity("counter")
export class Counter {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({
nullable: false,
length: 128,
unique: true,
type: "varchar",
})
key: string;
@Column({
nullable: false,
type: "bigint",
})
value: string;
@Column()
@CreateDateColumn()
created_at: Date;
@Column({ nullable: true })
@UpdateDateColumn()
updated_at: Date;
}

View File

@ -21,10 +21,10 @@ export class EmrPatient {
@Column({ nullable: true, length: 64 }) @Column({ nullable: true, length: 64 })
passport_number: string; passport_number: string;
@Column({ nullable: false, length: 256 }) @Column({ nullable: true, length: 256 })
first_name: string; first_name: string;
@Column({ nullable: false, length: 256 }) @Column({ nullable: true, length: 256 })
last_name: string; last_name: string;
@Column({ nullable: true, length: 256 }) @Column({ nullable: true, length: 256 })

View File

@ -1,15 +1,4 @@
import { import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn, OneToOne, ManyToMany } from "typeorm";
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
ManyToOne,
JoinColumn,
OneToOne,
ManyToMany
} from "typeorm";
import { RegistrationType } from "../../types/registration_type"; import { RegistrationType } from "../../types/registration_type";
import { RegistrationStatus } from "../../types/registration_status"; import { RegistrationStatus } from "../../types/registration_status";
@ -18,6 +7,7 @@ import { PatientGuarantor } from "../patient_guarantor";
import { EmrRegistrationOutpatient } from "./emr_registration_outpatient"; import { EmrRegistrationOutpatient } from "./emr_registration_outpatient";
import { EmrRegistrationEmergency } from "./emr_registration_emergency"; import { EmrRegistrationEmergency } from "./emr_registration_emergency";
import { EmrRegistrationEmergencyResponsible } from "./emr_registration_emergency_responsible"; import { EmrRegistrationEmergencyResponsible } from "./emr_registration_emergency_responsible";
import { RefferalHospital } from "../refferal_hospital";
/** /**
* Registrasi base: data umum untuk semua tipe (rawat jalan, rawat inap, emergency, hemodialysis). * Registrasi base: data umum untuk semua tipe (rawat jalan, rawat inap, emergency, hemodialysis).
@ -26,75 +16,82 @@ import { EmrRegistrationEmergencyResponsible } from "./emr_registration_emergenc
*/ */
@Entity("emr_registrations", { schema: "emr" }) @Entity("emr_registrations", { schema: "emr" })
export class EmrRegistration { export class EmrRegistration {
@PrimaryGeneratedColumn("uuid") @PrimaryGeneratedColumn("uuid")
id: string; id: string;
@OneToOne(() => EmrRegistrationEmergencyResponsible, (emergency) => emergency.emrregistration) @OneToOne(() => EmrRegistrationEmergencyResponsible, (emergency) => emergency.emrregistration)
emergency_responsible: EmrRegistrationEmergencyResponsible; emergency_responsible: EmrRegistrationEmergencyResponsible;
@OneToOne(() => EmrRegistrationOutpatient, (out) => out.registration) @OneToOne(() => EmrRegistrationOutpatient, (out) => out.registration)
outpatient: EmrRegistrationOutpatient; outpatient: EmrRegistrationOutpatient;
@OneToOne(() => EmrRegistrationEmergency, (emergency) => emergency.registration) @OneToOne(() => EmrRegistrationEmergency, (emergency) => emergency.registration)
emergency: EmrRegistrationEmergency; emergency: EmrRegistrationEmergency;
@ManyToOne(() => EmrPatient, { onDelete: "NO ACTION" }) @ManyToOne(() => EmrPatient, { onDelete: "NO ACTION" })
@JoinColumn() @JoinColumn()
patient: EmrPatient; patient: EmrPatient;
@Column({ nullable: true, type: "text" }) @Column({ nullable: true, type: "text" })
cancellation_reason: string; cancellation_reason: string;
@ManyToOne(() => PatientGuarantor, { onDelete: "NO ACTION" }) @ManyToOne(() => PatientGuarantor, { onDelete: "NO ACTION" })
@JoinColumn() @JoinColumn()
guarantor: PatientGuarantor; guarantor: PatientGuarantor;
@Column({ @Column({
type: "varchar", type: "varchar",
length: 32, length: 32,
nullable: false, nullable: false,
}) })
registration_type: RegistrationType; registration_type: RegistrationType;
@Column({ type: "date", nullable: false }) @Column({ type: "date", nullable: false })
registration_date: Date; registration_date: Date;
@Column({ type: "text", nullable: true }) @Column({ type: "text", nullable: true })
reason_notes: string; reason_notes: string;
@Column({ nullable: false, length: 32 }) @Column({ nullable: false, length: 32 })
status: RegistrationStatus; status: RegistrationStatus;
@Column({ type: "date", nullable: true }) @Column({ type: "date", nullable: true })
visit_date: Date; visit_date: Date;
@Column({ nullable: true, type: "text" }) @Column({ nullable: true, type: "text" })
fullname: string; fullname: string;
@Column({ nullable: true, type: "date" }) @Column({ nullable: true, type: "date" })
birthdate: Date; birthdate: Date;
@Column({ nullable: true, type: "text" }) @Column({ nullable: true, type: "text" })
idcard: string; idcard: string;
@Column() @ManyToOne(() => RefferalHospital, { onDelete: "NO ACTION", nullable: true })
@CreateDateColumn() @JoinColumn({ name: "referral_hospital_id" })
created_at: Date; referral_hospital: RefferalHospital;
@Column({ nullable: true, length: 256 }) @Column({ nullable: true, type: "text" })
created_by: string; patient_category: string;
@Column({ nullable: true }) @Column()
@UpdateDateColumn() @CreateDateColumn()
updated_at: Date; created_at: Date;
@Column({ nullable: true, length: 256 }) @Column({ nullable: true, length: 256 })
updated_by: string; created_by: string;
@Column({ nullable: true }) @Column({ nullable: true })
@DeleteDateColumn() @UpdateDateColumn()
deleted_at: Date; updated_at: Date;
@Column({ nullable: true, length: 256 }) @Column({ nullable: true, length: 256 })
deleted_by: string; updated_by: string;
@Column({ nullable: true })
@DeleteDateColumn()
deleted_at: Date;
@Column({ nullable: true, length: 256 })
deleted_by: string;
} }

View File

@ -51,4 +51,5 @@ export * from "../types/pharmacy_order_status";
export * from "../types/prescription_pharmacy_status"; export * from "../types/prescription_pharmacy_status";
export * from "../types/radiology_order_status"; export * from "../types/radiology_order_status";
export * from "../types/laboratory_order_status"; export * from "../types/laboratory_order_status";
export * from "../enum/consciousness" export * from "../enum/consciousness";
export * from "../types/patient_category";

View File

@ -54,6 +54,7 @@ export * from "../entity/ward";
export * from "../entity/responsible_party_consent"; export * from "../entity/responsible_party_consent";
export * from "../entity/foster_care_history"; export * from "../entity/foster_care_history";
export * from "../entity/notification"; export * from "../entity/notification";
export * from "../entity/counter";
export * from "../types/public"; export * from "../types/public";
export * from "../types/action"; export * from "../types/action";

View File

@ -0,0 +1,11 @@
/**
* Workflow kategori pendaftaran pasien.
* Existing: pasien sudah lama daftar
* New: pasien baru dari pendaftaran pasien
* Foreigner: pasien asing
*/
export enum PatientCategory {
EXISTING = "existing",
NEW = "new",
FOREIGNER = "foreigner",
}