update: implement cashier and cashier item, move guarantor to patient registration dan add guarantor to patient registration outpatient
This commit is contained in:
71
src/entity/cashier/cashier.ts
Normal file
71
src/entity/cashier/cashier.ts
Normal 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;
|
||||
}
|
||||
103
src/entity/cashier/cashier_item.ts
Normal file
103
src/entity/cashier/cashier_item.ts
Normal 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;
|
||||
}
|
||||
@ -15,7 +15,6 @@ import { Aldeia } from "../aldeia";
|
||||
import { Suco } from "../suco";
|
||||
import { Administrativu } from "../administrativu";
|
||||
import { Munisipo } from "../munisipo";
|
||||
import { PatientGuarantor } from "../patient_guarantor";
|
||||
|
||||
@Entity("emr_patients", { schema: "emr" })
|
||||
export class EmrPatient {
|
||||
@ -61,10 +60,6 @@ export class EmrPatient {
|
||||
@Column({ type: "text", nullable: true })
|
||||
address: string;
|
||||
|
||||
@ManyToOne(() => PatientGuarantor, { onDelete: "NO ACTION" })
|
||||
@JoinColumn()
|
||||
guarantor: PatientGuarantor;
|
||||
|
||||
@ManyToOne(() => Munisipo, { onDelete: "NO ACTION" })
|
||||
@JoinColumn()
|
||||
munisipio: Munisipo;
|
||||
|
||||
@ -12,6 +12,7 @@ import {
|
||||
import { RegistrationType } from "../../types/registration_type";
|
||||
import { RegistrationStatus } from "../../types/registration_status";
|
||||
import { EmrPatient } from "./emr_patient";
|
||||
import { PatientGuarantor } from "../patient_guarantor";
|
||||
|
||||
/**
|
||||
* 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" })
|
||||
cancellation_reason: string;
|
||||
|
||||
@ManyToOne(() => PatientGuarantor, { onDelete: "NO ACTION" })
|
||||
@JoinColumn()
|
||||
guarantor: PatientGuarantor;
|
||||
|
||||
@Column({
|
||||
type: "varchar",
|
||||
length: 32,
|
||||
|
||||
@ -16,6 +16,7 @@ import { User } from "../users";
|
||||
import { DoctorSchedule } from "../doctor_schedule";
|
||||
import { EmrInternalConsultation } from "./emr_internal_consultation";
|
||||
import { ScheduleSeries } from "../schedule_series";
|
||||
import { PatientGuarantor } from "../patient_guarantor";
|
||||
// import { RegistrationOutPatientStatus } from "../../enum/registrationOutPatientStatus";
|
||||
|
||||
/**
|
||||
@ -32,6 +33,10 @@ export class EmrRegistrationOutpatient {
|
||||
@JoinColumn()
|
||||
registration: EmrRegistration;
|
||||
|
||||
@ManyToOne(() => PatientGuarantor, { onDelete: "NO ACTION" })
|
||||
@JoinColumn()
|
||||
guarantor: PatientGuarantor;
|
||||
|
||||
@ManyToOne(() => Room, { onDelete: "NO ACTION" })
|
||||
@JoinColumn()
|
||||
room: Room;
|
||||
|
||||
@ -5,3 +5,4 @@ export * from "./schema/finances";
|
||||
export * from "./schema/procurement";
|
||||
export * from "./schema/pharmacy";
|
||||
export * from "./schema/pharmacy_logistic";
|
||||
export * from "./schema/cashier";
|
||||
2
src/schema/cashier.ts
Normal file
2
src/schema/cashier.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from "../entity/cashier/cashier";
|
||||
export * from "../entity/cashier/cashier_item";
|
||||
Reference in New Issue
Block a user