5000 |
03 Oct 18 |
olle |
var PersInfo = function() |
5000 |
03 Oct 18 |
olle |
2 |
{ |
5000 |
03 Oct 18 |
olle |
var persinfo = {}; |
5000 |
03 Oct 18 |
olle |
var debug = 0; |
5000 |
03 Oct 18 |
olle |
5 |
|
5000 |
03 Oct 18 |
olle |
//var caseInfo = null; |
5000 |
03 Oct 18 |
olle |
//var bloodInfo = null; |
5000 |
03 Oct 18 |
olle |
var nofBloodTubes = 0; |
5000 |
03 Oct 18 |
olle |
9 |
|
5000 |
03 Oct 18 |
olle |
var baseLineFileIsValid = false; |
5000 |
03 Oct 18 |
olle |
11 |
|
5000 |
03 Oct 18 |
olle |
var pnrIsValid = false; |
5000 |
03 Oct 18 |
olle |
var pnrIsAcceptable = false; |
5000 |
03 Oct 18 |
olle |
var caseIsValid = false; |
5000 |
03 Oct 18 |
olle |
15 |
|
5000 |
03 Oct 18 |
olle |
var sampleItemPrefix = ''; |
5000 |
03 Oct 18 |
olle |
var sampleItemNumDigits = 5; |
5000 |
03 Oct 18 |
olle |
var bloodItemPrefix = ''; |
5000 |
03 Oct 18 |
olle |
var nofTubesIsValid = false; |
5000 |
03 Oct 18 |
olle |
var bloodItemNumDigits = 5; |
5000 |
03 Oct 18 |
olle |
var bloodSamplingDateIsValid = true; |
5000 |
03 Oct 18 |
olle |
var viableTumourCellsPercentIsValid = true; |
5000 |
03 Oct 18 |
olle |
var usesSitePrefix = false; |
5002 |
04 Oct 18 |
olle |
var problemFound = false; |
5000 |
03 Oct 18 |
olle |
25 |
|
5000 |
03 Oct 18 |
olle |
// Well validation variable for input specimen, DNA, RNA |
5000 |
03 Oct 18 |
olle |
var wellIsValid = []; |
5000 |
03 Oct 18 |
olle |
// Well validation variables for extracts from specimen |
5000 |
03 Oct 18 |
olle |
var dnaWellIsValid = []; |
5000 |
03 Oct 18 |
olle |
var rnaWellIsValid = []; |
5000 |
03 Oct 18 |
olle |
31 |
|
5000 |
03 Oct 18 |
olle |
persinfo.initPage = function() |
5000 |
03 Oct 18 |
olle |
33 |
{ |
5000 |
03 Oct 18 |
olle |
34 |
|
5000 |
03 Oct 18 |
olle |
// Step 1 |
5149 |
28 Nov 18 |
olle |
Wizard.initFileSelectionField('baseLineFile'); |
5000 |
03 Oct 18 |
olle |
Events.addEventHandler('step-1', 'wizard-validate', persinfo.validateStep1); |
5000 |
03 Oct 18 |
olle |
//Events.addEventHandler('caseName', 'keypress', Wizard.goNextOnTabOrEnter); |
5000 |
03 Oct 18 |
olle |
//Events.addEventHandler('caseName', 'blur', persinfo.caseNameOnChange); |
5000 |
03 Oct 18 |
olle |
// Events.addEventHandler('baseLineFile', 'change', persinfo.baseLineFileOnChange); |
5000 |
03 Oct 18 |
olle |
41 |
|
5000 |
03 Oct 18 |
olle |
// Step 2 |
5000 |
03 Oct 18 |
olle |
Events.addEventHandler('step-2', 'wizard-initialize', persinfo.initializeStep2); |
5000 |
03 Oct 18 |
olle |
Events.addEventHandler('step-2', 'wizard-validate', persinfo.validateStep2); |
5000 |
03 Oct 18 |
olle |
45 |
|
5000 |
03 Oct 18 |
olle |
// Navigation |
5000 |
03 Oct 18 |
olle |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
5000 |
03 Oct 18 |
olle |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
5000 |
03 Oct 18 |
olle |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
5000 |
03 Oct 18 |
olle |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
5000 |
03 Oct 18 |
olle |
Buttons.addClickHandler('goupdate', Wizard.goRegister); |
5000 |
03 Oct 18 |
olle |
//Buttons.addClickHandler('downloadformbatch2', persinfo.downloadFormBatch2); |
5000 |
03 Oct 18 |
olle |
53 |
|
5000 |
03 Oct 18 |
olle |
// Final registration |
5000 |
03 Oct 18 |
olle |
Events.addEventHandler('wizard', 'wizard-submit', persinfo.submit); |
5000 |
03 Oct 18 |
olle |
56 |
|
5000 |
03 Oct 18 |
olle |
// Load configuration |
5000 |
03 Oct 18 |
olle |
persinfo.loadConfiguration(); |
5000 |
03 Oct 18 |
olle |
59 |
} |
5000 |
03 Oct 18 |
olle |
60 |
|
5000 |
03 Oct 18 |
olle |
persinfo.loadConfiguration = function() |
5000 |
03 Oct 18 |
olle |
62 |
{ |
5000 |
03 Oct 18 |
olle |
var url = '../Session.servlet?ID='+App.getSessionId(); |
5000 |
03 Oct 18 |
olle |
url += '&cmd=GetConfiguration' |
5000 |
03 Oct 18 |
olle |
var request = Ajax.getXmlHttpRequest(); |
5000 |
03 Oct 18 |
olle |
request.open("GET", url, true); |
5000 |
03 Oct 18 |
olle |
Ajax.setReadyStateHandler(request, persinfo.onConfiguration, persinfo.onConfiguration); |
5000 |
03 Oct 18 |
olle |
request.send(null); |
5000 |
03 Oct 18 |
olle |
69 |
} |
5000 |
03 Oct 18 |
olle |
70 |
|
5000 |
03 Oct 18 |
olle |
persinfo.onConfiguration = function(request) |
5000 |
03 Oct 18 |
olle |
72 |
{ |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
74 |
|
5000 |
03 Oct 18 |
olle |
if (debug) |
5000 |
03 Oct 18 |
olle |
76 |
{ |
5000 |
03 Oct 18 |
olle |
App.debug(Strings.encodeTags(request.responseText)); |
5000 |
03 Oct 18 |
olle |
78 |
} |
5000 |
03 Oct 18 |
olle |
79 |
|
5000 |
03 Oct 18 |
olle |
var response; |
5000 |
03 Oct 18 |
olle |
var error = false; |
5000 |
03 Oct 18 |
olle |
try |
5000 |
03 Oct 18 |
olle |
83 |
{ |
5000 |
03 Oct 18 |
olle |
response = JSON.parse(request.responseText); |
5000 |
03 Oct 18 |
olle |
if (response.status != 'ok') |
5000 |
03 Oct 18 |
olle |
86 |
{ |
5000 |
03 Oct 18 |
olle |
error = response.message || response.stacktrace || 'Unexpected error'; |
5000 |
03 Oct 18 |
olle |
88 |
} |
5000 |
03 Oct 18 |
olle |
89 |
} |
5000 |
03 Oct 18 |
olle |
catch (ex) |
5000 |
03 Oct 18 |
olle |
91 |
{ |
5000 |
03 Oct 18 |
olle |
error = ex; |
5000 |
03 Oct 18 |
olle |
93 |
} |
5000 |
03 Oct 18 |
olle |
if (error) App.debug(error); |
5000 |
03 Oct 18 |
olle |
95 |
|
5000 |
03 Oct 18 |
olle |
// Get configuration result |
5000 |
03 Oct 18 |
olle |
var conf = response.configuration; |
5000 |
03 Oct 18 |
olle |
// Check for uses site prefix flag |
5000 |
03 Oct 18 |
olle |
usesSitePrefix = conf.usesSitePrefix; |
5000 |
03 Oct 18 |
olle |
sampleItemPrefix = conf.sampleItemPrefix; |
5000 |
03 Oct 18 |
olle |
sampleItemNumDigits = conf.sampleItemNumDigits; |
5000 |
03 Oct 18 |
olle |
bloodItemPrefix = conf.bloodItemPrefix; |
5000 |
03 Oct 18 |
olle |
bloodItemNumDigits = conf.bloodItemNumDigits; |
5000 |
03 Oct 18 |
olle |
104 |
|
5000 |
03 Oct 18 |
olle |
105 |
/* |
5000 |
03 Oct 18 |
olle |
// Continue with initializing info for case |
5000 |
03 Oct 18 |
olle |
var url = '../LabelGeneration.servlet?ID='+App.getSessionId(); |
5000 |
03 Oct 18 |
olle |
url += '&cmd=CountCases'; |
5000 |
03 Oct 18 |
olle |
Wizard.showLoadingAnimation('Loading cases...'); |
5000 |
03 Oct 18 |
olle |
Wizard.asyncJsonRequest(url, persinfo.caseInfoLoadedStep1); |
5000 |
03 Oct 18 |
olle |
111 |
*/ |
5000 |
03 Oct 18 |
olle |
Doc.show('step-1'); |
5000 |
03 Oct 18 |
olle |
Doc.show('gonext'); |
5000 |
03 Oct 18 |
olle |
114 |
|
5000 |
03 Oct 18 |
olle |
// Ensure that flag 'caseIsValid' is set to 'true' or error reported |
5000 |
03 Oct 18 |
olle |
//persinfo.caseNameOnChange(); |
5000 |
03 Oct 18 |
olle |
117 |
} |
5000 |
03 Oct 18 |
olle |
118 |
|
5000 |
03 Oct 18 |
olle |
persinfo.caseInfoLoadedStep1 = function(response) |
5000 |
03 Oct 18 |
olle |
120 |
{ |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
122 |
|
5000 |
03 Oct 18 |
olle |
sampleItemPrefix = response.sampleItemPrefix; |
5000 |
03 Oct 18 |
olle |
sampleItemNumDigits = response.sampleItemNumDigits; |
5000 |
03 Oct 18 |
olle |
bloodItemPrefix = response.bloodItemPrefix; |
5000 |
03 Oct 18 |
olle |
var nofCases = response.count; |
5000 |
03 Oct 18 |
olle |
if (nofCases == null) |
5000 |
03 Oct 18 |
olle |
128 |
{ |
5000 |
03 Oct 18 |
olle |
nofCases = 0; |
5000 |
03 Oct 18 |
olle |
130 |
} |
5000 |
03 Oct 18 |
olle |
var startNum = nofCases + 1; |
5000 |
03 Oct 18 |
olle |
// Pad number with leading zeros to get right number of digits |
5000 |
03 Oct 18 |
olle |
startNum = String('0000000000' + startNum).slice(-sampleItemNumDigits); |
5000 |
03 Oct 18 |
olle |
var startCase = sampleItemPrefix + startNum; |
5000 |
03 Oct 18 |
olle |
if (usesSitePrefix != null && usesSitePrefix) |
5000 |
03 Oct 18 |
olle |
136 |
{ |
5000 |
03 Oct 18 |
olle |
startCase = ''; |
5000 |
03 Oct 18 |
olle |
138 |
} |
5000 |
03 Oct 18 |
olle |
frm.caseName.value = startCase; |
5000 |
03 Oct 18 |
olle |
140 |
|
5000 |
03 Oct 18 |
olle |
Doc.show('step-1'); |
5000 |
03 Oct 18 |
olle |
Doc.show('gonext'); |
5000 |
03 Oct 18 |
olle |
143 |
|
5000 |
03 Oct 18 |
olle |
// Ensure that flag 'caseIsValid' is set to 'true' or error reported |
5000 |
03 Oct 18 |
olle |
persinfo.caseNameOnChange(); |
5000 |
03 Oct 18 |
olle |
146 |
} |
5000 |
03 Oct 18 |
olle |
147 |
|
5000 |
03 Oct 18 |
olle |
persinfo.caseNameOnChange = function() |
5000 |
03 Oct 18 |
olle |
149 |
{ |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
var caseName = frm.caseName.value.toUpperCase(); |
5000 |
03 Oct 18 |
olle |
caseIsValid = false; |
5000 |
03 Oct 18 |
olle |
if (caseName == '') |
5000 |
03 Oct 18 |
olle |
154 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('caseName', 'invalid', 'Missing'); |
5000 |
03 Oct 18 |
olle |
frm.caseName.focus(); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
158 |
} |
5000 |
03 Oct 18 |
olle |
if (!Meludi.isValidCaseName2(caseName, sampleItemPrefix, sampleItemNumDigits)) |
5000 |
03 Oct 18 |
olle |
160 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('caseName', 'invalid', 'Only "' + sampleItemPrefix + '" + ' + sampleItemNumDigits + ' digits is allowed.'); |
5000 |
03 Oct 18 |
olle |
frm.caseName.focus(); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
164 |
} |
5000 |
03 Oct 18 |
olle |
165 |
|
5000 |
03 Oct 18 |
olle |
frm.caseName.value = caseName; |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('caseName', 'valid'); |
5000 |
03 Oct 18 |
olle |
caseIsValid = true; |
5000 |
03 Oct 18 |
olle |
169 |
|
5000 |
03 Oct 18 |
olle |
var url = '../BaseLineRegistration.servlet?ID='+App.getSessionId(); |
5000 |
03 Oct 18 |
olle |
url += '&cmd=GetCaseInfo&caseName=' + encodeURIComponent(caseName); |
5000 |
03 Oct 18 |
olle |
Wizard.showLoadingAnimation('Loading information about case...'); |
5000 |
03 Oct 18 |
olle |
Wizard.asyncJsonRequest(url, persinfo.onCaseInfoLoaded); |
5000 |
03 Oct 18 |
olle |
174 |
} |
5000 |
03 Oct 18 |
olle |
175 |
|
5000 |
03 Oct 18 |
olle |
persinfo.onCaseInfoLoaded = function(response) |
5000 |
03 Oct 18 |
olle |
177 |
{ |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
179 |
|
5000 |
03 Oct 18 |
olle |
// Get biosource information from the AJAX response |
5000 |
03 Oct 18 |
olle |
caseInfo = response.caseInfo; |
5000 |
03 Oct 18 |
olle |
182 |
|
5000 |
03 Oct 18 |
olle |
183 |
/* |
5000 |
03 Oct 18 |
olle |
// If site determined by site prefix in case name, set site default value and disable site menu |
5000 |
03 Oct 18 |
olle |
//alert("persinfo.js:: persinfo.caseInfoLoaded: caseInfo.siteDefault = " + caseInfo.siteDefault); |
5000 |
03 Oct 18 |
olle |
if (caseInfo.siteDefault != null) |
5000 |
03 Oct 18 |
olle |
187 |
{ |
5000 |
03 Oct 18 |
olle |
frm.site.value = caseInfo.siteDefault; |
5000 |
03 Oct 18 |
olle |
frm.site.disabled = true; |
5000 |
03 Oct 18 |
olle |
190 |
} |
5000 |
03 Oct 18 |
olle |
191 |
|
5000 |
03 Oct 18 |
olle |
if (caseInfo && caseInfo.patient) |
5000 |
03 Oct 18 |
olle |
193 |
{ |
5000 |
03 Oct 18 |
olle |
frm.personalNumber.value = caseInfo.patient.personalNumber; |
5000 |
03 Oct 18 |
olle |
persinfo.personalNumberOnChange(); |
5000 |
03 Oct 18 |
olle |
Wizard.goNext(false); |
5000 |
03 Oct 18 |
olle |
197 |
} |
5000 |
03 Oct 18 |
olle |
198 |
*/ |
5000 |
03 Oct 18 |
olle |
199 |
} |
5000 |
03 Oct 18 |
olle |
200 |
|
5000 |
03 Oct 18 |
olle |
persinfo.validateStep1 = function(event) |
5000 |
03 Oct 18 |
olle |
202 |
{ |
5000 |
03 Oct 18 |
olle |
// Check that BASE-line CSV file has been selected |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5149 |
28 Nov 18 |
olle |
//var file = frm.baseLineFile.files[0]; |
5149 |
28 Nov 18 |
olle |
var file = frm.baseLineFile.value; |
5000 |
03 Oct 18 |
olle |
if (!file) |
5000 |
03 Oct 18 |
olle |
208 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('baseLineFile', 'invalid', 'Missing'); |
5000 |
03 Oct 18 |
olle |
frm.baseLineFile.focus(); |
5000 |
03 Oct 18 |
olle |
event.preventDefault(); |
5000 |
03 Oct 18 |
olle |
212 |
} |
5000 |
03 Oct 18 |
olle |
213 |
} |
5000 |
03 Oct 18 |
olle |
214 |
|
5000 |
03 Oct 18 |
olle |
persinfo.initializeStep2a = function() |
5000 |
03 Oct 18 |
olle |
216 |
{ |
5000 |
03 Oct 18 |
olle |
// Get referral ID/Case ID mapping |
5000 |
03 Oct 18 |
olle |
218 |
|
5000 |
03 Oct 18 |
olle |
var url = '../BaseLineRegistration.servlet?ID='+App.getSessionId(); |
5000 |
03 Oct 18 |
olle |
url += '&cmd=GetReferralIdCaseIdMap'; |
5000 |
03 Oct 18 |
olle |
Wizard.showLoadingAnimation('Loading information about cases...'); |
5000 |
03 Oct 18 |
olle |
Wizard.asyncJsonRequest(url, persinfo.onCaseInfoLoaded); |
5000 |
03 Oct 18 |
olle |
223 |
} |
5000 |
03 Oct 18 |
olle |
224 |
|
5000 |
03 Oct 18 |
olle |
persinfo.initializeStep2 = function() |
5000 |
03 Oct 18 |
olle |
226 |
{ |
5000 |
03 Oct 18 |
olle |
persinfo.baseLineFileOnChange(); |
5000 |
03 Oct 18 |
olle |
228 |
|
5000 |
03 Oct 18 |
olle |
Doc.show('step-2'); |
5000 |
03 Oct 18 |
olle |
Doc.show('gocancel'); |
5000 |
03 Oct 18 |
olle |
231 |
} |
5000 |
03 Oct 18 |
olle |
232 |
|
5000 |
03 Oct 18 |
olle |
persinfo.baseLineFileOnChange = function() |
5000 |
03 Oct 18 |
olle |
234 |
{ |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5149 |
28 Nov 18 |
olle |
236 |
/* |
5149 |
28 Nov 18 |
olle |
// For outside file, read in Javascript |
5000 |
03 Oct 18 |
olle |
var file = frm.baseLineFile.files[0]; |
5000 |
03 Oct 18 |
olle |
239 |
|
5000 |
03 Oct 18 |
olle |
var reader = new FileReader(); |
5000 |
03 Oct 18 |
olle |
reader.onload = persinfo.baseLineFileLoaded; |
5000 |
03 Oct 18 |
olle |
reader.readAsText(file); |
5149 |
28 Nov 18 |
olle |
243 |
*/ |
5149 |
28 Nov 18 |
olle |
// For file on BASE file system, contact server |
5149 |
28 Nov 18 |
olle |
var file = frm.baseLineFile.value; |
5149 |
28 Nov 18 |
olle |
var url = '../BaseLineRegistration.servlet?ID='+App.getSessionId(); |
5149 |
28 Nov 18 |
olle |
url += '&cmd=ImportBaseLineFile'; |
5149 |
28 Nov 18 |
olle |
url += '&csvPath='+file; |
5149 |
28 Nov 18 |
olle |
Wizard.showLoadingAnimation('Importing BASE-line file...'); |
5149 |
28 Nov 18 |
olle |
Wizard.asyncJsonRequest(url, persinfo.parseBaseLineFile); |
5000 |
03 Oct 18 |
olle |
251 |
} |
5000 |
03 Oct 18 |
olle |
252 |
|
5000 |
03 Oct 18 |
olle |
persinfo.baseLineFileLoaded = function(event) |
5000 |
03 Oct 18 |
olle |
254 |
{ |
5000 |
03 Oct 18 |
olle |
persinfo.parseBaseLineFile(event.target.result); |
5002 |
04 Oct 18 |
olle |
if (problemFound) |
5002 |
04 Oct 18 |
olle |
257 |
{ |
5002 |
04 Oct 18 |
olle |
event.preventDefault(); |
5002 |
04 Oct 18 |
olle |
259 |
} |
5002 |
04 Oct 18 |
olle |
else |
5002 |
04 Oct 18 |
olle |
261 |
{ |
5002 |
04 Oct 18 |
olle |
Doc.show('goregister'); |
5002 |
04 Oct 18 |
olle |
263 |
} |
5000 |
03 Oct 18 |
olle |
264 |
} |
5000 |
03 Oct 18 |
olle |
265 |
|
5000 |
03 Oct 18 |
olle |
persinfo.parseBaseLineFile = function(data) |
5000 |
03 Oct 18 |
olle |
267 |
{ |
5000 |
03 Oct 18 |
olle |
//alert("baseline_from_file_alt_rec.js::parseBaseLineFile(data): Start"); |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
baseLineFileIsValid = false; |
5000 |
03 Oct 18 |
olle |
271 |
|
5326 |
05 Mar 19 |
olle |
272 |
/* |
5027 |
15 Oct 18 |
olle |
var REFERRAL_ID_HEADER = 'Studielöpnummer'; |
5027 |
15 Oct 18 |
olle |
var SAMPLING_DATE_HEADER = 'Provtagningsdatum'; |
5000 |
03 Oct 18 |
olle |
var ARRIVAL_DATE_HEADER = 'Ankomstdatum'; |
5027 |
15 Oct 18 |
olle |
var BLOOD_BOX_HEADER = 'Bankat helblod box'; |
5027 |
15 Oct 18 |
olle |
var BLOOD_TUBE_1_POS_HEADER = 'Bankat helblod position rör b.1'; |
5027 |
15 Oct 18 |
olle |
var BLOOD_TUBE_2_POS_HEADER = 'Bankat helblod position rör b.2'; |
5027 |
15 Oct 18 |
olle |
var BLOOD_TUBE_3_POS_HEADER = 'Bankat helblod position rör b.3'; |
5027 |
15 Oct 18 |
olle |
var COMMENT_HEADER = 'Kommentar'; |
5027 |
15 Oct 18 |
olle |
var OPERATOR_HEADER = 'Namn'; |
5326 |
05 Mar 19 |
olle |
282 |
*/ |
5326 |
05 Mar 19 |
olle |
// Use regular expressions to avoid problems with national characters |
5326 |
05 Mar 19 |
olle |
var REFERRAL_ID_HEADER = /Studiel.pnummer/; |
5326 |
05 Mar 19 |
olle |
var SAMPLING_DATE_HEADER = /Provtagningsdatum/; |
5326 |
05 Mar 19 |
olle |
var ARRIVAL_DATE_HEADER = /Ankomstdatum/; |
5326 |
05 Mar 19 |
olle |
var BLOOD_BOX_HEADER = /Bankat\shelblod\sbox/; |
5326 |
05 Mar 19 |
olle |
var BLOOD_TUBE_1_POS_HEADER = /Bankat\shelblod\sposition\sr.r\sb\.1/; |
5326 |
05 Mar 19 |
olle |
var BLOOD_TUBE_2_POS_HEADER = /Bankat\shelblod\sposition\sr.r\sb\.2/; |
5326 |
05 Mar 19 |
olle |
var BLOOD_TUBE_3_POS_HEADER = /Bankat\shelblod\sposition\sr.r\sb\.3/; |
5326 |
05 Mar 19 |
olle |
var COMMENT_HEADER = /Kommentar/; |
5326 |
05 Mar 19 |
olle |
var OPERATOR_HEADER = /Namn/; |
5326 |
05 Mar 19 |
olle |
293 |
|
5000 |
03 Oct 18 |
olle |
294 |
// |
5027 |
15 Oct 18 |
olle |
var referralIdClmIndex = null; |
5027 |
15 Oct 18 |
olle |
var samplingDateClmIndex = null; |
5027 |
15 Oct 18 |
olle |
var arrivalDateClmIndex = null; |
5027 |
15 Oct 18 |
olle |
var bloodBoxClmIndex = null; |
5027 |
15 Oct 18 |
olle |
var bloodTube1PosClmIndex = null; |
5027 |
15 Oct 18 |
olle |
var bloodTube2PosClmIndex = null; |
5027 |
15 Oct 18 |
olle |
var bloodTube3PosClmIndex = null; |
5027 |
15 Oct 18 |
olle |
var commentClmIndex = null; |
5027 |
15 Oct 18 |
olle |
var operatorClmIndex = null; |
5326 |
05 Mar 19 |
olle |
304 |
|
5326 |
05 Mar 19 |
olle |
305 |
/* |
5027 |
15 Oct 18 |
olle |
306 |
// |
5312 |
20 Feb 19 |
olle |
var referralIdClmIndex = 0; |
5312 |
20 Feb 19 |
olle |
var samplingDateClmIndex = 1; |
5312 |
20 Feb 19 |
olle |
var arrivalDateClmIndex = 2; |
5312 |
20 Feb 19 |
olle |
var bloodBoxClmIndex = 3; |
5312 |
20 Feb 19 |
olle |
var bloodTube1PosClmIndex = 4; |
5312 |
20 Feb 19 |
olle |
var bloodTube2PosClmIndex = 5; |
5312 |
20 Feb 19 |
olle |
var bloodTube3PosClmIndex = 6; |
5312 |
20 Feb 19 |
olle |
var commentClmIndex = 7; |
5312 |
20 Feb 19 |
olle |
var operatorClmIndex = 8; |
5326 |
05 Mar 19 |
olle |
316 |
*/ |
5312 |
20 Feb 19 |
olle |
317 |
// |
5000 |
03 Oct 18 |
olle |
var numReferralItems = 0; |
5000 |
03 Oct 18 |
olle |
var referralIdArr = []; |
5027 |
15 Oct 18 |
olle |
var samplingDateArr = []; |
5000 |
03 Oct 18 |
olle |
var arrivalDateArr = []; |
5000 |
03 Oct 18 |
olle |
var bloodTubeLabelArr = []; |
5000 |
03 Oct 18 |
olle |
var bloodItemIdArr = []; |
5000 |
03 Oct 18 |
olle |
var bloodItemBoxArr = []; |
5000 |
03 Oct 18 |
olle |
var bloodItemBoxPosArr = []; |
5000 |
03 Oct 18 |
olle |
var bloodItemBoxRowArr = []; |
5000 |
03 Oct 18 |
olle |
var bloodItemBoxClmArr = []; |
5027 |
15 Oct 18 |
olle |
var commentArr = []; |
5027 |
15 Oct 18 |
olle |
var operatorArr = []; |
5000 |
03 Oct 18 |
olle |
330 |
|
5313 |
27 Feb 19 |
olle |
// Find column separator as first character of comma, semicolon, or tab |
5313 |
27 Feb 19 |
olle |
var separator = ExtractUtils.findSeparatorFromJSONArray(data, "baseLineData"); |
5313 |
27 Feb 19 |
olle |
//alert("baseline_from_file_alt_rec.js::parseBaseLineFile(): separator = '" + separator + "'."); |
5313 |
27 Feb 19 |
olle |
if (separator == null) |
5313 |
27 Feb 19 |
olle |
335 |
{ |
5313 |
27 Feb 19 |
olle |
// Tab is default separator |
5313 |
27 Feb 19 |
olle |
separator = "\\t" |
5313 |
27 Feb 19 |
olle |
338 |
} |
5149 |
28 Nov 18 |
olle |
339 |
/* |
5000 |
03 Oct 18 |
olle |
// Find column separator as first character after first occurrence of search string |
5027 |
15 Oct 18 |
olle |
var separator = ExtractUtils.findSeparator(data, REFERRAL_ID_HEADER); |
5000 |
03 Oct 18 |
olle |
if (separator == null) |
5000 |
03 Oct 18 |
olle |
343 |
{ |
5000 |
03 Oct 18 |
olle |
// Comma is default separator |
5000 |
03 Oct 18 |
olle |
separator = ','; |
5000 |
03 Oct 18 |
olle |
346 |
} |
5149 |
28 Nov 18 |
olle |
347 |
*/ |
5313 |
27 Feb 19 |
olle |
348 |
/* |
5149 |
28 Nov 18 |
olle |
// Tab is default separator |
5149 |
28 Nov 18 |
olle |
var separator = "\\t" |
5313 |
27 Feb 19 |
olle |
351 |
*/ |
5313 |
27 Feb 19 |
olle |
352 |
|
5000 |
03 Oct 18 |
olle |
var columnSplitRegexp = new RegExp(" *" + separator + " *",''); |
5027 |
15 Oct 18 |
olle |
354 |
|
5027 |
15 Oct 18 |
olle |
// Get array of lines |
5149 |
28 Nov 18 |
olle |
//var lines = data.split(/[\n\r]+/); |
5149 |
28 Nov 18 |
olle |
// When file is on BASE file system, data is response from servlet |
5149 |
28 Nov 18 |
olle |
var lines = data.baseLineData; |
5312 |
20 Feb 19 |
olle |
359 |
|
5312 |
20 Feb 19 |
olle |
360 |
/* |
5027 |
15 Oct 18 |
olle |
// Find column indices for columns of interest from column header names |
5027 |
15 Oct 18 |
olle |
// This allows column values in a line to be read in any order |
5027 |
15 Oct 18 |
olle |
363 |
|
5027 |
15 Oct 18 |
olle |
// Get array of column headers from first line |
5000 |
03 Oct 18 |
olle |
var columns = lines[0].split(columnSplitRegexp); |
5027 |
15 Oct 18 |
olle |
for (var j = 0; j < columns.length; j++) |
5027 |
15 Oct 18 |
olle |
367 |
{ |
5027 |
15 Oct 18 |
olle |
// Referral ID |
5027 |
15 Oct 18 |
olle |
if (columns[j] == REFERRAL_ID_HEADER) |
5027 |
15 Oct 18 |
olle |
370 |
{ |
5027 |
15 Oct 18 |
olle |
referralIdClmIndex = j; |
5027 |
15 Oct 18 |
olle |
372 |
} |
5000 |
03 Oct 18 |
olle |
373 |
|
5027 |
15 Oct 18 |
olle |
// Sampling date |
5027 |
15 Oct 18 |
olle |
if (columns[j] == SAMPLING_DATE_HEADER) |
5027 |
15 Oct 18 |
olle |
376 |
{ |
5027 |
15 Oct 18 |
olle |
samplingDateClmIndex = j; |
5027 |
15 Oct 18 |
olle |
378 |
} |
5027 |
15 Oct 18 |
olle |
379 |
|
5027 |
15 Oct 18 |
olle |
// Arrival date |
5027 |
15 Oct 18 |
olle |
if (columns[j] == ARRIVAL_DATE_HEADER) |
5027 |
15 Oct 18 |
olle |
382 |
{ |
5027 |
15 Oct 18 |
olle |
arrivalDateClmIndex = j; |
5027 |
15 Oct 18 |
olle |
384 |
} |
5027 |
15 Oct 18 |
olle |
385 |
|
5027 |
15 Oct 18 |
olle |
// Box name |
5027 |
15 Oct 18 |
olle |
if (columns[j] == BLOOD_BOX_HEADER) |
5027 |
15 Oct 18 |
olle |
388 |
{ |
5027 |
15 Oct 18 |
olle |
bloodBoxClmIndex = j; |
5027 |
15 Oct 18 |
olle |
390 |
} |
5027 |
15 Oct 18 |
olle |
391 |
|
5027 |
15 Oct 18 |
olle |
// Blood item 1 tube box position |
5027 |
15 Oct 18 |
olle |
if (columns[j] == BLOOD_TUBE_1_POS_HEADER) |
5027 |
15 Oct 18 |
olle |
394 |
{ |
5027 |
15 Oct 18 |
olle |
bloodTube1PosClmIndex = j; |
5027 |
15 Oct 18 |
olle |
396 |
} |
5027 |
15 Oct 18 |
olle |
397 |
|
5027 |
15 Oct 18 |
olle |
// Blood item 2 tube box position |
5027 |
15 Oct 18 |
olle |
if (columns[j] == BLOOD_TUBE_2_POS_HEADER) |
5027 |
15 Oct 18 |
olle |
400 |
{ |
5027 |
15 Oct 18 |
olle |
bloodTube2PosClmIndex = j; |
5027 |
15 Oct 18 |
olle |
402 |
} |
5027 |
15 Oct 18 |
olle |
403 |
|
5027 |
15 Oct 18 |
olle |
// Blood item 3 tube box position |
5027 |
15 Oct 18 |
olle |
if (columns[j] == BLOOD_TUBE_3_POS_HEADER) |
5027 |
15 Oct 18 |
olle |
406 |
{ |
5027 |
15 Oct 18 |
olle |
bloodTube3PosClmIndex = j; |
5027 |
15 Oct 18 |
olle |
408 |
} |
5027 |
15 Oct 18 |
olle |
409 |
|
5027 |
15 Oct 18 |
olle |
// Comment |
5027 |
15 Oct 18 |
olle |
if (columns[j] == COMMENT_HEADER) |
5027 |
15 Oct 18 |
olle |
412 |
{ |
5027 |
15 Oct 18 |
olle |
commentClmIndex = j; |
5027 |
15 Oct 18 |
olle |
414 |
} |
5027 |
15 Oct 18 |
olle |
415 |
|
5027 |
15 Oct 18 |
olle |
// Operator |
5027 |
15 Oct 18 |
olle |
if (columns[j] == OPERATOR_HEADER) |
5027 |
15 Oct 18 |
olle |
418 |
{ |
5027 |
15 Oct 18 |
olle |
operatorClmIndex = j; |
5027 |
15 Oct 18 |
olle |
420 |
} |
5027 |
15 Oct 18 |
olle |
421 |
} |
5312 |
20 Feb 19 |
olle |
422 |
*/ |
5326 |
05 Mar 19 |
olle |
// Find column indices for columns of interest from column header names |
5326 |
05 Mar 19 |
olle |
// This allows column values in a line to be read in any order |
5027 |
15 Oct 18 |
olle |
425 |
|
5326 |
05 Mar 19 |
olle |
// Get array of column headers from first line |
5326 |
05 Mar 19 |
olle |
var columns = lines[0].split(columnSplitRegexp); |
5326 |
05 Mar 19 |
olle |
for (var j = 0; j < columns.length; j++) |
5326 |
05 Mar 19 |
olle |
429 |
{ |
5326 |
05 Mar 19 |
olle |
// Referral ID |
5326 |
05 Mar 19 |
olle |
if (REFERRAL_ID_HEADER.test(columns[j])) |
5326 |
05 Mar 19 |
olle |
432 |
{ |
5326 |
05 Mar 19 |
olle |
referralIdClmIndex = j; |
5326 |
05 Mar 19 |
olle |
434 |
} |
5326 |
05 Mar 19 |
olle |
435 |
|
5326 |
05 Mar 19 |
olle |
// Sampling date |
5326 |
05 Mar 19 |
olle |
if (SAMPLING_DATE_HEADER.test(columns[j])) |
5326 |
05 Mar 19 |
olle |
438 |
{ |
5326 |
05 Mar 19 |
olle |
samplingDateClmIndex = j; |
5326 |
05 Mar 19 |
olle |
440 |
} |
5326 |
05 Mar 19 |
olle |
441 |
|
5326 |
05 Mar 19 |
olle |
// Arrival date |
5326 |
05 Mar 19 |
olle |
if (ARRIVAL_DATE_HEADER.test(columns[j])) |
5326 |
05 Mar 19 |
olle |
444 |
{ |
5326 |
05 Mar 19 |
olle |
arrivalDateClmIndex = j; |
5326 |
05 Mar 19 |
olle |
446 |
} |
5326 |
05 Mar 19 |
olle |
447 |
|
5326 |
05 Mar 19 |
olle |
// Box name |
5326 |
05 Mar 19 |
olle |
if (BLOOD_BOX_HEADER.test(columns[j])) |
5326 |
05 Mar 19 |
olle |
450 |
{ |
5326 |
05 Mar 19 |
olle |
bloodBoxClmIndex = j; |
5326 |
05 Mar 19 |
olle |
452 |
} |
5326 |
05 Mar 19 |
olle |
453 |
|
5326 |
05 Mar 19 |
olle |
// Blood item 1 tube box position |
5326 |
05 Mar 19 |
olle |
if (BLOOD_TUBE_1_POS_HEADER.test(columns[j])) |
5326 |
05 Mar 19 |
olle |
456 |
{ |
5326 |
05 Mar 19 |
olle |
bloodTube1PosClmIndex = j; |
5326 |
05 Mar 19 |
olle |
458 |
} |
5326 |
05 Mar 19 |
olle |
459 |
|
5326 |
05 Mar 19 |
olle |
// Blood item 2 tube box position |
5326 |
05 Mar 19 |
olle |
if (BLOOD_TUBE_2_POS_HEADER.test(columns[j])) |
5326 |
05 Mar 19 |
olle |
462 |
{ |
5326 |
05 Mar 19 |
olle |
bloodTube2PosClmIndex = j; |
5326 |
05 Mar 19 |
olle |
464 |
} |
5326 |
05 Mar 19 |
olle |
465 |
|
5326 |
05 Mar 19 |
olle |
// Blood item 3 tube box position |
5326 |
05 Mar 19 |
olle |
if (BLOOD_TUBE_3_POS_HEADER.test(columns[j])) |
5326 |
05 Mar 19 |
olle |
468 |
{ |
5326 |
05 Mar 19 |
olle |
bloodTube3PosClmIndex = j; |
5326 |
05 Mar 19 |
olle |
470 |
} |
5326 |
05 Mar 19 |
olle |
471 |
|
5326 |
05 Mar 19 |
olle |
// Comment |
5326 |
05 Mar 19 |
olle |
if (COMMENT_HEADER.test(columns[j])) |
5326 |
05 Mar 19 |
olle |
474 |
{ |
5326 |
05 Mar 19 |
olle |
commentClmIndex = j; |
5326 |
05 Mar 19 |
olle |
476 |
} |
5326 |
05 Mar 19 |
olle |
477 |
|
5326 |
05 Mar 19 |
olle |
// Operator |
5326 |
05 Mar 19 |
olle |
if (OPERATOR_HEADER.test(columns[j])) |
5326 |
05 Mar 19 |
olle |
480 |
{ |
5326 |
05 Mar 19 |
olle |
operatorClmIndex = j; |
5326 |
05 Mar 19 |
olle |
482 |
} |
5326 |
05 Mar 19 |
olle |
483 |
} |
5326 |
05 Mar 19 |
olle |
484 |
|
5000 |
03 Oct 18 |
olle |
var numImported = 0; |
5000 |
03 Oct 18 |
olle |
var tubeNo = -1; |
5027 |
15 Oct 18 |
olle |
487 |
|
5027 |
15 Oct 18 |
olle |
// Process lines in file, skipping first header line |
5000 |
03 Oct 18 |
olle |
for (var i = 1; i < lines.length; i++) |
5000 |
03 Oct 18 |
olle |
490 |
{ |
5000 |
03 Oct 18 |
olle |
// Ignore empty lines |
5000 |
03 Oct 18 |
olle |
if (lines[i].match(/^\s*$/)) continue; |
5027 |
15 Oct 18 |
olle |
493 |
|
5027 |
15 Oct 18 |
olle |
// Get array of columns values in line |
5000 |
03 Oct 18 |
olle |
var row = lines[i].split(columnSplitRegexp); |
5000 |
03 Oct 18 |
olle |
496 |
|
5027 |
15 Oct 18 |
olle |
// Get values in selected columns |
5027 |
15 Oct 18 |
olle |
var referralId = row[referralIdClmIndex]; |
5027 |
15 Oct 18 |
olle |
var samplingDate = row[samplingDateClmIndex]; |
5027 |
15 Oct 18 |
olle |
var arrivalDate = row[arrivalDateClmIndex]; |
5027 |
15 Oct 18 |
olle |
var bloodBox = row[bloodBoxClmIndex]; |
5027 |
15 Oct 18 |
olle |
var tube1Pos = row[bloodTube1PosClmIndex]; |
5027 |
15 Oct 18 |
olle |
var tube2Pos = row[bloodTube2PosClmIndex]; |
5027 |
15 Oct 18 |
olle |
var tube3Pos = row[bloodTube3PosClmIndex]; |
5027 |
15 Oct 18 |
olle |
var comment = row[commentClmIndex]; |
5027 |
15 Oct 18 |
olle |
var operator = row[operatorClmIndex]; |
5027 |
15 Oct 18 |
olle |
507 |
|
5027 |
15 Oct 18 |
olle |
// Create a new blood tube item where a blood tube box position is specified |
5027 |
15 Oct 18 |
olle |
if (tube1Pos) |
5000 |
03 Oct 18 |
olle |
510 |
{ |
5027 |
15 Oct 18 |
olle |
var tubeLabel = referralId + ".b1"; |
5027 |
15 Oct 18 |
olle |
var position = tube1Pos; |
5027 |
15 Oct 18 |
olle |
513 |
// |
5027 |
15 Oct 18 |
olle |
tubeNo = tubeNo + 1; |
5027 |
15 Oct 18 |
olle |
bloodTubeLabelArr[tubeNo] = tubeLabel; |
5027 |
15 Oct 18 |
olle |
referralIdArr[tubeNo] = referralId; |
5027 |
15 Oct 18 |
olle |
samplingDateArr[tubeNo] = samplingDate; |
5027 |
15 Oct 18 |
olle |
arrivalDateArr[tubeNo] = arrivalDate; |
5027 |
15 Oct 18 |
olle |
bloodItemBoxArr[tubeNo] = bloodBox; |
5027 |
15 Oct 18 |
olle |
bloodItemBoxPosArr[tubeNo] = position; |
5027 |
15 Oct 18 |
olle |
bloodItemBoxRowArr[tubeNo] = position.substring(0, 1); |
5027 |
15 Oct 18 |
olle |
bloodItemBoxClmArr[tubeNo] = position.substring(1); |
5027 |
15 Oct 18 |
olle |
commentArr[tubeNo] = comment; |
5027 |
15 Oct 18 |
olle |
operatorArr[tubeNo] = operator; |
5027 |
15 Oct 18 |
olle |
525 |
} |
5000 |
03 Oct 18 |
olle |
526 |
|
5027 |
15 Oct 18 |
olle |
if (tube2Pos) |
5027 |
15 Oct 18 |
olle |
528 |
{ |
5027 |
15 Oct 18 |
olle |
var tubeLabel = referralId + ".b2"; |
5027 |
15 Oct 18 |
olle |
var position = tube2Pos; |
5027 |
15 Oct 18 |
olle |
531 |
// |
5027 |
15 Oct 18 |
olle |
tubeNo = tubeNo + 1; |
5027 |
15 Oct 18 |
olle |
bloodTubeLabelArr[tubeNo] = tubeLabel; |
5027 |
15 Oct 18 |
olle |
referralIdArr[tubeNo] = referralId; |
5027 |
15 Oct 18 |
olle |
samplingDateArr[tubeNo] = samplingDate; |
5027 |
15 Oct 18 |
olle |
arrivalDateArr[tubeNo] = arrivalDate; |
5027 |
15 Oct 18 |
olle |
bloodItemBoxArr[tubeNo] = bloodBox; |
5027 |
15 Oct 18 |
olle |
bloodItemBoxPosArr[tubeNo] = position; |
5027 |
15 Oct 18 |
olle |
bloodItemBoxRowArr[tubeNo] = position.substring(0, 1); |
5027 |
15 Oct 18 |
olle |
bloodItemBoxClmArr[tubeNo] = position.substring(1); |
5027 |
15 Oct 18 |
olle |
commentArr[tubeNo] = comment; |
5027 |
15 Oct 18 |
olle |
operatorArr[tubeNo] = operator; |
5027 |
15 Oct 18 |
olle |
543 |
} |
5000 |
03 Oct 18 |
olle |
544 |
|
5027 |
15 Oct 18 |
olle |
if (tube3Pos) |
5027 |
15 Oct 18 |
olle |
546 |
{ |
5027 |
15 Oct 18 |
olle |
var tubeLabel = referralId + ".b3"; |
5027 |
15 Oct 18 |
olle |
var position = tube3Pos; |
5027 |
15 Oct 18 |
olle |
549 |
// |
5027 |
15 Oct 18 |
olle |
tubeNo = tubeNo + 1; |
5027 |
15 Oct 18 |
olle |
bloodTubeLabelArr[tubeNo] = tubeLabel; |
5027 |
15 Oct 18 |
olle |
referralIdArr[tubeNo] = referralId; |
5027 |
15 Oct 18 |
olle |
samplingDateArr[tubeNo] = samplingDate; |
5027 |
15 Oct 18 |
olle |
arrivalDateArr[tubeNo] = arrivalDate; |
5027 |
15 Oct 18 |
olle |
bloodItemBoxArr[tubeNo] = bloodBox; |
5027 |
15 Oct 18 |
olle |
bloodItemBoxPosArr[tubeNo] = position; |
5027 |
15 Oct 18 |
olle |
bloodItemBoxRowArr[tubeNo] = position.substring(0, 1); |
5027 |
15 Oct 18 |
olle |
bloodItemBoxClmArr[tubeNo] = position.substring(1); |
5027 |
15 Oct 18 |
olle |
commentArr[tubeNo] = comment; |
5027 |
15 Oct 18 |
olle |
operatorArr[tubeNo] = operator; |
5000 |
03 Oct 18 |
olle |
561 |
} |
5016 |
09 Oct 18 |
olle |
//alert("baseline_from_file_alt_rec.js::parseBaseLineFile(data): line = " + i + " referralId = " + referralIdArr[i] + " arrival date = " + arrivalDateArr[i] + " box 1 = " + bloodItem1BoxArr[i] + " row 1 = " + bloodItem1BoxRowArr[i] + " clm 1 = " + bloodItem1BoxClmArr[i] + " box 2 = " + bloodItem2BoxArr[i] + " row 2 = " + bloodItem2BoxRowArr[i] + " clm 2 = " + bloodItem2BoxClmArr[i]); |
5000 |
03 Oct 18 |
olle |
563 |
} |
5000 |
03 Oct 18 |
olle |
//alert("baseline_from_file_alt_rec.js::parseBaseLineFile(data): tubeNo = " + tubeNo); |
5000 |
03 Oct 18 |
olle |
565 |
|
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('baseLineFile', 'valid'); |
5000 |
03 Oct 18 |
olle |
baseLineFileIsValid = true; |
5000 |
03 Oct 18 |
olle |
568 |
|
5000 |
03 Oct 18 |
olle |
var html = ''; |
5000 |
03 Oct 18 |
olle |
nofBloodTubes = tubeNo + 1; |
5000 |
03 Oct 18 |
olle |
var tubeContentType = 'Blood'; |
5002 |
04 Oct 18 |
olle |
problemFound = false; |
5000 |
03 Oct 18 |
olle |
573 |
|
5000 |
03 Oct 18 |
olle |
for (var i=0; i <= tubeNo; i++) |
5000 |
03 Oct 18 |
olle |
575 |
{ |
5027 |
15 Oct 18 |
olle |
// Check if necessary blood tube data entered |
5002 |
04 Oct 18 |
olle |
var problemFoundForTube = false; |
5027 |
15 Oct 18 |
olle |
// Check that box name entered |
5027 |
15 Oct 18 |
olle |
if (referralIdArr[i] == "" || bloodItemBoxArr[i] == "") |
5002 |
04 Oct 18 |
olle |
580 |
{ |
5002 |
04 Oct 18 |
olle |
problemFoundForTube = true; |
5002 |
04 Oct 18 |
olle |
problemFound = true; |
5002 |
04 Oct 18 |
olle |
583 |
} |
5000 |
03 Oct 18 |
olle |
var tubeContentTypeName = 'Blood'; |
5000 |
03 Oct 18 |
olle |
var tubeContentTypeNameInternal = persinfo.fetchTubeContentTypeNameInternal(tubeContentType, tubeContentTypeName); |
5000 |
03 Oct 18 |
olle |
var tubeName = bloodTubeLabelArr[i]; |
5000 |
03 Oct 18 |
olle |
//var tubeIdentifier = persinfo.fetchTubeIdentifier(tubeContentType, caseInfo, i); |
5149 |
28 Nov 18 |
olle |
var boxMsg = 'Box-number and position where blood tube #' + (i+1) + ' is placed.'; |
5027 |
15 Oct 18 |
olle |
if (referralIdArr[i] == "") |
5002 |
04 Oct 18 |
olle |
590 |
{ |
5027 |
15 Oct 18 |
olle |
boxMsg = 'Referral ID missing for blood tube #' + (i+1) + '!'; |
5027 |
15 Oct 18 |
olle |
if (bloodItemBoxArr[i] == "") |
5027 |
15 Oct 18 |
olle |
593 |
{ |
5027 |
15 Oct 18 |
olle |
boxMsg = 'Referral ID and box name missing for blood tube #' + (i+1) + '!'; |
5027 |
15 Oct 18 |
olle |
595 |
} |
5002 |
04 Oct 18 |
olle |
596 |
} |
5027 |
15 Oct 18 |
olle |
else if (bloodItemBoxArr[i] == "") |
5027 |
15 Oct 18 |
olle |
598 |
{ |
5027 |
15 Oct 18 |
olle |
boxMsg = 'Box name missing for blood tube #' + (i+1) + '!'; |
5027 |
15 Oct 18 |
olle |
600 |
} |
5159 |
30 Nov 18 |
olle |
var disabledAttribute = 'disabled'; |
5000 |
03 Oct 18 |
olle |
html += '<tr>'; |
5000 |
03 Oct 18 |
olle |
//html += '<td class="subprompt">Blood Tube label '+tubeName+' '+'Box</td>'; |
5000 |
03 Oct 18 |
olle |
//html += '<td class="subprompt">Label '+tubeName+' '+'Box</td>'; |
5000 |
03 Oct 18 |
olle |
html += '<td class="input">'; |
5000 |
03 Oct 18 |
olle |
html += 'Label <input type="text" name="tubeLabel.'+i+'" id="tubeLabel.'+i+'" style="width: 8em;" maxlength="13"'+disabledAttribute+'>'; |
5000 |
03 Oct 18 |
olle |
html += ' '+'Box <input type="text" name="box.'+i+'" id="box.'+i+'" style="width: 6em;" maxlength="10"'+disabledAttribute+'>'; |
5000 |
03 Oct 18 |
olle |
html += ' Row <input type="text" name="row.'+i+'" id="row.'+i+'" style="text-transform:uppercase; width: 1em;" maxlength="1"'+disabledAttribute+'>'; |
5000 |
03 Oct 18 |
olle |
//html += ' Column <input type="text" name="column.'+i+'" id="column.'+i+'" style="width: 1.5em;" maxlength="2"'+disabledAttribute+'>'; |
5000 |
03 Oct 18 |
olle |
html += ' Col <input type="text" name="column.'+i+'" id="column.'+i+'" style="width: 1.5em;" maxlength="2"'+disabledAttribute+'>'; |
5027 |
15 Oct 18 |
olle |
html += ' Sampling date <input type="text" name="samplingDate.'+i+'" id="samplingDate.'+i+'" style="width: 6em;" maxlength="10"'+disabledAttribute+'>'; |
5000 |
03 Oct 18 |
olle |
html += ' Arrival date <input type="text" name="arrivalDate.'+i+'" id="arrivalDate.'+i+'" style="width: 6em;" maxlength="10"'+disabledAttribute+'>'; |
5027 |
15 Oct 18 |
olle |
html += '<input type="hidden" name="comment.'+i+'" id="comment.'+i+'" style="width: 6em;" maxlength="10"'+disabledAttribute+'>'; |
5027 |
15 Oct 18 |
olle |
html += '<input type="hidden" name="operator.'+i+'" id="operator.'+i+'" style="width: 6em;" maxlength="10"'+disabledAttribute+'>'; |
5000 |
03 Oct 18 |
olle |
html += '</td>'; |
5000 |
03 Oct 18 |
olle |
html += '<td class="status" id="box.'+i+'.status"></td>'; |
5002 |
04 Oct 18 |
olle |
if (!problemFoundForTube) |
5002 |
04 Oct 18 |
olle |
618 |
{ |
5002 |
04 Oct 18 |
olle |
html += '<td class="help"><span id="box.'+i+'.message" class="message"></span>'+boxMsg+'<span id="position.'+i+'.message" class="message"></span></td>'; |
5002 |
04 Oct 18 |
olle |
620 |
} |
5002 |
04 Oct 18 |
olle |
else |
5002 |
04 Oct 18 |
olle |
622 |
{ |
5002 |
04 Oct 18 |
olle |
html += '<td class="help"><span id="box.'+i+'.message" class="fail-info"></span>' + boxMsg + ' ' + '<img src="../images/error.png"><span id="position.'+i+'.message" class="message"></span></td>'; |
5002 |
04 Oct 18 |
olle |
624 |
} |
5000 |
03 Oct 18 |
olle |
html += '</tr>'; |
5000 |
03 Oct 18 |
olle |
626 |
} |
5000 |
03 Oct 18 |
olle |
Doc.element('blood-tubes').innerHTML = html; |
5000 |
03 Oct 18 |
olle |
628 |
|
5000 |
03 Oct 18 |
olle |
// Enter read input data |
5000 |
03 Oct 18 |
olle |
for (var i=0; i <= tubeNo; i++) |
5000 |
03 Oct 18 |
olle |
631 |
{ |
5000 |
03 Oct 18 |
olle |
frm['tubeLabel.'+i].value = bloodTubeLabelArr[i]; |
5027 |
15 Oct 18 |
olle |
frm['samplingDate.'+i].value = samplingDateArr[i]; |
5027 |
15 Oct 18 |
olle |
frm['arrivalDate.'+i].value = arrivalDateArr[i]; |
5000 |
03 Oct 18 |
olle |
frm['box.'+i].value = bloodItemBoxArr[i]; |
5000 |
03 Oct 18 |
olle |
frm['row.'+i].value = bloodItemBoxRowArr[i]; |
5000 |
03 Oct 18 |
olle |
frm['column.'+i].value = bloodItemBoxClmArr[i]; |
5027 |
15 Oct 18 |
olle |
frm['comment.'+i].value = commentArr[i]; |
5027 |
15 Oct 18 |
olle |
frm['operator.'+i].value = operatorArr[i]; |
5000 |
03 Oct 18 |
olle |
640 |
} |
5149 |
28 Nov 18 |
olle |
Doc.show('goregister'); |
5000 |
03 Oct 18 |
olle |
642 |
} |
5000 |
03 Oct 18 |
olle |
643 |
|
5000 |
03 Oct 18 |
olle |
persinfo.nofTubesOnChange = function() |
5000 |
03 Oct 18 |
olle |
645 |
{ |
5000 |
03 Oct 18 |
olle |
nofTubesIsValid = false; |
5000 |
03 Oct 18 |
olle |
647 |
|
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
var nofTubes = frm.nofTubes.value; |
5000 |
03 Oct 18 |
olle |
650 |
|
5000 |
03 Oct 18 |
olle |
if (nofTubes == '') |
5000 |
03 Oct 18 |
olle |
652 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('nofTubes', 'invalid', 'Missing'); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
655 |
} |
5000 |
03 Oct 18 |
olle |
if (parseInt(nofTubes) < 1) |
5000 |
03 Oct 18 |
olle |
657 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('nofTubes', 'invalid', 'Must be at least 1'); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
660 |
} |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('nofTubes', 'valid'); |
5000 |
03 Oct 18 |
olle |
nofTubesIsValid = true; |
5000 |
03 Oct 18 |
olle |
663 |
} |
5000 |
03 Oct 18 |
olle |
664 |
|
5000 |
03 Oct 18 |
olle |
persinfo.validateStep2 = function(event) |
5000 |
03 Oct 18 |
olle |
666 |
{ |
5000 |
03 Oct 18 |
olle |
var isValid = bloodSamplingDateIsValid; |
5000 |
03 Oct 18 |
olle |
var hasSpecimen = caseInfo.specimen && caseInfo.specimen.length > 0; |
5000 |
03 Oct 18 |
olle |
if (hasSpecimen) |
5000 |
03 Oct 18 |
olle |
670 |
{ |
5000 |
03 Oct 18 |
olle |
isValid &= viableTumourCellsPercentIsValid; |
5000 |
03 Oct 18 |
olle |
672 |
} |
5000 |
03 Oct 18 |
olle |
if (!isValid) event.preventDefault(); |
5000 |
03 Oct 18 |
olle |
674 |
} |
5000 |
03 Oct 18 |
olle |
675 |
|
5000 |
03 Oct 18 |
olle |
persinfo.fetchTubeContentTypeName = function(tubeContentType, tubeIndex) |
5000 |
03 Oct 18 |
olle |
677 |
{ |
5000 |
03 Oct 18 |
olle |
var tubeContentTypeName = tubeContentType; |
5000 |
03 Oct 18 |
olle |
if (tubeContentType == 'DNA_RNA') |
5000 |
03 Oct 18 |
olle |
680 |
{ |
5000 |
03 Oct 18 |
olle |
if (tubeIndex == 0) |
5000 |
03 Oct 18 |
olle |
682 |
{ |
5000 |
03 Oct 18 |
olle |
tubeContentTypeName = 'DNA'; |
5000 |
03 Oct 18 |
olle |
684 |
} |
5000 |
03 Oct 18 |
olle |
else if (tubeIndex == 1) |
5000 |
03 Oct 18 |
olle |
686 |
{ |
5000 |
03 Oct 18 |
olle |
tubeContentTypeName = 'RNA'; |
5000 |
03 Oct 18 |
olle |
688 |
} |
5000 |
03 Oct 18 |
olle |
689 |
} |
5000 |
03 Oct 18 |
olle |
return tubeContentTypeName; |
5000 |
03 Oct 18 |
olle |
691 |
} |
5000 |
03 Oct 18 |
olle |
692 |
|
5000 |
03 Oct 18 |
olle |
persinfo.fetchTubeContentTypeNameInternal = function(tubeContentType, tubeContentTypeName) |
5000 |
03 Oct 18 |
olle |
694 |
{ |
5000 |
03 Oct 18 |
olle |
var tubeContentTypeNameInternal = tubeContentTypeName; |
5000 |
03 Oct 18 |
olle |
// Convert all names except abbreviations to all lower case |
5000 |
03 Oct 18 |
olle |
if (tubeContentType == 'Specimen') |
5000 |
03 Oct 18 |
olle |
698 |
{ |
5000 |
03 Oct 18 |
olle |
tubeContentTypeNameInternal = tubeContentTypeName.toLowerCase(); |
5000 |
03 Oct 18 |
olle |
700 |
} |
5000 |
03 Oct 18 |
olle |
return tubeContentTypeNameInternal; |
5000 |
03 Oct 18 |
olle |
702 |
} |
5000 |
03 Oct 18 |
olle |
703 |
|
5000 |
03 Oct 18 |
olle |
persinfo.fetchTubeName = function(tubeContentType, caseInfo, tubeIndex) |
5000 |
03 Oct 18 |
olle |
705 |
{ |
5000 |
03 Oct 18 |
olle |
var tubeName = Strings.encodeTags(caseInfo.originalName); |
5000 |
03 Oct 18 |
olle |
if (tubeContentType == 'Blood') |
5000 |
03 Oct 18 |
olle |
708 |
{ |
5000 |
03 Oct 18 |
olle |
// Exchange sample item prefix for blood item prefix |
5000 |
03 Oct 18 |
olle |
if (tubeName.startsWith(sampleItemPrefix)) |
5000 |
03 Oct 18 |
olle |
711 |
{ |
5000 |
03 Oct 18 |
olle |
//var tubeNameDigits = tubeName.substring(sampleItemPrefix.length); |
5000 |
03 Oct 18 |
olle |
tubeNameDigits = caseInfo.highestBloodItemNumber + (tubeIndex + 1); |
5000 |
03 Oct 18 |
olle |
tubeNameDigits = '0000000000000' + tubeNameDigits; |
5000 |
03 Oct 18 |
olle |
tubeNameDigits = tubeNameDigits.substring(tubeNameDigits.length - bloodItemNumDigits); |
5000 |
03 Oct 18 |
olle |
tubeName = bloodItemPrefix + tubeNameDigits; |
5000 |
03 Oct 18 |
olle |
717 |
} |
5000 |
03 Oct 18 |
olle |
718 |
|
5000 |
03 Oct 18 |
olle |
// Add suffix |
5000 |
03 Oct 18 |
olle |
if (bloodItemPrefix == sampleItemPrefix) |
5000 |
03 Oct 18 |
olle |
721 |
{ |
5000 |
03 Oct 18 |
olle |
tubeName = tubeName+'.b'; |
5000 |
03 Oct 18 |
olle |
if (tubeIndex > 0) |
5000 |
03 Oct 18 |
olle |
724 |
{ |
5000 |
03 Oct 18 |
olle |
tubeName = tubeName + (tubeIndex + 1); |
5000 |
03 Oct 18 |
olle |
726 |
} |
5000 |
03 Oct 18 |
olle |
727 |
} |
5000 |
03 Oct 18 |
olle |
728 |
} |
5000 |
03 Oct 18 |
olle |
else if (tubeContentType == 'Specimen') |
5000 |
03 Oct 18 |
olle |
730 |
{ |
5000 |
03 Oct 18 |
olle |
var tubeNo = tubeIndex + caseInfo.specimenFirstIndex; |
5000 |
03 Oct 18 |
olle |
tubeName = tubeName+'.'+tubeNo; |
5000 |
03 Oct 18 |
olle |
733 |
} |
5000 |
03 Oct 18 |
olle |
else if (tubeContentType == 'DNA') |
5000 |
03 Oct 18 |
olle |
735 |
{ |
5000 |
03 Oct 18 |
olle |
tubeName = tubeName+'.d'; |
5000 |
03 Oct 18 |
olle |
737 |
} |
5000 |
03 Oct 18 |
olle |
else if (tubeContentType == 'RNA') |
5000 |
03 Oct 18 |
olle |
739 |
{ |
5000 |
03 Oct 18 |
olle |
tubeName = tubeName+'.r'; |
5000 |
03 Oct 18 |
olle |
741 |
} |
5000 |
03 Oct 18 |
olle |
else if (tubeContentType == 'DNA_RNA') |
5000 |
03 Oct 18 |
olle |
743 |
{ |
5000 |
03 Oct 18 |
olle |
if (tubeIndex == 0) |
5000 |
03 Oct 18 |
olle |
745 |
{ |
5000 |
03 Oct 18 |
olle |
tubeName = tubeName+'.d'; |
5000 |
03 Oct 18 |
olle |
747 |
} |
5000 |
03 Oct 18 |
olle |
else if (tubeIndex == 1) |
5000 |
03 Oct 18 |
olle |
749 |
{ |
5000 |
03 Oct 18 |
olle |
tubeName = tubeName+'.r'; |
5000 |
03 Oct 18 |
olle |
751 |
} |
5000 |
03 Oct 18 |
olle |
752 |
} |
5000 |
03 Oct 18 |
olle |
return tubeName; |
5000 |
03 Oct 18 |
olle |
754 |
} |
5000 |
03 Oct 18 |
olle |
755 |
|
5000 |
03 Oct 18 |
olle |
persinfo.fetchTubeIdentifier = function(tubeContentType, tubeName, tubeNo) |
5000 |
03 Oct 18 |
olle |
757 |
{ |
5000 |
03 Oct 18 |
olle |
var tubeIdentifier = tubeName; |
5000 |
03 Oct 18 |
olle |
if (tubeContentType == 'Specimen') |
5000 |
03 Oct 18 |
olle |
760 |
{ |
5000 |
03 Oct 18 |
olle |
tubeIdentifier = tubeNo; |
5000 |
03 Oct 18 |
olle |
762 |
} |
5000 |
03 Oct 18 |
olle |
return tubeIdentifier; |
5000 |
03 Oct 18 |
olle |
764 |
} |
5000 |
03 Oct 18 |
olle |
765 |
|
5000 |
03 Oct 18 |
olle |
persinfo.boxOnKeyUp = function(event) |
5000 |
03 Oct 18 |
olle |
767 |
{ |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
var tubeContentType = frm.tubeContentType.value; |
5000 |
03 Oct 18 |
olle |
770 |
|
5000 |
03 Oct 18 |
olle |
var boxType = Data.get(event.currentTarget, 'boxtype'); |
5000 |
03 Oct 18 |
olle |
var index = Data.int(event.currentTarget, 'index'); |
5000 |
03 Oct 18 |
olle |
773 |
|
5000 |
03 Oct 18 |
olle |
// Get box prefix, default is for input tubes |
5000 |
03 Oct 18 |
olle |
var boxPrefix = 'box.'; |
5000 |
03 Oct 18 |
olle |
if (boxType && boxType == 'DNA') |
5000 |
03 Oct 18 |
olle |
777 |
{ |
5000 |
03 Oct 18 |
olle |
boxPrefix = 'dnaBox.'; |
5000 |
03 Oct 18 |
olle |
779 |
} |
5000 |
03 Oct 18 |
olle |
if (boxType && boxType == 'RNA') |
5000 |
03 Oct 18 |
olle |
781 |
{ |
5000 |
03 Oct 18 |
olle |
boxPrefix = 'rnaBox.'; |
5000 |
03 Oct 18 |
olle |
783 |
} |
5000 |
03 Oct 18 |
olle |
784 |
|
5000 |
03 Oct 18 |
olle |
// Check box name |
5000 |
03 Oct 18 |
olle |
var boxIsValid = true; |
5000 |
03 Oct 18 |
olle |
var box = frm[boxPrefix+index].value; |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus(boxPrefix+index); |
5000 |
03 Oct 18 |
olle |
// Check for prefix "ML_" |
5000 |
03 Oct 18 |
olle |
if (box.indexOf('ML_') != 0) |
5000 |
03 Oct 18 |
olle |
791 |
{ |
5000 |
03 Oct 18 |
olle |
boxIsValid = false; |
5000 |
03 Oct 18 |
olle |
793 |
} |
5000 |
03 Oct 18 |
olle |
var suffix = '_sp'; |
5000 |
03 Oct 18 |
olle |
if (tubeContentType == 'DNA' || (boxType && boxType == 'DNA')) |
5000 |
03 Oct 18 |
olle |
796 |
{ |
5000 |
03 Oct 18 |
olle |
suffix = '_dna'; |
5000 |
03 Oct 18 |
olle |
798 |
} |
5000 |
03 Oct 18 |
olle |
else if (tubeContentType == 'RNA' || (boxType && boxType == 'RNA')) |
5000 |
03 Oct 18 |
olle |
800 |
{ |
5000 |
03 Oct 18 |
olle |
suffix = '_rna'; |
5000 |
03 Oct 18 |
olle |
802 |
} |
5000 |
03 Oct 18 |
olle |
// Check for suffix |
5000 |
03 Oct 18 |
olle |
if (box.indexOf(suffix) != (box.length - suffix.length)) |
5000 |
03 Oct 18 |
olle |
805 |
{ |
5000 |
03 Oct 18 |
olle |
boxIsValid = false; |
5000 |
03 Oct 18 |
olle |
807 |
} |
5000 |
03 Oct 18 |
olle |
808 |
|
5000 |
03 Oct 18 |
olle |
if (!boxIsValid) |
5000 |
03 Oct 18 |
olle |
810 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Box name must start with "ML_" and end with "'+suffix+'"'); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
813 |
} |
5000 |
03 Oct 18 |
olle |
814 |
} |
5000 |
03 Oct 18 |
olle |
815 |
|
5000 |
03 Oct 18 |
olle |
persinfo.wellOnChange = function(event) |
5000 |
03 Oct 18 |
olle |
817 |
{ |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
var target = event.currentTarget; |
5000 |
03 Oct 18 |
olle |
820 |
|
5000 |
03 Oct 18 |
olle |
var boxType = Data.get(target, 'boxtype'); |
5000 |
03 Oct 18 |
olle |
var index = Data.int(target, 'index'); |
5000 |
03 Oct 18 |
olle |
823 |
|
5000 |
03 Oct 18 |
olle |
// Get well position prefixes, default is for input tubes |
5000 |
03 Oct 18 |
olle |
var boxPrefix = 'box.'; |
5000 |
03 Oct 18 |
olle |
var rowPrefix = 'row.'; |
5000 |
03 Oct 18 |
olle |
var columnPrefix = 'column.'; |
5000 |
03 Oct 18 |
olle |
if (boxType && boxType == 'DNA') |
5000 |
03 Oct 18 |
olle |
829 |
{ |
5000 |
03 Oct 18 |
olle |
boxPrefix = 'dnaBox.'; |
5000 |
03 Oct 18 |
olle |
rowPrefix = 'dnaRow.'; |
5000 |
03 Oct 18 |
olle |
columnPrefix = 'dnaColumn.'; |
5000 |
03 Oct 18 |
olle |
833 |
} |
5000 |
03 Oct 18 |
olle |
if (boxType && boxType == 'RNA') |
5000 |
03 Oct 18 |
olle |
835 |
{ |
5000 |
03 Oct 18 |
olle |
boxPrefix = 'rnaBox.'; |
5000 |
03 Oct 18 |
olle |
rowPrefix = 'rnaRow.'; |
5000 |
03 Oct 18 |
olle |
columnPrefix = 'rnaColumn.'; |
5000 |
03 Oct 18 |
olle |
839 |
} |
5000 |
03 Oct 18 |
olle |
var box = frm[boxPrefix+index].value; |
5000 |
03 Oct 18 |
olle |
var row = frm[rowPrefix+index].value; |
5000 |
03 Oct 18 |
olle |
var column = frm[columnPrefix+index].value; |
5000 |
03 Oct 18 |
olle |
843 |
|
5000 |
03 Oct 18 |
olle |
//wellIsValid[index] = true; |
5000 |
03 Oct 18 |
olle |
if (!boxType || boxType == 'Specimen') |
5000 |
03 Oct 18 |
olle |
846 |
{ |
5000 |
03 Oct 18 |
olle |
wellIsValid[index] = false; |
5000 |
03 Oct 18 |
olle |
848 |
} |
5000 |
03 Oct 18 |
olle |
else if (boxType && boxType == 'DNA') |
5000 |
03 Oct 18 |
olle |
850 |
{ |
5000 |
03 Oct 18 |
olle |
dnaWellIsValid[index] = false; |
5000 |
03 Oct 18 |
olle |
852 |
} |
5000 |
03 Oct 18 |
olle |
else if (boxType && boxType == 'RNA') |
5000 |
03 Oct 18 |
olle |
854 |
{ |
5000 |
03 Oct 18 |
olle |
rnaWellIsValid[index] = false; |
5000 |
03 Oct 18 |
olle |
856 |
} |
5000 |
03 Oct 18 |
olle |
else |
5000 |
03 Oct 18 |
olle |
858 |
{ |
5000 |
03 Oct 18 |
olle |
wellIsValid[index] = false; |
5000 |
03 Oct 18 |
olle |
860 |
} |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus(boxPrefix+index); |
5000 |
03 Oct 18 |
olle |
862 |
/* |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('position.'+index); |
5000 |
03 Oct 18 |
olle |
864 |
*/ |
5000 |
03 Oct 18 |
olle |
865 |
|
5000 |
03 Oct 18 |
olle |
if (box == '') |
5000 |
03 Oct 18 |
olle |
867 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Missing box'); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
870 |
} |
5000 |
03 Oct 18 |
olle |
871 |
|
5000 |
03 Oct 18 |
olle |
// Position errors are reported on box message line |
5000 |
03 Oct 18 |
olle |
if (row == '') |
5000 |
03 Oct 18 |
olle |
874 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Missing row'); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
877 |
} |
5000 |
03 Oct 18 |
olle |
878 |
|
5000 |
03 Oct 18 |
olle |
if (column == '') |
5000 |
03 Oct 18 |
olle |
880 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'Missing column'); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
883 |
} |
5000 |
03 Oct 18 |
olle |
884 |
|
5000 |
03 Oct 18 |
olle |
// Check for duplicates |
5000 |
03 Oct 18 |
olle |
var nofTubes = parseInt(frm.nofTubes.value); |
5000 |
03 Oct 18 |
olle |
for (var i=0; i < nofTubes; i++) |
5000 |
03 Oct 18 |
olle |
888 |
{ |
5000 |
03 Oct 18 |
olle |
if (i != index) |
5000 |
03 Oct 18 |
olle |
890 |
{ |
5000 |
03 Oct 18 |
olle |
if (box == frm.elements[boxPrefix+i].value && row == frm[rowPrefix+i].value && column == frm[columnPrefix+i].value) |
5000 |
03 Oct 18 |
olle |
892 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', 'The position is already used once in this wizard'); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
895 |
} |
5000 |
03 Oct 18 |
olle |
896 |
} |
5000 |
03 Oct 18 |
olle |
897 |
} |
5000 |
03 Oct 18 |
olle |
898 |
|
5000 |
03 Oct 18 |
olle |
//Wizard.setInputStatus('position.'+index, 'checking', 'Checking...'); |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'checking', 'Checking...'); |
5000 |
03 Oct 18 |
olle |
901 |
|
5000 |
03 Oct 18 |
olle |
// Seems to be ok -- check if used by another sample |
5000 |
03 Oct 18 |
olle |
var request = Ajax.getXmlHttpRequest(); |
5000 |
03 Oct 18 |
olle |
var url = '../SpecimenTubeRegistration.servlet?ID='+App.getSessionId(); |
5000 |
03 Oct 18 |
olle |
url += '&cmd=ValidateWell'; |
5000 |
03 Oct 18 |
olle |
url += '&box=' + encodeURIComponent(box); |
5000 |
03 Oct 18 |
olle |
url += '&row=' + encodeURIComponent(row); |
5000 |
03 Oct 18 |
olle |
url += '&column=' + encodeURIComponent(column); |
5000 |
03 Oct 18 |
olle |
909 |
|
5000 |
03 Oct 18 |
olle |
Wizard.asyncJsonRequest(url, function(response) { persinfo.onBoxValidated(response, boxType, index) } ); |
5000 |
03 Oct 18 |
olle |
911 |
} |
5000 |
03 Oct 18 |
olle |
912 |
|
5000 |
03 Oct 18 |
olle |
persinfo.onBoxValidated = function(response, boxType, index) |
5000 |
03 Oct 18 |
olle |
914 |
{ |
5000 |
03 Oct 18 |
olle |
// Get well position prefixes, default is for input tubes |
5000 |
03 Oct 18 |
olle |
var boxPrefix = 'box.'; |
5000 |
03 Oct 18 |
olle |
if (boxType && boxType == 'DNA') |
5000 |
03 Oct 18 |
olle |
918 |
{ |
5000 |
03 Oct 18 |
olle |
boxPrefix = 'dnaBox.'; |
5000 |
03 Oct 18 |
olle |
920 |
} |
5000 |
03 Oct 18 |
olle |
if (boxType && boxType == 'RNA') |
5000 |
03 Oct 18 |
olle |
922 |
{ |
5000 |
03 Oct 18 |
olle |
boxPrefix = 'rnaBox.'; |
5000 |
03 Oct 18 |
olle |
924 |
} |
5000 |
03 Oct 18 |
olle |
925 |
|
5000 |
03 Oct 18 |
olle |
//Wizard.setInputStatus('position.'+index); |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus(boxPrefix+index); |
5000 |
03 Oct 18 |
olle |
if (response.message) |
5000 |
03 Oct 18 |
olle |
929 |
{ |
5000 |
03 Oct 18 |
olle |
//Wizard.setInputStatus(response.box ? 'box.'+index : 'position.'+index, 'invalid', Strings.encodeTags(response.message)); |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'invalid', Strings.encodeTags(response.message)); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
933 |
} |
5000 |
03 Oct 18 |
olle |
934 |
|
5000 |
03 Oct 18 |
olle |
//wellIsValid[index] = true; |
5000 |
03 Oct 18 |
olle |
if (!boxType || boxType == 'Specimen') |
5000 |
03 Oct 18 |
olle |
937 |
{ |
5000 |
03 Oct 18 |
olle |
wellIsValid[index] = true; |
5000 |
03 Oct 18 |
olle |
939 |
} |
5000 |
03 Oct 18 |
olle |
else if (boxType && boxType == 'DNA') |
5000 |
03 Oct 18 |
olle |
941 |
{ |
5000 |
03 Oct 18 |
olle |
dnaWellIsValid[index] = true; |
5000 |
03 Oct 18 |
olle |
943 |
} |
5000 |
03 Oct 18 |
olle |
else if (boxType && boxType == 'RNA') |
5000 |
03 Oct 18 |
olle |
945 |
{ |
5000 |
03 Oct 18 |
olle |
rnaWellIsValid[index] = true; |
5000 |
03 Oct 18 |
olle |
947 |
} |
5000 |
03 Oct 18 |
olle |
else |
5000 |
03 Oct 18 |
olle |
949 |
{ |
5000 |
03 Oct 18 |
olle |
wellIsValid[index] = true; |
5000 |
03 Oct 18 |
olle |
951 |
} |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus(boxPrefix+index, 'valid'); |
5000 |
03 Oct 18 |
olle |
953 |
/* |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('position.'+index, 'valid'); |
5000 |
03 Oct 18 |
olle |
955 |
*/ |
5000 |
03 Oct 18 |
olle |
956 |
} |
5000 |
03 Oct 18 |
olle |
957 |
|
5000 |
03 Oct 18 |
olle |
persinfo.nofSectionsOnChange = function(event) |
5000 |
03 Oct 18 |
olle |
959 |
{ |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
var target = event.currentTarget; |
5000 |
03 Oct 18 |
olle |
962 |
|
5000 |
03 Oct 18 |
olle |
var index = Data.int(target, 'index'); |
5000 |
03 Oct 18 |
olle |
var nofSections = frm['nofSections.'+index].value; |
5000 |
03 Oct 18 |
olle |
965 |
|
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('nofSections.'+index); |
5000 |
03 Oct 18 |
olle |
967 |
|
5000 |
03 Oct 18 |
olle |
if (nofSections == '') |
5000 |
03 Oct 18 |
olle |
969 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('nofSections'+index, 'invalid', 'Missing'); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
972 |
} |
5000 |
03 Oct 18 |
olle |
if (parseInt(nofSections) < 1) |
5000 |
03 Oct 18 |
olle |
974 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('nofSections'+index, 'invalid', 'Must be at least 1'); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
977 |
} |
5000 |
03 Oct 18 |
olle |
Wizard.setInputStatus('nofSections'+index, 'valid'); |
5000 |
03 Oct 18 |
olle |
979 |
} |
5000 |
03 Oct 18 |
olle |
980 |
|
5000 |
03 Oct 18 |
olle |
persinfo.validateStep4 = function(event) |
5000 |
03 Oct 18 |
olle |
982 |
{ |
5000 |
03 Oct 18 |
olle |
var valid = false; |
5000 |
03 Oct 18 |
olle |
984 |
|
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
var tubeContentType = frm.tubeContentType.value; |
5000 |
03 Oct 18 |
olle |
if (tubeContentType == 'Specimen') |
5000 |
03 Oct 18 |
olle |
988 |
{ |
5000 |
03 Oct 18 |
olle |
for (var i = 0; i < wellIsValid.length; i++) |
5000 |
03 Oct 18 |
olle |
990 |
{ |
5000 |
03 Oct 18 |
olle |
// No storage space is allocated for first specimen, |
5000 |
03 Oct 18 |
olle |
// since all amount is expected to be used for analysis. |
5000 |
03 Oct 18 |
olle |
// Specimen tube with i == 0 is therefore skipped. |
5000 |
03 Oct 18 |
olle |
if (i > 0) |
5000 |
03 Oct 18 |
olle |
995 |
{ |
5000 |
03 Oct 18 |
olle |
if (!wellIsValid[i]) |
5000 |
03 Oct 18 |
olle |
997 |
{ |
5000 |
03 Oct 18 |
olle |
event.preventDefault(); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
1000 |
} |
5000 |
03 Oct 18 |
olle |
1001 |
} |
5000 |
03 Oct 18 |
olle |
if (!dnaWellIsValid[i]) |
5000 |
03 Oct 18 |
olle |
1003 |
{ |
5000 |
03 Oct 18 |
olle |
event.preventDefault(); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
1006 |
} |
5000 |
03 Oct 18 |
olle |
if (!rnaWellIsValid[i]) |
5000 |
03 Oct 18 |
olle |
1008 |
{ |
5000 |
03 Oct 18 |
olle |
event.preventDefault(); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
1011 |
} |
5000 |
03 Oct 18 |
olle |
1012 |
} |
5000 |
03 Oct 18 |
olle |
1013 |
} |
5000 |
03 Oct 18 |
olle |
else |
5000 |
03 Oct 18 |
olle |
1015 |
{ |
5000 |
03 Oct 18 |
olle |
// Input DNA, RNA, or DNA + RNA |
5000 |
03 Oct 18 |
olle |
for (var i = 0; i < wellIsValid.length; i++) |
5000 |
03 Oct 18 |
olle |
1018 |
{ |
5000 |
03 Oct 18 |
olle |
if (!wellIsValid[i]) |
5000 |
03 Oct 18 |
olle |
1020 |
{ |
5000 |
03 Oct 18 |
olle |
event.preventDefault(); |
5000 |
03 Oct 18 |
olle |
return; |
5000 |
03 Oct 18 |
olle |
1023 |
} |
5000 |
03 Oct 18 |
olle |
1024 |
} |
5000 |
03 Oct 18 |
olle |
1025 |
} |
5000 |
03 Oct 18 |
olle |
1026 |
} |
5000 |
03 Oct 18 |
olle |
1027 |
|
5000 |
03 Oct 18 |
olle |
persinfo.submit = function() |
5000 |
03 Oct 18 |
olle |
1029 |
{ |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
//var updateMode = caseInfo.id; |
5000 |
03 Oct 18 |
olle |
1032 |
|
5000 |
03 Oct 18 |
olle |
var bloodInfo = {}; |
5000 |
03 Oct 18 |
olle |
//var nofTubes = parseInt(frm.nofTubes.value); |
5000 |
03 Oct 18 |
olle |
bloodInfo.blood = []; |
5000 |
03 Oct 18 |
olle |
for (var i = 0; i < nofBloodTubes; i++) |
5000 |
03 Oct 18 |
olle |
1037 |
{ |
5000 |
03 Oct 18 |
olle |
var bloodTube ={}; |
5000 |
03 Oct 18 |
olle |
bloodTube.tubeLabel = frm['tubeLabel.'+i].value; |
5027 |
15 Oct 18 |
olle |
bloodTube.samplingDate = frm['samplingDate.'+i].value; |
5027 |
15 Oct 18 |
olle |
bloodTube.arrivalDate = frm['arrivalDate.'+i].value; |
5000 |
03 Oct 18 |
olle |
bloodTube.box = frm['box.'+i].value; |
5000 |
03 Oct 18 |
olle |
bloodTube.row = frm['row.'+i].value; |
5000 |
03 Oct 18 |
olle |
bloodTube.column = frm['column.'+i].value; |
5027 |
15 Oct 18 |
olle |
bloodTube.comment = frm['comment.'+i].value; |
5027 |
15 Oct 18 |
olle |
bloodTube.operator = frm['operator.'+i].value; |
5000 |
03 Oct 18 |
olle |
//alert("baseline_alt_rec.js::submit(): i = " + i + " bloodTube = " + JSON.stringify(bloodTube)); |
5000 |
03 Oct 18 |
olle |
bloodInfo.blood[i] = bloodTube; |
5000 |
03 Oct 18 |
olle |
1049 |
} |
5000 |
03 Oct 18 |
olle |
var submitInfo = {}; |
5000 |
03 Oct 18 |
olle |
submitInfo.bloodInfo = bloodInfo; |
5000 |
03 Oct 18 |
olle |
1052 |
|
5000 |
03 Oct 18 |
olle |
var url = '../BaseLineRegistration.servlet?ID='+App.getSessionId(); |
5000 |
03 Oct 18 |
olle |
//url += '&cmd=' + (updateMode ? 'UpdateCase' : 'CreateCase'); |
5000 |
03 Oct 18 |
olle |
//Wizard.showLoadingAnimation('Registering case...'); |
5000 |
03 Oct 18 |
olle |
url += '&cmd=RegisterBloodSamples'; |
5000 |
03 Oct 18 |
olle |
Wizard.showLoadingAnimation('Registering blood samples...'); |
5000 |
03 Oct 18 |
olle |
Wizard.asyncJsonRequest(url, persinfo.submissionResults, 'POST', JSON.stringify(submitInfo)); |
5000 |
03 Oct 18 |
olle |
1059 |
} |
5000 |
03 Oct 18 |
olle |
1060 |
|
5000 |
03 Oct 18 |
olle |
persinfo.submissionResults = function(response) |
5000 |
03 Oct 18 |
olle |
1062 |
{ |
5000 |
03 Oct 18 |
olle |
Wizard.showFinalMessage(response.messages); |
5000 |
03 Oct 18 |
olle |
Doc.show('gorestart'); |
5000 |
03 Oct 18 |
olle |
//Doc.show('downloadformbatch2'); |
5000 |
03 Oct 18 |
olle |
1066 |
} |
5000 |
03 Oct 18 |
olle |
1067 |
|
5000 |
03 Oct 18 |
olle |
persinfo.downloadFormBatch1 = function() |
5000 |
03 Oct 18 |
olle |
1069 |
{ |
5000 |
03 Oct 18 |
olle |
persinfo.downloadFormBatch(1); |
5000 |
03 Oct 18 |
olle |
1071 |
} |
5000 |
03 Oct 18 |
olle |
1072 |
|
5000 |
03 Oct 18 |
olle |
persinfo.downloadFormBatch2 = function() |
5000 |
03 Oct 18 |
olle |
1074 |
{ |
5000 |
03 Oct 18 |
olle |
persinfo.downloadFormBatch(2); |
5000 |
03 Oct 18 |
olle |
1076 |
} |
5000 |
03 Oct 18 |
olle |
1077 |
|
5000 |
03 Oct 18 |
olle |
persinfo.downloadFormBatch = function(batchType) |
5000 |
03 Oct 18 |
olle |
1079 |
{ |
5000 |
03 Oct 18 |
olle |
var frm = document.forms['meludi']; |
5000 |
03 Oct 18 |
olle |
var startItemName = frm.caseName.value; |
5000 |
03 Oct 18 |
olle |
//var nofFormSets = frm.nofFormSets.value; |
5000 |
03 Oct 18 |
olle |
var nofFormSets = 1; |
5000 |
03 Oct 18 |
olle |
1084 |
|
5000 |
03 Oct 18 |
olle |
var url = '../ReferralGenerator.servlet?ID='+App.getSessionId(); |
5000 |
03 Oct 18 |
olle |
url += '&cmd=DownloadFormBatchFile'; |
5000 |
03 Oct 18 |
olle |
url += '&batchType='+batchType; |
5000 |
03 Oct 18 |
olle |
url += '&startitemname='+encodeURIComponent(startItemName); |
5000 |
03 Oct 18 |
olle |
url += '&nofformsets='+encodeURIComponent(nofFormSets); |
5000 |
03 Oct 18 |
olle |
window.open(url); |
5000 |
03 Oct 18 |
olle |
1091 |
} |
5000 |
03 Oct 18 |
olle |
1092 |
|
5000 |
03 Oct 18 |
olle |
return persinfo; |
5000 |
03 Oct 18 |
olle |
1094 |
}(); |
5000 |
03 Oct 18 |
olle |
1095 |
|
5000 |
03 Oct 18 |
olle |
Doc.onLoad(PersInfo.initPage); |
5000 |
03 Oct 18 |
olle |
1097 |
|