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

LA7VIN.m

Go to the documentation of this file.
  1. LA7VIN ;VA/DALOI/JMC - Process Incoming Lab HL7 Messages ; Jan 12, 2005
  1. ;;5.2;AUTOMATED LAB INSTRUMENTS;**1031**;NOV 01, 1997
  1. ;
  1. ;;VA LA Patche(s): 46,67
  1. ;
  1. ; This routine processes incoming messages for various Lab HL7 configurations.
  1. Q
  1. ;
  1. EN ; Only one process should run at a time
  1. N LA76249,LA7I,LA7INTYP,LA7LOOP,LA7X
  1. ;
  1. L +^LAHM(62.48,"Z",LA76248):10
  1. E Q
  1. ;
  1. ; Setup DUZ array to 'non-human' user LRLAB,HL
  1. ; If user not found - send alert to G.LAB MESSAGING
  1. S LA7X=$$FIND1^DIC(200,"","OX","LRLAB,HL","B","")
  1. I LA7X<1 D Q
  1. . N MSG
  1. . S MSG="Lab Messaging - Unable to identify user 'LRLAB,HL' in NEW PERSON file"
  1. . D XQA^LA7UXQA(0,LA76248,0,0,MSG,"",0)
  1. D DUZ^XUP(LA7X)
  1. ;
  1. ; Determine interface type
  1. S LA7INTYP=+$P(^LAHM(62.48,LA76248,0),"^",9)
  1. ;
  1. ; main loop, LA7LOOP reset in GETIN, if no messages for 5 minutes (60x5) then quit
  1. F LA7LOOP=1:1:60 D Q:$G(ZTSTOP)
  1. . ; Check if task has been requested to stop
  1. . I $$S^%ZTLOAD("Idle - waiting for new messages to process") S ZTSTOP=1 Q
  1. . D GETIN H 5
  1. ;
  1. ; Release lock
  1. L -^LAHM(62.48,"Z",LA76248)
  1. ;
  1. ; Clean up taskman
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. ;
  1. ; Check TaskMan for scheduled lab option
  1. D CHECKTM
  1. ;
  1. K LA76248
  1. K CENUM,DPF,ECHOALL,ER,IDE,IDT,LALCT,LANM,LAZZ,LINK,LRTEC,NOW,RMK,T,TC,TP,TSK,WDT
  1. Q
  1. ;
  1. ;
  1. GETIN ; Check the incoming queue for messages and then call LA7VIN1 to
  1. ; process the message.
  1. ;
  1. ; Check incoming queue
  1. Q:'$O(^LAHM(62.49,"Q",LA76248,"IQ",0))
  1. ;
  1. ; Reset timeout counter
  1. S LA7LOOP=1
  1. ;
  1. ; Get lock on message, quit if still building, process message then release lock.
  1. F S LA76249=$O(^LAHM(62.49,"Q",LA76248,"IQ",0)) Q:'LA76249 D Q:$G(ZTSTOP)
  1. . ; Check if task has been requested to stop
  1. . I $$S^%ZTLOAD("Processing msg #"_LA76249) S ZTSTOP=1 Q
  1. . L +^LAHM(62.49,LA76249):1
  1. . I '$T H 5 Q
  1. . D NXTMSG^LA7VIN1
  1. . L -^LAHM(62.49,LA76249)
  1. ;
  1. K ^TMP("LA7TREE",$J)
  1. ;
  1. ; If point of care interface then task job(s) to process results in LAH.
  1. I LA7INTYP>19,LA7INTYP<30,$D(LA7INTYP("LWL")) D
  1. . I $G(ZTSTOP)=1 Q
  1. . S LA7I=0
  1. . F S LA7I=$O(LA7INTYP("LWL",LA7I)) Q:'LA7I D
  1. . . D QLAH(LA7I)
  1. . . K LA7INTYP("LWL",LA7I)
  1. ;
  1. Q
  1. ;
  1. ;
  1. QUE ; Call here to queue this processing routine to run in the background.
  1. ; Required variables are: LA76248 = pointer to configuration in 62.48
  1. ;
  1. N ZTDESC,ZTDTH,ZTIO,ZTSAVE,ZTRTN,ZTSK
  1. ;
  1. ; See if already running
  1. L +^LAHM(62.48,"Z",LA76248):1
  1. E Q
  1. ;
  1. S ZTRTN="EN^LA7VIN",ZTDTH=$H,ZTIO=""
  1. S ZTDESC="Processing Routine for "_$P(^LAHM(62.48,LA76248,0),"^")
  1. S ZTSAVE("LA76248")=LA76248
  1. D ^%ZTLOAD
  1. ;
  1. L -^LAHM(62.48,"Z",LA76248)
  1. ;
  1. Q
  1. ;
  1. ;
  1. 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
  1. ;
  1. N ZTDESC,ZTDTH,ZTIO,ZTSAVE,ZTRTN,ZTSK
  1. ;
  1. ; See if already running
  1. L +^LAH("Z",LWL):0
  1. E Q
  1. L -^LAH("Z",LWL)
  1. ;
  1. S ZTRTN="EN^LRVRPOC",ZTDTH=$H,ZTIO=""
  1. S ZTDESC="Result Processing for "_$P(^LRO(68.2,LWL,0),"^")
  1. S ZTSAVE("LRLL")=LWL
  1. D ^%ZTLOAD
  1. ;
  1. ;
  1. Q
  1. ;
  1. ;
  1. CHECKTM ; Check is LA7TASK NIGHTY is scheduled in TaskMan.
  1. ;
  1. N LA7TSK,LA7J,MSG,NOW,OK
  1. S (LA7TSK,OK)=0
  1. D OPTSTAT^XUTMOPT("LA7TASK NIGHTY",.LA7TSK)
  1. ;
  1. ; If scheduled check to see if for the future
  1. I LA7TSK>0 D
  1. . S LA7J=0,NOW=$$NOW^XLFDT
  1. . F S LA7J=$O(LA7TSK(LA7J)) Q:'LA7J I $P(LA7TSK(LA7J),"^",2)>NOW S OK=1 Q
  1. I OK Q
  1. ;
  1. ; Option is not scheduled - send alert to G.LAB MESSAGING
  1. S MSG="Lab Messaging - Option LA7TASK NIGHTY is not scheduled in TaskMan"
  1. D XQA^LA7UXQA(0,LA76248,0,0,MSG,"",0)
  1. Q