Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: INHUT6

INHUT6.m

Go to the documentation of this file.
  1. INHUT6 ; CHEM,KAC ; 6 May 97 17:03; HL7 Utilities
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. Q
  1. ;
  1. SUPPRESS(INPROC,INTT,INDEST,INBPC,INA,INDA,INUIF,INMSH) ; $$function - Identify
  1. ; application screening logic based on precedence at a particular
  1. ; GIS process screening point and execute (if exists).
  1. ;
  1. ; Input:
  1. ; INPROC - (req) function of calling process
  1. ; "XMT" = Transmitter
  1. ; "RCV" = Receiver
  1. ; INTT - (opt) INTERFACE TRANSACTION TYPE IEN
  1. ; INDEST - (opt) INTERFACE DESTINATION IEN (lowest level)
  1. ; Lowest level destination has Route IDs.
  1. ; INBPC - (opt) BACKGROUND PROCESS CONTROL IEN
  1. ; INA - (opt) "INA" or "^INTHU(IEN,7)" (UNIVERSAL INTERFACE file).
  1. ; Location of [selected subnodes of] the INA array.
  1. ; Selected subnodes of INA array are merged into
  1. ; the outbound message by the Format Controller
  1. ; after outbound script execution. Used by
  1. ; application teams' screening logic (@INA@("node")).
  1. ; INDA - (opt) "INDA" or "^INTHU(IEN,6)" (UNIVERSAL INTERFACE file).
  1. ; Location of INDA array. INDA array is merged into
  1. ; the outbound message by the Format Controller
  1. ; prior to outbound script execution. Used by
  1. ; application teams' screening logic (@INDA@("node")).
  1. ; INUIF - (opt) UNIVERSAL INTERFACE IEN of message to be screened
  1. ; INMSH - (opt) HL7 Message Header (MSH) string (not parsed)
  1. ; Set for inbound messages at Receiver screening
  1. ; point only.
  1. ;
  1. ; Variables:
  1. ; X - scratch
  1. ; INPRI - array - top level = precedence of screen to execute
  1. ; - descendents = information relevant to screen
  1. ; precedence and execution
  1. ; Format: INPRI(X)=File#^IEN^Field # of screening logic"
  1. ; Example: INPRI=2 ; execute screen w/ precedence=2
  1. ; INPRI(1)=Precedence 1 screening info
  1. ; INPRI(2)=Precedence 2 screening info
  1. ; INPRI(3)=Precedence 3 screening info
  1. ; INSRCTL - array - screening logic control information
  1. ; "INSRPROC" - identifies GIS process currently executing
  1. ; "XMT" = Transmitter
  1. ; "RCV" = Receiver
  1. ; "INTT" - INTERFACE TRANSACTION IEN
  1. ; "INDEST" - INTERFACE DESTINATION IEN (lowest level)
  1. ; Lowest level destination has Route IDs.
  1. ; "INBPC" - BACKGROUND PROCESS CONTROL IEN
  1. ; "MSH" - HL7 Message Header (MSH) string (not parsed)
  1. ; from inbound msg
  1. ; INSRDATA - array - screening logic return values
  1. ; false = send msg
  1. ; true = suppress msg
  1. ; "Route ID" - identifies destination to which to route msg.
  1. ; Multiple entries are allowed.
  1. ; INSRMC - selective routing M code to be executed as a screen at
  1. ; this screening point
  1. ; INSUPRES - flag - function return value
  1. ; 0 = send msg
  1. ; 1 = suppress msg
  1. ;
  1. ; Output:
  1. ; 0 = deliver msg to destination
  1. ; 1 = suppress msg (no delivery to destination)
  1. ;
  1. N INPRI,INSRCTL,INSRDATA,INSRMC,INSUPRES,X
  1. ;
  1. ; Initialization
  1. S INPROC=$G(INPROC),INTT=$G(INTT),INDEST=$G(INDEST),INBPC=$G(INBPC),INUIF=$G(INUIF),INMSH=$G(INMSH)
  1. ;
  1. ; Customizations for current screening point - File#^IEN^Screen Node
  1. I INPROC="XMT" D ; Transmitter screens
  1. .; Precedence 1 = Transaction Type
  1. . S:INTT INPRI(1)="4000^"_INTT_"^9"
  1. .; Precedence 2 = Background Process
  1. . S:INBPC INPRI(2)="4004^"_INBPC_"^12"
  1. .; Precedence 3 = Primary Destination
  1. . D:INDEST
  1. .. S X=$P($G(^INRHD(INDEST,7)),U,2) ; Primary Dest has SRMC
  1. .. S INPRI(3)="4005^"_$S(X:X,1:INDEST)_"^16"
  1. ;
  1. I INPROC="RCV" D ; Receiver screens
  1. .; Precedence 1 = Transaction Type
  1. . S:INTT INPRI(1)="4000^"_INTT_"^8"
  1. .; Precedence 2 = Background Process
  1. . S:INBPC INPRI(2)="4004^"_INBPC_"^11"
  1. .; Precedence 3 =Inbound Destination (off of BPC)
  1. . D:INDEST
  1. .. S X=$P($G(^INRHD(INDEST,7)),U,2) ; Primary Dest has SRMC
  1. .. S INPRI(3)="4005^"_$S(X:X,1:INDEST)_"^15"
  1. . S INSRCTL("MSH")=INMSH
  1. ;
  1. ; send if calling process NOT identified or no valid file/table passed in
  1. Q:'$D(INPRI) 0
  1. ;
  1. ; Get screen w/ highest precedence
  1. S INPRI=0 ; remember precedence of screen to be executed
  1. F S INPRI=$O(INPRI(INPRI)) Q:'INPRI D Q:$L(INSRMC)
  1. . S X="S INSRMC=$G("_^DIC(+INPRI(INPRI),0,"GL")_$P(INPRI(INPRI),U,2)_","_$P(INPRI(INPRI),U,3)_"))"
  1. . X X ; set INSRMC = screening logic to be executed (if exists) or ""
  1. ;
  1. Q:'$L($G(INSRMC)) 0 ; send if no screening logic in file/table
  1. ;
  1. ; Initialization prior to calling screen
  1. S INSRCTL("INSRPROC")=INPROC ; function of calling process
  1. S:INTT INSRCTL("INTT")=INTT
  1. S:INDEST INSRCTL("INDEST")=INDEST
  1. S:INBPC INSRCTL("INBPC")=INBPC
  1. X INSRMC ; execute screening logic
  1. ;
  1. ; Examine screening results (in INSRDATA)
  1. ; Check:
  1. ; 1) suppress
  1. ; 2) broadcast, no list
  1. ; 3) broadcast, list exists - ck if Route ID for this destination
  1. ; matches INSRDATA("RouteID") returned by screen
  1. S INSUPRES=$S($G(INSRDATA):1,$D(INSRDATA)<10:0,1:$S($G(INDEST):$$FINDRID^INHUT5(.INSRDATA,INDEST),1:0))
  1. ; Log suppressions
  1. I INSUPRES S X=INPRI(INPRI) D LOG^INHUT6(+X,$P(X,U,2),$P(X,U,3),INUIF,$S($G(INUIF):1,1:0))
  1. Q INSUPRES
  1. ;
  1. LOG(INFN,INIEN,INSRMC,INUIF,INLOG) ; Log error message.
  1. ; Add entry in the UIF ACTIVITY LOG MULTIPLE.
  1. ; Used for identifying which screening code suppressed this entry.
  1. ; If INUIF is absent, or SR debug is on,
  1. ; log message will be in the IFE file only.
  1. ; INPUTS:
  1. ; INFN File number (Should be 4000, 4004, or 4005)
  1. ; INIEN IEN w/in file that was suppressed
  1. ; INSRMC SRMC Field number
  1. ; INUIF (opt) IEN of the Universal Interface File (Optional)
  1. ; INLOG (opt) Boolean: 0 Don't update status, 1: Update status
  1. ; INENVSDB (opt) Boolean: 0 no SR debug, 1: Site SR debug is turned on
  1. ; INSRCTL("INSRPROC") (opt) Environment variable letting me know
  1. ; which gis function is calling me
  1. ; INSRCTL("INDEST") (opt) For XMT, its part of ENT^INHE call. (Dest)
  1. ; INSRCTL("INBPC") (opt) For RCV, this is part of ENR^INHE call
  1. ; INSRCTL("INTT") (opt) For REP, this is part of ENO^INHE call
  1. ;
  1. ; OUTPUTS:
  1. ; INENVSDB Boolean: 0 no debug, 1: Site debug is turned on
  1. ;
  1. N X,Y,%,MSG
  1. S:'$D(INENVSDB) INENVSDB=$P($G(^INRHSITE(1,0)),"^",16)
  1. S INFN=+$G(INFN),INIEN=+$G(INIEN),INSRMC=+$G(INSRMC),INUIF=+$G(INUIF),INLOG=+$G(INLOG)
  1. ;
  1. S MSG=INFN_"^"_INIEN_"^"_INSRMC_"^"_INUIF_"^"_$G(INSRCTL("INDEST"))
  1. D:INENVSDB ; Use pointers only, unless in DEBUG mode.
  1. .S MSG="INVALID FILE NUMBER IN LOG ROUTINE"
  1. .S %=$G(^DIC(INFN,0,"GL")) D:$L(%) ;
  1. ..K MSG S MSG(1)="Suppressed at "_$O(^DD(INFN,0,"NM",""))_" file, "
  1. ..I $G(INSRCTL("INDEST")) S X="^INRHD("_(INSRCTL("INDEST"))_",0)" S:$D(@X)#2 MSG(5)=" for dest "_$P(@X,"^")
  1. ..S X=%_(INIEN)_",0)" S MSG(2)=$P($G(@X),"^")_" record, "
  1. ..S MSG(3)=$P($G(^DD(INFN,INSRMC,0)),"^")_" field, "
  1. ..S X=%_(INIEN)_","_(INSRMC)_")"
  1. ..S MSG(4)=" with code "_$G(@X)
  1. ;
  1. I 'INUIF!INENVSDB D
  1. .;File in IEF via INHE
  1. .I $G(INSRCTL("INSRPROC"))="XMT" D ENT^INHE(INUIF,$G(INSRCTL("INDEST")),.MSG) Q
  1. .I $G(INSRCTL("INSRPROC"))="REP" D ENO^INHE($G(INSRCTL("INTT")),INUIF,$G(INSRCTL("INDEST")),.MSG) Q
  1. .D ENR^INHE(+$G(INSRCTL("INBPC")),.MSG)
  1. ;
  1. Q:'INUIF
  1. ;
  1. ;File in UIF (ACTIVITY LOG MULTIPLE) via ULOG^INHU
  1. I 'INENVSDB K MSG D ULOG^INHU(INUIF,"X",.MSG,"",1) ;Update multiple.
  1. D:INENVSDB ULOG^INHU(INUIF,"X",.MSG,"",1) ;Update multiple w/ MSG
  1. D:INLOG ULOG^INHU(INUIF,"C") ; Update status.
  1. Q
  1. ;