-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(sql): Add base DICOM model hierarchy to use duplicate functions
- Loading branch information
1 parent
274eb20
commit 17545b2
Showing
5 changed files
with
35 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const { raccoonConfig } = require("@root/config-class"); | ||
const { Model } = require("sequelize"); | ||
|
||
let Common; | ||
if (raccoonConfig.dicomDimseConfig.enableDimse) { | ||
require("@models/DICOM/dcm4che/java-instance"); | ||
Common = require("@java-wrapper/org/github/chinlinlee/dcm777/net/common/Common").Common; | ||
} | ||
class BaseDicomModel extends Model { | ||
async getAttributes() { | ||
let obj = this.toJSON(); | ||
let jsonStr = JSON.stringify(obj.json); | ||
return await Common.getAttributesFromJsonString(jsonStr); | ||
} | ||
|
||
async incrementDeleteStatus() { | ||
let deleteStatus = this.getDataValue("deleteStatus"); | ||
this.setDataValue("deleteStatus", deleteStatus + 1); | ||
await this.save(); | ||
} | ||
|
||
toDicomJson() { | ||
return this.json; | ||
} | ||
}; | ||
|
||
module.exports.BaseDicomModel = BaseDicomModel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters