| 1 | SRHLMFN ;B'HAM ISC/DLR - Surgery Interface Master File Notification Message ; [ 05/19/98  9:31 AM ]
 | 
|---|
| 2 |  ;;3.0; Surgery ;**41**;24 Jun 93
 | 
|---|
| 3 |  ; Per VHA Directive 10-93-142, this routine SHOULD NOT be modified.
 | 
|---|
| 4 | MSG(SRTBL,FEC,REC,SRENT) ;sends MFN message
 | 
|---|
| 5 |  ;MFN - Master File Notification Message
 | 
|---|
| 6 |  ; SRTBL - table entry consisting of <name><file><field>
 | 
|---|
| 7 |  ; FEC   - file event code (MAD,MDC,MAC,MDL)
 | 
|---|
| 8 |  ; REC   - record event code (REP,UPD)
 | 
|---|
| 9 |  ; SRENT - (IEN) internal entry number of the record to be passed
 | 
|---|
| 10 |  ;
 | 
|---|
| 11 |  N HLCOMP,HLREP,HLSUB,ID,FIELD,FILE,SRI,XX
 | 
|---|
| 12 |  S HLDAP=$O(^HL(771,"B","SR SURGERY",0)) Q:$G(HLDAP)=""
 | 
|---|
| 13 |  Q:$P($G(^HL(771,HLDAP,0)),U,2)'="a"
 | 
|---|
| 14 |  D INIT
 | 
|---|
| 15 |  S SRI=1,HLCOMP=$E(HL("ECH"),1),HLREP=$E(HL("ECH"),2),HLSUB=$E(HL("ECH"),4)
 | 
|---|
| 16 |  S ID=$P(SRTBL,U),FIELD=$P(SRTBL,U,3),FILE=$P(SRTBL,U,2)
 | 
|---|
| 17 |  D MFI^SRHLUO3(.SRI,ID,FEC,FILE,SRENT)
 | 
|---|
| 18 |  D MFE^SRHLUO3(.SRI,REC,FILE,FIELD,SRENT)
 | 
|---|
| 19 |  D GEN
 | 
|---|
| 20 | 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 "."
 | 
|---|
| 21 |  Q
 | 
|---|
| 22 | INIT ;V. 1.6 interface
 | 
|---|
| 23 |  ;EID - IEN of event protocol
 | 
|---|
| 24 |  ;HL - array of output parameters
 | 
|---|
| 25 |  ;INT - only for VISTA-to-VISTA message exchange
 | 
|---|
| 26 |  ;SRET - Surgery Event Trigger
 | 
|---|
| 27 |  I $P(SRTBL,U,2)=200 S SRET="SR Staff Master File Notification"
 | 
|---|
| 28 |  E  S SRET="SR Other Master File Notification"
 | 
|---|
| 29 |  S EID=$O(^ORD(101,"B",SRET,0)),HL="HL",INT=0
 | 
|---|
| 30 |  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")
 | 
|---|
| 31 |  Q
 | 
|---|
| 32 | GEN ;generate the message
 | 
|---|
| 33 |  ;HLEID - IEN of event protocol
 | 
|---|
| 34 |  ;HLARYTYP - acknowledgement array (see V. 1.6 HL7 doc)
 | 
|---|
| 35 |  ;HLFORMAT - is HLMA is pre-formatted HL7 form
 | 
|---|
| 36 |  ;HLMTIEN - IEN in 772
 | 
|---|
| 37 |  ;HLRESLT - message ID and/or the error message (for output)
 | 
|---|
| 38 |  ;HLP("CONTPTR") - continuation pointer field value (not used)
 | 
|---|
| 39 |  ;HLP("PRIORITY") - priority field value (not used)
 | 
|---|
| 40 |  ;HLP("SECURITY") - security information (not used)
 | 
|---|
| 41 |  S HLEID=EID,HLARYTYP="GM",HLFORMAT=1,HLMTIEN="",HLRESLT=""
 | 
|---|
| 42 |  D GENERATE^HLMA(HLEID,HLARYTYP,HLFORMAT,.HLRESLT,HLMTIEN,.HLP)
 | 
|---|
| 43 |  Q
 | 
|---|