Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: LA7UXQA

LA7UXQA.m

Go to the documentation of this file.
  1. LA7UXQA ;DALOI/JMC - HL7 Utility - Send alert to users ;04/13/10 14:41
  1. ;;5.2;AUTOMATED LAB INSTRUMENTS;**27,67,74**;Sep 27, 1994;Build 229
  1. ;
  1. XQA(LA7CTYP,LA76248,LA762485,LA76249,LA7AMSG,LA7DATA,LA7PALRT) ; Send alert when requested.
  1. ; Input
  1. ; LA7CTYP - Condition for alert (1=New Results, 2=Error on message, 3=New Orders)
  1. ; LA76248 - Pointer to file 62.48
  1. ; LA762485 - Optional, pointer to file 62.485 if condition=2
  1. ; LA76249 - Optional, pointer to file 62.49 if condition=2 or 3
  1. ; LA7AMSG - Optional, alert message, if missing will use default message^id to add to XQAID
  1. ; LA7DATA - Optional, pass values for specific conditions
  1. ; LA7PALRT - Keep previous alerts (1-yes,0-no)
  1. ;
  1. ; Called by LA7LOG, LA7UIIN, LA7VORM, LRVRPOC, LA7VIN1
  1. ;
  1. N XQA,XQADATA,XQAFLAG,XQAID,XQAMSG,XQAOPT,XQAROU,X,Y
  1. S XQAMSG=$P($G(LA7AMSG),"^"),XQAID=""
  1. ;
  1. I $G(LA7CTYP)=1 D
  1. . S XQAID="LA7-CONFIG-"_$S($G(LA76248):LA76248,1:"UNKNOWN-"_$H)
  1. . I XQAMSG="" S XQAMSG="Lab Messaging - New results received for "_$P($G(^LAHM(62.48,+$G(LA76248),0),"UNKNOWN"),"^")
  1. ;
  1. I $G(LA7CTYP)=2 D
  1. . S XQAID="LA7-MESSAGE-"_$S($G(LA76249):LA76249,1:"UNKNOWN-"_$H)
  1. . I XQAMSG="" S XQAMSG="Lab Messaging error #"_$G(LA762485,"UNKNOWN")_" on message #"_$G(LA76249,"UNKNOWN")_" at "_$$HTE^XLFDT($H,"2M")
  1. . I $G(LA76249) D ; Error processing message, setup action alert.
  1. . . S XQAROU="DIS^LA7UXQA" ; Alert action.
  1. . . S XQADATA=LA76249 ; Alert data (ien of message in 62.49, date of error and error number).
  1. ;
  1. I $G(LA7CTYP)=3 D
  1. . S LA7DATA=$G(LA7DATA)
  1. . S XQAID="LA7-ORDERS-"_$S(LA7DATA'="":$P(LA7DATA,"^"),$G(LA76249):LA76249,1:"UNKNOWN-"_$H)
  1. . I XQAMSG="" S XQAMSG="Lab Messaging - Manifest# "_$P(LA7DATA,"^")_" received from "_$P($G(^LAHM(62.48,+$G(LA76248),0),"UNKNOWN"),"^")
  1. ;
  1. I $P($G(LA7AMSG),"^",2)'="" S XQAID=XQAID_$S(XQAID'="":"-",1:"")_$P(LA7AMSG,"^",2)
  1. ;
  1. ; Determine mail group
  1. S X=""
  1. F S X=$O(^LAHM(62.48,+$G(LA76248),20,"B",LA7CTYP,X)) Q:'X D
  1. . S Y=$G(^LAHM(62.48,LA76248,20,X,0))
  1. . I $P(Y,"^",2)'="" S XQA("G."_$P(Y,"^",2))="" ; Send to mail group.
  1. ;
  1. ; Fail safe mail group when no mail group defined.
  1. I '$D(XQA) S XQA("G.LAB MESSAGING")=""
  1. ;
  1. ; Delete previous alerts with same id
  1. I '$G(LA7PALRT),$G(XQAID)'="" D DEL(XQAID)
  1. ;
  1. D SETUP^XQALERT
  1. Q
  1. ;
  1. ;
  1. DEL(ID) ; Delete previous alerts if present
  1. ; Call with ID = alert id
  1. ; Clear previous alert with same pkg id.
  1. N XQAID,XQAKLL,XQAMSG,XQAROU,XQADATA,XQA
  1. S XQAKLL=0
  1. S XQAID=ID
  1. D DELETEA^XQALERT
  1. Q
  1. ;
  1. ;
  1. DIS ; Display alert
  1. ;
  1. ;ZEXCEPT: XQADATA
  1. ;
  1. N DIR,I,J,K,LA7LIST,X,Y
  1. K ^TMP("DDB",$J),^TMP($J)
  1. I 'XQADATA W !,$C(7),"Missing message number, unable to proceed.",! Q
  1. I '$D(^LAHM(62.49,XQADATA)) W !,$C(7),"Message number# ",XQADATA," has been deleted, unable to proceed.",! Q
  1. S DIR(0)="YO",DIR("A")="Display message associated with this alert",DIR("B")="YES"
  1. D ^DIR K DIR
  1. I Y S LA7LIST(+XQADATA)="" D DEV^LA7UTILA
  1. Q
  1. ;
  1. ;
  1. DISIC ; Display Integrity Checker alert.
  1. ;
  1. ;ZEXCEPT: XQADATA
  1. ;
  1. N DIR,I,J,K,LA7IC,X,Y
  1. I XQADATA="" D Q
  1. . W !,$C(7),"Missing error report to display, unable to proceed.",!
  1. ;
  1. I '$D(^XTMP(XQADATA)) D Q
  1. . W !,$C(7),"Message number# ",XQADATA," has been deleted, unable to proceed.",!
  1. ;
  1. S DIR(0)="YO",DIR("A")="Display Integrity Check Report associated with this alert",DIR("B")="YES"
  1. D ^DIR K DIR
  1. I Y S LA7IC=XQADATA D DEV^LA7CHKFP
  1. Q