update: EmrCompoundingMedicine entity to include relation with EmrRegistration and update related controller to handle the new relation

This commit is contained in:
wayanrivan
2026-03-26 16:40:49 +07:00
parent c149200858
commit a6528de1eb
3 changed files with 53 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import {
import { EmrCompoundingMedicineItem } from "./emr_compounding_medicine_item";
import { UsageTime } from "../pharmacy/usage_time";
import { UsageInstructions } from "../pharmacy/usage_instructions";
import { EmrRegistration } from "./emr_registration";
@Entity("emr_compounding_medicine", { schema: "emr" })
export class EmrCompoundingMedicine {
@ -34,6 +35,10 @@ export class EmrCompoundingMedicine {
@Column({ nullable: true, type: "text" })
compounding_notes: string;
@ManyToOne(() => EmrRegistration, { onDelete: "CASCADE" })
@JoinColumn()
emrregistration: EmrRegistration;
@ManyToOne(() => UsageTime, { onDelete: "CASCADE" })
@JoinColumn()
usagetime: UsageTime;

View File

@ -0,0 +1,47 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
OneToOne,
JoinColumn,
ManyToOne,
} from "typeorm";
import { RefferalHospital } from "../refferal_hospital";
@Entity("emr_external_consultation", { schema: "emr" })
export class EmrExternalConsultation {
@PrimaryGeneratedColumn("uuid")
id: string;
@OneToOne(() => RefferalHospital, { onDelete: "CASCADE" })
@JoinColumn()
refferalhospital: RefferalHospital;
@Column({ nullable: true, type: "text" })
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;
}

View File

@ -22,6 +22,7 @@ export * from "../entity/emr/emr_radiology_services";
export * from "../entity/emr/emr_compounding_medicine";
export * from "../entity/emr/emr_compounding_medicine_item";
export * from "../entity/emr/emr_room_medical_equipment";
export * from "../entity/emr/emr_external_consultation";
export * from "../types/registration_type";
export * from "../types/registration_status";