1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | var openEHR = require('../openEHR/openEHR');
|
34 | var headingsLib = require('../headings/headings');
|
35 | var dicom = require('../dicom/dicom');
|
36 |
|
37 | var patientSummary = require('./patientSummary');
|
38 | var patientHeadingTable = require('./patientHeadingTable');
|
39 | var patientHeadingDetail = require('./patientHeadingDetail');
|
40 | var postHeading = require('./postHeading');
|
41 | var advancedSearch = require('./advancedSearch');
|
42 |
|
43 |
|
44 | module.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 | };
|