##################################################################################
# Name: select_pv1_17_obr_16 #
# Purpose: This proc determines if the message contains #
# one of the Doctors in the table. #
# If the message matches the criteria, it is passed; #
# ELSE the message is killed. #
# Table is entered as an argument. #
# #
# Written by: Barbi Heller #
# Micro Star Inc.com #
# Date: 05/01/2012 #
###################################################################################
# # # # # # # # # # # # # # # Changes # # # # # # # # # # # # # # # # # # # # # #
# #
# Date Comments Changed By #
# #
# UPoC type: tps #
# Args: tps keyedlist containing the following keys: #
# MODE run mode (“start”, “run” or “time”) #
# MSGID message handle #
# ARGS none #
# #
# #
# Returns: tps disposition list: #
#
###################################################################################
proc select_pv1_17_obr_16 { args } {
keylget args MODE mode ;# Fetch mode
set dispList {}
switch -exact — $mode {
start {
# Perform special init functions
}
run {
###################################################################################
# Hard Code #
###################################################################################
set segment1 “PV1”
set segment2 “OBR”
keylget args MSGID mh
keylget args ARGS arg_tbl
set msg [msgget $mh]
set segmentList [split $msg “r”]
set fieldSeparator [crange $msg 3 3]
set subfieldSeparator [crange $msg 4 4]
set DocTable $arg_tbl
set header [lrange [split $msg “r”] 0 1]
set msh [split [lindex $header 0] $fieldSeparator]
foreach seg [split $msg “r”] {
set segID [lindex [split $seg $fieldSeparator] 0]
if { [cequal $segID “PV1”]} {
#set ptclass [lindex [split $seg $fieldSeparator] 2]
# set pttype [lindex [split $seg $fieldSeparator] 10]
set doctest_fld [lindex [split $seg $fieldSeparator] 17]
set doctest [lindex [split $doctest_fld $subfieldSeparator] 0]
}
}
foreach seg [split $msg “r”] {
set segID [lindex [split $seg $fieldSeparator] 0]
if { [cequal $segID “OBR”]} {
set dr_number [lindex [split $seg $fieldSeparator] 16]
}
}
echo docnums:$doctest
echo segment1:$segment1
echo segment2:$segment2
###################################################################################
# If doctor number matches one of the entries in the argument table #
# set match to yes, so the pass flag will be set to Yes #
###################################################################################
set match “N”
set match [tbllookup $DocTable $doctest]
if {[cequal $segment1 “PV1”]} {
if {$match != “N”} {
lappend dispList “CONTINUE $mh”
echo CONTINE PV1:$mh
} else {
}
}
if {[cequal “CONTINUE” $mh]} {
if {[cequal $segment2 “OBR”]} {
if {$match != “N”} {
lappend dispList “CONTINUE $mh”
echo CONTINE OBR:$mh
} else {
lappend dispList “KILL $mh”
echo KILL OBR:$mh
}
}
}
return $dispList
}
}
}
return $dispList
}
shutdown {
}
}
}