LA7VIN1A ;DALOI/JMC - Process Incoming UI Msgs, continued ;11/17/11 15:42
;;5.2;AUTOMATED LAB INSTRUMENTS;**64,67,74**;Sep 27, 1994;Build 229
;
; This routine is a continuation of LA7VIN1.
; It performs generation of any mail bulletins needed.
;
; Reference to DUZ^XUP supported by DBIA #4129
;
Q
;
;
SENDARB ; Send amended report bulletin
N LA76304,LA7BODY,LA7I,LA7ISQN,LA7TSK,LA7X,LWL
N XMBODY,XMDUZ,XMBNAME,XMINSTR,XMPARM,XMTO,X,Y
N XQA,XQAID,XQADATA,XQAFLAG,XQAMSG,XQAOPT,XQAROU
;
I '$G(DUZ) D DUZ^XUP(.5)
S XMBNAME="LA7 AMENDED RESULTS RECEIVED"
S LA7I=0
F S LA7I=$O(^TMP("LA7 AMENDED RESULTS",$J,LA7I)) Q:'LA7I D
. S LA7I(0)=^TMP("LA7 AMENDED RESULTS",$J,LA7I)
. S LWL=$P(LA7I(0),"^",1),LA7ISQN=$P(LA7I(0),"^",2),LA76304=$P(LA7I(0),"^",3)
. S XMPARM(1)=$$GET1^DIQ(62.48,$P(LA7I(0),"^",4)_",",.01)
. S XMPARM(2)=$P(LA7I(0),"^",5)
. S XMPARM(3)=$G(^LAH(LWL,1,LA7ISQN,.1,"PID","PNM"))
. S XMPARM(4)=$G(^LAH(LWL,1,LA7ISQN,.1,"PID","SSN"))
. S XMPARM(5)=$G(^LAH(LWL,1,LA7ISQN,.1,"OBR","SID"))
. S XMPARM(6)=$$FMTE^XLFDT($G(^LAH(LWL,1,LA7ISQN,.1,"OBR","ORCDT")),"MZ")
.S XMPARM(7)=$P(LA7I(0),"^",8)_" ["_$P(LA7I(0),"^",7)_"]"
. S X=$G(^LAH(LWL,1,LA7ISQN,LA76304)),X(5)=$P(X,"^",5)
. S XMPARM(8)=$$GET1^DIQ(4,$P(X,"^",9)_",",.01)
. S XMPARM(9)=$G(^LAH(LWL,1,LA7ISQN,.1,"OBR","FID"))
. S XMPARM(10)=$P(X,"^")
. S XMPARM(11)=$P(X(5),"!",7)
. S XMPARM(12)=$P(X(5),"!",2)_$S($P(X(5),"!",3)'="":"-"_$P(X(5),"!",3),1:"")
. S LA7X=$P(LA7I(0),"^",9),X=" L^ H^LL^HH^ <^ >^ N^ A^AA^ U^ D^ B^ W^ S^ R^ I^MS^VS"
. S I=$F(X,LA7X)\3 S:I LA7X=$P($T(ABFLAGS+I^LA7VHLU1),";;",2)
. S XMPARM(13)=LA7X
. S X="UNKNOWN"
. I $P(LA7I(0),"^",6)="C" S X="Record coming over is a correction and thus replaces a final result"
. I $P(LA7I(0),"^",6)="D" S X="Deletes the OBX record"
. I $P(LA7I(0),"^",6)="W" S X="Post original as wrong, e.g., transmitted for wrong patient"
. S XMPARM(14)=X
. S LA7BODY(1)=" ",LA7BODY(2)="Comments:"
. S I=0
. F S I=$O(^LAH(LWL,1,LA7ISQN,1,I)) Q:'I S LA7BODY(I+2)=$P(^(I),"^")
. D SMB
. S XQAMSG="Lab Messaging - Amended results received from "_XMPARM(1),XQAID="LA7-AMENDED-"_XMPARM(1)
. D SA
;
K ^TMP("LA7 AMENDED RESULTS",$J)
;
Q
;
;
SENDUNCB ; Send units/normals changed bulletin
;
N LA76248,LA76304,LA7BODY,LA7I,LA7ISQN,LA7TSK,LA7X,LWL
N XMBODY,XMDUZ,XMBNAME,XMINSTR,XMPARM,XMTO,X,Y
N XQA,XQAID,XQADATA,XQAFLAG,XQAMSG,XQAOPT,XQAROU
;
I '$G(DUZ) D DUZ^XUP(.5)
S XMBNAME="LA7 UNITS/NORMALS CHANGED"
S LA7I=0
F S LA7I=$O(^TMP("LA7 UNITS/NORMALS CHANGED",$J,LA7I)) Q:'LA7I D
. S LA7I(0)=^TMP("LA7 UNITS/NORMALS CHANGED",$J,LA7I)
. S LWL=$P(LA7I(0),"^",1),LA7ISQN=$P(LA7I(0),"^",2),LA76304=$P(LA7I(0),"^",3),LA76248=$P(LA7I(0),"^",4)
. S XMPARM(1)=$$GET1^DIQ(62.48,LA76248_",",.01)
. S XMPARM(2)=$P(LA7I(0),"^",5)
. S XMPARM(3)=$G(^LAH(LWL,1,LA7ISQN,.1,"PID","PNM"))
. S XMPARM(4)=$G(^LAH(LWL,1,LA7ISQN,.1,"PID","SSN"))
. S XMPARM(5)=$G(^LAH(LWL,1,LA7ISQN,.1,"OBR","SID"))
. S XMPARM(6)=$$FMTE^XLFDT($G(^LAH(LWL,1,LA7ISQN,.1,"OBR","ORCDT")),"MZ")
.S XMPARM(7)=$P(LA7I(0),"^",8)_" ["_$P(LA7I(0),"^",7)_"]"
. S X=$G(^LAH(LWL,1,LA7ISQN,LA76304)),X(5)=$P(X,"^",5)
. S XMPARM(8)=$$GET1^DIQ(4,$P(X,"^",9)_",",.01)
. S XMPARM(9)=$G(^LAH(LWL,1,LA7ISQN,.1,"OBR","FID"))
. S XMPARM(10)=$$GET1^DIQ(60,$P(LA7I(0),"^",10)_",",.01)
. S XMPARM(11)=$P(X(5),"!",7)
. S XMPARM(12)=$P(X(5),"!",2)_$S($P(X(5),"!",3)'="":"-"_$P(X(5),"!",3),1:"")
. S XMTO("G."_$$FAMG^LA7VHLU1(LA76248,2))=""
. D SMB
. S XQAMSG="Lab Messaging - Reference Lab Units/Normals Change received from "_XMPARM(1),XQAID="LA7-UNITS/NORMALS-CHANGED-"_XMPARM(1)
. D SA
;
K ^TMP("LA7 UNITS/NORMALS CHANGED",$J)
;
Q
;
;
SENDACB ; Send abnormal/critical bulletin
;
N LA76248,LA76304,LA7BODY,LA7I,LA7ISQN,LA7TSK,LA7X,LWL
N XMBODY,XMDUZ,XMBNAME,XMINSTR,XMPARM,XMTO,X,Y
N XQA,XQAID,XQADATA,XQAFLAG,XQAMSG,XQAOPT,XQAROU
;
I '$G(DUZ) D DUZ^XUP(.5)
S XMBNAME="LA7 ABNORMAL RESULTS RECEIVED"
S LA7I=0
F S LA7I=$O(^TMP("LA7 ABNORMAL RESULTS",$J,LA7I)) Q:'LA7I D
. S LA7I(0)=^TMP("LA7 ABNORMAL RESULTS",$J,LA7I)
. S LWL=$P(LA7I(0),"^",1),LA7ISQN=$P(LA7I(0),"^",2),LA76304=$P(LA7I(0),"^",3),LA76248=$P(LA7I(0),"^",4)
. S XMPARM(1)=$$GET1^DIQ(62.48,LA76248_",",.01)
. S XMPARM(2)=$P(LA7I(0),"^",5)
. S XMPARM(3)=$G(^LAH(LWL,1,LA7ISQN,.1,"PID","PNM"))
. S XMPARM(4)=$G(^LAH(LWL,1,LA7ISQN,.1,"PID","SSN"))
. S XMPARM(5)=$G(^LAH(LWL,1,LA7ISQN,.1,"OBR","SID"))
. S XMPARM(6)=$$FMTE^XLFDT($G(^LAH(LWL,1,LA7ISQN,.1,"OBR","ORCDT")),"MZ")
.S XMPARM(7)=$P(LA7I(0),"^",8)_" ["_$P(LA7I(0),"^",7)_"]"
. S X=$G(^LAH(LWL,1,LA7ISQN,LA76304)),X(5)=$P(X,"^",5)
. S XMPARM(8)=$$GET1^DIQ(4,$P(X,"^",9)_",",.01)
. S XMPARM(9)=$G(^LAH(LWL,1,LA7ISQN,.1,"OBR","FID"))
. S XMPARM(10)=$P(X,"^")
. S XMPARM(11)=$P(X(5),"!",7)
. S XMPARM(12)=$P(X(5),"!",2)_$S($P(X(5),"!",3)'="":"-"_$P(X(5),"!",3),1:"")
. S LA7X=$P(LA7I(0),"^",9),X=" L^ H^LL^HH^ <^ >^ N^ A^AA^ U^ D^ B^ W^ S^ R^ I^MS^VS"
. S I=$F(X,LA7X)\3 S:I LA7X=$P($T(ABFLAGS+I^LA7VHLU1),";;",2)
. S XMPARM(13)=LA7X
. D SMB
. S XQAMSG="Lab Messaging - Reference Lab Abnormal Results received from "_XMPARM(1),XQAID="LA7-ABNORMAL-RESULTS-"_XMPARM(1)
. D SA
;
K ^TMP("LA7 ABNORMAL RESULTS",$J)
;
Q
;
;
SMB ; Send mail bulletin
; Ignore any restrictions (domain closed or protected by security key)
;
N XMERR
S XMINSTR("ADDR FLAGS")="R"
S XMINSTR("FROM")="LAB PACKAGE"
S XMTO("G."_$$FAMG^LA7VHLU1(LA76248,1))=""
D SENDBULL^XMXAPI(DUZ,XMBNAME,.XMPARM,$S($D(LA7BODY):"LA7BODY",1:""),.XMTO,.XMINSTR,.LA7TSK,"")
;
Q
;
;
SA ; Send alert
;
M XQA=XMTO
D DEL^LA7UXQA(XQAID)
D SETUP^XQALERT
;
Q
;
;
CHKOK(LA7INDX) ; Check if ok to send bulletin on added/reflexed tests order change
; Returns OK = 1 if results associated with added/reflex test are not
; on the accession.
; OK = 0 if accession already has tests on accession.
;
N LA760,LA7AA,LA7AD,LA7AN,LA7I,LA7TREEN,LRUID,OK,X
S OK=1,LRUID=$P($G(^LAH(LWL,1,LA7ISQN,.1,"OBR","SID")),"^")
;
; Store all tests accessioned in ^TMP
S X=$Q(^LRO(68,"C",LRUID))
I X'="",$QS(X,3)=LRUID D
. K ^TMP("LA7TREE",$J)
. S LA7AA=$QS(X,4),LA7AD=$QS(X,5),LA7AN=$QS(X,6),LA7I=0
. F S LA7I=$O(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,4,LA7I)) Q:'LA7I D UNWIND^LA7UTIL(LA7I)
. I '$O(^TMP("LA7 ORDER STATUS",$J,LA7INDX,0)) Q
. S (LA7I,OK)=0
. F S LA7I=$O(^TMP("LA7 ORDER STATUS",$J,LA7INDX,LA7I)) Q:'LA7I D Q:OK
. . I '$D(^TMP("LA7TREE",$J,LA7I)) S OK=1 ;wasn't ordered
. K ^TMP("LA7TREE",$J)
Q OK
;
;
LAHCLUP ; LAH clean up
; Clean up entry in LAH if no results/comments to process
; i.e. if entry added from ORR msg and needed for mail bulletins.
N LA7X
S LA7X=$O(^LAH(LWL,1,LA7ISQN,.3))
I LA7X="" D ZAPALL^LRVR3(LWL,LA7ISQN)
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLA7VIN1A 6893 printed Dec 13, 2024@01:40:20 Page 2
LA7VIN1A ;DALOI/JMC - Process Incoming UI Msgs, continued ;11/17/11 15:42
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;**64,67,74**;Sep 27, 1994;Build 229
+2 ;
+3 ; This routine is a continuation of LA7VIN1.
+4 ; It performs generation of any mail bulletins needed.
+5 ;
+6 ; Reference to DUZ^XUP supported by DBIA #4129
+7 ;
+8 QUIT
+9 ;
+10 ;
SENDARB ; Send amended report bulletin
+1 NEW LA76304,LA7BODY,LA7I,LA7ISQN,LA7TSK,LA7X,LWL
+2 NEW XMBODY,XMDUZ,XMBNAME,XMINSTR,XMPARM,XMTO,X,Y
+3 NEW XQA,XQAID,XQADATA,XQAFLAG,XQAMSG,XQAOPT,XQAROU
+4 ;
+5 IF '$GET(DUZ)
DO DUZ^XUP(.5)
+6 SET XMBNAME="LA7 AMENDED RESULTS RECEIVED"
+7 SET LA7I=0
+8 FOR
SET LA7I=$ORDER(^TMP("LA7 AMENDED RESULTS",$JOB,LA7I))
if 'LA7I
QUIT
Begin DoDot:1
+9 SET LA7I(0)=^TMP("LA7 AMENDED RESULTS",$JOB,LA7I)
+10 SET LWL=$PIECE(LA7I(0),"^",1)
SET LA7ISQN=$PIECE(LA7I(0),"^",2)
SET LA76304=$PIECE(LA7I(0),"^",3)
+11 SET XMPARM(1)=$$GET1^DIQ(62.48,$PIECE(LA7I(0),"^",4)_",",.01)
+12 SET XMPARM(2)=$PIECE(LA7I(0),"^",5)
+13 SET XMPARM(3)=$GET(^LAH(LWL,1,LA7ISQN,.1,"PID","PNM"))
+14 SET XMPARM(4)=$GET(^LAH(LWL,1,LA7ISQN,.1,"PID","SSN"))
+15 SET XMPARM(5)=$GET(^LAH(LWL,1,LA7ISQN,.1,"OBR","SID"))
+16 SET XMPARM(6)=$$FMTE^XLFDT($GET(^LAH(LWL,1,LA7ISQN,.1,"OBR","ORCDT")),"MZ")
+17 SET XMPARM(7)=$PIECE(LA7I(0),"^",8)_" ["_$PIECE(LA7I(0),"^",7)_"]"
+18 SET X=$GET(^LAH(LWL,1,LA7ISQN,LA76304))
SET X(5)=$PIECE(X,"^",5)
+19 SET XMPARM(8)=$$GET1^DIQ(4,$PIECE(X,"^",9)_",",.01)
+20 SET XMPARM(9)=$GET(^LAH(LWL,1,LA7ISQN,.1,"OBR","FID"))
+21 SET XMPARM(10)=$PIECE(X,"^")
+22 SET XMPARM(11)=$PIECE(X(5),"!",7)
+23 SET XMPARM(12)=$PIECE(X(5),"!",2)_$SELECT($PIECE(X(5),"!",3)'="":"-"_$PIECE(X(5),"!",3),1:"")
+24 SET LA7X=$PIECE(LA7I(0),"^",9)
SET X=" L^ H^LL^HH^ <^ >^ N^ A^AA^ U^ D^ B^ W^ S^ R^ I^MS^VS"
+25 SET I=$FIND(X,LA7X)\3
if I
SET LA7X=$PIECE($TEXT(ABFLAGS+I^LA7VHLU1),";;",2)
+26 SET XMPARM(13)=LA7X
+27 SET X="UNKNOWN"
+28 IF $PIECE(LA7I(0),"^",6)="C"
SET X="Record coming over is a correction and thus replaces a final result"
+29 IF $PIECE(LA7I(0),"^",6)="D"
SET X="Deletes the OBX record"
+30 IF $PIECE(LA7I(0),"^",6)="W"
SET X="Post original as wrong, e.g., transmitted for wrong patient"
+31 SET XMPARM(14)=X
+32 SET LA7BODY(1)=" "
SET LA7BODY(2)="Comments:"
+33 SET I=0
+34 FOR
SET I=$ORDER(^LAH(LWL,1,LA7ISQN,1,I))
if 'I
QUIT
SET LA7BODY(I+2)=$PIECE(^(I),"^")
+35 DO SMB
+36 SET XQAMSG="Lab Messaging - Amended results received from "_XMPARM(1)
SET XQAID="LA7-AMENDED-"_XMPARM(1)
+37 DO SA
End DoDot:1
+38 ;
+39 KILL ^TMP("LA7 AMENDED RESULTS",$JOB)
+40 ;
+41 QUIT
+42 ;
+43 ;
SENDUNCB ; Send units/normals changed bulletin
+1 ;
+2 NEW LA76248,LA76304,LA7BODY,LA7I,LA7ISQN,LA7TSK,LA7X,LWL
+3 NEW XMBODY,XMDUZ,XMBNAME,XMINSTR,XMPARM,XMTO,X,Y
+4 NEW XQA,XQAID,XQADATA,XQAFLAG,XQAMSG,XQAOPT,XQAROU
+5 ;
+6 IF '$GET(DUZ)
DO DUZ^XUP(.5)
+7 SET XMBNAME="LA7 UNITS/NORMALS CHANGED"
+8 SET LA7I=0
+9 FOR
SET LA7I=$ORDER(^TMP("LA7 UNITS/NORMALS CHANGED",$JOB,LA7I))
if 'LA7I
QUIT
Begin DoDot:1
+10 SET LA7I(0)=^TMP("LA7 UNITS/NORMALS CHANGED",$JOB,LA7I)
+11 SET LWL=$PIECE(LA7I(0),"^",1)
SET LA7ISQN=$PIECE(LA7I(0),"^",2)
SET LA76304=$PIECE(LA7I(0),"^",3)
SET LA76248=$PIECE(LA7I(0),"^",4)
+12 SET XMPARM(1)=$$GET1^DIQ(62.48,LA76248_",",.01)
+13 SET XMPARM(2)=$PIECE(LA7I(0),"^",5)
+14 SET XMPARM(3)=$GET(^LAH(LWL,1,LA7ISQN,.1,"PID","PNM"))
+15 SET XMPARM(4)=$GET(^LAH(LWL,1,LA7ISQN,.1,"PID","SSN"))
+16 SET XMPARM(5)=$GET(^LAH(LWL,1,LA7ISQN,.1,"OBR","SID"))
+17 SET XMPARM(6)=$$FMTE^XLFDT($GET(^LAH(LWL,1,LA7ISQN,.1,"OBR","ORCDT")),"MZ")
+18 SET XMPARM(7)=$PIECE(LA7I(0),"^",8)_" ["_$PIECE(LA7I(0),"^",7)_"]"
+19 SET X=$GET(^LAH(LWL,1,LA7ISQN,LA76304))
SET X(5)=$PIECE(X,"^",5)
+20 SET XMPARM(8)=$$GET1^DIQ(4,$PIECE(X,"^",9)_",",.01)
+21 SET XMPARM(9)=$GET(^LAH(LWL,1,LA7ISQN,.1,"OBR","FID"))
+22 SET XMPARM(10)=$$GET1^DIQ(60,$PIECE(LA7I(0),"^",10)_",",.01)
+23 SET XMPARM(11)=$PIECE(X(5),"!",7)
+24 SET XMPARM(12)=$PIECE(X(5),"!",2)_$SELECT($PIECE(X(5),"!",3)'="":"-"_$PIECE(X(5),"!",3),1:"")
+25 SET XMTO("G."_$$FAMG^LA7VHLU1(LA76248,2))=""
+26 DO SMB
+27 SET XQAMSG="Lab Messaging - Reference Lab Units/Normals Change received from "_XMPARM(1)
SET XQAID="LA7-UNITS/NORMALS-CHANGED-"_XMPARM(1)
+28 DO SA
End DoDot:1
+29 ;
+30 KILL ^TMP("LA7 UNITS/NORMALS CHANGED",$JOB)
+31 ;
+32 QUIT
+33 ;
+34 ;
SENDACB ; Send abnormal/critical bulletin
+1 ;
+2 NEW LA76248,LA76304,LA7BODY,LA7I,LA7ISQN,LA7TSK,LA7X,LWL
+3 NEW XMBODY,XMDUZ,XMBNAME,XMINSTR,XMPARM,XMTO,X,Y
+4 NEW XQA,XQAID,XQADATA,XQAFLAG,XQAMSG,XQAOPT,XQAROU
+5 ;
+6 IF '$GET(DUZ)
DO DUZ^XUP(.5)
+7 SET XMBNAME="LA7 ABNORMAL RESULTS RECEIVED"
+8 SET LA7I=0
+9 FOR
SET LA7I=$ORDER(^TMP("LA7 ABNORMAL RESULTS",$JOB,LA7I))
if 'LA7I
QUIT
Begin DoDot:1
+10 SET LA7I(0)=^TMP("LA7 ABNORMAL RESULTS",$JOB,LA7I)
+11 SET LWL=$PIECE(LA7I(0),"^",1)
SET LA7ISQN=$PIECE(LA7I(0),"^",2)
SET LA76304=$PIECE(LA7I(0),"^",3)
SET LA76248=$PIECE(LA7I(0),"^",4)
+12 SET XMPARM(1)=$$GET1^DIQ(62.48,LA76248_",",.01)
+13 SET XMPARM(2)=$PIECE(LA7I(0),"^",5)
+14 SET XMPARM(3)=$GET(^LAH(LWL,1,LA7ISQN,.1,"PID","PNM"))
+15 SET XMPARM(4)=$GET(^LAH(LWL,1,LA7ISQN,.1,"PID","SSN"))
+16 SET XMPARM(5)=$GET(^LAH(LWL,1,LA7ISQN,.1,"OBR","SID"))
+17 SET XMPARM(6)=$$FMTE^XLFDT($GET(^LAH(LWL,1,LA7ISQN,.1,"OBR","ORCDT")),"MZ")
+18 SET XMPARM(7)=$PIECE(LA7I(0),"^",8)_" ["_$PIECE(LA7I(0),"^",7)_"]"
+19 SET X=$GET(^LAH(LWL,1,LA7ISQN,LA76304))
SET X(5)=$PIECE(X,"^",5)
+20 SET XMPARM(8)=$$GET1^DIQ(4,$PIECE(X,"^",9)_",",.01)
+21 SET XMPARM(9)=$GET(^LAH(LWL,1,LA7ISQN,.1,"OBR","FID"))
+22 SET XMPARM(10)=$PIECE(X,"^")
+23 SET XMPARM(11)=$PIECE(X(5),"!",7)
+24 SET XMPARM(12)=$PIECE(X(5),"!",2)_$SELECT($PIECE(X(5),"!",3)'="":"-"_$PIECE(X(5),"!",3),1:"")
+25 SET LA7X=$PIECE(LA7I(0),"^",9)
SET X=" L^ H^LL^HH^ <^ >^ N^ A^AA^ U^ D^ B^ W^ S^ R^ I^MS^VS"
+26 SET I=$FIND(X,LA7X)\3
if I
SET LA7X=$PIECE($TEXT(ABFLAGS+I^LA7VHLU1),";;",2)
+27 SET XMPARM(13)=LA7X
+28 DO SMB
+29 SET XQAMSG="Lab Messaging - Reference Lab Abnormal Results received from "_XMPARM(1)
SET XQAID="LA7-ABNORMAL-RESULTS-"_XMPARM(1)
+30 DO SA
End DoDot:1
+31 ;
+32 KILL ^TMP("LA7 ABNORMAL RESULTS",$JOB)
+33 ;
+34 QUIT
+35 ;
+36 ;
SMB ; Send mail bulletin
+1 ; Ignore any restrictions (domain closed or protected by security key)
+2 ;
+3 NEW XMERR
+4 SET XMINSTR("ADDR FLAGS")="R"
+5 SET XMINSTR("FROM")="LAB PACKAGE"
+6 SET XMTO("G."_$$FAMG^LA7VHLU1(LA76248,1))=""
+7 DO SENDBULL^XMXAPI(DUZ,XMBNAME,.XMPARM,$SELECT($DATA(LA7BODY):"LA7BODY",1:""),.XMTO,.XMINSTR,.LA7TSK,"")
+8 ;
+9 QUIT
+10 ;
+11 ;
SA ; Send alert
+1 ;
+2 MERGE XQA=XMTO
+3 DO DEL^LA7UXQA(XQAID)
+4 DO SETUP^XQALERT
+5 ;
+6 QUIT
+7 ;
+8 ;
CHKOK(LA7INDX) ; Check if ok to send bulletin on added/reflexed tests order change
+1 ; Returns OK = 1 if results associated with added/reflex test are not
+2 ; on the accession.
+3 ; OK = 0 if accession already has tests on accession.
+4 ;
+5 NEW LA760,LA7AA,LA7AD,LA7AN,LA7I,LA7TREEN,LRUID,OK,X
+6 SET OK=1
SET LRUID=$PIECE($GET(^LAH(LWL,1,LA7ISQN,.1,"OBR","SID")),"^")
+7 ;
+8 ; Store all tests accessioned in ^TMP
+9 SET X=$QUERY(^LRO(68,"C",LRUID))
+10 IF X'=""
IF $QSUBSCRIPT(X,3)=LRUID
Begin DoDot:1
+11 KILL ^TMP("LA7TREE",$JOB)
+12 SET LA7AA=$QSUBSCRIPT(X,4)
SET LA7AD=$QSUBSCRIPT(X,5)
SET LA7AN=$QSUBSCRIPT(X,6)
SET LA7I=0
+13 FOR
SET LA7I=$ORDER(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,4,LA7I))
if 'LA7I
QUIT
DO UNWIND^LA7UTIL(LA7I)
+14 IF '$ORDER(^TMP("LA7 ORDER STATUS",$JOB,LA7INDX,0))
QUIT
+15 SET (LA7I,OK)=0
+16 FOR
SET LA7I=$ORDER(^TMP("LA7 ORDER STATUS",$JOB,LA7INDX,LA7I))
if 'LA7I
QUIT
Begin DoDot:2
+17 ;wasn't ordered
IF '$DATA(^TMP("LA7TREE",$JOB,LA7I))
SET OK=1
End DoDot:2
if OK
QUIT
+18 KILL ^TMP("LA7TREE",$JOB)
End DoDot:1
+19 QUIT OK
+20 ;
+21 ;
LAHCLUP ; LAH clean up
+1 ; Clean up entry in LAH if no results/comments to process
+2 ; i.e. if entry added from ORR msg and needed for mail bulletins.
+3 NEW LA7X
+4 SET LA7X=$ORDER(^LAH(LWL,1,LA7ISQN,.3))
+5 IF LA7X=""
DO ZAPALL^LRVR3(LWL,LA7ISQN)
+6 ;
+7 QUIT