RGFIACK ;ALB/CJM-PROCESS APPLICATION ACKNOWLEDGMENT ;08/27/99
;;1.0;CLINICAL INFO RESOURCE NETWORK;**5,13**;30 Apr 99
;
ACK ;
;Description: Process the application ack to the Facility Integration
;Message
;
;Input:
; HL7 variables must be defined
;Output: none
;Variables:
; FS - field seperator
; CS - component seperator
; CODE - returned error code
; MSG - error text returned
; TYPE - ack type (AA,ER)
; MSGID - HL7 msg id
; RGLOG - ien of entry in the CIRN HL7 Exception file
; ICN - Integrated Control Number
; DFN - patient DFN
; SITE - station # of site that sent the app ack
;
N FS,CS,QUIT,CODE,MSG,TYPE,MSGID,RGLOG,ICN,DFN,SITE
S FS=HL("FS")
S CS=$E(HL("ECH"),1)
S QUIT=0
K HLERR
;
X HLNEXT D Q:QUIT
.I (HLQUIT'>0) S HLERR="MISSING MSH SEGMENT",QUIT=1 Q
.I $P(HLNODE,FS)'["MSH" S HLERR="MISSING MSH SEGMENT",QUIT=1 Q
X HLNEXT D Q:QUIT
.I (HLQUIT'>0) S HLERR="MISSING MSA SEGMENT",QUIT=1 Q
.I $P(HLNODE,FS)'["MSA" S HLERR="MISSING MSA SEGMENT",QUIT=1 Q
.S TYPE=$P(HLNODE,FS,2)
.S MSGID=$P(HLNODE,FS,3)
.S MSG=$P(HLNODE,FS,4)
.S ICN=+$P(MSG,"ICN:",2)
.S DFN=$S(ICN:$$DFN^RGFIU(ICN),1:"")
.S SITE=$P(MSG,"From Station:",2),SITE=$P(SITE," ICN:")
.S CODE=$P($P(HLNODE,FS,7),CS,4)
I ($G(TYPE)["R"),$G(MSGID),$G(CODE) D
.N HLMTIEN
.S HLMTIEN=MSGID
.D EXC^RGFIU(CODE,"APPLICATION ACKNOWLEDGMENT TO MSGID: "_MSGID_" - "_MSG,DFN,MSGID,SITE)
.D STOP^RGHLLOG(1)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRGFIACK 1467 printed Dec 13, 2024@01:41:48 Page 2
RGFIACK ;ALB/CJM-PROCESS APPLICATION ACKNOWLEDGMENT ;08/27/99
+1 ;;1.0;CLINICAL INFO RESOURCE NETWORK;**5,13**;30 Apr 99
+2 ;
ACK ;
+1 ;Description: Process the application ack to the Facility Integration
+2 ;Message
+3 ;
+4 ;Input:
+5 ; HL7 variables must be defined
+6 ;Output: none
+7 ;Variables:
+8 ; FS - field seperator
+9 ; CS - component seperator
+10 ; CODE - returned error code
+11 ; MSG - error text returned
+12 ; TYPE - ack type (AA,ER)
+13 ; MSGID - HL7 msg id
+14 ; RGLOG - ien of entry in the CIRN HL7 Exception file
+15 ; ICN - Integrated Control Number
+16 ; DFN - patient DFN
+17 ; SITE - station # of site that sent the app ack
+18 ;
+19 NEW FS,CS,QUIT,CODE,MSG,TYPE,MSGID,RGLOG,ICN,DFN,SITE
+20 SET FS=HL("FS")
+21 SET CS=$EXTRACT(HL("ECH"),1)
+22 SET QUIT=0
+23 KILL HLERR
+24 ;
+25 XECUTE HLNEXT
Begin DoDot:1
+26 IF (HLQUIT'>0)
SET HLERR="MISSING MSH SEGMENT"
SET QUIT=1
QUIT
+27 IF $PIECE(HLNODE,FS)'["MSH"
SET HLERR="MISSING MSH SEGMENT"
SET QUIT=1
QUIT
End DoDot:1
if QUIT
QUIT
+28 XECUTE HLNEXT
Begin DoDot:1
+29 IF (HLQUIT'>0)
SET HLERR="MISSING MSA SEGMENT"
SET QUIT=1
QUIT
+30 IF $PIECE(HLNODE,FS)'["MSA"
SET HLERR="MISSING MSA SEGMENT"
SET QUIT=1
QUIT
+31 SET TYPE=$PIECE(HLNODE,FS,2)
+32 SET MSGID=$PIECE(HLNODE,FS,3)
+33 SET MSG=$PIECE(HLNODE,FS,4)
+34 SET ICN=+$PIECE(MSG,"ICN:",2)
+35 SET DFN=$SELECT(ICN:$$DFN^RGFIU(ICN),1:"")
+36 SET SITE=$PIECE(MSG,"From Station:",2)
SET SITE=$PIECE(SITE," ICN:")
+37 SET CODE=$PIECE($PIECE(HLNODE,FS,7),CS,4)
End DoDot:1
if QUIT
QUIT
+38 IF ($GET(TYPE)["R")
IF $GET(MSGID)
IF $GET(CODE)
Begin DoDot:1
+39 NEW HLMTIEN
+40 SET HLMTIEN=MSGID
+41 DO EXC^RGFIU(CODE,"APPLICATION ACKNOWLEDGMENT TO MSGID: "_MSGID_" - "_MSG,DFN,MSGID,SITE)
+42 DO STOP^RGHLLOG(1)
End DoDot:1
+43 QUIT