LA7VQIN ;VHA/DALOI/JMC - Process Incoming Lab HL7 Messages ;JUL 06, 2010 3:14 PM
;;5.2;AUTOMATED LAB INSTRUMENTS;**46,1027**;NOV 01, 1997;Build 9
; This routine processes incoming messages for various Lab HL7 configurations.
Q
;
EN ; Only one process should run at a time
N LA76249,LA7I,LA7INTYP,LA7LOOP
;
L +^LAHM(62.48,"Z",LA76248):10
E Q
;
; Determine interface type
S LA7INTYP=+$P(^LAHM(62.48,LA76248,0),"^",9)
;
; main loop, LA7LOOP reset in GETIN, if no messages for 5 minutes (60x5) then quit
F LA7LOOP=1:1:60 D GETIN H 5
;
; If point of care interface then task job(s) to process results in LAH.
I LA7INTYP=20,$D(LA7INTYP("LWL")) D
. S LA7I=0
. F S LA7I=$O(LA7INTYP("LWL",LA7I)) Q:'LA7I D QLAH(LA7I)
;
; Release lock
L -^LAHM(62.48,"Z",LA76248)
; Clean up taskman
I $D(ZTQUEUED) S ZTREQ="@"
K LA76248
K CENUM,DPF,ECHOALL,ER,IDE,IDT,LALCT,LANM,LAZZ,LINK,LRTEC,NOW,RMK,T,TC,TP,TSK,WDT
Q
;
;
GETIN ; Check the incoming queue for messages and then call LA7VIN1 to
; process the message.
;
; Check incoming queue
Q:'$O(^LAHM(62.49,"Q",LA76248,"IQ",0))
;
; Reset timeout counter
S LA7LOOP=1
;
; Get lock on message, quit if still building, process message then release lock.
F S LA76249=$O(^LAHM(62.49,"Q",LA76248,"IQ",0)) Q:'LA76249 D
. L +^LAHM(62.49,LA76249):1
. I '$T H 5 Q
. D NXTMSG^LA7VQIN1
. L -^LAHM(62.49,LA76249)
K ^TMP("LA7TREE",$J)
Q
;
;
QUE ; Call here to queue this processing routine to run in the background.
; Required variables are: LA76248 = pointer to configuration in 62.48
;
N ZTDESC,ZTDTH,ZTIO,ZTSAVE,ZTRTN,ZTSK
;
; See if already running
L +^LAHM(62.48,"Z",LA76248):1
E Q
;
S ZTRTN="EN^LA7VQIN",ZTDTH=$H,ZTIO=""
S ZTDESC="Processing Routine for "_$P(^LAHM(62.48,LA76248,0),"^")
S ZTSAVE("LA76248")=LA76248
D ^%ZTLOAD
;
L -^LAHM(62.48,"Z",LA76248)
;
Q
;
;
QLAH(LWL) ; Call here to queue result processing routine to run in the background.
; Call with LWL = pointer to loadlist in file #68.2
;
N ZTDESC,ZTDTH,ZTIO,ZTSAVE,ZTRTN,ZTSK
;
; See if already running
L +^LAH("Z",LWL):1
E Q
;
S ZTRTN="EN^LA7VIN",ZTDTH=$H,ZTIO=""
S ZTDESC="Result Processing for "_$P(^LRO(68.2,LWL,0),"^")
S ZTSAVE("LWL")=LWL
;D ^%ZTLOAD
;
L -^LAH("Z",LWL)
;
Q
LA7VQIN ;VHA/DALOI/JMC - Process Incoming Lab HL7 Messages ;JUL 06, 2010 3:14 PM
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;**46,1027**;NOV 01, 1997;Build 9
+2 ; This routine processes incoming messages for various Lab HL7 configurations.
+3 QUIT
+4 ;
EN ; Only one process should run at a time
+1 NEW LA76249,LA7I,LA7INTYP,LA7LOOP
+2 ;
+3 LOCK +^LAHM(62.48,"Z",LA76248):10
+4 IF '$TEST
QUIT
+5 ;
+6 ; Determine interface type
+7 SET LA7INTYP=+$PIECE(^LAHM(62.48,LA76248,0),"^",9)
+8 ;
+9 ; main loop, LA7LOOP reset in GETIN, if no messages for 5 minutes (60x5) then quit
+10 FOR LA7LOOP=1:1:60
DO GETIN
HANG 5
+11 ;
+12 ; If point of care interface then task job(s) to process results in LAH.
+13 IF LA7INTYP=20
IF $DATA(LA7INTYP("LWL"))
Begin DoDot:1
+14 SET LA7I=0
+15 FOR
SET LA7I=$ORDER(LA7INTYP("LWL",LA7I))
IF 'LA7I
QUIT
DO QLAH(LA7I)
End DoDot:1
+16 ;
+17 ; Release lock
+18 LOCK -^LAHM(62.48,"Z",LA76248)
+19 ; Clean up taskman
+20 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+21 KILL LA76248
+22 KILL CENUM,DPF,ECHOALL,ER,IDE,IDT,LALCT,LANM,LAZZ,LINK,LRTEC,NOW,RMK,T,TC,TP,TSK,WDT
+23 QUIT
+24 ;
+25 ;
GETIN ; Check the incoming queue for messages and then call LA7VIN1 to
+1 ; process the message.
+2 ;
+3 ; Check incoming queue
+4 IF '$ORDER(^LAHM(62.49,"Q",LA76248,"IQ",0))
QUIT
+5 ;
+6 ; Reset timeout counter
+7 SET LA7LOOP=1
+8 ;
+9 ; Get lock on message, quit if still building, process message then release lock.
+10 FOR
SET LA76249=$ORDER(^LAHM(62.49,"Q",LA76248,"IQ",0))
IF 'LA76249
QUIT
Begin DoDot:1
+11 LOCK +^LAHM(62.49,LA76249):1
+12 IF '$TEST
HANG 5
QUIT
+13 DO NXTMSG^LA7VQIN1
+14 LOCK -^LAHM(62.49,LA76249)
End DoDot:1
+15 KILL ^TMP("LA7TREE",$JOB)
+16 QUIT
+17 ;
+18 ;
QUE ; Call here to queue this processing routine to run in the background.
+1 ; Required variables are: LA76248 = pointer to configuration in 62.48
+2 ;
+3 NEW ZTDESC,ZTDTH,ZTIO,ZTSAVE,ZTRTN,ZTSK
+4 ;
+5 ; See if already running
+6 LOCK +^LAHM(62.48,"Z",LA76248):1
+7 IF '$TEST
QUIT
+8 ;
+9 SET ZTRTN="EN^LA7VQIN"
SET ZTDTH=$HOROLOG
SET ZTIO=""
+10 SET ZTDESC="Processing Routine for "_$PIECE(^LAHM(62.48,LA76248,0),"^")
+11 SET ZTSAVE("LA76248")=LA76248
+12 DO ^%ZTLOAD
+13 ;
+14 LOCK -^LAHM(62.48,"Z",LA76248)
+15 ;
+16 QUIT
+17 ;
+18 ;
QLAH(LWL) ; Call here to queue result processing routine to run in the background.
+1 ; Call with LWL = pointer to loadlist in file #68.2
+2 ;
+3 NEW ZTDESC,ZTDTH,ZTIO,ZTSAVE,ZTRTN,ZTSK
+4 ;
+5 ; See if already running
+6 LOCK +^LAH("Z",LWL):1
+7 IF '$TEST
QUIT
+8 ;
+9 SET ZTRTN="EN^LA7VIN"
SET ZTDTH=$HOROLOG
SET ZTIO=""
+10 SET ZTDESC="Result Processing for "_$PIECE(^LRO(68.2,LWL,0),"^")
+11 SET ZTSAVE("LWL")=LWL
+12 ;D ^%ZTLOAD
+13 ;
+14 LOCK -^LAH("Z",LWL)
+15 ;
+16 QUIT