# filterADT_3M
#
# Type: tps proc
#
# Args: tps keyedlist containing:
# MODE run mode (“start” or “run”)
# MSGID message handle
#
# Returns: Filter out ADT’s to 3M CDIS with location of SSCP and ARU
# and PRE IN and SCH. Also, filters out status of Observation.
#
# Notes: Filters out any ADT’s with the value in PV1.3.0 of SSCP, ARU
# and PRE IN and SCH.
# Filters out any ADT’s with the value in PV1.18.0 of INO.
#
#####################################################################
proc filterADT_3M { args } {
set mode [keylget args MODE]
switch -exact — $mode {
start {
return “” ;# Nothing specific
}
run {
set mh [keylget args MSGID] ;# Message header
set msg [msgget $mh] ;# The message
# Field and subfield separators
set fldSep [string range $msg 3 3]
set subSep [string range $msg 4 4]
# List of HL7 segments
set segments [split $msg r]
# Get PV1 fields. Value needed is in PV1.3.0
set PV1 [lindex [lregexp $segments {^PV1}] 0]
echo PV1: $PV1
set PV1_3flds [lindex [split $PV1 $fldSep] 3]
echo PV1_3flds: $PV1_3flds
set PV1_3 [lindex [split $PV1_3flds $subSep] 0]
echo PV1_3: $PV1_3
# Get PV1Ino fields. Value needed is in PV1.18.0
set PV1Ino [lindex [lregexp $segments {^PV1}] 0]
echo PV1Ino: $PV1Ino
set PV1_18flds [lindex [split $PV1Ino $fldSepIno] 3]
echo PV1_18flds: $PV1_18flds
set PV1_18 [lindex [split $PV1_18flds $subSepIno] 0]
echo PV1_18: $PV1_18
# IF PATIENT IS ACCOUNT TYPE IS “INO”
if {($PV1_18 == “INO”)} {
echo “Message killed!”
return “{KILL $mh}”
} else
{
#echo “Message sent!”
#return “{CONTINUE $mh}”
# IF PATIENT IS AT LOCATION “SSCP” OR “ARU”
if {($PV1_3 == “SSCP”)||($PV1_3 == “ARU”)||($PV1_41 == “SCH”)||($PV1_41 == “PRE”)} {
echo “Message killed!”
return “{KILL $mh}”
} else {
echo “Message sent!”
return “{CONTINUE $mh}”
}
}
}
}