| 1 | LA7UXQA ;;DALOI/JMC - HL7 Utility - Send alert to users; Jan 12, 2004 | 
|---|
| 2 | ;;5.2;AUTOMATED LAB INSTRUMENTS;**27,67**;Sep 27, 1994 | 
|---|
| 3 | ; | 
|---|
| 4 | XQA(LA7CTYP,LA76248,LA762485,LA76249,LA7AMSG,LA7DATA,LA7PALRT) ; Send alert when requested. | 
|---|
| 5 | ; Input | 
|---|
| 6 | ;   LA7CTYP  - Condition for alert (1=New Results, 2=Error on message, 3=New Orders) | 
|---|
| 7 | ;   LA76248  - Pointer to file 62.48 | 
|---|
| 8 | ;   LA762485 - Optional, pointer to file 62.485 if condition=2 | 
|---|
| 9 | ;   LA76249  - Optional, pointer to file 62.49 if condition=2 or 3 | 
|---|
| 10 | ;   LA7AMSG  - Optional, alert message if missing will use default message | 
|---|
| 11 | ;   LA7DATA  - Optional, pass values for specific conditions | 
|---|
| 12 | ;   LA7PALRT - Keep previous alerts (1-yes,0-no) | 
|---|
| 13 | ; | 
|---|
| 14 | ; Called by LA7LOG, LA7UIIN, LA7VORM, LRVRPOC, LA7VIN1 | 
|---|
| 15 | ; | 
|---|
| 16 | N XQA,XQAID,XQADATA,XQAFLAG,XQAMSG,XQAOPT,XQAROU,X,Y | 
|---|
| 17 | S XQAMSG=$G(LA7AMSG) | 
|---|
| 18 | ; | 
|---|
| 19 | I $G(LA7CTYP)=1 D | 
|---|
| 20 | . S XQAID="LA7-CONFIG-"_$S($G(LA76248):LA76248,1:"UNKNOWN-"_$H) | 
|---|
| 21 | . I XQAMSG="" S XQAMSG="Lab Messaging - New results received for "_$P($G(^LAHM(62.48,+$G(LA76248),0),"UNKNOWN"),"^") | 
|---|
| 22 | ; | 
|---|
| 23 | I $G(LA7CTYP)=2 D | 
|---|
| 24 | . S XQAID="LA7-MESSAGE-"_$S($G(LA76249):LA76249,1:"UNKNOWN-"_$H) | 
|---|
| 25 | . I XQAMSG="" S XQAMSG="Lab Messaging error #"_$G(LA762485,"UNKNOWN")_" on message #"_$G(LA76249,"UNKNOWN") | 
|---|
| 26 | . I $G(LA76249) D  ; Error processing message, setup action alert. | 
|---|
| 27 | . . S XQAROU="DIS^LA7UXQA" ; Alert action. | 
|---|
| 28 | . . S XQADATA=LA76249 ; Alert data (ien of message in 62.49, date of error and error number). | 
|---|
| 29 | ; | 
|---|
| 30 | I $G(LA7CTYP)=3 D | 
|---|
| 31 | . S LA7DATA=$G(LA7DATA) | 
|---|
| 32 | . S XQAID="LA7-ORDERS-"_$S($L(LA7DATA):$P(LA7DATA,"^"),$G(LA76249):LA76249,1:"UNKNOWN-"_$H) | 
|---|
| 33 | . I XQAMSG="" S XQAMSG="Lab Messaging - Manifest# "_$P(LA7DATA,"^")_" received from "_$P($G(^LAHM(62.48,+$G(LA76248),0),"UNKNOWN"),"^") | 
|---|
| 34 | ; | 
|---|
| 35 | ; Determine mail group | 
|---|
| 36 | S X="" | 
|---|
| 37 | F  S X=$O(^LAHM(62.48,+$G(LA76248),20,"B",LA7CTYP,X)) Q:'X  D | 
|---|
| 38 | . S Y=$G(^LAHM(62.48,LA76248,20,X,0)) | 
|---|
| 39 | . I $L($P(Y,"^",2)) S XQA("G."_$P(Y,"^",2))="" ; Send to mail group. | 
|---|
| 40 | ; | 
|---|
| 41 | ; Fail safe mail group when no mail group defined. | 
|---|
| 42 | I '$D(XQA) S XQA("G.LAB MESSAGING")="" | 
|---|
| 43 | ; | 
|---|
| 44 | ; Delete previous alerts with same id | 
|---|
| 45 | I '$G(LA7PALRT),$G(XQAID)'="" D DEL(XQAID) | 
|---|
| 46 | ; | 
|---|
| 47 | D SETUP^XQALERT | 
|---|
| 48 | Q | 
|---|
| 49 | ; | 
|---|
| 50 | ; | 
|---|
| 51 | DEL(ID) ; Delete previous alerts if present | 
|---|
| 52 | ; Call with ID = alert id | 
|---|
| 53 | ; Clear previous alert with same pkg id. | 
|---|
| 54 | N XQAID,XQAMSG,XQAROU,XQADATA,XQA | 
|---|
| 55 | S XQAKLL=0 | 
|---|
| 56 | S XQAID=ID | 
|---|
| 57 | D DELETEA^XQALERT | 
|---|
| 58 | Q | 
|---|
| 59 | ; | 
|---|
| 60 | ; | 
|---|
| 61 | DIS ; Display alert. | 
|---|
| 62 | N DIR,I,J,K,LA7LIST,X,Y | 
|---|
| 63 | K ^TMP("DDB",$J),^TMP($J) | 
|---|
| 64 | I 'XQADATA W !,$C(7),"Missing message number, unable to proceed.",! Q | 
|---|
| 65 | I '$D(^LAHM(62.49,XQADATA)) W !,$C(7),"Message number# ",XQADATA," has been deleted, unable to proceed.",! Q | 
|---|
| 66 | S DIR(0)="YO",DIR("A")="Display message associated with this alert",DIR("B")="YES" | 
|---|
| 67 | D ^DIR K DIR | 
|---|
| 68 | I Y S LA7LIST(+XQADATA)="" D DEV^LA7UTILA | 
|---|
| 69 | Q | 
|---|
| 70 | ; | 
|---|
| 71 | ; | 
|---|
| 72 | DISIC ; Display Integrity Checker alert. | 
|---|
| 73 | N DIR,I,J,K,LA7IC,X,Y | 
|---|
| 74 | I XQADATA="" D  Q | 
|---|
| 75 | . W !,$C(7),"Missing error report to display, unable to proceed.",! | 
|---|
| 76 | ; | 
|---|
| 77 | I '$D(^XTMP(XQADATA)) D  Q | 
|---|
| 78 | . W !,$C(7),"Message number# ",XQADATA," has been deleted, unable to proceed.",! | 
|---|
| 79 | ; | 
|---|
| 80 | S DIR(0)="YO",DIR("A")="Display Integrity Check Report associated with this alert",DIR("B")="YES" | 
|---|
| 81 | D ^DIR K DIR | 
|---|
| 82 | I Y S LA7IC=XQADATA D DEV^LA7CHKFP | 
|---|
| 83 | Q | 
|---|