source: WorldVistAEHR/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRAPTB.m@ 823

Last change on this file since 823 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.8 KB
Line 
1GMRAPTB ;HIRMFO/RM-BULLETIN SEND FOR E/E REACTIONS ;5/10/96 08:04
2 ;;4.0;Adverse Reaction Tracking;**2**;Mar 29, 1996
3EN1 ; SEND BULLETIN TO P&T COMMITTEE
4 ; This option is to fire of an alert to the P&T that a sign has changed
5 Q:$G(GMRAPA)<1 ;Bad or invalid IEN
6 S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0)) Q:GMRAPA(0)="" ;No zero Node
7 Q:$P(GMRAPA(0),U,6)'="o" ;Check to see that reaction is observed
8 Q:$P(GMRAPA(0),U,20)'["D" ;Check to see that reaction is a drug type
9 N GMRAPA1,GMRAPT,GMRAX
10 ;Check to see if in 120.85
11 S GMRAPA1=$O(^GMR(120.85,"C",GMRAPA,0)) Q:GMRAPA1<1
12 Q:$G(^GMR(120.85,GMRAPA1,0))="" ;No zero Node
13 ;Check to see if the reaction has changed
14 ; v--Check for add reactions
15 I $D(GMRARAD) S GMRAX=0 F S GMRAX=$O(GMRARAD(GMRAX)) Q:GMRAX<1 S GMRAPT("ADD",$P(GMRARAD(GMRAX),U))=""
16 ; v--Check for other add reactions
17 I $D(GMRAROT) S GMRATXT="" F S GMRATXT=$O(GMRAROT(GMRATXT)) Q:GMRATXT="" S GMRAPT("ADD",GMRATXT)=""
18 ; v--Check for deleted reactions
19 I $D(GMRARDL) S GMRAX=0 F S GMRAX=$O(GMRARDL(GMRAX)) Q:GMRAX<1 S GMRATXT=$P($G(^GMRD(120.83,GMRAX,0)),U) S:GMRATXT'="" GMRAPT("DELETE",GMRATXT)=""
20 ; v--Check for other deleted reactions
21 I $D(GMRAROTD) S GMRATXT="" F S GMRATXT=$O(GMRARAD(GMRATXT)) Q:GMRATXT="" S GMRAPT("DELETE",GMRATXT)=""
22 Q:'$D(GMRAPT) ; Nothing was added or deleted
23 D MAIL
24 Q
25MAIL ; INDICATING MEDWATCH FOR NEEDS TO BE UPDATED NEEDS UPDATES
26 Q:'$D(GMRAPT)
27 N GMRAGRUP,%,GMRANAM,GMRALOC,GMRASSN
28 S GMRANAM="",GMRALOC="",GMRASSN=""
29 D VAD^GMRAUTL1($P(GMRAPA(0),U),"",.GMRALOC,.GMRANAM,"",.GMRASSN)
30 I GMRALOC'="",+$G(^DIC(42,GMRALOC,44)) S GMRALOC=$P($G(^SC(+$G(^DIC(42,GMRALOC,44)),0)),U)
31 I GMRALOC="" S GMRALOC="OUT PATIENT"
32 S XMB="GMRA SIGNS/SYMPTOMS UPDATE"
33 ; Build XMB array
34 S XMB(1)=GMRANAM ; Patient Name
35 S XMB(2)=GMRASSN ; Patient SSN
36 S XMB(3)=$P(GMRAPA(0),"^",2) ; Reaction
37 S XMB(4)=GMRALOC ; Location
38 S XMB(5)=$S($P(GMRAPA(0),U,5)'="":$P($G(^VA(200,$P(GMRAPA(0),U,5),0)),U),1:"<None>") ; Originator
39 ; Get reactains that were changed
40 K ^TMP($J,"GMRAPT")
41 S GMRACNT=1,GMRASP=" "
42 ; v--Add s/s
43 I $D(GMRAPT("ADD")) K GMRAX D
44 .S ^TMP($J,"GMRAPT",GMRACNT)=" The following Signs/Symptoms have been ADDED to this reaction:" S GMRACNT=GMRACNT+1
45 .S GMRAX="" F S GMRAX=$O(GMRAPT("ADD",GMRAX)) Q:GMRAX="" S ^TMP($J,"GMRAPT",GMRACNT)=" "_GMRAX,GMRACNT=GMRACNT+1
46 .Q
47 ; v--Deleted s/s
48 I $D(GMRAPT("DELETE")) K GMRAX D
49 .S ^TMP($J,"GMRAPT",GMRACNT)=" The following Signs/Symptoms have been DELETED from this reaction:" S GMRACNT=GMRACNT+1
50 .S GMRAX="" F S GMRAX=$O(GMRAPT("DELETE",GMRAX)) Q:GMRAX="" S ^TMP($J,"GMRAPT",GMRACNT)=" "_GMRAX,GMRACNT=GMRACNT+1
51 .Q
52 S XMTEXT="^TMP($J,""GMRAPT"","
53 ; Build XMY array
54 S XMY("G.GMRA P&T COMMITTEE FDA")=""
55 D ^XMB
56 K XMB,XMY,XMTEXT,GMRATEXT,^TMP($J,"GMRAPT")
57 Q
Note: See TracBrowser for help on using the repository browser.