Skip to content

Commit

Permalink
feat: add series many to many person name model
Browse files Browse the repository at this point in the history
- PerformingPhysicianName
- OperatorsName
  • Loading branch information
Chinlinlee committed Aug 4, 2023
1 parent f48a5c0 commit b454036
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions models/sql/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ async function init() {
PatientModel.belongsTo(PersonNameModel, {
foreignKey: "x00100010"
});

StudyModel.belongsTo(PatientModel, {
foreignKey: "x00100020",
targetKey: "x00100020"
});

StudyModel.belongsTo(PersonNameModel, {
foreignKey: "x00080090"
});
Expand All @@ -61,6 +63,29 @@ async function init() {
foreignKey: "x0020000D",
targetKey: "x0020000D"
});

// Performing Physician Name many to many
SeriesModel.belongsToMany(PersonNameModel, {
through: "PerformingPhysicianName",
as: "performingPhysicianName",
sourceKey: "x0020000E",
foreignKey: "x0020000E"
});
PersonNameModel.belongsToMany(SeriesModel, {
through: "PerformingPhysicianName"
});

// Operator's Name many to many
SeriesModel.belongsToMany(PersonNameModel, {
through: "OperatorsName",
as: "operatorsName",
sourceKey: "x0020000E",
foreignKey: "x0020000E"
});
PersonNameModel.belongsToMany(SeriesModel, {
through: "OperatorsName"
});

InstanceModel.belongsTo(SeriesModel, {
foreignKey: "x0020000E",
targetKey: "x0020000E"
Expand Down

0 comments on commit b454036

Please sign in to comment.