-
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.
feat: search instances in a study by study uid API
- Loading branch information
1 parent
76e02e0
commit 2f066aa
Showing
2 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
api-sql/dicom-web/controller/QIDO-RS/queryStudies-Instances.js
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,47 @@ | ||
const { | ||
SqlQidoRsService: QidoRsService | ||
} = require("./service/QIDO-RS.service"); | ||
const { ApiLogger } = require("@root/utils/logs/api-logger"); | ||
const { Controller } = require("@root/api/controller.class"); | ||
|
||
class QueryInstancesOfStudiesController extends Controller { | ||
constructor(req, res) { | ||
super(req, res); | ||
} | ||
|
||
async mainProcess() { | ||
let apiLogger = new ApiLogger(this.request, "QIDO-RS"); | ||
|
||
apiLogger.addTokenValue(); | ||
apiLogger.logger.info(`Query instances in study, Study UID: ${this.request.params.studyUID}`); | ||
|
||
try { | ||
|
||
let qidoRsService = new QidoRsService(this.request, this.response, "instance"); | ||
|
||
await qidoRsService.getAndResponseDicomJson(); | ||
} catch (e) { | ||
let errorStr = JSON.stringify(e, Object.getOwnPropertyNames(e)); | ||
apiLogger.logger.error(errorStr); | ||
|
||
this.response.writeHead(500, { | ||
"Content-Type": "application/dicom+json" | ||
}); | ||
this.response.end(JSON.stringify({ | ||
code: 500, | ||
message: "Server error occurred" | ||
})); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* | ||
* @param {import('express').Request} req | ||
* @param {import('express').Response} res | ||
*/ | ||
module.exports = async function (req, res) { | ||
let controller = new QueryInstancesOfStudiesController(req, res); | ||
|
||
await controller.doPipeline(); | ||
}; |
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