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 { Room } from "../room";
|
||||
import { Diagnosis } from "../diagnosis";
|
||||
import { EmrRegistrationOutpatient } from "./emr_registration_outpatient";
|
||||
|
||||
@Entity("emr_internal_consultation", { schema: "emr" })
|
||||
export class EmrInternalConsultation {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@ManyToOne(() => EmrRegistrationOutpatient, { onDelete: "CASCADE" })
|
||||
@JoinColumn()
|
||||
registration_outpatient: EmrRegistrationOutpatient;
|
||||
|
||||
@ManyToOne(() => EmrPatient, { onDelete: "CASCADE" })
|
||||
@JoinColumn()
|
||||
emrpatient: EmrPatient;
|
||||
patient: EmrPatient;
|
||||
|
||||
@ManyToOne(() => Room, { onDelete: "CASCADE" })
|
||||
@ManyToOne(() => Room, { onDelete: "CASCADE", nullable: true })
|
||||
@JoinColumn()
|
||||
referring_room: Room;
|
||||
|
||||
@ -51,8 +56,8 @@ export class EmrInternalConsultation {
|
||||
@Column({ type: "text", nullable: true })
|
||||
consultation_report: string;
|
||||
|
||||
@Column({ type: "date", nullable: true })
|
||||
dates: Date;
|
||||
@Column({ type: "date", nullable: true, default: () => "CURRENT_DATE" })
|
||||
referring_date: Date;
|
||||
|
||||
@Column({ type: "date", nullable: true })
|
||||
consultation_date: Date;
|
||||
|
||||
Reference in New Issue
Block a user