I am trying to create a pre-tcl proc to not kill “postive” lab results or combination of “positive and negative” results to the xlate program.
I kind of figured out how to make that happen for a ORU containing a single OBX but I came across multiple OBX segments that might contain a combination of negative and positive results. If any positive results exist, I still want the message to still go to the xlate program. I think I need an array, not sure since I have never coded one. This is what I have soo far. Any help is appreciated…thank you
#############################################################################
# send_abnomal_values – Send abnormal results or combination of abnormal and normal.
#
# Args: tps keyedlist containing:
# MODE run mode (“start” or “run”)
# MSGID message handle
# CONTEXT Should be sms_ib_data
#
# Returns: tps keyed list containing
# CONTINUE The received message if valid
#
#############################################################################
proc send_abnomal_values { args } {
global HciConnName
# Get mode start or run
set mode [keylget args MODE]
# A good way to generically get the name of the procedure
# to be used for error messages, debug, etc.
set myname “$HciConnName/[lindex [info level 1] 0]”
echo What’s My Name? $myname
switch -exact — $mode {
start {
return “” ;# Nothing specific
}
run {
# Get the message handle
set mh [keylget args MSGID]
# The returned disposition list, assumes good message
set dispList
set msg [msgget $mh]
echo The Message content follows…..
echo $msg
set fldSep [string index $msg 3] ;# Normally |
set subSep [string index $msg 4] ;# Normally ^
set segments [split $msg r]
foreach loc [lsearch -all -regexp $segments {^OBX}] {
set OBX [split [lindex $segments $loc] $fldSep]
set obx_8 [lindex $OBX 8]
set abnormal_value [lindex $obx_8]
echo Value in OBX_8 = $abnormal_value
set tableName Valid_Abnormal_Values
set abnormalflag [tbllookup $tableName $abnormal_value]
echo The result Flag =$abnormalflag
} ;# foreach
# kill all messages that have a flag of N
if {([string equal $abnormalflag N])} {
echo “KILL $msg”
return “{KILL $mh}”
} else {
echo “CONTINUE $msg”
return “{CONTINUE $mh}”
}
} ;# foreach
time {
}
shutdown {
}
}
}