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

GMRASEN2.m

Go to the documentation of this file.
GMRASEN2 ;HIRMFO/WAA-SEND ID BAND/CHART MARK TO BULLETIN/TEAM ;12/21/04  15:56
 ;;4.0;Adverse Reaction Tracking;**14,19,21**;Mar 29, 1996
BULLT ; SEND GMRA MARK CHART BULLETIN
 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
 .D PID^VADPT6 S GMRAVIP=VA("PID") D KVAR^VADPT K VA
 .D BUL(.GMRASEND)
 .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)
 K GMRAPAT,GMRATEAM,GMRASEND
 Q
BUL(XMY) ;MAIL A BULLETIN TO A GROUP OR PERSON
 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
 S XMB(1)=GMRANAM,XMB(3)=$S(GMRALOC'="":GMRALOC,1:"Outpatient"),XMB(4)=GMRAVIP ;19
 I '$D(GMRAPA2(2)) S XMB(2)=$P(GMRAPA2(1),U),XMB(5)=$P(GMRAPA2(1),U,2)
 E  S XMB(2)="See listing of allergies below." D
 .S GMRAPA2=0 F  S GMRAPA2=$O(GMRAPA2(GMRAPA2)) Q:GMRAPA2<1  D
 ..N GMRALN,GMRASPC
 ..S GMRASPC="                                             "
 ..S GMRALN=GMRAPA2(GMRAPA2)
 ..S GMRAPA2(GMRAPA2)=$E($P(GMRALN,U),1,38)
 ..S GMRAPA2(GMRAPA2)=GMRAPA2(GMRAPA2)_$E(GMRASPC,$L(GMRAPA2(GMRAPA2)),40)
 ..S GMRAPA2(GMRAPA2)=GMRAPA2(GMRAPA2)_$P(GMRALN,U,2)
 ..Q
 .S GMRAPA2=0 S XMTEXT="GMRAPA2",GMRAPA2(.4)="" ;21
 .S GMRAPA2(.5)="This patient has the following allergies:"
 .S GMRAPA2(.6)=""
 .S GMRAPA2(.7)="Causative Agent                         Mechanism"
 .S GMRAPA2(.8)="---------------                         ---------"
 .Q
 S XMB(6)="chart (due to admission)",XMB(7)="chart" ;21
 M GMRAXMB=XMB,GMRAXMY=XMY ;21
 D SENDBULL^XMXAPI(DUZ,"GMRA MARK CHART",.GMRAXMB,$G(XMTEXT),.GMRAXMY) ;19,21
 K GMRAPAT,GMRATEAM,GMRASEND
 Q