UNPKG

4.44 kBJavaScriptView Raw
1/*
2
3 ----------------------------------------------------------------------------
4 | qewd-ripple: QEWD-based Middle Tier for Ripple OSI |
5 | |
6 | Copyright (c) 2016-17 Ripple Foundation Community Interest Company |
7 | All rights reserved. |
8 | |
9 | http://rippleosi.org |
10 | Email: code.custodian@rippleosi.org |
11 | |
12 | Author: Rob Tweed, M/Gateway Developments Ltd |
13 | |
14 | Licensed under the Apache License, Version 2.0 (the "License"); |
15 | you may not use this file except in compliance with the License. |
16 | You may obtain a copy of the License at |
17 | |
18 | http://www.apache.org/licenses/LICENSE-2.0 |
19 | |
20 | Unless required by applicable law or agreed to in writing, software |
21 | distributed under the License is distributed on an "AS IS" BASIS, |
22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
23 | See the License for the specific language governing permissions and |
24 | limitations under the License. |
25 ----------------------------------------------------------------------------
26
27 28 February 2017
28
29 Single Patient View module
30
31*/
32
33var openEHR = require('../openEHR/openEHR');
34var headingsLib = require('../headings/headings');
35var dicom = require('../dicom/dicom');
36
37var patientSummary = require('./patientSummary');
38var patientHeadingTable = require('./patientHeadingTable');
39var patientHeadingDetail = require('./patientHeadingDetail');
40var postHeading = require('./postHeading');
41var advancedSearch = require('./advancedSearch');
42
43
44module.exports = {
45
46 init: function() {
47 openEHR.init.call(this);
48 headingsLib.init.call(this);
49 patientSummary.init.call(this);
50 },
51
52 getPatientSummary: function(args, callback) {
53 if (args.patientId === 'advancedSearch') {
54 advancedSearch.call(this, args, callback);
55 return;
56 }
57 patientSummary.get.call(this, args.patientId, args.session, callback);
58 },
59
60 getHeadingTable: function(args, callback) {
61 console.log('** spv.getHeadingTable: ' + JSON.stringify(args));
62
63 if (args.patientId === 'null') {
64 callback({error: 'A null patientId was specified in the request'});
65 return;
66 }
67
68 patientHeadingTable.call(this, args.patientId, args.heading, args.session, callback)
69 },
70
71 postHeading: function(args, callback) {
72 console.log('** spv.postHeading: ' + JSON.stringify(args));
73 if (args.patientId === 'null') {
74 callback({error: 'A null patientId was specified in the request'});
75 return;
76 }
77
78 postHeading.call(this, args.patientId, args.heading, args.req.body, args.session, callback)
79 },
80
81 getHeadingDetail: function(args, callback) {
82
83 if (args.heading === 'dicom') {
84 dicom.studies.call(this, args, callback);
85 return;
86 }
87
88 var results = patientHeadingDetail.call(this, args.patientId, args.heading, args.sourceId, args.session);
89 callback(results);
90 },
91
92 probablyDicomL2: function(args, callback) {
93
94 if (args.heading === 'dicom') {
95 console.log('dicom: args = ' + JSON.stringify(args));
96 dicom.detailL2.call(this, args, callback);
97 return;
98 }
99
100 var results = patientHeadingDetail.call(this, args.patientId, args.heading, args.sourceId, args.session);
101 callback(results);
102 },
103
104 probablyDicomL3: function(args, callback) {
105
106 if (args.heading === 'dicom') {
107 console.log('dicom: args = ' + JSON.stringify(args));
108 dicom.detailL3.call(this, args, callback);
109 return;
110 }
111
112 var results = patientHeadingDetail.call(this, args.patientId, args.heading, args.sourceId, args.session);
113 callback(results);
114 }
115
116};