VDEFREQ1 ;INTEGIC/AM & BPOIFO/JG - VDEF Request Processor 2; 21 Dec 2004 11:24 AM
;;1.00;VDEF;;Dec 17, 2004
;Per VHA Directive 2004-038, this routine should not be modified.
;
; IA's: #4316 - Lookup to file #869.3
;
Q ; No bozos
;
; Generate HL7 message
GENERATE(NVPIEN,HLA,HLCS,IEN577,SUBT,DSTPROT,DSTTYP,ZTSTOP,VDEFHL,DYNAMIC) ;
N CNT,ARYTYP,HLL,II,VDEFOPT,VDEFRES,EXTPRG
;
; Build the HLL("LINKS") array for VistA HL7 Dynamic Addressing from
; the DYNAMIC array
F II=0:0 S II=$O(DYNAMIC(II)) Q:'II D
. N SUB S SUB=$G(DYNAMIC(II,0)) I SUB="" Q
. S HLL("LINKS",SUB)=$G(DYNAMIC(II,1))
;
; Set up control part of MSH for VistA HL7
S VDEFOPT("CONTPTR")=HLCS_HLCS_HLCS_SUBT
;
; Check to see if message extraction is active for this event
S EXTPRG=$$GET1^DIQ(577,IEN577_",",.3) S:EXTPRG="" EXTPRG="INACTIVE"
I EXTPRG="INACTIVE" D ERR^VDEFREQ("VDEF Event is not active") S ZTSTOP=1 Q
;
; Call the extraction program as a function and quit if error returned (ZTSTOP)
S ZTSTOP=0,@("ARYTYP=$$EN^"_EXTPRG_"(IEN577,NVPIEN,DSTTYP,.HLA,VDEFOPT(""CONTPTR""))")
K OUT Q:ZTSTOP'=0
;
; Send to VistA HL7, stop processing if error from HL7
D GENERATE^HLMA(DSTPROT,$P(ARYTYP,U,1),1,.VDEFRES)
I $P($G(VDEFRES),U,2) D ERR^VDEFREQ("VistA HL7 Error: "_$P(VDEFRES,U,3)) S ZTSTOP=2 Q
;
; Update date/time message created
D NOW^%DTC S FDA(1,579.31,IENS,.1)=% D FILE^DIE("","FDA(1)","ERR(1)") K FDA
I 'ZTSTOP,'$$S^%ZTLOAD(),$$GET1^DIQ(579.3,QIEN_",",.09,"I")'="S" Q
S ZTSTOP=1
Q
;
; Update statue of request
STATUS(IENS,STATUS) ;
; If the status is to be changed to "P"rocessed, update related DTS
N FDA I STATUS="P" D NOW^%DTC S FDA(1,579.31,IENS,.13)=%
S FDA(1,579.31,IENS,.02)=STATUS D FILE^DIE("","FDA(1)","ERR(1)")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVDEFREQ1 1786 printed Dec 13, 2024@02:43:58 Page 2
VDEFREQ1 ;INTEGIC/AM & BPOIFO/JG - VDEF Request Processor 2; 21 Dec 2004 11:24 AM
+1 ;;1.00;VDEF;;Dec 17, 2004
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 ; IA's: #4316 - Lookup to file #869.3
+5 ;
+6 ; No bozos
QUIT
+7 ;
+8 ; Generate HL7 message
GENERATE(NVPIEN,HLA,HLCS,IEN577,SUBT,DSTPROT,DSTTYP,ZTSTOP,VDEFHL,DYNAMIC) ;
+1 NEW CNT,ARYTYP,HLL,II,VDEFOPT,VDEFRES,EXTPRG
+2 ;
+3 ; Build the HLL("LINKS") array for VistA HL7 Dynamic Addressing from
+4 ; the DYNAMIC array
+5 FOR II=0:0
SET II=$ORDER(DYNAMIC(II))
if 'II
QUIT
Begin DoDot:1
+6 NEW SUB
SET SUB=$GET(DYNAMIC(II,0))
IF SUB=""
QUIT
+7 SET HLL("LINKS",SUB)=$GET(DYNAMIC(II,1))
End DoDot:1
+8 ;
+9 ; Set up control part of MSH for VistA HL7
+10 SET VDEFOPT("CONTPTR")=HLCS_HLCS_HLCS_SUBT
+11 ;
+12 ; Check to see if message extraction is active for this event
+13 SET EXTPRG=$$GET1^DIQ(577,IEN577_",",.3)
if EXTPRG=""
SET EXTPRG="INACTIVE"
+14 IF EXTPRG="INACTIVE"
DO ERR^VDEFREQ("VDEF Event is not active")
SET ZTSTOP=1
QUIT
+15 ;
+16 ; Call the extraction program as a function and quit if error returned (ZTSTOP)
+17 SET ZTSTOP=0
SET @("ARYTYP=$$EN^"_EXTPRG_"(IEN577,NVPIEN,DSTTYP,.HLA,VDEFOPT(""CONTPTR""))")
+18 KILL OUT
if ZTSTOP'=0
QUIT
+19 ;
+20 ; Send to VistA HL7, stop processing if error from HL7
+21 DO GENERATE^HLMA(DSTPROT,$PIECE(ARYTYP,U,1),1,.VDEFRES)
+22 IF $PIECE($GET(VDEFRES),U,2)
DO ERR^VDEFREQ("VistA HL7 Error: "_$PIECE(VDEFRES,U,3))
SET ZTSTOP=2
QUIT
+23 ;
+24 ; Update date/time message created
+25 DO NOW^%DTC
SET FDA(1,579.31,IENS,.1)=%
DO FILE^DIE("","FDA(1)","ERR(1)")
KILL FDA
+26 IF 'ZTSTOP
IF '$$S^%ZTLOAD()
IF $$GET1^DIQ(579.3,QIEN_",",.09,"I")'="S"
QUIT
+27 SET ZTSTOP=1
+28 QUIT
+29 ;
+30 ; Update statue of request
STATUS(IENS,STATUS) ;
+1 ; If the status is to be changed to "P"rocessed, update related DTS
+2 NEW FDA
IF STATUS="P"
DO NOW^%DTC
SET FDA(1,579.31,IENS,.13)=%
+3 SET FDA(1,579.31,IENS,.02)=STATUS
DO FILE^DIE("","FDA(1)","ERR(1)")
+4 QUIT