reporting
This commit is contained in:
54
src/entity/reporting/emergency_diagnosis_fact.ts
Normal file
54
src/entity/reporting/emergency_diagnosis_fact.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
Index,
|
||||
} from "typeorm";
|
||||
import { OpdReportGrain } from "../../types/opd_report_grain";
|
||||
|
||||
@Entity({ schema: "reporting", name: "emergency_diagnosis_fact" })
|
||||
@Index(["grain", "period_start", "period_end", "rank", "is_new_only"], {
|
||||
unique: true,
|
||||
})
|
||||
export class EmergencyDiagnosisFact {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: OpdReportGrain,
|
||||
nullable: false,
|
||||
})
|
||||
grain: OpdReportGrain;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_start: string;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_end: string;
|
||||
|
||||
@Column({ nullable: true, length: 64 })
|
||||
icd_code: string | null;
|
||||
|
||||
@Column({ nullable: false, length: 512 })
|
||||
diagnosis_name: string;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
total_visits: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
rank: number;
|
||||
|
||||
@Column({ type: "boolean", nullable: false, default: false })
|
||||
is_new_only: boolean;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
}
|
||||
64
src/entity/reporting/emergency_fact.ts
Normal file
64
src/entity/reporting/emergency_fact.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
Index,
|
||||
} from "typeorm";
|
||||
import { OpdReportGrain } from "../../types/opd_report_grain";
|
||||
|
||||
@Entity({ schema: "reporting", name: "emergency_fact" })
|
||||
@Index(["grain", "period_start", "period_end"], { unique: true })
|
||||
export class EmergencyFact {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: OpdReportGrain,
|
||||
nullable: false,
|
||||
})
|
||||
grain: OpdReportGrain;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_start: string;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_end: string;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
total_patients: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
new_patients_male: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
new_patients_female: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
returning_patients_male: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
returning_patients_female: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
foreign_patients_male: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
foreign_patients_female: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
total_referral_male: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
total_referral_female: number;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
}
|
||||
52
src/entity/reporting/emergency_outcome_fact.ts
Normal file
52
src/entity/reporting/emergency_outcome_fact.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
Index,
|
||||
} from "typeorm";
|
||||
import { OpdReportGrain } from "../../types/opd_report_grain";
|
||||
|
||||
@Entity({ schema: "reporting", name: "emergency_outcome_fact" })
|
||||
@Index(["grain", "period_start", "period_end"], { unique: true })
|
||||
export class EmergencyOutcomeFact {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: OpdReportGrain,
|
||||
nullable: false,
|
||||
})
|
||||
grain: OpdReportGrain;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_start: string;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_end: string;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
observation: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
admitted: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
discharged: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
dead: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
dba: number;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
}
|
||||
60
src/entity/reporting/emergency_referral_name_fact.ts
Normal file
60
src/entity/reporting/emergency_referral_name_fact.ts
Normal file
@ -0,0 +1,60 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
Index,
|
||||
} from "typeorm";
|
||||
import { OpdReportGrain } from "../../types/opd_report_grain";
|
||||
|
||||
export enum EmergencyReferralType {
|
||||
HOSPITAL = "hospital",
|
||||
HEALTH_CENTER = "health_center",
|
||||
}
|
||||
|
||||
@Entity({ schema: "reporting", name: "emergency_referral_name_fact" })
|
||||
@Index(["grain", "period_start", "period_end", "referral_type", "rank"], {
|
||||
unique: true,
|
||||
})
|
||||
export class EmergencyReferralNameFact {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: OpdReportGrain,
|
||||
nullable: false,
|
||||
})
|
||||
grain: OpdReportGrain;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_start: string;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_end: string;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: EmergencyReferralType,
|
||||
nullable: false,
|
||||
})
|
||||
referral_type: EmergencyReferralType;
|
||||
|
||||
@Column({ nullable: false, length: 512 })
|
||||
referral_name: string;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
total_patients: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
rank: number;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
}
|
||||
46
src/entity/reporting/emergency_referral_source_fact.ts
Normal file
46
src/entity/reporting/emergency_referral_source_fact.ts
Normal file
@ -0,0 +1,46 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
Index,
|
||||
} from "typeorm";
|
||||
import { OpdReportGrain } from "../../types/opd_report_grain";
|
||||
|
||||
@Entity({ schema: "reporting", name: "emergency_referral_source_fact" })
|
||||
@Index(["grain", "period_start", "period_end"], { unique: true })
|
||||
export class EmergencyReferralSourceFact {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: OpdReportGrain,
|
||||
nullable: false,
|
||||
})
|
||||
grain: OpdReportGrain;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_start: string;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_end: string;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
direct: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
hospital_referral: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
health_center_referral: number;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
}
|
||||
42
src/entity/reporting/opd_clinic_map.ts
Normal file
42
src/entity/reporting/opd_clinic_map.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
Index,
|
||||
} from "typeorm";
|
||||
import { Room } from "../room";
|
||||
|
||||
@Entity({ schema: "reporting", name: "opd_clinic_map" })
|
||||
@Index(["report_name"], { unique: true })
|
||||
export class OpdClinicMap {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({ nullable: false, length: 256 })
|
||||
report_name: string;
|
||||
|
||||
@Column({ nullable: true, length: 256 })
|
||||
parent_report_name: string | null;
|
||||
|
||||
@ManyToOne(() => Room, { onDelete: "NO ACTION", nullable: true })
|
||||
@JoinColumn({ name: "room_id" })
|
||||
room: Room | null;
|
||||
|
||||
@Column({ type: "smallint", nullable: false, default: 0 })
|
||||
sort_order: number;
|
||||
|
||||
@Column({ type: "boolean", nullable: false, default: true })
|
||||
is_active: boolean;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
}
|
||||
25
src/entity/reporting/opd_cron_state.ts
Normal file
25
src/entity/reporting/opd_cron_state.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryColumn,
|
||||
Column,
|
||||
UpdateDateColumn,
|
||||
} from "typeorm";
|
||||
|
||||
@Entity({ schema: "reporting", name: "opd_cron_state" })
|
||||
export class OpdCronState {
|
||||
@PrimaryColumn({ length: 128 })
|
||||
job_name: string;
|
||||
|
||||
@Column({ type: "timestamptz", nullable: true })
|
||||
last_success_at: Date | null;
|
||||
|
||||
@Column({ type: "date", nullable: true })
|
||||
last_period_end: string | null;
|
||||
|
||||
@Column({ type: "text", nullable: true })
|
||||
last_error: string | null;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
}
|
||||
62
src/entity/reporting/opd_diagnosis_fact.ts
Normal file
62
src/entity/reporting/opd_diagnosis_fact.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
Index,
|
||||
} from "typeorm";
|
||||
import { Room } from "../room";
|
||||
import { OpdReportGrain } from "../../types/opd_report_grain";
|
||||
|
||||
@Entity({ schema: "reporting", name: "opd_diagnosis_fact" })
|
||||
@Index(["grain", "period_start", "period_end", "rank", "is_new_only", "report_name"], { unique: true })
|
||||
export class OpdDiagnosisFact {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: OpdReportGrain,
|
||||
nullable: false,
|
||||
})
|
||||
grain: OpdReportGrain;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_start: string;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_end: string;
|
||||
|
||||
@ManyToOne(() => Room, { onDelete: "NO ACTION", nullable: true })
|
||||
@JoinColumn({ name: "room_id" })
|
||||
room: Room | null;
|
||||
|
||||
@Column({ nullable: true, length: 256 })
|
||||
report_name: string | null;
|
||||
|
||||
@Column({ type: "smallint", nullable: false })
|
||||
rank: number;
|
||||
|
||||
@Column({ nullable: true, length: 32 })
|
||||
icd_code: string | null;
|
||||
|
||||
@Column({ nullable: false, length: 512 })
|
||||
diagnosis_name: string;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
total_visits: number;
|
||||
|
||||
@Column({ type: "boolean", nullable: false, default: false })
|
||||
is_new_only: boolean;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
}
|
||||
59
src/entity/reporting/opd_referral_fact.ts
Normal file
59
src/entity/reporting/opd_referral_fact.ts
Normal file
@ -0,0 +1,59 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
Index,
|
||||
} from "typeorm";
|
||||
import { Room } from "../room";
|
||||
import { OpdReportGrain } from "../../types/opd_report_grain";
|
||||
|
||||
@Entity({ schema: "reporting", name: "opd_referral_fact" })
|
||||
@Index(["grain", "period_start", "period_end", "report_name"], { unique: true })
|
||||
export class OpdReferralFact {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: OpdReportGrain,
|
||||
nullable: false,
|
||||
})
|
||||
grain: OpdReportGrain;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_start: string;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_end: string;
|
||||
|
||||
@ManyToOne(() => Room, { onDelete: "NO ACTION", nullable: true })
|
||||
@JoinColumn({ name: "room_id" })
|
||||
room: Room | null;
|
||||
|
||||
@Column({ nullable: true, length: 256 })
|
||||
report_name: string | null;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
hospital_referral: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
centro_saude_referral: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
internal_referral: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
no_referral: number;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
}
|
||||
68
src/entity/reporting/opd_visit_fact.ts
Normal file
68
src/entity/reporting/opd_visit_fact.ts
Normal file
@ -0,0 +1,68 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
Index,
|
||||
} from "typeorm";
|
||||
import { Room } from "../room";
|
||||
import { OpdReportGrain } from "../../types/opd_report_grain";
|
||||
|
||||
@Entity({ schema: "reporting", name: "opd_visit_fact" })
|
||||
@Index(["grain", "period_start", "period_end", "report_name"], { unique: true })
|
||||
export class OpdVisitFact {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: OpdReportGrain,
|
||||
nullable: false,
|
||||
})
|
||||
grain: OpdReportGrain;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_start: string;
|
||||
|
||||
@Column({ type: "date", nullable: false })
|
||||
period_end: string;
|
||||
|
||||
@ManyToOne(() => Room, { onDelete: "NO ACTION", nullable: true })
|
||||
@JoinColumn({ name: "room_id" })
|
||||
room: Room | null;
|
||||
|
||||
@Column({ nullable: false, length: 256 })
|
||||
report_name: string;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
total_visits: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
new_visits: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
existing_visits: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
foreigner_visits: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
male_visits: number;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
female_visits: number;
|
||||
|
||||
@Column({ type: "int", nullable: true })
|
||||
referral_total: number | null;
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
}
|
||||
@ -7,4 +7,5 @@ export * from "./schema/pharmacy";
|
||||
export * from "./schema/pharmacy_logistic";
|
||||
export * from "./schema/cashier";
|
||||
export * from "./schema/blood_bank";
|
||||
export * from "./schema/card_management";
|
||||
export * from "./schema/card_management";
|
||||
export * from "./schema/reporting";
|
||||
11
src/schema/reporting.ts
Normal file
11
src/schema/reporting.ts
Normal file
@ -0,0 +1,11 @@
|
||||
export * from "../types/opd_report_grain";
|
||||
export * from "../entity/reporting/opd_clinic_map";
|
||||
export * from "../entity/reporting/opd_visit_fact";
|
||||
export * from "../entity/reporting/opd_diagnosis_fact";
|
||||
export * from "../entity/reporting/opd_referral_fact";
|
||||
export * from "../entity/reporting/opd_cron_state";
|
||||
export * from "../entity/reporting/emergency_fact";
|
||||
export * from "../entity/reporting/emergency_outcome_fact";
|
||||
export * from "../entity/reporting/emergency_referral_source_fact";
|
||||
export * from "../entity/reporting/emergency_referral_name_fact";
|
||||
export * from "../entity/reporting/emergency_diagnosis_fact";
|
||||
6
src/types/opd_report_grain.ts
Normal file
6
src/types/opd_report_grain.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export enum OpdReportGrain {
|
||||
DAY = "day",
|
||||
MONTH = "month",
|
||||
QUARTER = "quarter",
|
||||
YEAR = "year",
|
||||
}
|
||||
Reference in New Issue
Block a user