update: implement cashier and cashier item, move guarantor to patient registration dan add guarantor to patient registration outpatient

This commit is contained in:
wayanrivan
2026-04-01 13:33:51 +07:00
parent f782d32c1d
commit c5fbaf52e4
7 changed files with 188 additions and 6 deletions

View File

@ -0,0 +1,71 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
JoinColumn,
OneToOne,
} from "typeorm";
import { EmrRegistration } from "../emr/emr_registration";
import { Room } from "../room";
@Entity("cashier", { schema: "cashier" })
export class Cashier {
@PrimaryGeneratedColumn("uuid")
id: string;
@OneToOne(() => EmrRegistration, { onDelete: "CASCADE" })
@JoinColumn()
emrregistration: EmrRegistration;
@OneToOne(() => Room, { onDelete: "CASCADE" })
@JoinColumn()
room: Room;
@Column({ type: "date", nullable: true })
regdate: Date;
@Column({
nullable: true,
type: 'bigint'
})
total_amount: number;
@Column({
nullable: true,
type: 'bigint'
})
amount_paid: number;
@Column({
nullable: true,
type: 'bigint'
})
balance_due: number;
@Column({ nullable: true, type: "text" })
status: 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;
}

View File

@ -0,0 +1,103 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
JoinColumn,
ManyToOne,
} from "typeorm";
import { Cashier } from "./cashier";
import { Room } from "../room";
import { Department } from "../department";
import { ServiceClass } from "../service_class";
import { Service } from "../service";
import { ServiceType } from "../service_type";
@Entity("cashier_item", { schema: "cashier" })
export class CashierItem {
@PrimaryGeneratedColumn("uuid")
id: string;
@ManyToOne(() => Service, { onDelete: "CASCADE" })
@JoinColumn()
service: Service;
@ManyToOne(() => ServiceType, { onDelete: "CASCADE" })
@JoinColumn()
servicetype: ServiceType;
@ManyToOne(() => Cashier, { onDelete: "CASCADE" })
@JoinColumn()
cashier: Cashier;
@ManyToOne(() => Room, { onDelete: "CASCADE" })
@JoinColumn()
room: Room;
@ManyToOne(() => Department, { onDelete: "CASCADE" })
@JoinColumn()
department: Department;
@ManyToOne(() => ServiceClass, { onDelete: "CASCADE" })
@JoinColumn()
serviceclass: ServiceClass;
@Column({ type: "date", nullable: true })
service_date: Date;
@Column({ type: "boolean", default: false })
ispay: boolean;
@Column({
nullable: true,
type: 'bigint'
})
guarantor_liability: number;
@Column({
nullable: true,
type: 'bigint'
})
subtotal: number;
@Column({
nullable: true,
type: 'bigint'
})
price: number;
@Column({
nullable: true,
type: 'bigint'
})
qty: number;
@Column({ nullable: true, type: "text" })
status: string;
@Column({ nullable: true, length: 256 })
category: 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;
}

View File

@ -15,7 +15,6 @@ import { Aldeia } from "../aldeia";
import { Suco } from "../suco"; import { Suco } from "../suco";
import { Administrativu } from "../administrativu"; import { Administrativu } from "../administrativu";
import { Munisipo } from "../munisipo"; import { Munisipo } from "../munisipo";
import { PatientGuarantor } from "../patient_guarantor";
@Entity("emr_patients", { schema: "emr" }) @Entity("emr_patients", { schema: "emr" })
export class EmrPatient { export class EmrPatient {
@ -61,10 +60,6 @@ export class EmrPatient {
@Column({ type: "text", nullable: true }) @Column({ type: "text", nullable: true })
address: string; address: string;
@ManyToOne(() => PatientGuarantor, { onDelete: "NO ACTION" })
@JoinColumn()
guarantor: PatientGuarantor;
@ManyToOne(() => Munisipo, { onDelete: "NO ACTION" }) @ManyToOne(() => Munisipo, { onDelete: "NO ACTION" })
@JoinColumn() @JoinColumn()
munisipio: Munisipo; munisipio: Munisipo;

View File

@ -12,6 +12,7 @@ import {
import { RegistrationType } from "../../types/registration_type"; import { RegistrationType } from "../../types/registration_type";
import { RegistrationStatus } from "../../types/registration_status"; import { RegistrationStatus } from "../../types/registration_status";
import { EmrPatient } from "./emr_patient"; import { EmrPatient } from "./emr_patient";
import { PatientGuarantor } from "../patient_guarantor";
/** /**
* 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).
@ -30,6 +31,10 @@ export class EmrRegistration {
@Column({ nullable: true, type: "text" }) @Column({ nullable: true, type: "text" })
cancellation_reason: string; cancellation_reason: string;
@ManyToOne(() => PatientGuarantor, { onDelete: "NO ACTION" })
@JoinColumn()
guarantor: PatientGuarantor;
@Column({ @Column({
type: "varchar", type: "varchar",
length: 32, length: 32,

View File

@ -16,6 +16,7 @@ import { User } from "../users";
import { DoctorSchedule } from "../doctor_schedule"; import { DoctorSchedule } from "../doctor_schedule";
import { EmrInternalConsultation } from "./emr_internal_consultation"; import { EmrInternalConsultation } from "./emr_internal_consultation";
import { ScheduleSeries } from "../schedule_series"; import { ScheduleSeries } from "../schedule_series";
import { PatientGuarantor } from "../patient_guarantor";
// import { RegistrationOutPatientStatus } from "../../enum/registrationOutPatientStatus"; // import { RegistrationOutPatientStatus } from "../../enum/registrationOutPatientStatus";
/** /**
@ -32,6 +33,10 @@ export class EmrRegistrationOutpatient {
@JoinColumn() @JoinColumn()
registration: EmrRegistration; registration: EmrRegistration;
@ManyToOne(() => PatientGuarantor, { onDelete: "NO ACTION" })
@JoinColumn()
guarantor: PatientGuarantor;
@ManyToOne(() => Room, { onDelete: "NO ACTION" }) @ManyToOne(() => Room, { onDelete: "NO ACTION" })
@JoinColumn() @JoinColumn()
room: Room; room: Room;

View File

@ -4,4 +4,5 @@ export * from "./schema/emr";
export * from "./schema/finances"; export * from "./schema/finances";
export * from "./schema/procurement"; export * from "./schema/procurement";
export * from "./schema/pharmacy"; export * from "./schema/pharmacy";
export * from "./schema/pharmacy_logistic"; export * from "./schema/pharmacy_logistic";
export * from "./schema/cashier";

2
src/schema/cashier.ts Normal file
View File

@ -0,0 +1,2 @@
export * from "../entity/cashier/cashier";
export * from "../entity/cashier/cashier_item";