比较相关实例

在重复表单中检查匹配实例的值。

规则说明:相同相关不良事件 (AENUM) 的严重性(单选控制)必须与前一个相同。

规则表达式

//variable declaration
var rc;                         //Radio Control - severity
var ins;                        //placeholder for Repeating Form instance 
var outc='';                    //placeholder for severity label value
var cnt=0;                      //counter variable

//function definition to identify number of instances matching the severity value
function functi(item,index)
{
	if(item.deleted===false && item.value!==null && index!==(ins-1) && index<ins-1)
	{
	
		if(item.value===aenum1val)                                    //Checks if the passed-in instance has a matching AE number value with the current instance
		{
		     if(newsev[index]!==null && sevval!==null)                    
		     {
			     outc=JSON.parse(newsev[index].value)[0].label;     //Retrieves label from severity selection made by the user in the related instance
			     if(outc===sevval)                                //Checks if the severity value in the related instance is matching in the current instance
			     {
			          cnt=cnt+1;                                 //Updates the number of identified matching instances
			     }
			     else
			     {
				    cnt=cnt;
			     }			
	            }
		     else
		     {
		          cnt=cnt;
		     }
		}
		else
		{
		     cnt=cnt;
		}
     }
     else
     {
          cnt=cnt;
     }		
}

try
{
//variable declaration
	ins = GetCurrentRFInstance();                                //Retrieves instance of the current AE form
	var aenum1val=aenum1;                                        //Adverse event number item
	var sevval=getStringFromChoice(newsev1);                    //Variable for severity item to retrieve the label for the severity choice item selected by the user
	rc=getValues('aenum','newsev');                              //Gets values entered for AE number and severity items
	if(rc===true && aenum1val!==null && sevval!==null && ins>1)     //Checks if getValues function retrieved results array, if AE number and severity values are not null and if current instance is not the first instance of the form
	{
		aenum.forEach(functi);        //Execute the function code for all AE number values entered in the form
		if(cnt>0 )
		{
			return false;          //System sends query when return false condition is met
		}
		else 
		{
			return true;
		}
	}
	else
	{
		return true;
	}
}
catch(err)
{
    setQueryMessage(err);                 //set query message to display an encountered error
    return false;                         //System sends query when return false condition is met
}

查询:新的严重性与前一个严重性相同。请检查。

定义

newsev

根据规则说明为严重性项创建了变量。

aenum(枚举)

对应于规则说明中的不利事件编号项。

GetCurrentRFInstance( )

获取当前重复表单的表单实例编号。

getStringFromChoice( )

将选项元素(下拉、单选按钮或复选框)的选定标签转换为字符串或逗号分隔值。将选择元素作为参数。

getValues( )

以按访问顺序排序的数组格式获取多个访问中一个或多个变量的值。在这种情况下,采用上述 aenumnewsev 变量。

setQueryMessage( )

指定作为参数传入的动态查询文本。

functi(item,index)

在代码中声明的函数。标识与捐赠严重性值匹配的实例数。

返回值

布尔值

返回 truefalse。满足返回 false 条件时,系统会引发查询。

验证步骤

  1. 使用主题进行测试,转到包含要检查的 iems 的给定访问和表单,在此示例中,指定重复表单实例中的不良事件编号 <aenumval> 和严重性 <sevval>。
  2. 如下表所示更新表单项 aenumvalsevval 并验证结果是否已列出:
    步骤 注释 结果

    a. 在第一个重复格式 (1RF) 实例中,将 aenumval 项输入为 '1' (AE1),然后选择 sevval 作为 'Grade 1'。

    只有一个重复的表单实例。

    没有查询。

    b. 转到第二个重复表单 (2RF) 实例,并将 aenumval 项输入为 '1' (AE1),然后选择 sevval 作为 'Grade 1'(与上一步相同)。

    1RF 和 2RF 中的匹配值:
    • 1RF:
      • AE1
      • 严重性等级 1
    • 2RF:
      • AE1
      • 严重性等级 1

    查询 2RF。

    c. 将 2RF 实例中的 sevval 项更新为“级别 2 ”。

    1RF 和 2RF 中的不同值:
    • 1RF:
      • AE1
      • 严重性等级 1
    • 2RF:
      • AE1
      • 严重性等级 2

    无查询。

    d. 将 2RF 实例中的 sevval 项重新更新为“ 1 级”。

    1RF 和 2RF 中的匹配值:
    • 1RF:
      • AE1
      • 严重性等级 1
    • 2RF:
      • AE1
      • 严重性等级 1

    查询 2RF。

    e. 将 2RF 实例中的 aenumval 项更新为 '2' (AE2)。

    1RF 和 2RF 中的不同值:
    • 1RF:
      • AE1
      • 严重性等级 1
    • 2RF:
      • AE2
      • 严重性等级 1

    无查询。

    f. 创建一个网格重复表单 (3RF) 实例,并将 aenumval 项输入为 '1' (AE1),将 sevval 输入为 'Grade 1'。

    1RF 和 3RF 中的匹配值:
    • 1RF:
      • AE1
      • 严重性等级 1
    • 2RF:
      • AE2
      • 严重性等级 1
    • 3RF:
      • AE1
      • 严重性等级 1

    查询 3RF。

    g. 将 3RF 中的 aenumval 更新为 '3' (AE3)。

    所有重复表单实例中的值不同:
    • 1RF:
      • AE1
      • 严重性等级 1
    • 2RF:
      • AE2
      • 严重性等级 1
    • 3RF:
      • AE3
      • 严重性等级 1

    无查询。

    h. 将 3RF 中的 aenumval 项更新为 '2' (AE2)。

    2RF 和 3RF 中的匹配值:
    • 1RF:
      • AE1
      • 严重性等级 1
    • 2RF:
      • AE2
      • 严重性等级 1
    • 3RF:
      • AE2
      • 严重性等级 1

    查询 3RF。

    i。 将 2RF 中的 sevval 项更新为“ 3 级”。

    所有重复表单实例中的值不同:
    • 1RF:
      • AE1
      • 严重性等级 1
    • 2RF:
      • AE2
      • 严重性等级 3
    • 3RF:
      • AE2
      • 严重性等级 1

    无查询。

其他示例

示例 4-28 治疗的开始日期必须晚于或等于同一药物上一处方的治疗停止日期

var rc;
var ins;
var ind=-1;
var res='';
function functi(item,index)
{
	if(item.deleted===false && item.value!==null && index!==(ins-1) && index<ins-1)
	{
		if(item.value===trtname1)
		{
			if(stpdt[index]!==null && stdt[ins-1]!==null)
			{
				if(getDatesCompareResult(stdt[ins-1].value,true,stpdt[index].value,true,'>='))
				{
					ind=1;	
					
				}
				else{  ind = 0;}
			}
		}
	}
}
	ins = GetCurrentRFInstance();
	rc=getValues("trtname","stdt","stpdt");
	if(rc===true && ins!==1)
	{
		trtname.forEach(functi);
		if(ind===0)
		{			
			return false;
		}
		else { return true; }
	}
	else
	{
		return true;
	}

查询消息:开始日期早于上一个处方的停止日期。请更正或确认。