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 })
passport_number: string;
@Column({ nullable: false, length: 256 })
@Column({ nullable: true, length: 256 })
first_name: string;
@Column({ nullable: false, length: 256 })
@Column({ nullable: true, length: 256 })
last_name: string;
@Column({ nullable: true, length: 256 })

View File

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