Bläddra i källkod

Changing id display to follow local/study id from crfEntry

Andrej Studen 2 år sedan
förälder
incheckning
d874828a9d
1 ändrade filer med 8 tillägg och 37 borttagningar
  1. 8 37
      web/crf/formPortal.js

+ 8 - 37
web/crf/formPortal.js

@@ -412,16 +412,14 @@ function fcontinue2(){
 			
 			let fp3=config.document.createElement("p");
 			fp3.id="pid"+id;
-			fp3.innerHTML="NONE";
-			print('Setting participant id from query: '+masterQuery);
-			if (masterQuery!="NONE"){
-				let qconfig=new Object();
-				qconfig.schemaName='lists';
-				qconfig.queryName=masterQuery;
-				qconfig.filterArray=[LABKEY.Filter.create('crfRef',id)];
-				qconfig.success=function(data){setPatientId(data,fp3.id);}
-				LABKEY.Query.selectRows(qconfig);
-			}
+         let pid=entry['participantStudyId'];
+         let loc=entry['participantLocalId'];
+         let label='';
+         if (pid) label+=pid+' ';
+         if (loc) label+='(Local: '+loc+')';
+         if (label.length==0) label="NONE";
+			fp3.innerHTML=label;
+
 			fp3.classList.add("center");
 			fbox.appendChild(fp3);
 			
@@ -472,33 +470,6 @@ function fcontinue2(){
 
 }
 
-function setPatientId(data,id){
-	let formConfig=config.formConfig;
-
-	if (data.rows.length==0) return;
-
-	//every masterQuery must have participantCode
-	let participantCode=data.rows[0].participantCode;
-	let participantField=formConfig.studyData.rows[0].SubjectColumnName;
-
-	print('setPatientId: '+data.queryName);
-	print('participantCode: '+participantCode);
-	print('participantField: '+participantField);
-	//equates to registration
-	for (let i=0;i<formConfig.demographicData.rows.length;i++){
-		let entry=formConfig.demographicData.rows[i];
-		let key=entry.lsid;
-		print('Comparing to: '+key);
-		if (key!=participantCode) continue;
-		print('Setting: ');
-		let participantId=entry[participantField];
-		config.document.getElementById(id).innerHTML=participantId;
-		break;
-	}
-	
-
-}
-
 function openForm(crfEntry){
 	let formConfig=config.formConfig;
 	let crfRef=crfEntry.entryId;