2617 |
01 Sep 14 |
nicklas |
var PersInfo = function() |
2617 |
01 Sep 14 |
nicklas |
2 |
{ |
2617 |
01 Sep 14 |
nicklas |
var persinfo = {}; |
2656 |
11 Sep 14 |
nicklas |
var debug = 0; |
2617 |
01 Sep 14 |
nicklas |
5 |
|
2617 |
01 Sep 14 |
nicklas |
var patientInfo = null; |
2617 |
01 Sep 14 |
nicklas |
var caseInfo = null; |
2617 |
01 Sep 14 |
nicklas |
var bloodInfo = null; |
2617 |
01 Sep 14 |
nicklas |
9 |
|
6510 |
03 Dec 21 |
nicklas |
var pnrIsTested = false; |
2617 |
01 Sep 14 |
nicklas |
var pnrIsValid = false; |
2617 |
01 Sep 14 |
nicklas |
var pnrIsAcceptable = false; |
2617 |
01 Sep 14 |
nicklas |
var caseIsValid = false; |
2617 |
01 Sep 14 |
nicklas |
14 |
|
2617 |
01 Sep 14 |
nicklas |
var lateralityIsValid = false; |
2617 |
01 Sep 14 |
nicklas |
var samplingDateIsValid = true; |
2617 |
01 Sep 14 |
nicklas |
var rnaLaterDateIsValid = true; |
2617 |
01 Sep 14 |
nicklas |
var copyConsentEnabled = false; |
2617 |
01 Sep 14 |
nicklas |
19 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.initPage = function() |
2617 |
01 Sep 14 |
nicklas |
21 |
{ |
2617 |
01 Sep 14 |
nicklas |
22 |
|
2617 |
01 Sep 14 |
nicklas |
// Step 1 |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', persinfo.validateStep1); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('caseName', 'keypress', Wizard.focusOnEnter); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('caseName', 'blur', persinfo.caseNameOnChange); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('personalNumber', 'keyup', persinfo.personalNumberOnChange); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('personalNumber', 'keypress', Wizard.goNextOnTabOrEnter); |
6510 |
03 Dec 21 |
nicklas |
Events.addEventHandler('select-waiting-case', 'click', persinfo.showCaseSelection); |
6510 |
03 Dec 21 |
nicklas |
Events.addEventHandler('select-case', 'click', persinfo.caseSelected); |
6510 |
03 Dec 21 |
nicklas |
Events.addEventHandler(document.body, 'click', persinfo.hideCaseSelection); |
2617 |
01 Sep 14 |
nicklas |
32 |
|
2617 |
01 Sep 14 |
nicklas |
// Step 2 |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', persinfo.initializeStep2); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('step-2', 'wizard-validate', persinfo.validateStep2); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('familyName', 'blur', persinfo.nameOnChange); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('allFirstNames', 'blur', persinfo.nameOnChange); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('allFirstNames', 'keypress', Wizard.goNextOnTabOrEnter); |
2617 |
01 Sep 14 |
nicklas |
39 |
|
2617 |
01 Sep 14 |
nicklas |
// Step 3 |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('step-3', 'wizard-initialize', persinfo.initializeStep3); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('step-3', 'wizard-validate', persinfo.validateStep3); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('pad', 'blur', persinfo.padOnChange); |
6574 |
08 Feb 22 |
nicklas |
Events.addEventHandler('externalSpecimenExists', 'change', persinfo.externalSpecimenExistsOnChange); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('samplingDate', 'blur', persinfo.samplingDateTimeOnChange); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('samplingTime', 'blur', persinfo.samplingDateTimeOnChange); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('samplingDate', 'keypress', persinfo.samplingDateTimeFocus); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('samplingTime', 'keypress', persinfo.samplingDateTimeFocus); |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('rnaLaterDate', 'blur', persinfo.rnaLaterDateTimeOnChange); |
2801 |
13 Oct 14 |
nicklas |
Events.addEventHandler('rnaLaterTime', 'blur', persinfo.rnaLaterDateTimeOnChange); |
5318 |
28 Feb 19 |
nicklas |
Events.addEventHandler('noReferralForm', 'change', persinfo.noReferralFormOnChange); |
6991 |
19 Jan 23 |
nicklas |
Buttons.addClickHandler('swapPad', persinfo.swapPad); |
2617 |
01 Sep 14 |
nicklas |
53 |
|
2617 |
01 Sep 14 |
nicklas |
// Navigation |
2617 |
01 Sep 14 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
2617 |
01 Sep 14 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
2617 |
01 Sep 14 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
2617 |
01 Sep 14 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
2617 |
01 Sep 14 |
nicklas |
Buttons.addClickHandler('goupdate', Wizard.goRegister); |
2617 |
01 Sep 14 |
nicklas |
60 |
|
2617 |
01 Sep 14 |
nicklas |
// Final registration |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', persinfo.submit); |
2617 |
01 Sep 14 |
nicklas |
63 |
|
2617 |
01 Sep 14 |
nicklas |
Doc.show('step-1'); |
2617 |
01 Sep 14 |
nicklas |
Doc.show('gonext'); |
6510 |
03 Dec 21 |
nicklas |
66 |
|
6510 |
03 Dec 21 |
nicklas |
var url = '../PersonalRegistration.servlet?ID='+App.getSessionId(); |
6510 |
03 Dec 21 |
nicklas |
url += '&cmd=GetSpecimenWithoutCase'; |
6510 |
03 Dec 21 |
nicklas |
Wizard.showLoadingAnimation('Loading information about specimen tubes...'); |
6510 |
03 Dec 21 |
nicklas |
Wizard.asyncJsonRequest(url, persinfo.onSpecimenTubesLoaded); |
2617 |
01 Sep 14 |
nicklas |
71 |
} |
2617 |
01 Sep 14 |
nicklas |
72 |
|
6510 |
03 Dec 21 |
nicklas |
persinfo.onSpecimenTubesLoaded = function(response) |
6510 |
03 Dec 21 |
nicklas |
74 |
{ |
6510 |
03 Dec 21 |
nicklas |
var specimenTubes = response.specimenTubes; |
6510 |
03 Dec 21 |
nicklas |
if (specimenTubes.length == 0) return; |
6510 |
03 Dec 21 |
nicklas |
77 |
|
6510 |
03 Dec 21 |
nicklas |
var html = ''; |
6510 |
03 Dec 21 |
nicklas |
var lastPrefix = null; |
6510 |
03 Dec 21 |
nicklas |
for (var spNo = 0; spNo < specimenTubes.length; spNo++) |
6510 |
03 Dec 21 |
nicklas |
81 |
{ |
6510 |
03 Dec 21 |
nicklas |
var sp = specimenTubes[spNo]; |
6510 |
03 Dec 21 |
nicklas |
var prefix = sp.name.substr(0, 2); |
6510 |
03 Dec 21 |
nicklas |
if (lastPrefix && prefix != lastPrefix) |
6510 |
03 Dec 21 |
nicklas |
85 |
{ |
6510 |
03 Dec 21 |
nicklas |
html += '<div class="menuseparator"></div>'; |
6510 |
03 Dec 21 |
nicklas |
87 |
} |
6510 |
03 Dec 21 |
nicklas |
lastPrefix = prefix; |
6510 |
03 Dec 21 |
nicklas |
html += '<div class="menuitem interactable enabled" id="sp-'+sp.id+'" data-case-name="'+Strings.encodeTags(sp.name)+'">'; |
6510 |
03 Dec 21 |
nicklas |
html += Strings.encodeTags(sp.name); |
6510 |
03 Dec 21 |
nicklas |
if (sp.numSpecimen > 1) html += ' ('+sp.numSpecimen+')'; |
6510 |
03 Dec 21 |
nicklas |
if (sp.externalRef) html += ' – '+Strings.encodeTags(sp.externalRef); |
6510 |
03 Dec 21 |
nicklas |
html += '</div>'; |
6510 |
03 Dec 21 |
nicklas |
94 |
} |
6510 |
03 Dec 21 |
nicklas |
Doc.element('select-case-all').innerHTML = html; |
6510 |
03 Dec 21 |
nicklas |
Doc.element('num-waiting-cases').innerHTML = specimenTubes.length+(specimenTubes.length == 1 ? ' case':' cases')+' waiting for registration'; |
6510 |
03 Dec 21 |
nicklas |
Doc.show('waitingCasesSection'); |
6510 |
03 Dec 21 |
nicklas |
98 |
} |
6510 |
03 Dec 21 |
nicklas |
99 |
|
6510 |
03 Dec 21 |
nicklas |
persinfo.showCaseSelection = function(event) |
6510 |
03 Dec 21 |
nicklas |
101 |
{ |
6510 |
03 Dec 21 |
nicklas |
var menu = Doc.element('select-case'); |
6510 |
03 Dec 21 |
nicklas |
menu.style.display = 'block'; |
6510 |
03 Dec 21 |
nicklas |
var x = event.clientX+1; |
6510 |
03 Dec 21 |
nicklas |
var y = event.clientY; |
6510 |
03 Dec 21 |
nicklas |
menu.style.left = (x)+'px'; |
6510 |
03 Dec 21 |
nicklas |
menu.style.top = (y)+'px'; |
6510 |
03 Dec 21 |
nicklas |
event.stopPropagation(); |
6510 |
03 Dec 21 |
nicklas |
109 |
} |
6510 |
03 Dec 21 |
nicklas |
110 |
|
6510 |
03 Dec 21 |
nicklas |
persinfo.hideCaseSelection = function() |
6510 |
03 Dec 21 |
nicklas |
112 |
{ |
6510 |
03 Dec 21 |
nicklas |
Doc.hide('select-case'); |
6510 |
03 Dec 21 |
nicklas |
114 |
} |
6510 |
03 Dec 21 |
nicklas |
115 |
|
6510 |
03 Dec 21 |
nicklas |
persinfo.caseSelected = function(event) |
6510 |
03 Dec 21 |
nicklas |
117 |
{ |
6510 |
03 Dec 21 |
nicklas |
var frm = document.forms['reggie']; |
6510 |
03 Dec 21 |
nicklas |
var name = Data.get(event.target, 'case-name'); |
6510 |
03 Dec 21 |
nicklas |
frm.caseName.value = name; |
6510 |
03 Dec 21 |
nicklas |
frm.personalNumber.focus(); |
6510 |
03 Dec 21 |
nicklas |
persinfo.caseNameOnChange(); |
6510 |
03 Dec 21 |
nicklas |
123 |
} |
6510 |
03 Dec 21 |
nicklas |
124 |
|
6510 |
03 Dec 21 |
nicklas |
125 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.caseNameOnChange = function() |
2617 |
01 Sep 14 |
nicklas |
127 |
{ |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
var caseName = frm.caseName.value.toUpperCase(); |
2617 |
01 Sep 14 |
nicklas |
caseIsValid = false; |
6510 |
03 Dec 21 |
nicklas |
Doc.element('numSpecimenTubes').innerHTML = ''; |
2617 |
01 Sep 14 |
nicklas |
if (caseName == '') |
2617 |
01 Sep 14 |
nicklas |
133 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('caseName', 'invalid', 'Missing'); |
2617 |
01 Sep 14 |
nicklas |
frm.caseName.focus(); |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
137 |
} |
2840 |
20 Oct 14 |
nicklas |
if (!Reggie.isValidCaseName(caseName, true)) // Allow C/D suffix to be used |
2617 |
01 Sep 14 |
nicklas |
139 |
{ |
2840 |
20 Oct 14 |
nicklas |
Wizard.setInputStatus('caseName', 'invalid', 'Only 7-digits name + optional \'C\' or \'D\' is allowed.'); |
2617 |
01 Sep 14 |
nicklas |
frm.caseName.focus(); |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
143 |
} |
2617 |
01 Sep 14 |
nicklas |
144 |
|
2617 |
01 Sep 14 |
nicklas |
frm.caseName.value = caseName; |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('caseName', 'valid'); |
2617 |
01 Sep 14 |
nicklas |
caseIsValid = true; |
2617 |
01 Sep 14 |
nicklas |
148 |
|
2617 |
01 Sep 14 |
nicklas |
var url = '../PersonalRegistration.servlet?ID='+App.getSessionId(); |
2617 |
01 Sep 14 |
nicklas |
url += '&cmd=GetCaseInfo&caseName=' + encodeURIComponent(caseName); |
2617 |
01 Sep 14 |
nicklas |
Wizard.showLoadingAnimation('Loading information about case...'); |
2617 |
01 Sep 14 |
nicklas |
Wizard.asyncJsonRequest(url, persinfo.onCaseInfoLoaded); |
2617 |
01 Sep 14 |
nicklas |
153 |
} |
2617 |
01 Sep 14 |
nicklas |
154 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.onCaseInfoLoaded = function(response) |
2617 |
01 Sep 14 |
nicklas |
156 |
{ |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
158 |
|
2617 |
01 Sep 14 |
nicklas |
// Get biosource information from the AJAX response |
2617 |
01 Sep 14 |
nicklas |
caseInfo = response.caseInfo; |
2617 |
01 Sep 14 |
nicklas |
bloodInfo = response.bloodInfo; |
6510 |
03 Dec 21 |
nicklas |
var numSpecimenTubes = caseInfo.specimen ? caseInfo.specimen.length : 0; |
6510 |
03 Dec 21 |
nicklas |
Doc.element('numSpecimenTubes').innerHTML = '<i>('+(numSpecimenTubes || 'no')+' existing specimen '+(numSpecimenTubes==1?'item':'items')+')</i>'; |
2617 |
01 Sep 14 |
nicklas |
164 |
|
2617 |
01 Sep 14 |
nicklas |
if (caseInfo && caseInfo.patient) |
2617 |
01 Sep 14 |
nicklas |
166 |
{ |
6575 |
09 Feb 22 |
nicklas |
patientInfo = caseInfo.patient; |
6575 |
09 Feb 22 |
nicklas |
frm.personalNumber.value = patientInfo.personalNumber; |
2617 |
01 Sep 14 |
nicklas |
persinfo.personalNumberOnChange(); |
6575 |
09 Feb 22 |
nicklas |
pnrIsValid = true; |
6574 |
08 Feb 22 |
nicklas |
Wizard.goNext(true); |
2617 |
01 Sep 14 |
nicklas |
172 |
} |
2617 |
01 Sep 14 |
nicklas |
else if (bloodInfo && bloodInfo.patient) |
2617 |
01 Sep 14 |
nicklas |
174 |
{ |
6575 |
09 Feb 22 |
nicklas |
patientInfo = bloodInfo.patient; |
6575 |
09 Feb 22 |
nicklas |
frm.personalNumber.value = patientInfo.personalNumber; |
2617 |
01 Sep 14 |
nicklas |
persinfo.personalNumberOnChange(); |
6575 |
09 Feb 22 |
nicklas |
pnrIsValid = true; |
6574 |
08 Feb 22 |
nicklas |
Wizard.goNext(true); |
2617 |
01 Sep 14 |
nicklas |
180 |
} |
2617 |
01 Sep 14 |
nicklas |
181 |
} |
2617 |
01 Sep 14 |
nicklas |
182 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.personalNumberOnChange = function() |
2617 |
01 Sep 14 |
nicklas |
184 |
{ |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
var pnr = frm.personalNumber.value; |
2617 |
01 Sep 14 |
nicklas |
pnrIsValid = false; |
6510 |
03 Dec 21 |
nicklas |
pnrIsAcceptable = false; |
6510 |
03 Dec 21 |
nicklas |
pnrIsTested = true; |
2617 |
01 Sep 14 |
nicklas |
190 |
|
2617 |
01 Sep 14 |
nicklas |
var pnrLen = pnr.length; |
6510 |
03 Dec 21 |
nicklas |
if (pnrLen == 0) |
6510 |
03 Dec 21 |
nicklas |
193 |
{ |
6510 |
03 Dec 21 |
nicklas |
Wizard.setInputStatus('personalNumber', 'invalid', 'A personal number is required'); |
6510 |
03 Dec 21 |
nicklas |
return; |
6510 |
03 Dec 21 |
nicklas |
196 |
} |
6510 |
03 Dec 21 |
nicklas |
197 |
|
6510 |
03 Dec 21 |
nicklas |
pnrIsAcceptable = true; |
2617 |
01 Sep 14 |
nicklas |
if (pnrLen != 12 && pnrLen != 10) |
2617 |
01 Sep 14 |
nicklas |
200 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('personalNumber', 'warning', pnrLen < 12 ? 'Too short' : 'Too long'); |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
203 |
} |
2617 |
01 Sep 14 |
nicklas |
204 |
|
2617 |
01 Sep 14 |
nicklas |
if (!pnr.match(/^\d+$/)) |
2617 |
01 Sep 14 |
nicklas |
206 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('personalNumber', 'warning', 'Non-standard personal number'); |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
209 |
} |
2617 |
01 Sep 14 |
nicklas |
210 |
|
2617 |
01 Sep 14 |
nicklas |
var datePart = pnr.substring(0, pnrLen - 4); // Remove last four digits |
2617 |
01 Sep 14 |
nicklas |
var dateFormat = pnrLen == 10 ? 'yyMMdd' : 'yyyyMMdd'; |
2617 |
01 Sep 14 |
nicklas |
var isValidDate = Dates.isDate(datePart, dateFormat); |
2617 |
01 Sep 14 |
nicklas |
if (!isValidDate) |
2617 |
01 Sep 14 |
nicklas |
215 |
{ |
2617 |
01 Sep 14 |
nicklas |
var dayInMonth = parseInt(datePart.substring(-2), 10); // Last two characters |
2617 |
01 Sep 14 |
nicklas |
if (dayInMonth > 60) |
2617 |
01 Sep 14 |
nicklas |
218 |
{ |
2617 |
01 Sep 14 |
nicklas |
// 'Samordningsnummer' has day-in-month + 60; check this |
2617 |
01 Sep 14 |
nicklas |
dayInMonth -= 60; |
2617 |
01 Sep 14 |
nicklas |
var tmpPnr = pnr.substring(0, pnrLen - 6); // First 4 or 6 digits is year+month |
2617 |
01 Sep 14 |
nicklas |
if (dayInMonth < 10) tmpPnr += '0'; |
2617 |
01 Sep 14 |
nicklas |
tmpPnr += dayInMonth; |
2617 |
01 Sep 14 |
nicklas |
isValidDate = Dates.isDate(tmpPnr, dateFormat); |
2617 |
01 Sep 14 |
nicklas |
225 |
} |
2617 |
01 Sep 14 |
nicklas |
226 |
} |
2617 |
01 Sep 14 |
nicklas |
if (!isValidDate) |
2617 |
01 Sep 14 |
nicklas |
228 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('personalNumber', 'warning', 'Not a valid date'); |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
231 |
} |
2617 |
01 Sep 14 |
nicklas |
232 |
|
2617 |
01 Sep 14 |
nicklas |
if (!Reggie.personalNumberControlDigitCheck(pnr.substr(pnrLen == 10 ? 0 : 2))) |
2617 |
01 Sep 14 |
nicklas |
234 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('personalNumber', 'warning', 'Invalid control digit'); |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
237 |
} |
2617 |
01 Sep 14 |
nicklas |
238 |
|
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('personalNumber', 'valid'); |
2617 |
01 Sep 14 |
nicklas |
pnrIsValid = true; |
2617 |
01 Sep 14 |
nicklas |
Wizard.hideGoNextConfirmation(); |
2617 |
01 Sep 14 |
nicklas |
242 |
} |
2617 |
01 Sep 14 |
nicklas |
243 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.validateStep1 = function(event) |
2617 |
01 Sep 14 |
nicklas |
245 |
{ |
6510 |
03 Dec 21 |
nicklas |
if (!pnrIsTested) persinfo.personalNumberOnChange(); |
6510 |
03 Dec 21 |
nicklas |
if (!caseIsValid || !pnrIsValid) |
2617 |
01 Sep 14 |
nicklas |
248 |
{ |
6510 |
03 Dec 21 |
nicklas |
if (!pnrIsAcceptable) |
2617 |
01 Sep 14 |
nicklas |
250 |
{ |
2617 |
01 Sep 14 |
nicklas |
event.preventDefault(); |
6510 |
03 Dec 21 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
253 |
} |
6510 |
03 Dec 21 |
nicklas |
var frm = document.forms['reggie']; |
6575 |
09 Feb 22 |
nicklas |
if (!frm.verifyGoNext) |
6510 |
03 Dec 21 |
nicklas |
256 |
{ |
6510 |
03 Dec 21 |
nicklas |
frm.personalNumber.focus(); |
6510 |
03 Dec 21 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Check to verify registration of non-standard personal number.'); |
6510 |
03 Dec 21 |
nicklas |
event.preventDefault(); |
6510 |
03 Dec 21 |
nicklas |
260 |
} |
2617 |
01 Sep 14 |
nicklas |
261 |
} |
2617 |
01 Sep 14 |
nicklas |
262 |
} |
2617 |
01 Sep 14 |
nicklas |
263 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.initializeStep2 = function(event) |
2617 |
01 Sep 14 |
nicklas |
265 |
{ |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
6575 |
09 Feb 22 |
nicklas |
if (!patientInfo) |
2617 |
01 Sep 14 |
nicklas |
268 |
{ |
6575 |
09 Feb 22 |
nicklas |
var pnr = frm.personalNumber.value; |
6575 |
09 Feb 22 |
nicklas |
if (pnr.length == 10 && pnrIsValid) |
6575 |
09 Feb 22 |
nicklas |
271 |
{ |
6575 |
09 Feb 22 |
nicklas |
var year = Reggie.fullYear(parseInt(pnr.substr(0, 2), 10)); |
6575 |
09 Feb 22 |
nicklas |
pnr = year + pnr.substr(2); |
6575 |
09 Feb 22 |
nicklas |
274 |
} |
6575 |
09 Feb 22 |
nicklas |
275 |
|
6575 |
09 Feb 22 |
nicklas |
var url = '../PersonalRegistration.servlet?ID='+App.getSessionId(); |
6575 |
09 Feb 22 |
nicklas |
url += '&cmd=GetPatientInfo'; |
6575 |
09 Feb 22 |
nicklas |
url += '&personalNumber=' + encodeURIComponent(pnr); |
6575 |
09 Feb 22 |
nicklas |
url += '&pnrIsValid=' + pnrIsValid; |
6575 |
09 Feb 22 |
nicklas |
280 |
|
6575 |
09 Feb 22 |
nicklas |
Wizard.showLoadingAnimation('Loading patient information...'); |
6575 |
09 Feb 22 |
nicklas |
Wizard.asyncJsonRequest(url, persinfo.patientInfoLoaded); |
2617 |
01 Sep 14 |
nicklas |
283 |
} |
6575 |
09 Feb 22 |
nicklas |
else |
6575 |
09 Feb 22 |
nicklas |
285 |
{ |
6575 |
09 Feb 22 |
nicklas |
persinfo.patientInfoLoaded(); |
6575 |
09 Feb 22 |
nicklas |
287 |
} |
2617 |
01 Sep 14 |
nicklas |
288 |
} |
2617 |
01 Sep 14 |
nicklas |
289 |
|
2617 |
01 Sep 14 |
nicklas |
290 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.patientInfoLoaded = function(response) |
2617 |
01 Sep 14 |
nicklas |
292 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setCurrentStep(2); |
2617 |
01 Sep 14 |
nicklas |
// Get patient information from the AJAX response |
6575 |
09 Feb 22 |
nicklas |
if (response) patientInfo = response.patientInfo; |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
297 |
|
2617 |
01 Sep 14 |
nicklas |
frm.patientCode.value=patientInfo.name; |
2617 |
01 Sep 14 |
nicklas |
frm.familyName.value = patientInfo.familyName || ''; |
2617 |
01 Sep 14 |
nicklas |
frm.allFirstNames.value = patientInfo.allFirstNames || ''; |
2617 |
01 Sep 14 |
nicklas |
Doc.element('dateOfBirth').innerHTML = patientInfo.dateOfBirth ? Strings.encodeTags(patientInfo.dateOfBirth) : '---'; |
2617 |
01 Sep 14 |
nicklas |
Doc.element('gender').innerHTML = patientInfo.gender ? Strings.encodeTags(patientInfo.gender) : '---'; |
2617 |
01 Sep 14 |
nicklas |
frm.familyName.focus(); |
2617 |
01 Sep 14 |
nicklas |
304 |
|
2617 |
01 Sep 14 |
nicklas |
if (!patientInfo.id) |
2617 |
01 Sep 14 |
nicklas |
306 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (!pnrIsValid) |
2617 |
01 Sep 14 |
nicklas |
308 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('gender', 'warning', 'Gender and DateOfBirth can\'t be automatically generated for non-standard Personal number'); |
2617 |
01 Sep 14 |
nicklas |
310 |
} |
2617 |
01 Sep 14 |
nicklas |
311 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
313 |
{ |
2617 |
01 Sep 14 |
nicklas |
Doc.element('step-2-title').innerHTML = 'Existing patient: Verify names'; |
2617 |
01 Sep 14 |
nicklas |
frm.patientCode.disabled = true; |
2617 |
01 Sep 14 |
nicklas |
316 |
} |
2617 |
01 Sep 14 |
nicklas |
317 |
|
2617 |
01 Sep 14 |
nicklas |
Doc.show('gonext'); |
2617 |
01 Sep 14 |
nicklas |
Doc.show('gocancel'); |
2617 |
01 Sep 14 |
nicklas |
320 |
|
2617 |
01 Sep 14 |
nicklas |
321 |
} |
2617 |
01 Sep 14 |
nicklas |
322 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.nameOnChange = function(event) |
2617 |
01 Sep 14 |
nicklas |
324 |
{ |
2617 |
01 Sep 14 |
nicklas |
var field = event.target; |
2617 |
01 Sep 14 |
nicklas |
if (field.value == '') |
2617 |
01 Sep 14 |
nicklas |
327 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus(field, 'warning', 'Missing'); |
2617 |
01 Sep 14 |
nicklas |
329 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
331 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus(field, 'valid'); |
2617 |
01 Sep 14 |
nicklas |
Wizard.hideGoNextConfirmation(); |
2617 |
01 Sep 14 |
nicklas |
334 |
} |
2617 |
01 Sep 14 |
nicklas |
335 |
} |
2617 |
01 Sep 14 |
nicklas |
336 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.validateStep2 = function(event) |
2617 |
01 Sep 14 |
nicklas |
338 |
{ |
2617 |
01 Sep 14 |
nicklas |
var valid = true; |
2617 |
01 Sep 14 |
nicklas |
var acceptable = true; |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
342 |
|
2617 |
01 Sep 14 |
nicklas |
if (frm.allFirstNames.value == '') |
2617 |
01 Sep 14 |
nicklas |
344 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('allFirstNames', 'warning', 'Missing'); |
2617 |
01 Sep 14 |
nicklas |
valid = false; |
2617 |
01 Sep 14 |
nicklas |
347 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
349 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('allFirstNames', 'valid'); |
2617 |
01 Sep 14 |
nicklas |
351 |
} |
6997 |
20 Jan 23 |
nicklas |
patientInfo.allFirstNames = frm.allFirstNames.value; |
2617 |
01 Sep 14 |
nicklas |
353 |
|
2617 |
01 Sep 14 |
nicklas |
if (frm.familyName.value == '') |
2617 |
01 Sep 14 |
nicklas |
355 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('familyName', 'warning', 'Missing'); |
2617 |
01 Sep 14 |
nicklas |
valid = false; |
2617 |
01 Sep 14 |
nicklas |
358 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
360 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('familyName', 'valid'); |
2617 |
01 Sep 14 |
nicklas |
362 |
} |
6997 |
20 Jan 23 |
nicklas |
patientInfo.familyName = frm.familyName.value; |
2617 |
01 Sep 14 |
nicklas |
364 |
|
2617 |
01 Sep 14 |
nicklas |
// New patient only |
2617 |
01 Sep 14 |
nicklas |
if (!patientInfo.id) |
2617 |
01 Sep 14 |
nicklas |
367 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (frm.patientCode.value == '') |
2617 |
01 Sep 14 |
nicklas |
369 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('patientCode', 'invalid', 'Missing'); |
2617 |
01 Sep 14 |
nicklas |
frm.patientCode.focus(); |
2617 |
01 Sep 14 |
nicklas |
valid = false; |
2617 |
01 Sep 14 |
nicklas |
acceptable = false; |
2617 |
01 Sep 14 |
nicklas |
374 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
376 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('patientCode', 'valid'); |
2617 |
01 Sep 14 |
nicklas |
patientInfo.name = frm.patientCode.value; |
2617 |
01 Sep 14 |
nicklas |
379 |
} |
2617 |
01 Sep 14 |
nicklas |
380 |
} |
2617 |
01 Sep 14 |
nicklas |
381 |
|
2617 |
01 Sep 14 |
nicklas |
if (event.detail.auto) |
2617 |
01 Sep 14 |
nicklas |
383 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (!valid) |
2617 |
01 Sep 14 |
nicklas |
385 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Check to verify registration with missing name(s).'); |
2617 |
01 Sep 14 |
nicklas |
event.preventDefault(); |
2617 |
01 Sep 14 |
nicklas |
388 |
} |
2617 |
01 Sep 14 |
nicklas |
389 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
391 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (!acceptable) event.preventDefault(); |
2617 |
01 Sep 14 |
nicklas |
393 |
} |
2617 |
01 Sep 14 |
nicklas |
394 |
|
2617 |
01 Sep 14 |
nicklas |
395 |
} |
2617 |
01 Sep 14 |
nicklas |
396 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.initializeStep3 = function() |
2617 |
01 Sep 14 |
nicklas |
398 |
{ |
2617 |
01 Sep 14 |
nicklas |
// Check entered case and pnr with AJAX |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
var updateMode = caseInfo.id && caseInfo.patient; |
5277 |
05 Feb 19 |
nicklas |
var isPreCase = caseInfo.id && !caseInfo.patient && caseInfo.consent; // The case is a pre-registered consent |
2617 |
01 Sep 14 |
nicklas |
403 |
|
2617 |
01 Sep 14 |
nicklas |
// Generate list of specimen tubes |
2617 |
01 Sep 14 |
nicklas |
var hasLeftSpecimen = false; |
2617 |
01 Sep 14 |
nicklas |
var hasRightSpecimen = false; |
2617 |
01 Sep 14 |
nicklas |
var hasUnknownSpecimen = false; |
2617 |
01 Sep 14 |
nicklas |
var thisCaseLaterality = caseInfo.laterality; |
2617 |
01 Sep 14 |
nicklas |
var hasSpecimen = caseInfo.specimen && caseInfo.specimen.length > 0; |
2617 |
01 Sep 14 |
nicklas |
var thisCasePAD = null; |
6991 |
19 Jan 23 |
nicklas |
var thisCaseAlternatePAD = null; |
6996 |
20 Jan 23 |
nicklas |
var thisCaseExternalOperator = null; |
2617 |
01 Sep 14 |
nicklas |
var hasPAD = false; |
2617 |
01 Sep 14 |
nicklas |
var thisCaseSamplingDate = null; |
2617 |
01 Sep 14 |
nicklas |
var thisCaseRNALaterDate = null; |
2617 |
01 Sep 14 |
nicklas |
416 |
|
2617 |
01 Sep 14 |
nicklas |
if (hasSpecimen) |
2617 |
01 Sep 14 |
nicklas |
418 |
{ |
6510 |
03 Dec 21 |
nicklas |
Doc.element('specimenTubes').innerHTML = persinfo.createSpecimenHtml(); |
3726 |
28 Jan 16 |
nicklas |
420 |
|
6998 |
20 Jan 23 |
nicklas |
var downloadable = Doc.element('specimenTubes').getElementsByClassName('download-file'); |
6998 |
20 Jan 23 |
nicklas |
for (var fileNo = 0; fileNo < downloadable.length; fileNo++) |
6998 |
20 Jan 23 |
nicklas |
423 |
{ |
6998 |
20 Jan 23 |
nicklas |
Events.addEventHandler(downloadable[fileNo], 'click', persinfo.downloadJsonFile); |
6998 |
20 Jan 23 |
nicklas |
425 |
} |
6998 |
20 Jan 23 |
nicklas |
426 |
|
2617 |
01 Sep 14 |
nicklas |
for (var i = 0; i < caseInfo.specimen.length; i++) |
2617 |
01 Sep 14 |
nicklas |
428 |
{ |
2617 |
01 Sep 14 |
nicklas |
var specimen = caseInfo.specimen[i]; |
3726 |
28 Jan 16 |
nicklas |
var isYellow = specimen.YellowLabel != null; |
3726 |
28 Jan 16 |
nicklas |
specimen.YellowLabelOriginal = specimen.YellowLabel; |
6510 |
03 Dec 21 |
nicklas |
432 |
|
6510 |
03 Dec 21 |
nicklas |
frm['yellow.'+specimen.id].checked = isYellow; |
6510 |
03 Dec 21 |
nicklas |
Forms.selectListOption(frm['specimenType.'+specimen.id], specimen.specimenType); |
6510 |
03 Dec 21 |
nicklas |
Forms.selectListOption(frm['biopsyType.'+specimen.id], specimen.biopsyType); |
6510 |
03 Dec 21 |
nicklas |
frm['comment.'+specimen.id].value = specimen.operatorDeliveryComment; |
6510 |
03 Dec 21 |
nicklas |
frm['otherPathNote.'+specimen.id].value = specimen.otherPathNote; |
6510 |
03 Dec 21 |
nicklas |
Events.addEventHandler('yellow.'+specimen.id, 'click', persinfo.yellowOnChange); |
6510 |
03 Dec 21 |
nicklas |
439 |
|
2617 |
01 Sep 14 |
nicklas |
if (specimen.pad && !hasPAD) |
2617 |
01 Sep 14 |
nicklas |
441 |
{ |
2617 |
01 Sep 14 |
nicklas |
hasPAD = true; |
2617 |
01 Sep 14 |
nicklas |
thisCasePAD = specimen.pad; |
2617 |
01 Sep 14 |
nicklas |
444 |
} |
6991 |
19 Jan 23 |
nicklas |
if (specimen.alternatePad && thisCaseAlternatePAD == null) |
6991 |
19 Jan 23 |
nicklas |
446 |
{ |
6991 |
19 Jan 23 |
nicklas |
thisCaseAlternatePAD = specimen.alternatePad; |
6991 |
19 Jan 23 |
nicklas |
448 |
} |
6996 |
20 Jan 23 |
nicklas |
if (specimen.externalOperator && thisCaseExternalOperator == null) |
6996 |
20 Jan 23 |
nicklas |
450 |
{ |
6996 |
20 Jan 23 |
nicklas |
thisCaseExternalOperator = specimen.externalOperator; |
6996 |
20 Jan 23 |
nicklas |
452 |
} |
2617 |
01 Sep 14 |
nicklas |
if (specimen.samplingDate && !thisCaseSamplingDate) |
2617 |
01 Sep 14 |
nicklas |
454 |
{ |
2617 |
01 Sep 14 |
nicklas |
thisCaseSamplingDate = specimen.samplingDate; |
2617 |
01 Sep 14 |
nicklas |
456 |
} |
2617 |
01 Sep 14 |
nicklas |
if (specimen.rnaLaterDate && !thisCaseRNALaterDate) |
2617 |
01 Sep 14 |
nicklas |
458 |
{ |
2617 |
01 Sep 14 |
nicklas |
thisCaseRNALaterDate = specimen.rnaLaterDate; |
2617 |
01 Sep 14 |
nicklas |
460 |
} |
2617 |
01 Sep 14 |
nicklas |
if (specimen.laterality) |
2617 |
01 Sep 14 |
nicklas |
462 |
{ |
2617 |
01 Sep 14 |
nicklas |
Forms.checkRadio(frm.laterality, specimen.laterality); |
2617 |
01 Sep 14 |
nicklas |
if (specimen.laterality == 'LEFT') hasLeftSpecimen = true; |
2617 |
01 Sep 14 |
nicklas |
if (specimen.laterality == 'RIGHT') hasRightSpecimen = true; |
2617 |
01 Sep 14 |
nicklas |
if (!thisCaseLaterality) thisCaseLaterality = specimen.laterality; |
2617 |
01 Sep 14 |
nicklas |
467 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
469 |
{ |
2617 |
01 Sep 14 |
nicklas |
hasUnknownSpecimen = true; |
2617 |
01 Sep 14 |
nicklas |
471 |
} |
2617 |
01 Sep 14 |
nicklas |
472 |
} |
2617 |
01 Sep 14 |
nicklas |
473 |
|
2617 |
01 Sep 14 |
nicklas |
// Check that all specimen tubes have the same laterality |
2617 |
01 Sep 14 |
nicklas |
var numLateralities = 0; |
2617 |
01 Sep 14 |
nicklas |
if (hasLeftSpecimen) numLateralities++; |
2617 |
01 Sep 14 |
nicklas |
if (hasRightSpecimen) numLateralities++; |
2617 |
01 Sep 14 |
nicklas |
if (hasUnknownSpecimen) numLateralities++; |
2617 |
01 Sep 14 |
nicklas |
if (numLateralities > 1) |
2617 |
01 Sep 14 |
nicklas |
480 |
{ |
6510 |
03 Dec 21 |
nicklas |
Wizard.setInputStatus('laterality', 'warning', 'Specimen tubes with different laterality'); |
2617 |
01 Sep 14 |
nicklas |
thisCaseLaterality = null; |
2617 |
01 Sep 14 |
nicklas |
483 |
} |
2617 |
01 Sep 14 |
nicklas |
484 |
|
7002 |
23 Jan 23 |
nicklas |
if (thisCaseExternalOperator != null || thisCaseAlternatePAD != null) |
6996 |
20 Jan 23 |
nicklas |
486 |
{ |
6996 |
20 Jan 23 |
nicklas |
Doc.show('externalSpecimenExistsSection'); |
6996 |
20 Jan 23 |
nicklas |
Doc.show('externalOperatorSection'); |
6996 |
20 Jan 23 |
nicklas |
Doc.show('alternatePadSection'); |
6996 |
20 Jan 23 |
nicklas |
490 |
} |
6996 |
20 Jan 23 |
nicklas |
491 |
|
2617 |
01 Sep 14 |
nicklas |
Doc.show('samplingDateSection'); |
2617 |
01 Sep 14 |
nicklas |
Doc.show('rnaLaterDateSection'); |
6510 |
03 Dec 21 |
nicklas |
Doc.show('specimenTubes'); |
2617 |
01 Sep 14 |
nicklas |
495 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
497 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (caseInfo.noSpecimen) |
2617 |
01 Sep 14 |
nicklas |
499 |
{ |
6574 |
08 Feb 22 |
nicklas |
var noSpecimen = caseInfo.noSpecimen; |
2617 |
01 Sep 14 |
nicklas |
// This case is registered with 'NoSpecimen' |
6574 |
08 Feb 22 |
nicklas |
thisCasePAD = noSpecimen.pad; |
6991 |
19 Jan 23 |
nicklas |
thisCaseAlternatePAD = noSpecimen.alternatePad; |
6996 |
20 Jan 23 |
nicklas |
thisCaseExternalOperator = noSpecimen.externalOperator; |
6574 |
08 Feb 22 |
nicklas |
thisCaseSamplingDate = noSpecimen.samplingDate; |
6574 |
08 Feb 22 |
nicklas |
thisCaseRNALaterDate = noSpecimen.rnaLaterDate; |
6574 |
08 Feb 22 |
nicklas |
frm.reasonIfNoSpecimen.value = noSpecimen.reasonIfNoSpecimen; |
6574 |
08 Feb 22 |
nicklas |
Doc.element('noSpecimenTubes').innerHTML = '<i>Not found – NoSpecimen item already exists and can be updated</i>'; |
6574 |
08 Feb 22 |
nicklas |
Doc.element('existingItemName').innerHTML = Strings.encodeTags(noSpecimen.name); |
6151 |
26 Feb 21 |
nicklas |
Doc.show('existingItemNameSection'); |
6574 |
08 Feb 22 |
nicklas |
511 |
|
6574 |
08 Feb 22 |
nicklas |
frm.externalSpecimenExists.checked = noSpecimen.externalSpecimenExists == 'Yes'; |
6574 |
08 Feb 22 |
nicklas |
frm.otherPathNote.value = noSpecimen.otherPathNote; |
6574 |
08 Feb 22 |
nicklas |
frm.liasonComment.value = noSpecimen.liasonComment; |
2617 |
01 Sep 14 |
nicklas |
515 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
517 |
{ |
6574 |
08 Feb 22 |
nicklas |
Doc.element('noSpecimenTubes').innerHTML = '<i>Not found – NoSpecimen item will be created</i>'; |
6574 |
08 Feb 22 |
nicklas |
Forms.selectListOption(frm.externalOperator, 'CMD'); |
2617 |
01 Sep 14 |
nicklas |
520 |
} |
6574 |
08 Feb 22 |
nicklas |
Doc.show('noSpecimenSection'); |
6574 |
08 Feb 22 |
nicklas |
persinfo.externalSpecimenExistsOnChange(); |
2617 |
01 Sep 14 |
nicklas |
523 |
} |
2617 |
01 Sep 14 |
nicklas |
524 |
|
6996 |
20 Jan 23 |
nicklas |
if (thisCaseExternalOperator) |
6996 |
20 Jan 23 |
nicklas |
526 |
{ |
6996 |
20 Jan 23 |
nicklas |
Forms.selectListOption(frm.externalOperator, thisCaseExternalOperator); |
6996 |
20 Jan 23 |
nicklas |
if (frm.externalOperator.selectedIndex == 0) |
6996 |
20 Jan 23 |
nicklas |
529 |
{ |
6996 |
20 Jan 23 |
nicklas |
frm.externalOperator[frm.externalOperator.length] = new Option(thisCaseExternalOperator, thisCaseExternalOperator, true, true); |
6996 |
20 Jan 23 |
nicklas |
531 |
} |
6996 |
20 Jan 23 |
nicklas |
532 |
} |
6996 |
20 Jan 23 |
nicklas |
533 |
|
2617 |
01 Sep 14 |
nicklas |
if (caseInfo.coreBiopsies && caseInfo.coreBiopsies.length) |
2617 |
01 Sep 14 |
nicklas |
535 |
{ |
2617 |
01 Sep 14 |
nicklas |
var html = '<i>'; |
2617 |
01 Sep 14 |
nicklas |
for (var i = 0; i < caseInfo.coreBiopsies.length; i++) |
2617 |
01 Sep 14 |
nicklas |
538 |
{ |
2617 |
01 Sep 14 |
nicklas |
var cb = caseInfo.coreBiopsies[i]; |
2617 |
01 Sep 14 |
nicklas |
html += Strings.encodeTags(cb.name+' ('+cb.laterality) + ')<br>'; |
2617 |
01 Sep 14 |
nicklas |
541 |
} |
2617 |
01 Sep 14 |
nicklas |
html += '</i>'; |
2617 |
01 Sep 14 |
nicklas |
Doc.element('coreBiopsies').innerHTML = html; |
2617 |
01 Sep 14 |
nicklas |
Doc.show('coreBiopsiesSection'); |
2617 |
01 Sep 14 |
nicklas |
545 |
} |
2617 |
01 Sep 14 |
nicklas |
546 |
|
2617 |
01 Sep 14 |
nicklas |
// Populate 'Sampling date' and 'RNA Later date' fields |
2617 |
01 Sep 14 |
nicklas |
if (thisCaseSamplingDate != null) |
2617 |
01 Sep 14 |
nicklas |
549 |
{ |
2617 |
01 Sep 14 |
nicklas |
frm.samplingDate.value = thisCaseSamplingDate.substring(0, 8); |
6574 |
08 Feb 22 |
nicklas |
frm.samplingTime.value = thisCaseSamplingDate.substring(9, 13); |
2617 |
01 Sep 14 |
nicklas |
552 |
} |
6574 |
08 Feb 22 |
nicklas |
persinfo.samplingDateTimeOnChange(); |
2617 |
01 Sep 14 |
nicklas |
if (thisCaseRNALaterDate != null) |
2617 |
01 Sep 14 |
nicklas |
555 |
{ |
2617 |
01 Sep 14 |
nicklas |
frm.rnaLaterDate.value = thisCaseRNALaterDate.substring(0, 8); |
2617 |
01 Sep 14 |
nicklas |
frm.rnaLaterTime.value = thisCaseRNALaterDate.substring(9, 13); |
2617 |
01 Sep 14 |
nicklas |
558 |
} |
6574 |
08 Feb 22 |
nicklas |
persinfo.rnaLaterDateTimeOnChange(); |
2617 |
01 Sep 14 |
nicklas |
560 |
|
2617 |
01 Sep 14 |
nicklas |
frm.pad.value = thisCasePAD; |
6991 |
19 Jan 23 |
nicklas |
frm.alternatePad.value = thisCaseAlternatePAD; |
2617 |
01 Sep 14 |
nicklas |
563 |
|
2617 |
01 Sep 14 |
nicklas |
Doc.show('caseSection'); |
2617 |
01 Sep 14 |
nicklas |
565 |
|
4930 |
22 Aug 18 |
nicklas |
// Check the blood registration for consent information |
5277 |
05 Feb 19 |
nicklas |
if (!isPreCase && !copyConsentEnabled && bloodInfo && bloodInfo.consent) |
4930 |
22 Aug 18 |
nicklas |
568 |
{ |
4930 |
22 Aug 18 |
nicklas |
var html = "From blood '" + Strings.encodeTags(bloodInfo.name); |
4930 |
22 Aug 18 |
nicklas |
html += "' (" + bloodInfo.consent; |
4930 |
22 Aug 18 |
nicklas |
if (bloodInfo.consentDate) html += '; ' + Reggie.reformatDate(bloodInfo.consentDate); |
4930 |
22 Aug 18 |
nicklas |
html += ')'; |
4930 |
22 Aug 18 |
nicklas |
Doc.element('copyConsent.text').innerHTML = html; |
4930 |
22 Aug 18 |
nicklas |
frm.copyConsent.value = bloodInfo.id; |
4930 |
22 Aug 18 |
nicklas |
copyConsentEnabled = true; |
4930 |
22 Aug 18 |
nicklas |
576 |
} |
4930 |
22 Aug 18 |
nicklas |
577 |
|
2617 |
01 Sep 14 |
nicklas |
// Existing cases for this patient |
2617 |
01 Sep 14 |
nicklas |
var hasLeftCase = false; |
2617 |
01 Sep 14 |
nicklas |
var hasRightCase = false; |
2617 |
01 Sep 14 |
nicklas |
var hasUnknownCase = false; |
2617 |
01 Sep 14 |
nicklas |
if (patientInfo.cases && patientInfo.cases.length > 0) |
2617 |
01 Sep 14 |
nicklas |
583 |
{ |
2617 |
01 Sep 14 |
nicklas |
var cases = ''; |
2617 |
01 Sep 14 |
nicklas |
for (var i = 0; i < patientInfo.cases.length; i++) |
2617 |
01 Sep 14 |
nicklas |
586 |
{ |
2617 |
01 Sep 14 |
nicklas |
var cc = patientInfo.cases[i]; |
2617 |
01 Sep 14 |
nicklas |
if (cc.laterality == 'LEFT') |
2617 |
01 Sep 14 |
nicklas |
589 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (hasLeftCase && !updateMode) |
2617 |
01 Sep 14 |
nicklas |
591 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('laterality', 'warning', 'Two cases with laterality=LEFT'); |
2617 |
01 Sep 14 |
nicklas |
593 |
} |
2617 |
01 Sep 14 |
nicklas |
hasLeftCase = true; |
2617 |
01 Sep 14 |
nicklas |
595 |
} |
2617 |
01 Sep 14 |
nicklas |
else if (cc.laterality == 'RIGHT') |
2617 |
01 Sep 14 |
nicklas |
597 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (hasRightCase && !updateMode) |
2617 |
01 Sep 14 |
nicklas |
599 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('laterality', 'warning', 'Two cases with laterality=RIGHT'); |
2617 |
01 Sep 14 |
nicklas |
601 |
} |
2617 |
01 Sep 14 |
nicklas |
hasRightCase = true; |
2617 |
01 Sep 14 |
nicklas |
603 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
605 |
{ |
2617 |
01 Sep 14 |
nicklas |
hasUnknownCase = true; |
2617 |
01 Sep 14 |
nicklas |
607 |
} |
2617 |
01 Sep 14 |
nicklas |
if (!updateMode || cc.id == caseInfo.id) |
2617 |
01 Sep 14 |
nicklas |
609 |
{ |
6646 |
17 Mar 22 |
nicklas |
cases += '<label><input type="radio" name="laterality" value="' + (updateMode ? cc.laterality || cc.id : cc.id) + '" id="laterality'+cc.id+'"'; |
2617 |
01 Sep 14 |
nicklas |
if (cc.laterality == thisCaseLaterality) cases += ' checked'; |
2617 |
01 Sep 14 |
nicklas |
cases += '>'; |
2617 |
01 Sep 14 |
nicklas |
if (cc.laterality) |
2617 |
01 Sep 14 |
nicklas |
614 |
{ |
2617 |
01 Sep 14 |
nicklas |
cases += cc.laterality; |
2617 |
01 Sep 14 |
nicklas |
616 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
618 |
{ |
2617 |
01 Sep 14 |
nicklas |
cases += '<i>unknown laterality</i>'; |
2617 |
01 Sep 14 |
nicklas |
620 |
} |
5277 |
05 Feb 19 |
nicklas |
cases += '</label>'; |
2617 |
01 Sep 14 |
nicklas |
if (!updateMode) |
2617 |
01 Sep 14 |
nicklas |
623 |
{ |
2617 |
01 Sep 14 |
nicklas |
cases += ' [merge with ' + Strings.encodeTags(cc.name) + ']'; |
2617 |
01 Sep 14 |
nicklas |
625 |
} |
5277 |
05 Feb 19 |
nicklas |
cases += '<br>'; |
2617 |
01 Sep 14 |
nicklas |
627 |
} |
2617 |
01 Sep 14 |
nicklas |
628 |
} |
2617 |
01 Sep 14 |
nicklas |
629 |
|
6646 |
17 Mar 22 |
nicklas |
// Create the 'new case' option (which may also be an existing pre-registered consent) |
6646 |
17 Mar 22 |
nicklas |
var newCaseText = isPreCase ? ' [<i>pre-registered consent: ' + persinfo.toConsentString(caseInfo) + '</i>]' : ' [<i>new case</i>]'; |
6646 |
17 Mar 22 |
nicklas |
if (!hasLeftCase) |
2617 |
01 Sep 14 |
nicklas |
633 |
{ |
6646 |
17 Mar 22 |
nicklas |
cases += '<label><input type="radio" name="laterality" value="LEFT" id="lateralityLeft"'; |
6646 |
17 Mar 22 |
nicklas |
if (thisCaseLaterality == 'LEFT') cases += ' checked'; |
6646 |
17 Mar 22 |
nicklas |
cases += '>LEFT</label>'; |
6646 |
17 Mar 22 |
nicklas |
if (!updateMode) cases += newCaseText; |
6646 |
17 Mar 22 |
nicklas |
cases += '<br>'; |
2617 |
01 Sep 14 |
nicklas |
639 |
} |
6646 |
17 Mar 22 |
nicklas |
if (!hasRightCase) |
6646 |
17 Mar 22 |
nicklas |
641 |
{ |
6646 |
17 Mar 22 |
nicklas |
cases += '<label><input type="radio" name="laterality" value="RIGHT" id="lateralityRight"'; |
6646 |
17 Mar 22 |
nicklas |
if (thisCaseLaterality == 'RIGHT') cases += ' checked'; |
6646 |
17 Mar 22 |
nicklas |
cases += '>RIGHT</label>'; |
6646 |
17 Mar 22 |
nicklas |
if (!updateMode) cases += newCaseText; |
6646 |
17 Mar 22 |
nicklas |
cases += '<br>'; |
6646 |
17 Mar 22 |
nicklas |
647 |
} |
6646 |
17 Mar 22 |
nicklas |
if (!updateMode && !hasLeftCase && !hasRightCase) |
6646 |
17 Mar 22 |
nicklas |
649 |
{ |
6646 |
17 Mar 22 |
nicklas |
cases += '<label><input type="radio" name="laterality" value="" id="lateralityUnknown"'; |
6646 |
17 Mar 22 |
nicklas |
if (thisCaseLaterality == null) cases += ' checked'; |
6646 |
17 Mar 22 |
nicklas |
cases += '><i>unknown laterality</i></label>' + newCaseText; |
6646 |
17 Mar 22 |
nicklas |
cases += '<br>' |
6646 |
17 Mar 22 |
nicklas |
654 |
} |
2617 |
01 Sep 14 |
nicklas |
655 |
|
6646 |
17 Mar 22 |
nicklas |
if (!isPreCase && !updateMode && !copyConsentEnabled && patientInfo.cases[0].consent) |
6646 |
17 Mar 22 |
nicklas |
657 |
{ |
6646 |
17 Mar 22 |
nicklas |
var c = patientInfo.cases[0]; |
6646 |
17 Mar 22 |
nicklas |
var html = "From case '" + Strings.encodeTags(c.name); |
6646 |
17 Mar 22 |
nicklas |
html += "' (" + persinfo.toConsentString(c) + ')'; |
6646 |
17 Mar 22 |
nicklas |
Doc.element('copyConsent.text').innerHTML = html; |
6646 |
17 Mar 22 |
nicklas |
frm.copyConsent.value = patientInfo.cases[0].id; |
6646 |
17 Mar 22 |
nicklas |
copyConsentEnabled = true; |
6646 |
17 Mar 22 |
nicklas |
664 |
} |
6646 |
17 Mar 22 |
nicklas |
665 |
|
2617 |
01 Sep 14 |
nicklas |
if (updateMode) |
2617 |
01 Sep 14 |
nicklas |
667 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (caseInfo.merged) |
2617 |
01 Sep 14 |
nicklas |
669 |
{ |
2617 |
01 Sep 14 |
nicklas |
Doc.element('step-3-title').innerHTML = 'Update case \''+Strings.encodeTags(caseInfo.originalName)+'\' (which is merged with case \'' + Strings.encodeTags(caseInfo.name) + '\')'; |
2617 |
01 Sep 14 |
nicklas |
671 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
673 |
{ |
2617 |
01 Sep 14 |
nicklas |
Doc.element('step-3-title').innerHTML = 'Update case \''+Strings.encodeTags(caseInfo.name)+'\''; |
2617 |
01 Sep 14 |
nicklas |
675 |
} |
2617 |
01 Sep 14 |
nicklas |
676 |
|
2617 |
01 Sep 14 |
nicklas |
677 |
} |
2617 |
01 Sep 14 |
nicklas |
else if (patientInfo.cases.length == 2) |
2617 |
01 Sep 14 |
nicklas |
679 |
{ |
2617 |
01 Sep 14 |
nicklas |
Doc.element('step-3-title').innerHTML = 'Merge with existing case'; |
2617 |
01 Sep 14 |
nicklas |
681 |
} |
2617 |
01 Sep 14 |
nicklas |
else if (patientInfo.cases.length > 0) |
2617 |
01 Sep 14 |
nicklas |
683 |
{ |
2617 |
01 Sep 14 |
nicklas |
Doc.element('step-3-title').innerHTML = 'Create new case or merge with existing case'; |
2617 |
01 Sep 14 |
nicklas |
685 |
} |
2617 |
01 Sep 14 |
nicklas |
686 |
|
2617 |
01 Sep 14 |
nicklas |
Doc.element('laterality.input').innerHTML = cases; |
2617 |
01 Sep 14 |
nicklas |
688 |
} |
2617 |
01 Sep 14 |
nicklas |
689 |
|
2617 |
01 Sep 14 |
nicklas |
for (var i = 0; i < frm.laterality.length; i++) |
2617 |
01 Sep 14 |
nicklas |
691 |
{ |
2617 |
01 Sep 14 |
nicklas |
Events.addEventHandler(frm.laterality[i], 'click', persinfo.lateralityOnChange); |
2617 |
01 Sep 14 |
nicklas |
693 |
} |
2617 |
01 Sep 14 |
nicklas |
persinfo.lateralityOnChange(); |
2617 |
01 Sep 14 |
nicklas |
695 |
|
2617 |
01 Sep 14 |
nicklas |
Wizard.setCurrentStep(3); |
2617 |
01 Sep 14 |
nicklas |
if (updateMode) |
2617 |
01 Sep 14 |
nicklas |
698 |
{ |
2617 |
01 Sep 14 |
nicklas |
Doc.show('goupdate'); |
2617 |
01 Sep 14 |
nicklas |
700 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
702 |
{ |
2617 |
01 Sep 14 |
nicklas |
Doc.show('goregister'); |
2617 |
01 Sep 14 |
nicklas |
704 |
} |
2617 |
01 Sep 14 |
nicklas |
Doc.show('gocancel'); |
2617 |
01 Sep 14 |
nicklas |
if (lateralityIsValid) frm.pad.focus(); |
2617 |
01 Sep 14 |
nicklas |
707 |
} |
2617 |
01 Sep 14 |
nicklas |
708 |
|
6824 |
30 Aug 22 |
nicklas |
persinfo.externalSpecimenExistsOnChange = function() |
6574 |
08 Feb 22 |
nicklas |
710 |
{ |
6574 |
08 Feb 22 |
nicklas |
var frm = document.forms['reggie']; |
6574 |
08 Feb 22 |
nicklas |
persinfo.externalSpecimenExists(frm.externalSpecimenExists.checked); |
6574 |
08 Feb 22 |
nicklas |
frm.samplingDate.focus(); |
6574 |
08 Feb 22 |
nicklas |
714 |
} |
6574 |
08 Feb 22 |
nicklas |
715 |
|
6574 |
08 Feb 22 |
nicklas |
persinfo.externalSpecimenExists = function(enabled) |
6574 |
08 Feb 22 |
nicklas |
717 |
{ |
6574 |
08 Feb 22 |
nicklas |
var frm = document.forms['reggie']; |
6574 |
08 Feb 22 |
nicklas |
if (enabled) |
6574 |
08 Feb 22 |
nicklas |
720 |
{ |
6574 |
08 Feb 22 |
nicklas |
Doc.show('samplingTimeField', 'inline'); |
6574 |
08 Feb 22 |
nicklas |
frm.samplingTime.disabled = false; |
6574 |
08 Feb 22 |
nicklas |
Doc.show('rnaLaterDateSection'); |
6574 |
08 Feb 22 |
nicklas |
Doc.hide('reasonIfNoSpecimenSection'); |
6574 |
08 Feb 22 |
nicklas |
Doc.show('otherPathNoteSection'); |
6574 |
08 Feb 22 |
nicklas |
Doc.show('externalOperatorSection'); |
6991 |
19 Jan 23 |
nicklas |
Doc.show('alternatePadSection'); |
6574 |
08 Feb 22 |
nicklas |
Doc.show('liasonCommentSection'); |
6574 |
08 Feb 22 |
nicklas |
729 |
} |
6574 |
08 Feb 22 |
nicklas |
else |
6574 |
08 Feb 22 |
nicklas |
731 |
{ |
6574 |
08 Feb 22 |
nicklas |
Doc.hide('samplingTimeField'); |
6574 |
08 Feb 22 |
nicklas |
frm.samplingTime.disabled = true; |
6574 |
08 Feb 22 |
nicklas |
Doc.hide('rnaLaterDateSection'); |
6574 |
08 Feb 22 |
nicklas |
Doc.show('reasonIfNoSpecimenSection'); |
6574 |
08 Feb 22 |
nicklas |
Doc.hide('otherPathNoteSection'); |
6574 |
08 Feb 22 |
nicklas |
Doc.hide('externalOperatorSection'); |
6991 |
19 Jan 23 |
nicklas |
Doc.hide('alternatePadSection'); |
6574 |
08 Feb 22 |
nicklas |
Doc.hide('liasonCommentSection'); |
6574 |
08 Feb 22 |
nicklas |
740 |
} |
6574 |
08 Feb 22 |
nicklas |
741 |
} |
6574 |
08 Feb 22 |
nicklas |
742 |
|
6998 |
20 Jan 23 |
nicklas |
persinfo.downloadJsonFile = function(event) |
6998 |
20 Jan 23 |
nicklas |
744 |
{ |
6998 |
20 Jan 23 |
nicklas |
var fileId = Data.get(event.currentTarget, 'file-id'); |
6998 |
20 Jan 23 |
nicklas |
var fileName = Data.get(event.currentTarget, 'file-name'); |
6998 |
20 Jan 23 |
nicklas |
747 |
|
6998 |
20 Jan 23 |
nicklas |
var url = '../ExternalSpecimen.servlet?ID='+App.getSessionId(); |
6998 |
20 Jan 23 |
nicklas |
url += '&cmd=DownloadJsonFile'; |
6998 |
20 Jan 23 |
nicklas |
url += '&fileId='+fileId; |
6998 |
20 Jan 23 |
nicklas |
751 |
|
6998 |
20 Jan 23 |
nicklas |
Dialogs.openPopup(url, fileName, 800, 800); |
6998 |
20 Jan 23 |
nicklas |
753 |
} |
6998 |
20 Jan 23 |
nicklas |
754 |
|
6998 |
20 Jan 23 |
nicklas |
755 |
|
6510 |
03 Dec 21 |
nicklas |
persinfo.createSpecimenHtml = function() |
6151 |
26 Feb 21 |
nicklas |
757 |
{ |
6510 |
03 Dec 21 |
nicklas |
var html = ''; |
6510 |
03 Dec 21 |
nicklas |
for (var i = 0; i < caseInfo.specimen.length; i++) |
6151 |
26 Feb 21 |
nicklas |
760 |
{ |
6510 |
03 Dec 21 |
nicklas |
var specimen = caseInfo.specimen[i]; |
6510 |
03 Dec 21 |
nicklas |
var isYellow = specimen.YellowLabel != null; |
6510 |
03 Dec 21 |
nicklas |
var isPaused = specimen.bioWell && specimen.bioWell.bioPlate.name.indexOf('PSp') == 0; |
6510 |
03 Dec 21 |
nicklas |
specimen.YellowLabelOriginal = specimen.YellowLabel; |
6510 |
03 Dec 21 |
nicklas |
765 |
|
6510 |
03 Dec 21 |
nicklas |
html += '<tr class="section-header">'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td colspan="4">Specimen Tube '+Strings.encodeTags(specimen.name)+'</td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '</tr>'; |
6510 |
03 Dec 21 |
nicklas |
769 |
|
6510 |
03 Dec 21 |
nicklas |
html += '<tr>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="subprompt">Laterality</td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="input">'+Strings.encodeTags(specimen.laterality || 'unknown')+'</td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="status" id="laterality.'+specimen.id+'.status"></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="help"><span id="laterality.'+specimen.id+'.message" class="message"></span></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '</tr>'; |
6998 |
20 Jan 23 |
nicklas |
776 |
|
6998 |
20 Jan 23 |
nicklas |
if (specimen.externalRef) |
6998 |
20 Jan 23 |
nicklas |
778 |
{ |
6998 |
20 Jan 23 |
nicklas |
html += '<tr>'; |
6998 |
20 Jan 23 |
nicklas |
html += '<td class="subprompt">External reference</td>'; |
6998 |
20 Jan 23 |
nicklas |
html += '<td class="input" colspan="2" style="background-color: #f0f080; padding: 4px;">'; |
6998 |
20 Jan 23 |
nicklas |
html += Strings.encodeTags(specimen.externalRef); |
6998 |
20 Jan 23 |
nicklas |
if (specimen.importedFrom) |
6998 |
20 Jan 23 |
nicklas |
784 |
{ |
6998 |
20 Jan 23 |
nicklas |
var file = specimen.importedFrom; |
6998 |
20 Jan 23 |
nicklas |
html += ' <span class="link download-file" data-file-id="'+file.id+'" data-file-name="'+file.name+'"' + |
6998 |
20 Jan 23 |
nicklas |
' title="View the raw data from the JSON file that was imported"><img src="../images/download.png"></span>'; |
6998 |
20 Jan 23 |
nicklas |
788 |
} |
6998 |
20 Jan 23 |
nicklas |
html += '</td>'; |
6998 |
20 Jan 23 |
nicklas |
html += '<td class="help">The JSON file that was imported to this specimen.</td>'; |
6998 |
20 Jan 23 |
nicklas |
html += '</tr>'; |
6998 |
20 Jan 23 |
nicklas |
792 |
} |
6510 |
03 Dec 21 |
nicklas |
793 |
|
6510 |
03 Dec 21 |
nicklas |
html += '<tr id="specimen-row.'+specimen.id+'" class="specimen-tube'+(isYellow?' yellow':'')+(isPaused?' paused':'')+'">'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="subprompt yellow-tag"><label for="yellow.'+specimen.id+'">Yellow label</label></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="input">'; |
6510 |
03 Dec 21 |
nicklas |
html += '<input type="checkbox" name="yellow.'+specimen.id+'" id="yellow.'+specimen.id+'"'; |
6510 |
03 Dec 21 |
nicklas |
html += ' data-specimen-id="'+specimen.id+'"'; |
6510 |
03 Dec 21 |
nicklas |
html += '></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="status"></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="help"></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '</tr>'; |
6510 |
03 Dec 21 |
nicklas |
803 |
|
6510 |
03 Dec 21 |
nicklas |
html += '<tr>' |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="subprompt">Biopsy type</td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="input">'; |
6510 |
03 Dec 21 |
nicklas |
html += '<select name="biopsyType.'+specimen.id+'" id="biopsyType.'+specimen.id+'">'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option selected value="">unknown'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option value="SpecimenSurgery">SpecimenSurgery'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option value="SpecimenCoreBiopsy">SpecimenCoreBiopsy'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option value="SpecimenCoreBiopsy2nd">SpecimenCoreBiopsy2nd'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option value="SpecimenFineNeedleAspiration">SpecimenFineNeedleAspiration'; |
6510 |
03 Dec 21 |
nicklas |
html += '</select>'; |
6510 |
03 Dec 21 |
nicklas |
html += '</td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="status" id="biopsyType.'+specimen.id+'.status"></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="help"><span id="biopsyType.'+specimen.id+'.message" class="message"></span></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '</tr>'; |
6510 |
03 Dec 21 |
nicklas |
818 |
|
6510 |
03 Dec 21 |
nicklas |
819 |
|
6510 |
03 Dec 21 |
nicklas |
html += '<tr>' |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="subprompt">Specimen type</td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="input">'; |
6510 |
03 Dec 21 |
nicklas |
html += '<select name="specimenType.'+specimen.id+'" id="specimenType.'+specimen.id+'">'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option selected value="">unknown'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option value="Primary">Primary'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option value="LymphnodeRegional">LymphnodeRegional'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option value="MetastasisDistant">MetastasisDistant'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option value="RecurrenceLocal">RecurrenceLocal'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option value="RecurrenceRegional">RecurrenceRegional'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option value="Normal">Normal'; |
6510 |
03 Dec 21 |
nicklas |
html += '<option value="Uncertain">Uncertain'; |
6510 |
03 Dec 21 |
nicklas |
html += '</select>'; |
6510 |
03 Dec 21 |
nicklas |
html += '</td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="status" id="specimenType.'+specimen.id+'.status"></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="help"><span id="specimenType.'+specimen.id+'.message" class="message"></span></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '</tr>'; |
6510 |
03 Dec 21 |
nicklas |
837 |
|
6510 |
03 Dec 21 |
nicklas |
html += '<tr class="align-top">'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="subprompt">Other path note</td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="input"><textarea rows="3" name="otherPathNote.'+specimen.id+'" id="otherPathNote.'+specimen.id+'"></textarea></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="status" id="otherPathNote.'+specimen.id+'.status"></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="help"><span id="otherPathNote.'+specimen.id+'.message" class="message"></span>In this field, enter ALL text noted on the referral form by the pathologist.</td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '</tr>'; |
6510 |
03 Dec 21 |
nicklas |
844 |
|
6510 |
03 Dec 21 |
nicklas |
html += '<tr class="align-top">'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="subprompt">Operator delivery comment</td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="input"><textarea rows="3" name="comment.'+specimen.id+'" id="comment.'+specimen.id+'"></textarea></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="status" id="comment.'+specimen.id+'.status"></td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '<td class="help"><span id="comment.'+specimen.id+'.message" class="message"></span>In this field, enter information specific for the specimen tube.</td>'; |
6510 |
03 Dec 21 |
nicklas |
html += '</tr>'; |
6151 |
26 Feb 21 |
nicklas |
851 |
} |
6510 |
03 Dec 21 |
nicklas |
return html; |
6151 |
26 Feb 21 |
nicklas |
853 |
} |
6151 |
26 Feb 21 |
nicklas |
854 |
|
5277 |
05 Feb 19 |
nicklas |
persinfo.toConsentString = function(item) |
5277 |
05 Feb 19 |
nicklas |
856 |
{ |
5277 |
05 Feb 19 |
nicklas |
var s = item.consent; |
5277 |
05 Feb 19 |
nicklas |
if (item.consentDate) |
5277 |
05 Feb 19 |
nicklas |
859 |
{ |
5277 |
05 Feb 19 |
nicklas |
s += '; ' + Reggie.reformatDate(item.consentDate); |
5277 |
05 Feb 19 |
nicklas |
861 |
} |
5277 |
05 Feb 19 |
nicklas |
return s; |
5277 |
05 Feb 19 |
nicklas |
863 |
} |
2617 |
01 Sep 14 |
nicklas |
864 |
|
3726 |
28 Jan 16 |
nicklas |
persinfo.yellowOnChange = function(event) |
3726 |
28 Jan 16 |
nicklas |
866 |
{ |
3726 |
28 Jan 16 |
nicklas |
var spId = Data.get(event.currentTarget, 'specimen-id'); |
3726 |
28 Jan 16 |
nicklas |
Doc.addOrRemoveClass('specimen-row.'+spId, 'yellow', event.currentTarget.checked); |
3726 |
28 Jan 16 |
nicklas |
869 |
} |
3726 |
28 Jan 16 |
nicklas |
870 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.lateralityOnChange = function() |
2617 |
01 Sep 14 |
nicklas |
872 |
{ |
2617 |
01 Sep 14 |
nicklas |
lateralityIsValid = false; |
2617 |
01 Sep 14 |
nicklas |
var updateMode = caseInfo.id; |
2617 |
01 Sep 14 |
nicklas |
875 |
|
2617 |
01 Sep 14 |
nicklas |
// Check selected laterality against specimen tubes |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
var selectedLaterality = Forms.getCheckedRadio(frm.laterality); |
2617 |
01 Sep 14 |
nicklas |
879 |
|
2617 |
01 Sep 14 |
nicklas |
// No laterality/case selected |
2617 |
01 Sep 14 |
nicklas |
if (selectedLaterality == null) |
2617 |
01 Sep 14 |
nicklas |
882 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('laterality', 'invalid', 'Not selected'); |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
885 |
} |
2617 |
01 Sep 14 |
nicklas |
886 |
|
2617 |
01 Sep 14 |
nicklas |
var numCases = patientInfo.cases ? patientInfo.cases.length : 0; |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('laterality', 'valid', updateMode && numCases > 1 ? 'NOTE! Some alternatives may be missing if there is another case for the patient.' : ''); |
2617 |
01 Sep 14 |
nicklas |
lateralityIsValid = true; |
2617 |
01 Sep 14 |
nicklas |
890 |
|
2617 |
01 Sep 14 |
nicklas |
var laterality = selectedLaterality.value; |
4930 |
22 Aug 18 |
nicklas |
var mergeWithCase = laterality.match(/\d+/); |
4930 |
22 Aug 18 |
nicklas |
if (mergeWithCase) |
2617 |
01 Sep 14 |
nicklas |
894 |
{ |
4930 |
22 Aug 18 |
nicklas |
// 'laterality' is the ID of an existing case |
2617 |
01 Sep 14 |
nicklas |
for (var i = 0; i < patientInfo.cases.length; i++) |
2617 |
01 Sep 14 |
nicklas |
897 |
{ |
2617 |
01 Sep 14 |
nicklas |
var cse = patientInfo.cases[i]; |
2617 |
01 Sep 14 |
nicklas |
if (cse.id == laterality) |
2617 |
01 Sep 14 |
nicklas |
900 |
{ |
2617 |
01 Sep 14 |
nicklas |
laterality = cse.laterality; |
2617 |
01 Sep 14 |
nicklas |
break; |
2617 |
01 Sep 14 |
nicklas |
903 |
} |
2617 |
01 Sep 14 |
nicklas |
904 |
} |
2617 |
01 Sep 14 |
nicklas |
905 |
} |
2617 |
01 Sep 14 |
nicklas |
else if (laterality == '') |
2617 |
01 Sep 14 |
nicklas |
907 |
{ |
2617 |
01 Sep 14 |
nicklas |
laterality = null; |
2617 |
01 Sep 14 |
nicklas |
909 |
} |
2617 |
01 Sep 14 |
nicklas |
910 |
|
4930 |
22 Aug 18 |
nicklas |
// If the selected laterality/case is a new case it is possible to copy consent |
4930 |
22 Aug 18 |
nicklas |
Doc.showHide('copyConsentSection', copyConsentEnabled && !mergeWithCase); |
2617 |
01 Sep 14 |
nicklas |
913 |
|
2617 |
01 Sep 14 |
nicklas |
// No specimen tubes? |
2617 |
01 Sep 14 |
nicklas |
if (caseInfo.specimen) |
2617 |
01 Sep 14 |
nicklas |
916 |
{ |
2617 |
01 Sep 14 |
nicklas |
for (var i = 0; i < caseInfo.specimen.length; i++) |
2617 |
01 Sep 14 |
nicklas |
918 |
{ |
2617 |
01 Sep 14 |
nicklas |
var specimen = caseInfo.specimen[i]; |
2617 |
01 Sep 14 |
nicklas |
if (specimen.laterality != laterality) |
2617 |
01 Sep 14 |
nicklas |
921 |
{ |
6646 |
17 Mar 22 |
nicklas |
Wizard.setInputStatus('laterality', 'valid', 'Specimen tubes are updated to: ' + laterality) |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
924 |
} |
2617 |
01 Sep 14 |
nicklas |
925 |
} |
2617 |
01 Sep 14 |
nicklas |
926 |
} |
2617 |
01 Sep 14 |
nicklas |
927 |
|
2617 |
01 Sep 14 |
nicklas |
if (caseInfo.coreBiopsies) |
2617 |
01 Sep 14 |
nicklas |
929 |
{ |
2617 |
01 Sep 14 |
nicklas |
for (var i = 0; i < caseInfo.coreBiopsies.length; i++) |
2617 |
01 Sep 14 |
nicklas |
931 |
{ |
2617 |
01 Sep 14 |
nicklas |
var cb = caseInfo.coreBiopsies[i]; |
2617 |
01 Sep 14 |
nicklas |
if (cb.laterality != laterality) |
2617 |
01 Sep 14 |
nicklas |
934 |
{ |
6646 |
17 Mar 22 |
nicklas |
Wizard.setInputStatus('laterality', 'valid', 'Core biopsies are updated to: ' + laterality); |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
937 |
} |
2617 |
01 Sep 14 |
nicklas |
938 |
} |
2617 |
01 Sep 14 |
nicklas |
939 |
} |
2617 |
01 Sep 14 |
nicklas |
940 |
|
2617 |
01 Sep 14 |
nicklas |
941 |
} |
2617 |
01 Sep 14 |
nicklas |
942 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.padOnChange = function() |
2617 |
01 Sep 14 |
nicklas |
944 |
{ |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
var PAD = frm.pad.value; |
2617 |
01 Sep 14 |
nicklas |
if (PAD == '') |
2617 |
01 Sep 14 |
nicklas |
948 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('pad', 'warning', 'Missing'); |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
951 |
} |
2617 |
01 Sep 14 |
nicklas |
frm.pad.value = PAD.replace(/\+/, '-'); |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('pad', 'valid'); |
2617 |
01 Sep 14 |
nicklas |
954 |
} |
2617 |
01 Sep 14 |
nicklas |
955 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.samplingDateTimeFocus = function(event) |
2617 |
01 Sep 14 |
nicklas |
957 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (event.keyCode == 13) |
2617 |
01 Sep 14 |
nicklas |
959 |
{ |
2617 |
01 Sep 14 |
nicklas |
var focusTo = caseInfo.specimen && caseInfo.specimen.length > 0 ? 'rnaLaterDate' : 'reasonIfNoSpecimen' |
2617 |
01 Sep 14 |
nicklas |
Doc.element(focusTo).focus(); |
2617 |
01 Sep 14 |
nicklas |
962 |
} |
2617 |
01 Sep 14 |
nicklas |
963 |
} |
2617 |
01 Sep 14 |
nicklas |
964 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.samplingDateTimeOnChange = function() |
2617 |
01 Sep 14 |
nicklas |
966 |
{ |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
samplingDateIsValid = false; |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('samplingDate'); |
2617 |
01 Sep 14 |
nicklas |
970 |
|
2617 |
01 Sep 14 |
nicklas |
var samplingDate = frm.samplingDate.value; |
2617 |
01 Sep 14 |
nicklas |
var samplingTime = frm.samplingTime.disabled ? null : frm.samplingTime.value; |
2617 |
01 Sep 14 |
nicklas |
973 |
|
2617 |
01 Sep 14 |
nicklas |
if (samplingDate == '') |
2617 |
01 Sep 14 |
nicklas |
975 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('samplingDate', 'warning', 'Missing date'); |
2617 |
01 Sep 14 |
nicklas |
977 |
} |
2617 |
01 Sep 14 |
nicklas |
else |
2617 |
01 Sep 14 |
nicklas |
979 |
{ |
2617 |
01 Sep 14 |
nicklas |
// Auto-fill the date if it's only given with 4(MMdd) or 6(yyMMdd) digits. |
2617 |
01 Sep 14 |
nicklas |
samplingDate = Reggie.autoFillDate(samplingDate, true); |
2617 |
01 Sep 14 |
nicklas |
frm.samplingDate.value = samplingDate; |
2617 |
01 Sep 14 |
nicklas |
983 |
|
2617 |
01 Sep 14 |
nicklas |
if (!frm.samplingTime.disabled) |
2617 |
01 Sep 14 |
nicklas |
985 |
{ |
2617 |
01 Sep 14 |
nicklas |
samplingTime = Reggie.autoFillTime(samplingTime); |
2617 |
01 Sep 14 |
nicklas |
frm.samplingTime.value = samplingTime; |
2617 |
01 Sep 14 |
nicklas |
988 |
} |
2617 |
01 Sep 14 |
nicklas |
989 |
|
2617 |
01 Sep 14 |
nicklas |
if (samplingDate != '' && !Dates.isDate(samplingDate, 'yyyyMMdd')) |
2617 |
01 Sep 14 |
nicklas |
991 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('samplingDate', 'invalid', 'Not a valid date'); |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
994 |
} |
2617 |
01 Sep 14 |
nicklas |
if (frm.rnaLaterDate.value == '') frm.rnaLaterDate.value = samplingDate; |
2617 |
01 Sep 14 |
nicklas |
996 |
|
2617 |
01 Sep 14 |
nicklas |
if (!frm.samplingTime.disabled) |
2617 |
01 Sep 14 |
nicklas |
998 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (!Dates.isDate(samplingDate + ' ' + samplingTime, 'yyyyMMdd HHmm')) |
2617 |
01 Sep 14 |
nicklas |
1000 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (samplingDate != '') |
2617 |
01 Sep 14 |
nicklas |
1002 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('samplingDate', 'invalid', 'Not a valid time'); |
2617 |
01 Sep 14 |
nicklas |
1004 |
} |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
1006 |
} |
2617 |
01 Sep 14 |
nicklas |
1007 |
} |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('samplingDate', 'valid'); |
2617 |
01 Sep 14 |
nicklas |
1009 |
} |
2617 |
01 Sep 14 |
nicklas |
samplingDateIsValid = true; |
2617 |
01 Sep 14 |
nicklas |
1011 |
} |
2617 |
01 Sep 14 |
nicklas |
1012 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.rnaLaterDateTimeOnChange = function() |
2617 |
01 Sep 14 |
nicklas |
1014 |
{ |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
rnaLaterDateIsValid = false; |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('rnaLaterDate'); |
2617 |
01 Sep 14 |
nicklas |
1018 |
|
2617 |
01 Sep 14 |
nicklas |
var rnaLaterDate = frm.rnaLaterDate.value; |
2617 |
01 Sep 14 |
nicklas |
var rnaLaterTime = frm.rnaLaterTime.value; |
2617 |
01 Sep 14 |
nicklas |
var rnaLaterTimestamp; |
2617 |
01 Sep 14 |
nicklas |
1022 |
|
2617 |
01 Sep 14 |
nicklas |
if (rnaLaterDate != '' || rnaLaterTime != '') |
2617 |
01 Sep 14 |
nicklas |
1024 |
{ |
2617 |
01 Sep 14 |
nicklas |
// Auto-fill the date if it's only given with 4(MMdd) or 6(yyMMdd) digits. |
2617 |
01 Sep 14 |
nicklas |
rnaLaterDate = Reggie.autoFillDate(rnaLaterDate, true); |
2617 |
01 Sep 14 |
nicklas |
frm.rnaLaterDate.value = rnaLaterDate; |
2617 |
01 Sep 14 |
nicklas |
1028 |
|
2617 |
01 Sep 14 |
nicklas |
rnaLaterTime = Reggie.autoFillTime(rnaLaterTime); |
2617 |
01 Sep 14 |
nicklas |
frm.rnaLaterTime.value = rnaLaterTime; |
2617 |
01 Sep 14 |
nicklas |
1031 |
|
2617 |
01 Sep 14 |
nicklas |
if (!Dates.isDate(rnaLaterDate, 'yyyyMMdd')) |
2617 |
01 Sep 14 |
nicklas |
1033 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('rnaLaterDate', 'invalid', 'Not a valid date'); |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
1036 |
} |
2617 |
01 Sep 14 |
nicklas |
rnaLaterTimestamp = Dates.parseString(rnaLaterDate + ' ' + rnaLaterTime, 'yyyyMMdd HHmm'); |
2617 |
01 Sep 14 |
nicklas |
if (rnaLaterTimestamp == null) |
2617 |
01 Sep 14 |
nicklas |
1039 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (rnaLaterDate != '') |
2617 |
01 Sep 14 |
nicklas |
1041 |
{ |
2801 |
13 Oct 14 |
nicklas |
Wizard.setInputStatus('rnaLaterDate', 'invalid', 'Not a valid time'); |
2617 |
01 Sep 14 |
nicklas |
1043 |
} |
2617 |
01 Sep 14 |
nicklas |
return; |
2617 |
01 Sep 14 |
nicklas |
1045 |
} |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('rnaLaterDate', 'valid'); |
2617 |
01 Sep 14 |
nicklas |
1047 |
} |
2617 |
01 Sep 14 |
nicklas |
1048 |
|
2617 |
01 Sep 14 |
nicklas |
rnaLaterDateIsValid = true; |
2617 |
01 Sep 14 |
nicklas |
1050 |
|
2617 |
01 Sep 14 |
nicklas |
if (samplingDateIsValid && rnaLaterTimestamp && !frm.samplingTime.disabled) |
2617 |
01 Sep 14 |
nicklas |
1052 |
{ |
2617 |
01 Sep 14 |
nicklas |
var samplingTimestamp = Dates.parseString(frm.samplingDate.value + ' ' + frm.samplingTime.value, 'yyyyMMdd Hmm'); |
2617 |
01 Sep 14 |
nicklas |
if (samplingTimestamp) |
2617 |
01 Sep 14 |
nicklas |
1055 |
{ |
2617 |
01 Sep 14 |
nicklas |
if (rnaLaterTimestamp.getDate() != samplingTimestamp.getDate()) |
2617 |
01 Sep 14 |
nicklas |
1057 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('rnaLaterDate', 'warning', 'Sampling and RNA later dates are different'); |
2617 |
01 Sep 14 |
nicklas |
1059 |
} |
2617 |
01 Sep 14 |
nicklas |
else if (rnaLaterTimestamp.getTime() < samplingTimestamp.getTime()) |
2617 |
01 Sep 14 |
nicklas |
1061 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.setInputStatus('rnaLaterDate', 'warning', 'RNA later time is before Sampling time'); |
2617 |
01 Sep 14 |
nicklas |
1063 |
} |
2617 |
01 Sep 14 |
nicklas |
1064 |
} |
2617 |
01 Sep 14 |
nicklas |
1065 |
} |
2617 |
01 Sep 14 |
nicklas |
1066 |
} |
2617 |
01 Sep 14 |
nicklas |
1067 |
|
5318 |
28 Feb 19 |
nicklas |
persinfo.noReferralFormOnChange = function() |
5318 |
28 Feb 19 |
nicklas |
1069 |
{ |
5318 |
28 Feb 19 |
nicklas |
var frm = document.forms['reggie']; |
5318 |
28 Feb 19 |
nicklas |
if (frm.noReferralForm.checked) |
5318 |
28 Feb 19 |
nicklas |
1072 |
{ |
5318 |
28 Feb 19 |
nicklas |
frm.reasonIfNoSpecimen.disabled = true; |
5318 |
28 Feb 19 |
nicklas |
frm.reasonIfNoSpecimen.oldValue = frm.reasonIfNoSpecimen.value; |
5318 |
28 Feb 19 |
nicklas |
frm.reasonIfNoSpecimen.value = 'no_referral_form'; |
5318 |
28 Feb 19 |
nicklas |
1076 |
} |
5318 |
28 Feb 19 |
nicklas |
else |
5318 |
28 Feb 19 |
nicklas |
1078 |
{ |
5318 |
28 Feb 19 |
nicklas |
frm.reasonIfNoSpecimen.disabled = false; |
5318 |
28 Feb 19 |
nicklas |
frm.reasonIfNoSpecimen.value = frm.reasonIfNoSpecimen.oldValue || ''; |
5318 |
28 Feb 19 |
nicklas |
1081 |
} |
5318 |
28 Feb 19 |
nicklas |
1082 |
} |
5318 |
28 Feb 19 |
nicklas |
1083 |
|
6991 |
19 Jan 23 |
nicklas |
persinfo.swapPad = function() |
6991 |
19 Jan 23 |
nicklas |
1085 |
{ |
6991 |
19 Jan 23 |
nicklas |
var frm = document.forms['reggie']; |
6991 |
19 Jan 23 |
nicklas |
var pad = frm.pad.value; |
6991 |
19 Jan 23 |
nicklas |
var alternatePad = frm.alternatePad.value; |
6991 |
19 Jan 23 |
nicklas |
frm.pad.value = alternatePad; |
6991 |
19 Jan 23 |
nicklas |
frm.alternatePad.value = pad; |
6991 |
19 Jan 23 |
nicklas |
persinfo.padOnChange(); |
6991 |
19 Jan 23 |
nicklas |
1092 |
} |
6991 |
19 Jan 23 |
nicklas |
1093 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.validateStep3 = function(event) |
2617 |
01 Sep 14 |
nicklas |
1095 |
{ |
6574 |
08 Feb 22 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
var isValid = lateralityIsValid && samplingDateIsValid; |
2617 |
01 Sep 14 |
nicklas |
if (caseInfo.specimen && caseInfo.specimen.length > 0) |
2617 |
01 Sep 14 |
nicklas |
1099 |
{ |
2617 |
01 Sep 14 |
nicklas |
isValid = isValid && rnaLaterDateIsValid; |
2617 |
01 Sep 14 |
nicklas |
1101 |
} |
6574 |
08 Feb 22 |
nicklas |
if (frm.externalSpecimenExists.checked) |
6574 |
08 Feb 22 |
nicklas |
1103 |
{ |
6574 |
08 Feb 22 |
nicklas |
isValid = isValid && rnaLaterDateIsValid; |
6574 |
08 Feb 22 |
nicklas |
1105 |
} |
2617 |
01 Sep 14 |
nicklas |
if (!isValid) event.preventDefault(); |
2617 |
01 Sep 14 |
nicklas |
1107 |
} |
2617 |
01 Sep 14 |
nicklas |
1108 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.submit = function() |
2617 |
01 Sep 14 |
nicklas |
1110 |
{ |
2617 |
01 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2617 |
01 Sep 14 |
nicklas |
1112 |
|
2617 |
01 Sep 14 |
nicklas |
caseInfo.laterality = Forms.getCheckedRadio(frm.laterality).value; |
2617 |
01 Sep 14 |
nicklas |
caseInfo.reasonIfNoSpecimen = frm.reasonIfNoSpecimen.value; |
2617 |
01 Sep 14 |
nicklas |
caseInfo.pad = frm.pad.value; |
6991 |
19 Jan 23 |
nicklas |
caseInfo.alternatePad = frm.alternatePad.value; |
2617 |
01 Sep 14 |
nicklas |
1117 |
|
2617 |
01 Sep 14 |
nicklas |
var caseName = frm.caseName.value; |
2840 |
20 Oct 14 |
nicklas |
var suffix = caseName.length > 7 ? caseName.substring(7, 8) : null; |
2840 |
20 Oct 14 |
nicklas |
if (suffix != null) |
2617 |
01 Sep 14 |
nicklas |
1121 |
{ |
2840 |
20 Oct 14 |
nicklas |
if (suffix == 'C') |
2840 |
20 Oct 14 |
nicklas |
1123 |
{ |
2840 |
20 Oct 14 |
nicklas |
// 'C' suffix is only for 'SpecimenCoreBiopsy' items |
2840 |
20 Oct 14 |
nicklas |
caseInfo.biopsyType = 'SpecimenCoreBiopsy'; |
2840 |
20 Oct 14 |
nicklas |
1126 |
} |
2840 |
20 Oct 14 |
nicklas |
if (suffix == 'D') |
2840 |
20 Oct 14 |
nicklas |
1128 |
{ |
2840 |
20 Oct 14 |
nicklas |
// 'D' suffix is only for 'SpecimenCoreBiopsy2nd' items |
2840 |
20 Oct 14 |
nicklas |
caseInfo.biopsyType = 'SpecimenCoreBiopsy2nd'; |
2840 |
20 Oct 14 |
nicklas |
1131 |
} |
2617 |
01 Sep 14 |
nicklas |
1132 |
} |
6574 |
08 Feb 22 |
nicklas |
caseInfo.externalSpecimenExists = frm.externalSpecimenExists.checked; |
6574 |
08 Feb 22 |
nicklas |
caseInfo.externalOperator = frm.externalOperator.value; |
6574 |
08 Feb 22 |
nicklas |
caseInfo.liasonComment = frm.liasonComment.value; |
2617 |
01 Sep 14 |
nicklas |
caseInfo.samplingDate = Strings.trim(frm.samplingDate.value + ' ' + frm.samplingTime.value); |
2617 |
01 Sep 14 |
nicklas |
caseInfo.rnaLaterDate = Strings.trim(frm.rnaLaterDate.value + ' ' + frm.rnaLaterTime.value); |
6574 |
08 Feb 22 |
nicklas |
caseInfo.otherPathNote = frm.otherPathNote.value; |
2617 |
01 Sep 14 |
nicklas |
if (frm.copyConsent.checked && frm.copyConsent.value) |
2617 |
01 Sep 14 |
nicklas |
1140 |
{ |
2617 |
01 Sep 14 |
nicklas |
caseInfo.copyConsent = parseInt(frm.copyConsent.value, 10); |
2617 |
01 Sep 14 |
nicklas |
1142 |
} |
2617 |
01 Sep 14 |
nicklas |
1143 |
|
6510 |
03 Dec 21 |
nicklas |
if (caseInfo.specimen && caseInfo.specimen.length > 0) |
6510 |
03 Dec 21 |
nicklas |
1145 |
{ |
6510 |
03 Dec 21 |
nicklas |
for (var i = 0; i < caseInfo.specimen.length; i++) |
6510 |
03 Dec 21 |
nicklas |
1147 |
{ |
6510 |
03 Dec 21 |
nicklas |
var specimen = caseInfo.specimen[i]; |
6510 |
03 Dec 21 |
nicklas |
specimen.YellowLabel = frm['yellow.'+specimen.id].checked ? 'yellow' : null; |
6510 |
03 Dec 21 |
nicklas |
specimen.specimenType = frm['specimenType.'+specimen.id].value; |
6510 |
03 Dec 21 |
nicklas |
specimen.biopsyType = frm['biopsyType.'+specimen.id].value; |
6510 |
03 Dec 21 |
nicklas |
specimen.otherPathNote = frm['otherPathNote.'+specimen.id].value; |
6510 |
03 Dec 21 |
nicklas |
specimen.operatorDeliveryComment = frm['comment.'+specimen.id].value; |
6510 |
03 Dec 21 |
nicklas |
1154 |
} |
6510 |
03 Dec 21 |
nicklas |
1155 |
} |
6510 |
03 Dec 21 |
nicklas |
1156 |
|
2617 |
01 Sep 14 |
nicklas |
var updateMode = caseInfo.id && caseInfo.patient; |
2617 |
01 Sep 14 |
nicklas |
var submitInfo = {}; |
2617 |
01 Sep 14 |
nicklas |
submitInfo.patientInfo = patientInfo; |
2617 |
01 Sep 14 |
nicklas |
submitInfo.caseInfo = caseInfo; |
3726 |
28 Jan 16 |
nicklas |
1161 |
|
2617 |
01 Sep 14 |
nicklas |
var url = '../PersonalRegistration.servlet?ID='+App.getSessionId(); |
2617 |
01 Sep 14 |
nicklas |
url += '&cmd=' + (updateMode ? 'UpdateCase' : 'CreateCase'); |
2617 |
01 Sep 14 |
nicklas |
Wizard.showLoadingAnimation('Registering case...'); |
2617 |
01 Sep 14 |
nicklas |
Wizard.asyncJsonRequest(url, persinfo.submissionResults, 'POST', JSON.stringify(submitInfo)); |
2617 |
01 Sep 14 |
nicklas |
1166 |
} |
2617 |
01 Sep 14 |
nicklas |
1167 |
|
2617 |
01 Sep 14 |
nicklas |
persinfo.submissionResults = function(response) |
2617 |
01 Sep 14 |
nicklas |
1169 |
{ |
2617 |
01 Sep 14 |
nicklas |
Wizard.showFinalMessage(response.messages); |
2617 |
01 Sep 14 |
nicklas |
Doc.show('gorestart'); |
2617 |
01 Sep 14 |
nicklas |
1172 |
} |
2617 |
01 Sep 14 |
nicklas |
1173 |
|
2617 |
01 Sep 14 |
nicklas |
return persinfo; |
2617 |
01 Sep 14 |
nicklas |
1175 |
}(); |
2617 |
01 Sep 14 |
nicklas |
1176 |
|
2617 |
01 Sep 14 |
nicklas |
Doc.onLoad(PersInfo.initPage); |
2617 |
01 Sep 14 |
nicklas |
1178 |
|