LA7VMSG ;DALOI/JMC - LAB ORU (Observation Result) message builder ;08/12/13 15:12
;;5.2;AUTOMATED LAB INSTRUMENTS;**27,50,56,46,64,74,80**;Sep 27, 1994;Build 19
;
ORU ; Bleed the ORU (Observation Result) message queue
; Tasked by LA7SRR, LRCAPV2, LRU
;
N LA7MTYP
S LA7MTYP="ORU"
D START^LA7VMSG1
;
Q
;
ORR ; Bleed the ORR (Order Response) message queue
; Called by LRWLST12
;
N LA7MTYP
S LA7MTYP="ORR"
;D START^LA7VMSG1
;
Q
;
;
SET(LRUID,SITE,RUID,SITEN,ORD,LRNLT,LRIDT,LRSS,LRDFN,ORDT,LA7VDB,LA7MTYP) ; adds entries to LA7V QUEUE file
; Called by LA7SRR, LRVER3, LRWLST12
; variable list
; LRUID - Host Unique ID from the local ACCESSION file (#68)
; SITE - remote sites IEN in INSTITUTION file (#4)
; RUID - Remote sites Unique ID from ACCESSION file (#68)
; SITEN - Primary site number of remote site ($$SITE^VASITE)
; ORD - Free text ordered test name from WKLD CODE file (#64)
; LRNLT - National Laboratory test code from WKLD CODE file (#64)
; LRIDT - Inverse date/time (accession date/time)
; LRSS - test subscript defined in LABORATORY TEST file (#60)
; LRDFN - IEN in LAB DATA file (#63)
; ORDT - Order date
; LA7VDB - <opt><byref> Chemistry results or database section
; for MI, SP, CY, EM subscripts
; ex. glucose LA7VDB(2)=LR NODE
; LA7VDB(2,1)="C" (corrected results)
; MI: LA7VDB(File #64 Field #63)=""
; SP: LA7VDB("88515.0000")="" CY: LA7VDB("88593.0000")=""
; EM: LA7VDB("88597.0000")="" AU: LA7VDB("88533.0000")=""
; LA7MTYP (Optional) - Message Type (ORU or ORR) defaults to ORU
;
N FDA,LA76248,LA76249,LA7DT,LA7FACID,LA7ERR,LA7RSITE,LA7Y,LAHLSTAT,PORD,PORT,RSITE
;
S LA7ERR=0
I $G(LA7MTYP)="" S LA7MTYP="ORU"
; Currently not building ORR when accessioning - JMC/7/11/00
I LA7MTYP="ORR" Q
;
; Retrieve facility id (VA=station number, DoD=DMIS code, other=local site assigned id)
S LA7FACID=$$RETFACID^LA7VHLU2(SITEN,2,1),LA76248=0
S LA7RSITE="LA7V COLLECTION "_LA7FACID
S LA76248=$O(^LAHM(62.48,"B",LA7RSITE,0))
; No entry in 62.48 - *** Need to add error logging ****
I 'LA76248 Q
I '$P(^LAHM(62.48,LA76248,0),"^",3) Q ; not active
;
;
; add check here to see if agency associated with site (SITE) is enabled for this subscript;CKA 6/11
S LAHLSTAT=$$HLSTATUS("ORU",SITE,LRSS)
I 'LAHLSTAT Q
;
; Create new outgoing entry in 62.49
S LA76249=$$INIT6249^LA7VHLU
I LA76249<1 D Q
. ; Log entry creation error
;
; Check/validate parameters before storing
; If error store but flag entry with error status.
D CHKACC
;
; File data
S FDA(1,62.49,LA76249_",",1)="O"
S FDA(1,62.49,LA76249_",",.5)=LA76248
S FDA(1,62.49,LA76249_",",2)=$S(LA7ERR:"E",1:"P")
S FDA(1,62.49,LA76249_",",5)=LA7RSITE_"-O-"_RUID
S FDA(1,62.49,LA76249_",",108)=LA7MTYP
S FDA(1,62.49,LA76249_",",151)=LRUID
S FDA(1,62.49,LA76249_",",152)=SITEN
S FDA(1,62.49,LA76249_",",153)=RUID
S FDA(1,62.49,LA76249_",",154)=ORD
S FDA(1,62.49,LA76249_",",155)=LRNLT
S FDA(1,62.49,LA76249_",",156)=LRIDT
S FDA(1,62.49,LA76249_",",157)=LRSS
S FDA(1,62.49,LA76249_",",158)=LRDFN
S FDA(1,62.49,LA76249_",",159)=ORDT
;
D FILE^DIE("","FDA(1)","LA7ERR(1)")
D CLEAN^DILF
;
; Add test to order
S LA7Y=0
F S LA7Y=$O(LA7VDB(LA7Y)) Q:'LA7Y D
. N FDAIEN
. S FDA(2,62.49162,"+2,"_LA76249_",",.01)=LA7Y
. I $G(LA7VDB(LA7Y,1))="C" S FDA(2,62.49162,"+2,"_LA76249_",",.02)="C"
. S FDAIEN(1)=LA76249
. D UPDATE^DIE("","FDA(2)","FDAIEN","LA7ERR(2)")
. D CLEAN^DILF
;
; Check for date report completed.
I '$$OK2SEND^LA7SRR D CREATE^LA7LOG(122)
;
; Release lock on entry.
L -^LAHM(62.49,LA76249)
Q
;
;
MIAP(LRAA,LRAD,LRAN,LR60,LRDFN,LRSS,LRIDT,LRODT) ; Makes MI/AP calls to send results to LA7V QUEUE
;
; Call with LRAA = accession area IEN
; LRAD = accession date (FM format)
; LRAN = accession number
; LR60 = file #60 test IEN
; LRDFN = IEN in LAB DATA file (#63)
; LRSS = test subscript defined in LABORATORY TEST file (#60)
; LRIDT = Inverse date/time (accession date/time)
; LRORDT = Order date (FM format)
;
; Called by LRVR0, LRMIUT, LRVRAP4
;
N LA764,LA76248,LA76249,LA7NLT,LA7NLTN,LA7ONQUE,LA7SS,LA7VDB,LA7Y,LRORU3
;
S LA764=$$GET1^DIQ(60,LR60_",",64,"I")
S LA7NLT=$$GET1^DIQ(64,LA764_",",1)
I LA7NLT="" Q
S LA7NLTN=$$GET1^DIQ(64,LA764_",",.01)
;
S LA7VDB=$$GET1^DIQ(64,LA764_",",63,"I")
I LA7VDB'="" S LA7Y(LA7VDB)=""
;
S LRORU3=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,.3))
;
; Check if this report is already in the queue
S LA7ONQUE=0
S LA76248=0 F S LA76248=$O(^LAHM(62.49,"AC","ORU","P",LA76248)) Q:'LA76248 D
. S LA76249=0 F S LA76249=$O(^LAHM(62.49,"AC","ORU","P",LA76248,LA76249)) Q:'LA76249 D
. . I $$GET1^DIQ(62.49,LA76249_",",2,"I")'="P" Q
. . ;
. . ; Check the following fields. If they all match, then it's the same report and don't add to the queue again
. . I $P(LRORU3,U,5)'=$$GET1^DIQ(62.49,LA76249_",",153,"I") Q ; Check REMOTE UID
. . I $P(LRORU3,U,3)'=$$GET1^DIQ(62.49,LA76249_",",152,"I") Q ; Check COLLECTING SITE
. . I LA7NLT'=$$GET1^DIQ(62.49,LA76249_",",155,"I") Q ; Check NLT
. . I LRIDT'=$$GET1^DIQ(62.49,LA76249_",",156,"I") Q ; Check LRIDT
. . I LRSS'=$$GET1^DIQ(62.49,LA76249_",",157,"I") Q ; Check LRSS
. . I LRDFN'=$$GET1^DIQ(62.49,LA76249_",",158,"I") Q ; Check LRDFN
. . ;
. . S LA7ONQUE=1 ; All fields match - report already in the queue
;
I LA7ONQUE D Q ; Report already in queue, don't add again
. W !,$$CJ^XLFSTR("Report already in LEDI queue - no need to add again",IOM)
;
;
D SET^LA7VMSG($P(LRORU3,U,4),$P(LRORU3,U,2),$P(LRORU3,U,5),$P(LRORU3,U,3),LA7NLTN,LA7NLT,LRIDT,LRSS,LRDFN,LRODT,.LA7Y,"ORU")
;
Q
;
;
CHKACC ; Check/validate parameters passed in before storing in file #62.49
;
N I,LA763,LA768,LA7AA,LA7AD,LA7AN
;
I $G(LRUID)="",$G(RUID)="" Q
I LRUID'="",'$D(^LRO(68,"C",LRUID)) D
. S LRUID=$G(RUID)
. I LRUID'="",'$D(^LRO(68,"C",LRUID)) S LRUID=""
I LRUID="" Q
;
S I=$Q(^LRO(68,"C",LRUID)),(LA7AA,LA7AD,LA7AN)=0
I I'="",$QS(I,3)=LRUID S LA7AA=$QS(I,4),LA7AD=$QS(I,5),LA7AN=$QS(I,6)
F I=0,.2,.3,3 S LA768(I)=$G(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,I))
;
F I=0,"ORU" S LA763(I)=$G(^LR(LRDFN,LRSS,LRIDT,I))
;
; Mismatch on subscript with file #68
I LRSS'=$P(^LRO(68,LA7AA,0),"^",2) S LA7ERR=40 D CREATE^LA7LOG(LA7ERR)
;
; Mismatch on LRDFN with file #68
I LRDFN'=$P(LA768(0),"^") S LA7ERR=41 D CREATE^LA7LOG(LA7ERR)
;
; Mismatch on specimen inverse d/t with file #68
I LRIDT'=$P(LA768(3),"^",5) S LA7ERR=42 D CREATE^LA7LOG(LA7ERR)
;
; Mismatch on remote UID with file #68
I $G(RUID)'="",RUID'=$P(LA768(.3),"^",5) S LA7ERR=43 D CREATE^LA7LOG(LA7ERR)
;
; Mismatch on remote UID with file #63
I $G(RUID)'="",$P(LA763("ORU"),"^",5)'="",RUID'=$P(LA763("ORU"),"^",5) S LA7ERR=44 D CREATE^LA7LOG(LA7ERR)
;
; Mismatch on UID between file #63 and file #68
I $P(LA768(.3),"^")'="",$P(LA763("ORU"),"^")'="",$P(LA768(.3),"^")'=$P(LA763("ORU"),"^") S LA7ERR=45 D CREATE^LA7LOG(LA7ERR)
;
Q
;
;
ACK ; ACKnowledgment message processor
;
G ACK^LA7VHL
Q
HLSTATUS(LA7MTYP,SITE,LRSS) ;
;
; Check if agency associated with site has LEDI HL7 messaging enabled for this Subscript.
;
; Call with:
; LA7MTYP = The HL7 message type. Either: "ORU" or "ORM"
; SITE = Site's IEN in INSTITUTION file (#4)
; LRSS = Subscript
;
; Returns 0: LEDI HL7 messaging is disabled for this SITE and Subscript.
; 1: LEDI HL7 messaging is enabled for this SITE and Subscript.
; -- if LSRP cutover is installed and rollback restore is not installed, return 1 (enabled)
I $$PATCH^XPDUTL("LA*5.2*75"),'$$PATCH^XPDUTL("LA*5.2*78") Q 1
;
N LA7PAR
;
S LA7PAR=2
I LA7MTYP="ORU" S LA7PAR=$$GET^XPAR("ALL","LA LEDI ORU HL7 STATUS",$$WHAT^XUAF4(SITE,"AGENCY"),"Q")
I LA7MTYP="ORM" S LA7PAR=$$GET^XPAR("ALL","LA LEDI ORM HL7 STATUS",$$WHAT^XUAF4(SITE,"AGENCY"),"Q")
;
I LA7PAR=0 Q 0
I LA7PAR=2,LRSS'="CH" Q 0
I LA7PAR=3,LRSS'="MI" Q 0
I LA7PAR=4,LRSS'["SPCYEM" Q 0
I LA7PAR=5,"CHMI"'[LRSS Q 0
I LA7PAR=6,"CHSPCYEM"'[LRSS Q 0
I LA7PAR=7,"MISPCYEM"'[LRSS Q 0
;
Q 1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLA7VMSG 8312 printed Oct 16, 2024@17:41:36 Page 2
LA7VMSG ;DALOI/JMC - LAB ORU (Observation Result) message builder ;08/12/13 15:12
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;**27,50,56,46,64,74,80**;Sep 27, 1994;Build 19
+2 ;
ORU ; Bleed the ORU (Observation Result) message queue
+1 ; Tasked by LA7SRR, LRCAPV2, LRU
+2 ;
+3 NEW LA7MTYP
+4 SET LA7MTYP="ORU"
+5 DO START^LA7VMSG1
+6 ;
+7 QUIT
+8 ;
ORR ; Bleed the ORR (Order Response) message queue
+1 ; Called by LRWLST12
+2 ;
+3 NEW LA7MTYP
+4 SET LA7MTYP="ORR"
+5 ;D START^LA7VMSG1
+6 ;
+7 QUIT
+8 ;
+9 ;
SET(LRUID,SITE,RUID,SITEN,ORD,LRNLT,LRIDT,LRSS,LRDFN,ORDT,LA7VDB,LA7MTYP) ; adds entries to LA7V QUEUE file
+1 ; Called by LA7SRR, LRVER3, LRWLST12
+2 ; variable list
+3 ; LRUID - Host Unique ID from the local ACCESSION file (#68)
+4 ; SITE - remote sites IEN in INSTITUTION file (#4)
+5 ; RUID - Remote sites Unique ID from ACCESSION file (#68)
+6 ; SITEN - Primary site number of remote site ($$SITE^VASITE)
+7 ; ORD - Free text ordered test name from WKLD CODE file (#64)
+8 ; LRNLT - National Laboratory test code from WKLD CODE file (#64)
+9 ; LRIDT - Inverse date/time (accession date/time)
+10 ; LRSS - test subscript defined in LABORATORY TEST file (#60)
+11 ; LRDFN - IEN in LAB DATA file (#63)
+12 ; ORDT - Order date
+13 ; LA7VDB - <opt><byref> Chemistry results or database section
+14 ; for MI, SP, CY, EM subscripts
+15 ; ex. glucose LA7VDB(2)=LR NODE
+16 ; LA7VDB(2,1)="C" (corrected results)
+17 ; MI: LA7VDB(File #64 Field #63)=""
+18 ; SP: LA7VDB("88515.0000")="" CY: LA7VDB("88593.0000")=""
+19 ; EM: LA7VDB("88597.0000")="" AU: LA7VDB("88533.0000")=""
+20 ; LA7MTYP (Optional) - Message Type (ORU or ORR) defaults to ORU
+21 ;
+22 NEW FDA,LA76248,LA76249,LA7DT,LA7FACID,LA7ERR,LA7RSITE,LA7Y,LAHLSTAT,PORD,PORT,RSITE
+23 ;
+24 SET LA7ERR=0
+25 IF $GET(LA7MTYP)=""
SET LA7MTYP="ORU"
+26 ; Currently not building ORR when accessioning - JMC/7/11/00
+27 IF LA7MTYP="ORR"
QUIT
+28 ;
+29 ; Retrieve facility id (VA=station number, DoD=DMIS code, other=local site assigned id)
+30 SET LA7FACID=$$RETFACID^LA7VHLU2(SITEN,2,1)
SET LA76248=0
+31 SET LA7RSITE="LA7V COLLECTION "_LA7FACID
+32 SET LA76248=$ORDER(^LAHM(62.48,"B",LA7RSITE,0))
+33 ; No entry in 62.48 - *** Need to add error logging ****
+34 IF 'LA76248
QUIT
+35 ; not active
IF '$PIECE(^LAHM(62.48,LA76248,0),"^",3)
QUIT
+36 ;
+37 ;
+38 ; add check here to see if agency associated with site (SITE) is enabled for this subscript;CKA 6/11
+39 SET LAHLSTAT=$$HLSTATUS("ORU",SITE,LRSS)
+40 IF 'LAHLSTAT
QUIT
+41 ;
+42 ; Create new outgoing entry in 62.49
+43 SET LA76249=$$INIT6249^LA7VHLU
+44 IF LA76249<1
Begin DoDot:1
+45 ; Log entry creation error
End DoDot:1
QUIT
+46 ;
+47 ; Check/validate parameters before storing
+48 ; If error store but flag entry with error status.
+49 DO CHKACC
+50 ;
+51 ; File data
+52 SET FDA(1,62.49,LA76249_",",1)="O"
+53 SET FDA(1,62.49,LA76249_",",.5)=LA76248
+54 SET FDA(1,62.49,LA76249_",",2)=$SELECT(LA7ERR:"E",1:"P")
+55 SET FDA(1,62.49,LA76249_",",5)=LA7RSITE_"-O-"_RUID
+56 SET FDA(1,62.49,LA76249_",",108)=LA7MTYP
+57 SET FDA(1,62.49,LA76249_",",151)=LRUID
+58 SET FDA(1,62.49,LA76249_",",152)=SITEN
+59 SET FDA(1,62.49,LA76249_",",153)=RUID
+60 SET FDA(1,62.49,LA76249_",",154)=ORD
+61 SET FDA(1,62.49,LA76249_",",155)=LRNLT
+62 SET FDA(1,62.49,LA76249_",",156)=LRIDT
+63 SET FDA(1,62.49,LA76249_",",157)=LRSS
+64 SET FDA(1,62.49,LA76249_",",158)=LRDFN
+65 SET FDA(1,62.49,LA76249_",",159)=ORDT
+66 ;
+67 DO FILE^DIE("","FDA(1)","LA7ERR(1)")
+68 DO CLEAN^DILF
+69 ;
+70 ; Add test to order
+71 SET LA7Y=0
+72 FOR
SET LA7Y=$ORDER(LA7VDB(LA7Y))
if 'LA7Y
QUIT
Begin DoDot:1
+73 NEW FDAIEN
+74 SET FDA(2,62.49162,"+2,"_LA76249_",",.01)=LA7Y
+75 IF $GET(LA7VDB(LA7Y,1))="C"
SET FDA(2,62.49162,"+2,"_LA76249_",",.02)="C"
+76 SET FDAIEN(1)=LA76249
+77 DO UPDATE^DIE("","FDA(2)","FDAIEN","LA7ERR(2)")
+78 DO CLEAN^DILF
End DoDot:1
+79 ;
+80 ; Check for date report completed.
+81 IF '$$OK2SEND^LA7SRR
DO CREATE^LA7LOG(122)
+82 ;
+83 ; Release lock on entry.
+84 LOCK -^LAHM(62.49,LA76249)
+85 QUIT
+86 ;
+87 ;
MIAP(LRAA,LRAD,LRAN,LR60,LRDFN,LRSS,LRIDT,LRODT) ; Makes MI/AP calls to send results to LA7V QUEUE
+1 ;
+2 ; Call with LRAA = accession area IEN
+3 ; LRAD = accession date (FM format)
+4 ; LRAN = accession number
+5 ; LR60 = file #60 test IEN
+6 ; LRDFN = IEN in LAB DATA file (#63)
+7 ; LRSS = test subscript defined in LABORATORY TEST file (#60)
+8 ; LRIDT = Inverse date/time (accession date/time)
+9 ; LRORDT = Order date (FM format)
+10 ;
+11 ; Called by LRVR0, LRMIUT, LRVRAP4
+12 ;
+13 NEW LA764,LA76248,LA76249,LA7NLT,LA7NLTN,LA7ONQUE,LA7SS,LA7VDB,LA7Y,LRORU3
+14 ;
+15 SET LA764=$$GET1^DIQ(60,LR60_",",64,"I")
+16 SET LA7NLT=$$GET1^DIQ(64,LA764_",",1)
+17 IF LA7NLT=""
QUIT
+18 SET LA7NLTN=$$GET1^DIQ(64,LA764_",",.01)
+19 ;
+20 SET LA7VDB=$$GET1^DIQ(64,LA764_",",63,"I")
+21 IF LA7VDB'=""
SET LA7Y(LA7VDB)=""
+22 ;
+23 SET LRORU3=$GET(^LRO(68,LRAA,1,LRAD,1,LRAN,.3))
+24 ;
+25 ; Check if this report is already in the queue
+26 SET LA7ONQUE=0
+27 SET LA76248=0
FOR
SET LA76248=$ORDER(^LAHM(62.49,"AC","ORU","P",LA76248))
if 'LA76248
QUIT
Begin DoDot:1
+28 SET LA76249=0
FOR
SET LA76249=$ORDER(^LAHM(62.49,"AC","ORU","P",LA76248,LA76249))
if 'LA76249
QUIT
Begin DoDot:2
+29 IF $$GET1^DIQ(62.49,LA76249_",",2,"I")'="P"
QUIT
+30 ;
+31 ; Check the following fields. If they all match, then it's the same report and don't add to the queue again
+32 ; Check REMOTE UID
IF $PIECE(LRORU3,U,5)'=$$GET1^DIQ(62.49,LA76249_",",153,"I")
QUIT
+33 ; Check COLLECTING SITE
IF $PIECE(LRORU3,U,3)'=$$GET1^DIQ(62.49,LA76249_",",152,"I")
QUIT
+34 ; Check NLT
IF LA7NLT'=$$GET1^DIQ(62.49,LA76249_",",155,"I")
QUIT
+35 ; Check LRIDT
IF LRIDT'=$$GET1^DIQ(62.49,LA76249_",",156,"I")
QUIT
+36 ; Check LRSS
IF LRSS'=$$GET1^DIQ(62.49,LA76249_",",157,"I")
QUIT
+37 ; Check LRDFN
IF LRDFN'=$$GET1^DIQ(62.49,LA76249_",",158,"I")
QUIT
+38 ;
+39 ; All fields match - report already in the queue
SET LA7ONQUE=1
End DoDot:2
End DoDot:1
+40 ;
+41 ; Report already in queue, don't add again
IF LA7ONQUE
Begin DoDot:1
+42 WRITE !,$$CJ^XLFSTR("Report already in LEDI queue - no need to add again",IOM)
End DoDot:1
QUIT
+43 ;
+44 ;
+45 DO SET^LA7VMSG($PIECE(LRORU3,U,4),$PIECE(LRORU3,U,2),$PIECE(LRORU3,U,5),$PIECE(LRORU3,U,3),LA7NLTN,LA7NLT,LRIDT,LRSS,LRDFN,LRODT,.LA7Y,"ORU")
+46 ;
+47 QUIT
+48 ;
+49 ;
CHKACC ; Check/validate parameters passed in before storing in file #62.49
+1 ;
+2 NEW I,LA763,LA768,LA7AA,LA7AD,LA7AN
+3 ;
+4 IF $GET(LRUID)=""
IF $GET(RUID)=""
QUIT
+5 IF LRUID'=""
IF '$DATA(^LRO(68,"C",LRUID))
Begin DoDot:1
+6 SET LRUID=$GET(RUID)
+7 IF LRUID'=""
IF '$DATA(^LRO(68,"C",LRUID))
SET LRUID=""
End DoDot:1
+8 IF LRUID=""
QUIT
+9 ;
+10 SET I=$QUERY(^LRO(68,"C",LRUID))
SET (LA7AA,LA7AD,LA7AN)=0
+11 IF I'=""
IF $QSUBSCRIPT(I,3)=LRUID
SET LA7AA=$QSUBSCRIPT(I,4)
SET LA7AD=$QSUBSCRIPT(I,5)
SET LA7AN=$QSUBSCRIPT(I,6)
+12 FOR I=0,.2,.3,3
SET LA768(I)=$GET(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,I))
+13 ;
+14 FOR I=0,"ORU"
SET LA763(I)=$GET(^LR(LRDFN,LRSS,LRIDT,I))
+15 ;
+16 ; Mismatch on subscript with file #68
+17 IF LRSS'=$PIECE(^LRO(68,LA7AA,0),"^",2)
SET LA7ERR=40
DO CREATE^LA7LOG(LA7ERR)
+18 ;
+19 ; Mismatch on LRDFN with file #68
+20 IF LRDFN'=$PIECE(LA768(0),"^")
SET LA7ERR=41
DO CREATE^LA7LOG(LA7ERR)
+21 ;
+22 ; Mismatch on specimen inverse d/t with file #68
+23 IF LRIDT'=$PIECE(LA768(3),"^",5)
SET LA7ERR=42
DO CREATE^LA7LOG(LA7ERR)
+24 ;
+25 ; Mismatch on remote UID with file #68
+26 IF $GET(RUID)'=""
IF RUID'=$PIECE(LA768(.3),"^",5)
SET LA7ERR=43
DO CREATE^LA7LOG(LA7ERR)
+27 ;
+28 ; Mismatch on remote UID with file #63
+29 IF $GET(RUID)'=""
IF $PIECE(LA763("ORU"),"^",5)'=""
IF RUID'=$PIECE(LA763("ORU"),"^",5)
SET LA7ERR=44
DO CREATE^LA7LOG(LA7ERR)
+30 ;
+31 ; Mismatch on UID between file #63 and file #68
+32 IF $PIECE(LA768(.3),"^")'=""
IF $PIECE(LA763("ORU"),"^")'=""
IF $PIECE(LA768(.3),"^")'=$PIECE(LA763("ORU"),"^")
SET LA7ERR=45
DO CREATE^LA7LOG(LA7ERR)
+33 ;
+34 QUIT
+35 ;
+36 ;
ACK ; ACKnowledgment message processor
+1 ;
+2 GOTO ACK^LA7VHL
+3 QUIT
HLSTATUS(LA7MTYP,SITE,LRSS) ;
+1 ;
+2 ; Check if agency associated with site has LEDI HL7 messaging enabled for this Subscript.
+3 ;
+4 ; Call with:
+5 ; LA7MTYP = The HL7 message type. Either: "ORU" or "ORM"
+6 ; SITE = Site's IEN in INSTITUTION file (#4)
+7 ; LRSS = Subscript
+8 ;
+9 ; Returns 0: LEDI HL7 messaging is disabled for this SITE and Subscript.
+10 ; 1: LEDI HL7 messaging is enabled for this SITE and Subscript.
+11 ; -- if LSRP cutover is installed and rollback restore is not installed, return 1 (enabled)
+12 IF $$PATCH^XPDUTL("LA*5.2*75")
IF '$$PATCH^XPDUTL("LA*5.2*78")
QUIT 1
+13 ;
+14 NEW LA7PAR
+15 ;
+16 SET LA7PAR=2
+17 IF LA7MTYP="ORU"
SET LA7PAR=$$GET^XPAR("ALL","LA LEDI ORU HL7 STATUS",$$WHAT^XUAF4(SITE,"AGENCY"),"Q")
+18 IF LA7MTYP="ORM"
SET LA7PAR=$$GET^XPAR("ALL","LA LEDI ORM HL7 STATUS",$$WHAT^XUAF4(SITE,"AGENCY"),"Q")
+19 ;
+20 IF LA7PAR=0
QUIT 0
+21 IF LA7PAR=2
IF LRSS'="CH"
QUIT 0
+22 IF LA7PAR=3
IF LRSS'="MI"
QUIT 0
+23 IF LA7PAR=4
IF LRSS'["SPCYEM"
QUIT 0
+24 IF LA7PAR=5
IF "CHMI"'[LRSS
QUIT 0
+25 IF LA7PAR=6
IF "CHSPCYEM"'[LRSS
QUIT 0
+26 IF LA7PAR=7
IF "MISPCYEM"'[LRSS
QUIT 0
+27 ;
+28 QUIT 1