UNPKG

2.4 kBJavaScriptView Raw
1/*
2
3 ----------------------------------------------------------------------------
4 | rippleosi-ewd3: EWD3/ewd-xpress Middle Tier for Ripple OSI |
5 | |
6 | Copyright (c) 2016-7 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 9 March 2017
28
29*/
30
31function fetchFromPas(nhsNumber, session, callback) {
32
33 // called once when a PHR user logs in
34
35 // fetches the patient's PAS data and caches it into the session
36
37 var pas = require('../' + this.userDefined.rippleUser.pasModule);
38 if (!pas.init) pas.init.call(this);
39
40 var patientCache = session.data.$('patients');
41
42 pas.getOnePatient.call(this, nhsNumber, function(results) {
43
44 if (!results.error) {
45 patientCache.setDocument(results);
46 if (callback) callback();
47 }
48 });
49
50}
51
52module.exports = fetchFromPas;