card management
This commit is contained in:
74
src/entity/card-management/card_inventory.ts
Normal file
74
src/entity/card-management/card_inventory.ts
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
Index,
|
||||||
|
} from "typeorm";
|
||||||
|
import { EmrPatient } from "../emr/emr_patient";
|
||||||
|
import { HealthcareFacility } from "./healthcare_facility";
|
||||||
|
import { CardInventoryStatus } from "../../types/card_inventory_status";
|
||||||
|
|
||||||
|
@Entity({ schema: "card_management", name: "card_inventory" })
|
||||||
|
@Index(["card_number"], { unique: true })
|
||||||
|
@Index(["running_number"], { unique: true })
|
||||||
|
export class CardInventory {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => EmrPatient, { onDelete: "NO ACTION", nullable: true })
|
||||||
|
@JoinColumn({ name: "patientId" })
|
||||||
|
patient: EmrPatient;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 64 })
|
||||||
|
mrn: string;
|
||||||
|
|
||||||
|
@Column({ type: "bigint", nullable: false, unique: true })
|
||||||
|
running_number: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 64, unique: true })
|
||||||
|
card_number: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 128 })
|
||||||
|
tag_id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => HealthcareFacility, { onDelete: "NO ACTION", nullable: true })
|
||||||
|
@JoinColumn()
|
||||||
|
facility: HealthcareFacility;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: "enum",
|
||||||
|
enum: CardInventoryStatus,
|
||||||
|
nullable: false,
|
||||||
|
default: CardInventoryStatus.NOT_USED,
|
||||||
|
})
|
||||||
|
status: CardInventoryStatus;
|
||||||
|
|
||||||
|
@Column({ type: "timestamp", nullable: true })
|
||||||
|
printed_at: Date;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
48
src/entity/card-management/card_stock_in.ts
Normal file
48
src/entity/card-management/card_stock_in.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
} from "typeorm";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Placeholder for future batch card stock-in workflow.
|
||||||
|
* Entity only — no API, UI, or business logic yet.
|
||||||
|
*/
|
||||||
|
@Entity({ schema: "card_management", name: "card_stock_in" })
|
||||||
|
export class CardStockIn {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true, length: 64 })
|
||||||
|
batch_number: string;
|
||||||
|
|
||||||
|
@Column({ type: "int", nullable: true })
|
||||||
|
quantity: number;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
notes: 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;
|
||||||
|
}
|
||||||
73
src/entity/card-management/healthcare_facility.ts
Normal file
73
src/entity/card-management/healthcare_facility.ts
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
Index,
|
||||||
|
} from "typeorm";
|
||||||
|
import { Munisipo } from "../munisipo";
|
||||||
|
import { Administrativu } from "../administrativu";
|
||||||
|
import { HealthcareFacilityStatus } from "../../types/healthcare_facility_status";
|
||||||
|
import { HealthcareFacilityType } from "../../types/healthcare_facility_type";
|
||||||
|
|
||||||
|
@Entity({ schema: "card_management", name: "healthcare_facility" })
|
||||||
|
@Index(["code"], { unique: true })
|
||||||
|
export class HealthcareFacility {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ nullable: false, length: 64, unique: true })
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: false })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: "enum",
|
||||||
|
enum: HealthcareFacilityType,
|
||||||
|
nullable: false,
|
||||||
|
default: HealthcareFacilityType.HOSPITAL,
|
||||||
|
})
|
||||||
|
type: HealthcareFacilityType;
|
||||||
|
|
||||||
|
@ManyToOne(() => Munisipo, { onDelete: "NO ACTION", nullable: true })
|
||||||
|
@JoinColumn()
|
||||||
|
municipio: Munisipo;
|
||||||
|
|
||||||
|
@ManyToOne(() => Administrativu, { onDelete: "NO ACTION", nullable: true })
|
||||||
|
@JoinColumn()
|
||||||
|
administrativu: Administrativu;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: "enum",
|
||||||
|
enum: HealthcareFacilityStatus,
|
||||||
|
nullable: false,
|
||||||
|
default: HealthcareFacilityStatus.ACTIVE,
|
||||||
|
})
|
||||||
|
status: HealthcareFacilityStatus;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
53
src/entity/card-management/running_number_log.ts
Normal file
53
src/entity/card-management/running_number_log.ts
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
Index,
|
||||||
|
} from "typeorm";
|
||||||
|
|
||||||
|
@Entity({ schema: "card_management", name: "running_number_log" })
|
||||||
|
@Index(["running_number"])
|
||||||
|
@Index(["requested_at"])
|
||||||
|
export class RunningNumberLog {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "bigint", nullable: false })
|
||||||
|
running_number: string;
|
||||||
|
|
||||||
|
@Column({ nullable: false, length: 128 })
|
||||||
|
service_name: string;
|
||||||
|
|
||||||
|
@Column({ type: "uuid", nullable: false })
|
||||||
|
requested_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: false, length: 256 })
|
||||||
|
requested_by_name: string;
|
||||||
|
|
||||||
|
@Column({ type: "timestamp", nullable: false })
|
||||||
|
requested_at: Date;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
@ -6,4 +6,5 @@ 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";
|
export * from "./schema/cashier";
|
||||||
export * from "./schema/blood_bank";
|
export * from "./schema/blood_bank";
|
||||||
|
export * from "./schema/card_management";
|
||||||
7
src/schema/card_management.ts
Normal file
7
src/schema/card_management.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export * from "../types/card_inventory_status";
|
||||||
|
export * from "../types/healthcare_facility_status";
|
||||||
|
export * from "../types/healthcare_facility_type";
|
||||||
|
export * from "../entity/card-management/card_inventory";
|
||||||
|
export * from "../entity/card-management/healthcare_facility";
|
||||||
|
export * from "../entity/card-management/running_number_log";
|
||||||
|
export * from "../entity/card-management/card_stock_in";
|
||||||
7
src/types/card_inventory_status.ts
Normal file
7
src/types/card_inventory_status.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export enum CardInventoryStatus {
|
||||||
|
/** Blank card in stock — not yet assigned / injected to a patient */
|
||||||
|
NOT_USED = "NOT_USED",
|
||||||
|
ACTIVE = "ACTIVE",
|
||||||
|
LOST = "LOST",
|
||||||
|
REPLACED = "REPLACED",
|
||||||
|
}
|
||||||
4
src/types/healthcare_facility_status.ts
Normal file
4
src/types/healthcare_facility_status.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export enum HealthcareFacilityStatus {
|
||||||
|
ACTIVE = "ACTIVE",
|
||||||
|
INACTIVE = "INACTIVE",
|
||||||
|
}
|
||||||
6
src/types/healthcare_facility_type.ts
Normal file
6
src/types/healthcare_facility_type.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export enum HealthcareFacilityType {
|
||||||
|
HOSPITAL = "HOSPITAL",
|
||||||
|
CLINIC = "CLINIC",
|
||||||
|
HEALTH_CENTER = "HEALTH_CENTER",
|
||||||
|
OTHER = "OTHER",
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user