| 1 | MHVRQI ;WAS/GPM - Request Manager Immediate Mode ; [8/22/05 6:19pm]
 | 
|---|
| 2 |  ;;1.0;My HealtheVet;;Aug 23, 2005
 | 
|---|
| 3 |  ;;Per VHA Directive 2004-038, this routine should not be modified.
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 |  ;
 | 
|---|
| 6 | REALTIME(REQ,XMT,HL) ; Manage real time requests
 | 
|---|
| 7 |  ;
 | 
|---|
| 8 |  ;  It is assumed no ROI logging or checking is needed for real time
 | 
|---|
| 9 |  ; request.
 | 
|---|
| 10 |  ;
 | 
|---|
| 11 |  ;  Triage, execute/extract and respond to real time requests and
 | 
|---|
| 12 |  ; queries.  If the request is rejected (blocked, or doesn't support
 | 
|---|
| 13 |  ; real time access), send a negative acknowledgement, otherwise call
 | 
|---|
| 14 |  ; the execute/extraction routine.  If there are no errors transmit
 | 
|---|
| 15 |  ; the results, send a negative acknowledgement if there are errors.
 | 
|---|
| 16 |  ;
 | 
|---|
| 17 |  ; Input:
 | 
|---|
| 18 |  ;      REQ - Parsed query and query paramters
 | 
|---|
| 19 |  ;      XMT - Transmission parameters
 | 
|---|
| 20 |  ;       HL - HL7 package array variable
 | 
|---|
| 21 |  ;
 | 
|---|
| 22 |  ; Output:
 | 
|---|
| 23 |  ;      Extract information and respond to query
 | 
|---|
| 24 |  ;
 | 
|---|
| 25 |  N ERR,DATAROOT
 | 
|---|
| 26 |  S DATAROOT="^TMP(""MHVEXTRACT"",$J,"_REQ("TYPE")_")"
 | 
|---|
| 27 |  S ERR=""
 | 
|---|
| 28 |  ;
 | 
|---|
| 29 |  D LOG^MHV7U("REAL TIME","BEGIN","S",0)
 | 
|---|
| 30 |  ;
 | 
|---|
| 31 |  I $$REJECT(.REQ,.ERR) D  Q
 | 
|---|
| 32 |  . D LOG^MHV7U("REQUEST CHECK","REJECT^"_ERR,"S",0)
 | 
|---|
| 33 |  . D XMIT^MHV7T(.REQ,.XMT,ERR,"",.HL)
 | 
|---|
| 34 |  D LOG^MHV7U("REQUEST CHECK","PROCESS","S",0)
 | 
|---|
| 35 |  ;
 | 
|---|
| 36 |  I '$$EXECUTE(.REQ,.ERR,DATAROOT) D  Q
 | 
|---|
| 37 |  . D LOG^MHV7U("EXECUTE","ERROR^"_ERR,"S",0)
 | 
|---|
| 38 |  . D XMIT^MHV7T(.REQ,.XMT,ERR,DATAROOT,.HL)
 | 
|---|
| 39 |  D LOG^MHV7U("EXECUTE","COMPLETE","S",0)
 | 
|---|
| 40 |  ;
 | 
|---|
| 41 |  D XMIT^MHV7T(.REQ,.XMT,ERR,DATAROOT,.HL)
 | 
|---|
| 42 |  K @DATAROOT
 | 
|---|
| 43 |  ;
 | 
|---|
| 44 |  D LOG^MHV7U("REAL TIME","END","S",0)
 | 
|---|
| 45 |  ;
 | 
|---|
| 46 |  Q
 | 
|---|
| 47 |  ;
 | 
|---|
| 48 | REJECT(REQ,ERR) ;Check to see if request can be processed
 | 
|---|
| 49 |  S ERR=""
 | 
|---|
| 50 |  I REQ("BLOCKED") D  Q 1
 | 
|---|
| 51 |  . S ERR="^207^AR^Request Type Blocked by Site"
 | 
|---|
| 52 |  . I $D(REQ("QPD")) S ERR="QPD^1^5"_ERR    ;Its a query flag the QPD
 | 
|---|
| 53 |  . E  S ERR="MSH^1^9"_ERR
 | 
|---|
| 54 |  . Q
 | 
|---|
| 55 |  I 'REQ("REALTIME") D  Q 1
 | 
|---|
| 56 |  . S ERR="^207^AR^Real Time Calls Not Supported By Request Type"
 | 
|---|
| 57 |  . I $D(REQ("QPD")) S ERR="RCP^1^1"_ERR    ;Its a query flag the RCP
 | 
|---|
| 58 |  . E  S ERR="MSH^1^9"_ERR
 | 
|---|
| 59 |  . Q
 | 
|---|
| 60 |  Q 0
 | 
|---|
| 61 |  ;
 | 
|---|
| 62 | EXECUTE(REQ,ERR,DATAROOT) ;Execute action or extraction
 | 
|---|
| 63 |  ;Calls the execute routine for this request type
 | 
|---|
| 64 |  ;For queries this is the extraction routine
 | 
|---|
| 65 |  ;Parameters can be passed on REQ
 | 
|---|
| 66 |  ;Errors are passed on ERR
 | 
|---|
| 67 |  ;DATAROOT is the name holding the data, can be local or global
 | 
|---|
| 68 |  S ERR=""
 | 
|---|
| 69 |  D @(REQ("EXECUTE")_"(.REQ,.ERR,DATAROOT)")
 | 
|---|
| 70 |  I ERR D  Q 0
 | 
|---|
| 71 |  . S ERR="^207^AR^"_$P(ERR,"^",2)
 | 
|---|
| 72 |  . I $D(REQ("QPD")) S ERR="QPD^1^5"_ERR    ;Its a query flag the QPD
 | 
|---|
| 73 |  . E  S ERR="MSH^1^9"_ERR
 | 
|---|
| 74 |  . Q
 | 
|---|
| 75 |  Q 1
 | 
|---|
| 76 |  ;
 | 
|---|