Ver código fonte

Infrastructure to show all concomitantMedications entries for a participant

Andrej Studen 1 ano atrás
pai
commit
85b402c91c
1 arquivos alterados com 30 adições e 2 exclusões
  1. 30 2
      web/crfTecant/crfVisit.js

+ 30 - 2
web/crfTecant/crfVisit.js

@@ -252,8 +252,32 @@ function(formSetupEntry){
 
    //for data queries, limit to present CRF only
 	ad.filters=new Object();
-	ad.filters['crfRef']=this.getCRFref();
 
+	let crfValues=this.getCRFref();
+
+   let settings=this.config.formConfig.settings;
+   let doMerge=false;
+   if ("mergeListData" in settings){
+      let ar=settings["mergeListData"].split(',');
+      if (ar.includes(ad.queryName))
+         doMerge=true;
+   }
+   let idField='participantStudyId';
+   let id=this.config.formConfig.crfEntry[idField];
+   this.print(fName+": studyId "+id+" doMerge "+doMerge);
+
+   if (doMerge){
+      let entries=config.formConfig.crfEntries.rows;
+      for (let i=0;i<entries.length;i++){
+         let e=entries[i];
+         if (e[idField]==id){
+            crfValues+=";"+e['entryId'];
+         }
+      }
+   }
+
+   this.print(fName+": crfValues "+crfValues);
+	ad.filters['crfRef']=crfValues;
    //compose a long debug message
 	let msg=fName+": flag "+ad.showFlag;
 	msg+=" value "+ad.showFlagValue;
@@ -584,7 +608,7 @@ function(divName,queryName,filters,readonlyFlag){
 	let div=this.getElement(divName);
 
    this.print(fName+": generating WebPart: "+queryName);
-	
+   
 	var qconfig=new Object();
 	qconfig.renderTo=divName;
 	//point to data container
@@ -2857,6 +2881,10 @@ function(){
 		queryArray.push(runQuery.makeQuery(targetObject,'data','crfEntry','parentCrfData',[crfFilter]));	
 	}	
 
+   //crfEntries
+   queryArray.push(
+         runQuery.makeQuery(targetObject,'data','crfEntry','crfEntries',[]));
+   
 	this.print('running getDataFromQueries');
    let that=this;
    //let action=function(data){that.doNothing();};