feat(db): add outpatient link to consultations
add a registration_outpatient relation to internal consultations to track outpatient registration context directly rename emrpatient to patient and dates to referring_date for clearer field semantics, and make referring_room optional with a default CURRENT_DATE for referring_date BREAKING CHANGE: emr_internal_consultation fields emrpatient and dates are renamed to patient and referring_date
This commit is contained in:
@ -15,17 +15,22 @@ import { EmrPatient } from "./emr_patient";
|
|||||||
import { User } from "../users";
|
import { User } from "../users";
|
||||||
import { Room } from "../room";
|
import { Room } from "../room";
|
||||||
import { Diagnosis } from "../diagnosis";
|
import { Diagnosis } from "../diagnosis";
|
||||||
|
import { EmrRegistrationOutpatient } from "./emr_registration_outpatient";
|
||||||
|
|
||||||
@Entity("emr_internal_consultation", { schema: "emr" })
|
@Entity("emr_internal_consultation", { schema: "emr" })
|
||||||
export class EmrInternalConsultation {
|
export class EmrInternalConsultation {
|
||||||
@PrimaryGeneratedColumn("uuid")
|
@PrimaryGeneratedColumn("uuid")
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => EmrRegistrationOutpatient, { onDelete: "CASCADE" })
|
||||||
|
@JoinColumn()
|
||||||
|
registration_outpatient: EmrRegistrationOutpatient;
|
||||||
|
|
||||||
@ManyToOne(() => EmrPatient, { onDelete: "CASCADE" })
|
@ManyToOne(() => EmrPatient, { onDelete: "CASCADE" })
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
emrpatient: EmrPatient;
|
patient: EmrPatient;
|
||||||
|
|
||||||
@ManyToOne(() => Room, { onDelete: "CASCADE" })
|
@ManyToOne(() => Room, { onDelete: "CASCADE", nullable: true })
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
referring_room: Room;
|
referring_room: Room;
|
||||||
|
|
||||||
@ -51,8 +56,8 @@ export class EmrInternalConsultation {
|
|||||||
@Column({ type: "text", nullable: true })
|
@Column({ type: "text", nullable: true })
|
||||||
consultation_report: string;
|
consultation_report: string;
|
||||||
|
|
||||||
@Column({ type: "date", nullable: true })
|
@Column({ type: "date", nullable: true, default: () => "CURRENT_DATE" })
|
||||||
dates: Date;
|
referring_date: Date;
|
||||||
|
|
||||||
@Column({ type: "date", nullable: true })
|
@Column({ type: "date", nullable: true })
|
||||||
consultation_date: Date;
|
consultation_date: Date;
|
||||||
|
|||||||
Reference in New Issue
Block a user