fixed submissions fields

This commit is contained in:
David Baldwynn 2015-10-06 13:14:12 -07:00
parent 6c4bfc2714
commit 2638af607f
2 changed files with 0 additions and 342 deletions

View file

@ -1,114 +0,0 @@
var soap = require('soap'),
async = require('async'),
demo = require('./test_headless'),
OscarSecurity = require('./OscarSecurity');
var url_demo = 'https://secure2.oscarhost.ca/kensington/ws/DemographicService?wsdl',
url_login = 'https://secure2.oscarhost.ca/kensington/ws/LoginService?wsdl',
args_demo = {arg0: 0},
args_login = {arg0: 'davieb', arg1: 'Temppass1'},
my_hin = 9146489321;
var fakeDemo = {
"activeCount": 1,
"address": "880-9650 Velit. St.",
"alias": "",
"anonymous": "",
"chartNo": "",
"children":"",
"citizenship":"Canadian",
"city": "Lloydminster",
"dateJoined": new Date(),
"dateOfBirth": "10",
"demographicNo": 90348,
"email": "Sed.nunc@dis.co.uk",
"firstName": "Uriah F.",
"hin": 9146509343,
"lastName": "Little",
"lastUpdateDate": new Date(),
"monthOfBirth": "05",
"officialLanguage": "English",
"phone": "(306) 872-3210",
"phone2": "(306) 556-8264",
"providerNo": 4,
"province": "SK",
"sex": "F",
"spokenLanguage": "English",
"postal": "S4M 7T8",
"yearOfBirth": "2015"
};
var exampleDemo = {
activeCount: 1,
address: '880-9650 Velit. St.',
chartNo: '',
city: '',
dateJoined: Date.now(),
dateOfBirth: '10',
displayName: 'LITTLE, URIAH',
email: '',
familyDoctor: '<rdohip></rdohip><rd></rd>',
firstName: 'Uriah F.',
hcType: 'BC',
hin: '',
hsAlertCount: 0,
lastName: 'Little',
lastUpdateDate: Date.now(),
lastUpdateUser: '',
links: '',
monthOfBirth: '05',
officialLanguage: 'English',
patientStatus: 'AC',
patientStatusDate: Date.now(),
phone: '250-',
phone2: '',
postal: "S4M 7T8",
providerNo: '4',
province: 'BC',
rosterStatus: '',
sex: 'M',
sexDesc: 'Female',
sin: '',
spokenLanguage: 'English',
title: 'MS.',
yearOfBirth: '2015' }
var options = {
ignoredNamespaces: {
namespaces: ['targetNamespace', 'typedNamespace'],
override: true
}
}
async.waterfall([
function (callback) {
//Authenticate with API
soap.createClient(url_login, options, function(err, client) {
client.login(args_login, function (err, result) {
if(err) callback(err);
callback(null, result.return);
});
});
},
function (security_obj, callback) {
//Add demographic
soap.createClient(url_demo, options, function(err, client) {
client.setSecurity(new OscarSecurity(security_obj.securityId, security_obj.securityTokenKey) );
client.addDemographic({ arg0: exampleDemo }, function (err, result) {
if(err) callback(err);
console.log(client.describe());
callback(null, result);
});
});
},
], function(err, result) {
if(err) throw err;
console.log(result);
});

View file

@ -1,228 +0,0 @@
var request = require('request'),
async = require('async'),
jsdom = require('jsdom-compat'),
url = require('url');
var url_base = 'https://secure11.oscarhost.ca/'
url_login_crsf = url_base+'kensington',
url_login = url_base+'kensington/login.do',
url_demo = url_base+'demographic/demographiccontrol.jsp';
var args_searchDemo = {'search_mode': 'search_hin', 'keyword': '', 'orderby': 'last_name,first_name', 'dboperation': 'search_titlename', 'limit1': 0, 'limit2': 10, 'displaymode': 'Search', 'ptstatus': 'active', 'fromMessenger': 'false'},
args_login = {'authenticity_token': '', 'username': 'kensington', 'password': 'Temppass4', 'pin': 6448, 'commit': 'Login'};
/*
var args_updateDemo =
{
'demographic_no':189164,
'last_name':'TEST1',
'first_name':'ACCOUNT1',
'title':'MR',
'official_lang':'English',
'spoken_lang':'English',
'address':'500 Somewhere Ave',
'city':'TEST CITY',
'province':'BC',
'postal':'V6V262',
'phone':'604-123-4333',
'hPhoneExt':''
'hPhoneExtOrig':'',
'phone2':'',
'wPhoneExt':'',
'wPhoneExtOrig':'',
'demo_cell':6041118888,
'demo_cellOrig':6041118888,
'countryOfOrigin':'AT',
'email':'someone@tsnstnhs.com',
'myOscarUserName':''
'newsletter':'No',
'sin':'',
'year_of_birth':1994,
'month_of_birth':06,
'date_of_birth':15,
'age':21,
'sex':'M',
'hin':9146509343,
'ver':'',
'eff_date_year':2015,
'eff_date_month':05,
'eff_date_date':01,
'hc_renew_date_year':'',
'hc_renew_date_month':'',
'hc_renew_date_date':'',
'hc_type':'BC',
'cytolNum':'',
'cytolNumOrig':'',
'provider_no':'',
'resident':'',
'midwife':'',
'nurse':'',
'r_doctor':'',
'r_doctor_ohip':'',
'initial_rosterstatus':'',
'roster_status':''
'roster_date_year':'',
'roster_date_month':'',
'roster_date_day':'',
'roster_termination_date_year':'',
'roster_termination_date_month':'',
'roster_termination_date_day':'',
'roster_termination_reason':'',
'initial_patientstatus':'AC',
'patient_status':'AC',
'patientstatus_date_year':2015,
'patientstatus_date_month':09,
'patientstatus_date_day':10,
'chart_no':''
'wlId':''
'list_id':0,
'waiting_list_note':''
'waiting_list_referral_date':''
'date_joined_year':2015,
'date_joined_month':09,
'date_joined_date':10,
'end_date_year':2016,
'end_date_month':09,
'end_date_date':10,
'rxInteractionWarningLevelOrig':0,
'rxInteractionWarningLevel':0,
'alert':'',
'notes':'',
'dboperation':'update_record'
'displaymode':'Update Record'
};
var _processDemo = function(newDemographic){
};
*/
module.exports.getDemoByHIN = function (hin, cb){
var cookieJar = request.jar(),
responseHeaders;
async.waterfall([
function (callback) {
request.get({url: url_login, jar: cookieJar}, function (err, httpResponse, body) {
if (err) {
callback(err, 'Error in HTTP POST of Login');
}
jsdom.env(
body,
function (err, window) {
if (err) {
callback(err, 'Error in Getting AuthenticityToken');
}
args_login.authenticity_token = window.document.querySelector('input[name="authenticity_token"]').value;
callback();
}
);
});
},
function (callback) {
request.post({url: url_login, jar: cookieJar, form: args_login}, function (err, httpResponse, body) {
if (err) {
callback(err, 'Error in HTTP POST of Login');
}
responseHeaders = httpResponse.toJSON().headers;
callback();
});
},
function (callback) {
var urlTemplate = url.parse(url_demo);
args_searchDemo.keyword = hin+'';
urlTemplate.query = args_searchDemo;
var compiledSearchUrl = urlTemplate.format();
request.get({url: compiledSearchUrl, jar: cookieJar, header: responseHeaders}, function (err, httpResponse, body) {
if (err) {
callback(err, 'Error in HTTP Get of Search');
}
jsdom.env(
body,
["http://code.jquery.com/jquery.js"],
function (err, window) {
if(err){
callback(err);
}
console.log(body);
//var demogp_number = window.document.querySelectorAll("li > .demoIdSearch > a[title='Master Demo File']")[0].innerText;
//demogp_number = parseInt(demogp_number, 10);
callback(null, 8);
}
);
});
}
], function(err, result) {
if(err) throw err;
if( (typeof result) != 'number'){
throw new Error('Demographic number not captured');
}
cb(result);
});
};
/*
module.exports.updateDemo = function (newDemo){
async.waterfall([
function (callback) {
request.get({url: url_login, jar: cookieJar}, function (err, httpResponse, body) {
if (err) {
callback(err, 'Error in HTTP POST of Login');
}
jsdom.env(
body,
function (err, window) {
if (err) {
callback(err, 'Error in Getting AuthenticityToken');
}
args_login.authenticity_token = window.document.querySelector('input[name="authenticity_token"]').value;
callback();
}
);
});
},
function (callback) {
request.post({url: url_login, jar: cookieJar, form: args_login}, function (err, httpResponse, body) {
if (err) {
callback(err, 'Error in HTTP POST of Login');
}
responseHeaders = httpResponse.toJSON().headers;
callback();
});
},
function (callback) {
var urlTemplate = url.parse(url_demo);
urlTemplate.query = args_search;
var compiledSearchUrl = urlTemplate.format();
request.get({url: urlSearchStr, jar: cookieJar, header: responseHeaders}, function (err, httpResponse, body) {
if (err) {
callback(err, 'Error in HTTP Get of Search');
}
jsdom.env(
body,
function (err, window) {
if(err){
callback(err);
}
var urlDemo =
callback(null, demogp_number);
}
);
});
}
], function(err, result) {
if(err) throw err;
if( (typeof result) != 'number'){
throw new Error('Demographic number not captured');
}
cb(result);
});
};
*/