feat(regis):add referral_hospital on emr regis

This commit is contained in:
avicenan
2026-05-14 11:10:17 +09:00
parent edcb74f0c8
commit 4b554ca78d

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,79 @@ 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()
created_by: string; @CreateDateColumn()
created_at: Date;
@Column({ nullable: true }) @Column({ nullable: true, length: 256 })
@UpdateDateColumn() created_by: string;
updated_at: Date;
@Column({ nullable: true, length: 256 }) @Column({ nullable: true })
updated_by: string; @UpdateDateColumn()
updated_at: Date;
@Column({ nullable: true }) @Column({ nullable: true, length: 256 })
@DeleteDateColumn() updated_by: string;
deleted_at: Date;
@Column({ nullable: true, length: 256 }) @Column({ nullable: true })
deleted_by: string; @DeleteDateColumn()
deleted_at: Date;
@Column({ nullable: true, length: 256 })
deleted_by: string;
} }