- LA7UXQA ;VA/DALOI/JMC - HL7 Utility - Send alert to users; Jan 12, 2004
- ;;5.2;AUTOMATED LAB INSTRUMENTS;**1002,1031**;NOV 01, 1997
- ;
- ;;VA LA Patche(s): 27,67
- ;
- XQA(LA7CTYP,LA76248,LA762485,LA76249,LA7AMSG,LA7DATA,LA7PALRT) ; Send alert when requested.
- ; Input
- ; LA7CTYP - Condition for alert (1=New Results, 2=Error on message, 3=New Orders)
- ; LA76248 - Pointer to file 62.48
- ; LA762485 - Optional, pointer to file 62.485 if condition=2
- ; LA76249 - Optional, pointer to file 62.49 if condition=2 or 3
- ; LA7AMSG - Optional, alert message if missing will use default message
- ; LA7DATA - Optional, pass values for specific conditions
- ; LA7PALRT - Keep previous alerts (1-yes,0-no)
- ;
- ; Called by LA7LOG, LA7UIIN, LA7VORM, LRVRPOC, LA7VIN1
- ;
- N XQA,XQAID,XQADATA,XQAFLAG,XQAMSG,XQAOPT,XQAROU,X,Y
- S XQAMSG=$G(LA7AMSG)
- ;
- I $G(LA7CTYP)=1 D
- . S XQAID="LA7-CONFIG-"_$S($G(LA76248):LA76248,1:"UNKNOWN-"_$H)
- . I XQAMSG="" S XQAMSG="Lab Messaging - New results received for "_$P($G(^LAHM(62.48,+$G(LA76248),0),"UNKNOWN"),"^")
- ;
- I $G(LA7CTYP)=2 D
- . S XQAID="LA7-MESSAGE-"_$S($G(LA76249):LA76249,1:"UNKNOWN-"_$H)
- . I XQAMSG="" S XQAMSG="Lab Messaging error #"_$G(LA762485,"UNKNOWN")_" on message #"_$G(LA76249,"UNKNOWN")
- . I $G(LA76249) D ; Error processing message, setup action alert.
- . . S XQAROU="DIS^LA7UXQA" ; Alert action.
- . . S XQADATA=LA76249 ; Alert data (ien of message in 62.49, date of error and error number).
- ;
- I $G(LA7CTYP)=3 D
- . S LA7DATA=$G(LA7DATA)
- . S XQAID="LA7-ORDERS-"_$S($L(LA7DATA):$P(LA7DATA,"^"),$G(LA76249):LA76249,1:"UNKNOWN-"_$H)
- . I XQAMSG="" S XQAMSG="Lab Messaging - Manifest# "_$P(LA7DATA,"^")_" received from "_$P($G(^LAHM(62.48,+$G(LA76248),0),"UNKNOWN"),"^")
- ;
- ; Determine mail group
- S X=""
- F S X=$O(^LAHM(62.48,+$G(LA76248),20,"B",LA7CTYP,X)) Q:'X D
- . S Y=$G(^LAHM(62.48,LA76248,20,X,0))
- . I $L($P(Y,"^",2)) S XQA("G."_$P(Y,"^",2))="" ; Send to mail group.
- ;
- ; Fail safe mail group when no mail group defined.
- I '$D(XQA) S XQA("G.LAB MESSAGING")=""
- ;
- ; Delete previous alerts with same id
- I '$G(LA7PALRT),$G(XQAID)'="" D DEL(XQAID)
- ;
- D SETUP^XQALERT
- Q
- ;
- ;
- DEL(ID) ; Delete previous alerts if present
- ; Call with ID = alert id
- ; Clear previous alert with same pkg id.
- N XQAID,XQAMSG,XQAROU,XQADATA,XQA
- S XQAKLL=0
- S XQAID=ID
- D DELETEA^XQALERT
- Q
- ;
- ;
- DIS ; Display alert.
- N DIR,I,J,K,LA7LIST,X,Y
- K ^TMP("DDB",$J),^TMP($J)
- I 'XQADATA W !,$C(7),"Missing message number, unable to proceed.",! Q
- I '$D(^LAHM(62.49,XQADATA)) W !,$C(7),"Message number# ",XQADATA," has been deleted, unable to proceed.",! Q
- S DIR(0)="YO",DIR("A")="Display message associated with this alert",DIR("B")="YES"
- D ^DIR K DIR
- I Y S LA7LIST(+XQADATA)="" D DEV^LA7UTILA
- Q
- ;
- ;
- DISIC ; Display Integrity Checker alert.
- N DIR,I,J,K,LA7IC,X,Y
- I XQADATA="" D Q
- . W !,$C(7),"Missing error report to display, unable to proceed.",!
- ;
- I '$D(^XTMP(XQADATA)) D Q
- . W !,$C(7),"Message number# ",XQADATA," has been deleted, unable to proceed.",!
- ;
- S DIR(0)="YO",DIR("A")="Display Integrity Check Report associated with this alert",DIR("B")="YES"
- D ^DIR K DIR
- I Y S LA7IC=XQADATA D DEV^LA7CHKFP
- Q
- LA7UXQA ;VA/DALOI/JMC - HL7 Utility - Send alert to users; Jan 12, 2004
- +1 ;;5.2;AUTOMATED LAB INSTRUMENTS;**1002,1031**;NOV 01, 1997
- +2 ;
- +3 ;;VA LA Patche(s): 27,67
- +4 ;
- XQA(LA7CTYP,LA76248,LA762485,LA76249,LA7AMSG,LA7DATA,LA7PALRT) ; Send alert when requested.
- +1 ; Input
- +2 ; LA7CTYP - Condition for alert (1=New Results, 2=Error on message, 3=New Orders)
- +3 ; LA76248 - Pointer to file 62.48
- +4 ; LA762485 - Optional, pointer to file 62.485 if condition=2
- +5 ; LA76249 - Optional, pointer to file 62.49 if condition=2 or 3
- +6 ; LA7AMSG - Optional, alert message if missing will use default message
- +7 ; LA7DATA - Optional, pass values for specific conditions
- +8 ; LA7PALRT - Keep previous alerts (1-yes,0-no)
- +9 ;
- +10 ; Called by LA7LOG, LA7UIIN, LA7VORM, LRVRPOC, LA7VIN1
- +11 ;
- +12 NEW XQA,XQAID,XQADATA,XQAFLAG,XQAMSG,XQAOPT,XQAROU,X,Y
- +13 SET XQAMSG=$GET(LA7AMSG)
- +14 ;
- +15 IF $GET(LA7CTYP)=1
- Begin DoDot:1
- +16 SET XQAID="LA7-CONFIG-"_$SELECT($GET(LA76248):LA76248,1:"UNKNOWN-"_$HOROLOG)
- +17 IF XQAMSG=""
- SET XQAMSG="Lab Messaging - New results received for "_$PIECE($GET(^LAHM(62.48,+$GET(LA76248),0),"UNKNOWN"),"^")
- End DoDot:1
- +18 ;
- +19 IF $GET(LA7CTYP)=2
- Begin DoDot:1
- +20 SET XQAID="LA7-MESSAGE-"_$SELECT($GET(LA76249):LA76249,1:"UNKNOWN-"_$HOROLOG)
- +21 IF XQAMSG=""
- SET XQAMSG="Lab Messaging error #"_$GET(LA762485,"UNKNOWN")_" on message #"_$GET(LA76249,"UNKNOWN")
- +22 ; Error processing message, setup action alert.
- IF $GET(LA76249)
- Begin DoDot:2
- +23 ; Alert action.
- SET XQAROU="DIS^LA7UXQA"
- +24 ; Alert data (ien of message in 62.49, date of error and error number).
- SET XQADATA=LA76249
- End DoDot:2
- End DoDot:1
- +25 ;
- +26 IF $GET(LA7CTYP)=3
- Begin DoDot:1
- +27 SET LA7DATA=$GET(LA7DATA)
- +28 SET XQAID="LA7-ORDERS-"_$SELECT($LENGTH(LA7DATA):$PIECE(LA7DATA,"^"),$GET(LA76249):LA76249,1:"UNKNOWN-"_$HOROLOG)
- +29 IF XQAMSG=""
- SET XQAMSG="Lab Messaging - Manifest# "_$PIECE(LA7DATA,"^")_" received from "_$PIECE($GET(^LAHM(62.48,+$GET(LA76248),0),"UNKNOWN"),"^")
- End DoDot:1
- +30 ;
- +31 ; Determine mail group
- +32 SET X=""
- +33 FOR
- SET X=$ORDER(^LAHM(62.48,+$GET(LA76248),20,"B",LA7CTYP,X))
- IF 'X
- QUIT
- Begin DoDot:1
- +34 SET Y=$GET(^LAHM(62.48,LA76248,20,X,0))
- +35 ; Send to mail group.
- IF $LENGTH($PIECE(Y,"^",2))
- SET XQA("G."_$PIECE(Y,"^",2))=""
- End DoDot:1
- +36 ;
- +37 ; Fail safe mail group when no mail group defined.
- +38 IF '$DATA(XQA)
- SET XQA("G.LAB MESSAGING")=""
- +39 ;
- +40 ; Delete previous alerts with same id
- +41 IF '$GET(LA7PALRT)
- IF $GET(XQAID)'=""
- DO DEL(XQAID)
- +42 ;
- +43 DO SETUP^XQALERT
- +44 QUIT
- +45 ;
- +46 ;
- DEL(ID) ; Delete previous alerts if present
- +1 ; Call with ID = alert id
- +2 ; Clear previous alert with same pkg id.
- +3 NEW XQAID,XQAMSG,XQAROU,XQADATA,XQA
- +4 SET XQAKLL=0
- +5 SET XQAID=ID
- +6 DO DELETEA^XQALERT
- +7 QUIT
- +8 ;
- +9 ;
- DIS ; Display alert.
- +1 NEW DIR,I,J,K,LA7LIST,X,Y
- +2 KILL ^TMP("DDB",$JOB),^TMP($JOB)
- +3 IF 'XQADATA
- WRITE !,$CHAR(7),"Missing message number, unable to proceed.",!
- QUIT
- +4 IF '$DATA(^LAHM(62.49,XQADATA))
- WRITE !,$CHAR(7),"Message number# ",XQADATA," has been deleted, unable to proceed.",!
- QUIT
- +5 SET DIR(0)="YO"
- SET DIR("A")="Display message associated with this alert"
- SET DIR("B")="YES"
- +6 DO ^DIR
- KILL DIR
- +7 IF Y
- SET LA7LIST(+XQADATA)=""
- DO DEV^LA7UTILA
- +8 QUIT
- +9 ;
- +10 ;
- DISIC ; Display Integrity Checker alert.
- +1 NEW DIR,I,J,K,LA7IC,X,Y
- +2 IF XQADATA=""
- Begin DoDot:1
- +3 WRITE !,$CHAR(7),"Missing error report to display, unable to proceed.",!
- End DoDot:1
- QUIT
- +4 ;
- +5 IF '$DATA(^XTMP(XQADATA))
- Begin DoDot:1
- +6 WRITE !,$CHAR(7),"Message number# ",XQADATA," has been deleted, unable to proceed.",!
- End DoDot:1
- QUIT
- +7 ;
- +8 SET DIR(0)="YO"
- SET DIR("A")="Display Integrity Check Report associated with this alert"
- SET DIR("B")="YES"
- +9 DO ^DIR
- KILL DIR
- +10 IF Y
- SET LA7IC=XQADATA
- DO DEV^LA7CHKFP
- +11 QUIT