SRHLMFN ;B'HAM ISC/DLR - Surgery Interface Master File Notification Message ; [ 05/19/98 9:31 AM ]
;;3.0; Surgery ;**41**;24 Jun 93
; Per VHA Directive 10-93-142, this routine SHOULD NOT be modified.
MSG(SRTBL,FEC,REC,SRENT) ;sends MFN message
;MFN - Master File Notification Message
; SRTBL - table entry consisting of <name><file><field>
; FEC - file event code (MAD,MDC,MAC,MDL)
; REC - record event code (REP,UPD)
; SRENT - (IEN) internal entry number of the record to be passed
;
N HLCOMP,HLREP,HLSUB,ID,FIELD,FILE,SRI,XX
S HLDAP=$O(^HL(771,"B","SR SURGERY",0)) Q:$G(HLDAP)=""
Q:$P($G(^HL(771,HLDAP,0)),U,2)'="a"
D INIT
S SRI=1,HLCOMP=$E(HL("ECH"),1),HLREP=$E(HL("ECH"),2),HLSUB=$E(HL("ECH"),4)
S ID=$P(SRTBL,U),FIELD=$P(SRTBL,U,3),FILE=$P(SRTBL,U,2)
D MFI^SRHLUO3(.SRI,ID,FEC,FILE,SRENT)
D MFE^SRHLUO3(.SRI,REC,FILE,FIELD,SRENT)
D GEN
EXIT W !,REC," Sending HL7 Master File ",$S(REC="MAD":"addition",REC="MDC":"deactivate",REC="MAC":"Reactivation",REC="MDL":"Deletion",1:"")," message" F XX=1:1:5 W "."
Q
INIT ;V. 1.6 interface
;EID - IEN of event protocol
;HL - array of output parameters
;INT - only for VISTA-to-VISTA message exchange
;SRET - Surgery Event Trigger
I $P(SRTBL,U,2)=200 S SRET="SR Staff Master File Notification"
E S SRET="SR Other Master File Notification"
S EID=$O(^ORD(101,"B",SRET,0)),HL="HL",INT=0
D INIT^HLFNC2(EID,.HL,INT) S HLCOMP=$E(HL("ECH"),1),HLREP=$E(HL("ECH"),2),HLSUB=$E(HL("ECH"),4),HLFS=HL("FS"),HLQ=HL("Q"),HLECH=HL("ECH")
Q
GEN ;generate the message
;HLEID - IEN of event protocol
;HLARYTYP - acknowledgement array (see V. 1.6 HL7 doc)
;HLFORMAT - is HLMA is pre-formatted HL7 form
;HLMTIEN - IEN in 772
;HLRESLT - message ID and/or the error message (for output)
;HLP("CONTPTR") - continuation pointer field value (not used)
;HLP("PRIORITY") - priority field value (not used)
;HLP("SECURITY") - security information (not used)
S HLEID=EID,HLARYTYP="GM",HLFORMAT=1,HLMTIEN="",HLRESLT=""
D GENERATE^HLMA(HLEID,HLARYTYP,HLFORMAT,.HLRESLT,HLMTIEN,.HLP)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSRHLMFN 2082 printed Dec 13, 2024@02:39:15 Page 2
SRHLMFN ;B'HAM ISC/DLR - Surgery Interface Master File Notification Message ; [ 05/19/98 9:31 AM ]
+1 ;;3.0; Surgery ;**41**;24 Jun 93
+2 ; Per VHA Directive 10-93-142, this routine SHOULD NOT be modified.
MSG(SRTBL,FEC,REC,SRENT) ;sends MFN message
+1 ;MFN - Master File Notification Message
+2 ; SRTBL - table entry consisting of <name><file><field>
+3 ; FEC - file event code (MAD,MDC,MAC,MDL)
+4 ; REC - record event code (REP,UPD)
+5 ; SRENT - (IEN) internal entry number of the record to be passed
+6 ;
+7 NEW HLCOMP,HLREP,HLSUB,ID,FIELD,FILE,SRI,XX
+8 SET HLDAP=$ORDER(^HL(771,"B","SR SURGERY",0))
if $GET(HLDAP)=""
QUIT
+9 if $PIECE($GET(^HL(771,HLDAP,0)),U,2)'="a"
QUIT
+10 DO INIT
+11 SET SRI=1
SET HLCOMP=$EXTRACT(HL("ECH"),1)
SET HLREP=$EXTRACT(HL("ECH"),2)
SET HLSUB=$EXTRACT(HL("ECH"),4)
+12 SET ID=$PIECE(SRTBL,U)
SET FIELD=$PIECE(SRTBL,U,3)
SET FILE=$PIECE(SRTBL,U,2)
+13 DO MFI^SRHLUO3(.SRI,ID,FEC,FILE,SRENT)
+14 DO MFE^SRHLUO3(.SRI,REC,FILE,FIELD,SRENT)
+15 DO GEN
EXIT WRITE !,REC," Sending HL7 Master File ",$SELECT(REC="MAD":"addition",REC="MDC":"deactivate",REC="MAC":"Reactivation",REC="MDL":"Deletion",1:"")," message"
FOR XX=1:1:5
WRITE "."
+1 QUIT
INIT ;V. 1.6 interface
+1 ;EID - IEN of event protocol
+2 ;HL - array of output parameters
+3 ;INT - only for VISTA-to-VISTA message exchange
+4 ;SRET - Surgery Event Trigger
+5 IF $PIECE(SRTBL,U,2)=200
SET SRET="SR Staff Master File Notification"
+6 IF '$TEST
SET SRET="SR Other Master File Notification"
+7 SET EID=$ORDER(^ORD(101,"B",SRET,0))
SET HL="HL"
SET INT=0
+8 DO INIT^HLFNC2(EID,.HL,INT)
SET HLCOMP=$EXTRACT(HL("ECH"),1)
SET HLREP=$EXTRACT(HL("ECH"),2)
SET HLSUB=$EXTRACT(HL("ECH"),4)
SET HLFS=HL("FS")
SET HLQ=HL("Q")
SET HLECH=HL("ECH")
+9 QUIT
GEN ;generate the message
+1 ;HLEID - IEN of event protocol
+2 ;HLARYTYP - acknowledgement array (see V. 1.6 HL7 doc)
+3 ;HLFORMAT - is HLMA is pre-formatted HL7 form
+4 ;HLMTIEN - IEN in 772
+5 ;HLRESLT - message ID and/or the error message (for output)
+6 ;HLP("CONTPTR") - continuation pointer field value (not used)
+7 ;HLP("PRIORITY") - priority field value (not used)
+8 ;HLP("SECURITY") - security information (not used)
+9 SET HLEID=EID
SET HLARYTYP="GM"
SET HLFORMAT=1
SET HLMTIEN=""
SET HLRESLT=""
+10 DO GENERATE^HLMA(HLEID,HLARYTYP,HLFORMAT,.HLRESLT,HLMTIEN,.HLP)
+11 QUIT