source: FOIAVistA/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7VIN.m@ 1328

Last change on this file since 1328 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.4 KB
Line 
1LA7VIN ;DALOI/JMC - Process Incoming Lab HL7 Messages ; Jan 12, 2005
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**46,67**;Sep 27, 1994
3 ; This routine processes incoming messages for various Lab HL7 configurations.
4 Q
5 ;
6EN ; Only one process should run at a time
7 N LA76249,LA7I,LA7INTYP,LA7LOOP,LA7X
8 ;
9 L +^LAHM(62.48,"Z",LA76248):10
10 E Q
11 ;
12 ; Setup DUZ array to 'non-human' user LRLAB,HL
13 ; If user not found - send alert to G.LAB MESSAGING
14 S LA7X=$$FIND1^DIC(200,"","OX","LRLAB,HL","B","")
15 I LA7X<1 D Q
16 . N MSG
17 . S MSG="Lab Messaging - Unable to identify user 'LRLAB,HL' in NEW PERSON file"
18 . D XQA^LA7UXQA(0,LA76248,0,0,MSG,"",0)
19 D DUZ^XUP(LA7X)
20 ;
21 ; Determine interface type
22 S LA7INTYP=+$P(^LAHM(62.48,LA76248,0),"^",9)
23 ;
24 ; main loop, LA7LOOP reset in GETIN, if no messages for 5 minutes (60x5) then quit
25 F LA7LOOP=1:1:60 D Q:$G(ZTSTOP)
26 . ; Check if task has been requested to stop
27 . I $$S^%ZTLOAD("Idle - waiting for new messages to process") S ZTSTOP=1 Q
28 . D GETIN H 5
29 ;
30 ; Release lock
31 L -^LAHM(62.48,"Z",LA76248)
32 ;
33 ; Clean up taskman
34 I $D(ZTQUEUED) S ZTREQ="@"
35 ;
36 ; Check TaskMan for scheduled lab option
37 D CHECKTM
38 ;
39 K LA76248
40 K CENUM,DPF,ECHOALL,ER,IDE,IDT,LALCT,LANM,LAZZ,LINK,LRTEC,NOW,RMK,T,TC,TP,TSK,WDT
41 Q
42 ;
43 ;
44GETIN ; Check the incoming queue for messages and then call LA7VIN1 to
45 ; process the message.
46 ;
47 ; Check incoming queue
48 Q:'$O(^LAHM(62.49,"Q",LA76248,"IQ",0))
49 ;
50 ; Reset timeout counter
51 S LA7LOOP=1
52 ;
53 ; Get lock on message, quit if still building, process message then release lock.
54 F S LA76249=$O(^LAHM(62.49,"Q",LA76248,"IQ",0)) Q:'LA76249 D Q:$G(ZTSTOP)
55 . ; Check if task has been requested to stop
56 . I $$S^%ZTLOAD("Processing msg #"_LA76249) S ZTSTOP=1 Q
57 . L +^LAHM(62.49,LA76249):1
58 . I '$T H 5 Q
59 . D NXTMSG^LA7VIN1
60 . L -^LAHM(62.49,LA76249)
61 ;
62 K ^TMP("LA7TREE",$J)
63 ;
64 ; If point of care interface then task job(s) to process results in LAH.
65 I LA7INTYP>19,LA7INTYP<30,$D(LA7INTYP("LWL")) D
66 . I $G(ZTSTOP)=1 Q
67 . S LA7I=0
68 . F S LA7I=$O(LA7INTYP("LWL",LA7I)) Q:'LA7I D
69 . . D QLAH(LA7I)
70 . . K LA7INTYP("LWL",LA7I)
71 ;
72 Q
73 ;
74 ;
75QUE ; Call here to queue this processing routine to run in the background.
76 ; Required variables are: LA76248 = pointer to configuration in 62.48
77 ;
78 N ZTDESC,ZTDTH,ZTIO,ZTSAVE,ZTRTN,ZTSK
79 ;
80 ; See if already running
81 L +^LAHM(62.48,"Z",LA76248):1
82 E Q
83 ;
84 S ZTRTN="EN^LA7VIN",ZTDTH=$H,ZTIO=""
85 S ZTDESC="Processing Routine for "_$P(^LAHM(62.48,LA76248,0),"^")
86 S ZTSAVE("LA76248")=LA76248
87 D ^%ZTLOAD
88 ;
89 L -^LAHM(62.48,"Z",LA76248)
90 ;
91 Q
92 ;
93 ;
94QLAH(LWL) ; Call here to queue result processing routine to run in the background.
95 ; Call with LWL = pointer to loadlist in file #68.2
96 ;
97 N ZTDESC,ZTDTH,ZTIO,ZTSAVE,ZTRTN,ZTSK
98 ;
99 ; See if already running
100 L +^LAH("Z",LWL):0
101 E Q
102 L -^LAH("Z",LWL)
103 ;
104 S ZTRTN="EN^LRVRPOC",ZTDTH=$H,ZTIO=""
105 S ZTDESC="Result Processing for "_$P(^LRO(68.2,LWL,0),"^")
106 S ZTSAVE("LRLL")=LWL
107 D ^%ZTLOAD
108 ;
109 ;
110 Q
111 ;
112 ;
113CHECKTM ; Check is LA7TASK NIGHTY is scheduled in TaskMan.
114 ;
115 N LA7TSK,LA7J,MSG,NOW,OK
116 S (LA7TSK,OK)=0
117 D OPTSTAT^XUTMOPT("LA7TASK NIGHTY",.LA7TSK)
118 ;
119 ; If scheduled check to see if for the future
120 I LA7TSK>0 D
121 . S LA7J=0,NOW=$$NOW^XLFDT
122 . F S LA7J=$O(LA7TSK(LA7J)) Q:'LA7J I $P(LA7TSK(LA7J),"^",2)>NOW S OK=1 Q
123 I OK Q
124 ;
125 ; Option is not scheduled - send alert to G.LAB MESSAGING
126 S MSG="Lab Messaging - Option LA7TASK NIGHTY is not scheduled in TaskMan"
127 D XQA^LA7UXQA(0,LA76248,0,0,MSG,"",0)
128 Q
Note: See TracBrowser for help on using the repository browser.