diff --git a/src/entity/emr/emr_patient.ts b/src/entity/emr/emr_patient.ts new file mode 100644 index 0000000..23b6075 --- /dev/null +++ b/src/entity/emr/emr_patient.ts @@ -0,0 +1,104 @@ +import { + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + UpdateDateColumn, + DeleteDateColumn, + ManyToOne, + JoinColumn, +} from "typeorm"; + +import { Status } from "../../types/status"; +import { Aldeia } from "../aldeia"; +import { Suco } from "../suco"; +import { Administrativu } from "../administrativu"; +import { Munisipo } from "../munisipo"; + +@Entity("emr_patients", { schema: "emr" }) +export class EmrPatient { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ nullable: false, length: 64 }) + mrn_number: string; + + @Column({ nullable: false, length: 256 }) + first_name: string; + + @Column({ nullable: false, length: 256 }) + last_name: string; + + @Column({ type: "date", nullable: false }) + birth_date: Date; + + @Column({ nullable: false, length: 32 }) + gender: string; + + @Column({ nullable: false, length: 32 }) + citizen: string; + + @Column({ nullable: true, length: 64 }) + marriage_status: string; + + @Column({ nullable: true, length: 256 }) + profession: string; + + @Column({ nullable: false, length: 32 }) + born_in: string; + + @Column({ nullable: true, length: 256 }) + place_of_birth: string; + + @Column({ nullable: true, length: 512 }) + photo: string; + + @Column({ type: "text", nullable: true }) + address: string; + + @ManyToOne(() => Munisipo, { onDelete: "NO ACTION" }) + @JoinColumn() + munisipio: Munisipo; + + @ManyToOne(() => Administrativu, { onDelete: "NO ACTION" }) + @JoinColumn() + administrativu: Administrativu; + + @ManyToOne(() => Suco, { onDelete: "NO ACTION" }) + @JoinColumn() + suco: Suco; + + @ManyToOne(() => Aldeia, { onDelete: "NO ACTION" }) + @JoinColumn() + aldeia: Aldeia; + + @Column({ nullable: true, length: 256 }) + email: string; + + @Column({ nullable: false, length: 64 }) + status: Status; + + @Column({ nullable: true, length: 128 }) + electoral_id_number: 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; +} diff --git a/src/index.ts b/src/index.ts index e49ab82..169eda2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,5 @@ export * from "./schema/public"; export * from "./schema/hrms"; +export * from "./schema/emr"; export * from "./schema/finances"; export * from "./schema/procurement"; diff --git a/src/schema/emr.ts b/src/schema/emr.ts new file mode 100644 index 0000000..d48d63d --- /dev/null +++ b/src/schema/emr.ts @@ -0,0 +1 @@ +export * from "../entity/emr/emr_patient";