fix(db): map physical exam to outpatient registration
use outpatient registration as the linked record for physical examinations and enforce a one-to-one relationship. rename the relation field to registration_outpatient for clarity
This commit is contained in:
@ -5,20 +5,20 @@ import {
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
DeleteDateColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
OneToOne,
|
||||
} from "typeorm";
|
||||
|
||||
import { EmrRegistration } from "./emr_registration";
|
||||
import { EmrRegistrationOutpatient } from "./emr_registration_outpatient";
|
||||
|
||||
@Entity("emr_physical_examination", { schema: "emr" })
|
||||
export class EmrPhysicalExamination {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@ManyToOne(() => EmrRegistration, { onDelete: "CASCADE" })
|
||||
@OneToOne(() => EmrRegistrationOutpatient, { onDelete: "CASCADE" })
|
||||
@JoinColumn()
|
||||
registration: EmrRegistration;
|
||||
registration_outpatient: EmrRegistrationOutpatient;
|
||||
|
||||
@Column({ nullable: true, type: "text" })
|
||||
internal_status: string;
|
||||
|
||||
Reference in New Issue
Block a user