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

GMRASEND.m

Go to the documentation of this file.
GMRASEND ;HIRMFO/WAA-SEND ID BAND/CHART MARK TO BULLETIN/TEAM ;12/8/04  11:24
 ;;4.0;Adverse Reaction Tracking;**14,19,21**;Mar 29, 1996
BULLT ; SEND GMRA MARK CHART BULLETIN
 I '$D(GMRATYPE) S GMRATYPE="B"
 S GMRAOUT=0 K GMRASEND
 I '$D(GMRASITE) D SITE^GMRAUTL S GMRASITE(0)=$G(^GMRD(120.84,+GMRASITE,0))
 I $P(GMRASITE(0),U,8)=2 Q
 I $P(GMRASITE(0),U,8)<1!($$VERSION^XPDUTL("OR")<2) D  K GMRASEND,GMRASND,GMRABULL Q
 .S GMRABULL=$$FIND1^DIC(3.8,,"BX","GMRA MARK CHART") ;19
 .I GMRABULL<1 D:'$D(ZTQUEUED)&('$$BROKER^XWBLIB)  Q  ;19
 ..W !,"PLEASE CONTACT IRM TO CREATE A MAIL GROUP: GMRA MARK CHART",$C(7) S GMRASEND(DUZ)=""
 ..K DIR S DIR(0)="E" D ^DIR K DIR
 ..Q
 .I '$$GOTLOCAL^XMXAPIG(GMRABULL) D:'$D(ZTQUEUED)&('$$BROKER^XWBLIB)  Q  ;19
 ..W !,"CALL IRM AND HAVE USERS ASSIGNED TO THE GMRA MARK CHART MAIL GROUP",$C(7)
 ..K DIR S DIR(0)="E" D ^DIR K DIR S GMRASEND(DUZ)=""
 ..Q
 .E  S GMRASEND("G.GMRA MARK CHART")="" ;19
 .S DFN=$P(GMRAPA(0),U) D INP^VADPT S:'+VAIN(4) GMRALOC=""
 .I +VAIN(4) S GMRAHLOC=+$G(^DIC(42,+VAIN(4),44)),GMRALOC=$P(VAIN(4),U,2)
 .D PID^VADPT6 S GMRAVIP=VA("PID") D KVAR^VADPT K VA
 .D BUL(.GMRASEND,GMRATYPE)
 .Q
 ;=====================================================================
 S GMRAPAT=$P(GMRAPA(0),U)_";DPT("
 S GMRATEAM=0 F  S GMRATEAM=$O(^OR(100.21,"AB",GMRAPAT,GMRATEAM)) Q:GMRATEAM<1  D
 .Q:'$D(^OR(100.21,GMRATEAM,0))
 .S GMRASEND=0 F  S GMRASEND=$O(^OR(100.21,GMRATEAM,1,GMRASEND)) Q:GMRASEND<1  D
 ..Q:'$D(^OR(100.21,GMRATEAM,1,GMRASEND,0))
 ..S GMRASEND(GMRASEND)=""
 ..Q
 .Q
 ;*********************************************************************
 D BUL(.GMRASEND,GMRATYPE)
 K GMRAPAT,GMRATEAM,GMRASEND
 Q
BUL(XMY,GMRATYPE) ;MAIL A BULLETIN TO A GROUP OR PERSON
 I '$D(GMRAVIP) S DFN=$P(GMRAPA(0),U) D PID^VADPT6 S GMRAVIP=VA("PID") D KVAR^VADPT K VA
 I '($D(XMY)\10) W:'$D(ZTQUEUED)&('$$BROKER^XWBLIB) !,"CALL IRM THERE IS NO ONE TO RECEIVE THIS BULLETIN",$C(7) S GMRAOUT=1 Q  ;19
 I GMRATYPE="A",$P(GMRASITE(0),U,9)'=0 D  Q
 .N GMRA
 .S GMRA=0 F  S GMRA=$O(XMY(GMRA)) Q:GMRA<1  S XQA(GMRA)=""
 .K XMY
 .S XQAMSG="Mark Chart"_$S(GMRALOC'="":"/ID Band",1:"")_" for "_$E(GMRANAM,1,30)_","_GMRAVIP_" with "_$E($P(GMRAPA(0),U,2),1,20)
 .D SETUP^XQALERT
 .Q
 S XMB(1)=GMRANAM,XMB(3)=$S(GMRALOC'="":GMRALOC,1:"Outpatient"),XMB(4)=GMRAVIP,XMB(2)=$P(GMRAPA(0),U,2) ;19
 S XMB(5)=$S($P(GMRAPA(0),U,14)="A":"Allergy",$P(GMRAPA(0),U,14)="P":"Adverse Reaction",$P(GMRAPA(0),U,14)="U":"Unknown",1:"")
 N GMRACHT,GMRAID ;21
 S GMRACHT=$O(^GMR(120.8,GMRAPA,13,0)),GMRAID=$S('$P(GMRASITE(0),U,5):1,$G(GMRAHLOC):$O(^GMR(120.8,GMRAPA,14,0)),1:1) ;21
 S (XMB(6),XMB(7))=$S('GMRACHT&('GMRAID):"chart and ID band",'GMRACHT:"chart",'GMRAID:"ID band",1:"") ;21
 I XMB(6)="" Q  ;21 Don't send bulletin if it's not needed
 N GMRAXMB,GMRAXMY ;19
 M GMRAXMB=XMB,GMRAXMY=XMY ;19
 D SENDBULL^XMXAPI(DUZ,"GMRA MARK CHART",.GMRAXMB,,.GMRAXMY) ;19
 Q