VistA-FOIAVistA/r/ADVERSE_REACTION_TRACKING-G.../GMRAPT.m

88 lines
3.0 KiB
Mathematica
Raw Normal View History

GMRAPT ;HIRMFO/WAA-P&T COMMITTEE COMPLETION SYSTEM ;12/1/95 14:45
;;4.0;Adverse Reaction Tracking;;Mar 29, 1996
EN1 ; Entry for ENTER/EDIT P&T COMMITTEE DATA option
D MAIN
D EXIT
Q
MAIN ;MAIN STARTING POINT
S GMRAOUT=0,GMRALAGO=1 D EN1^GMRAU85 G:GMRAPA1<1 EXIT1
S GMRAPA=0 D ^GMRADSP7
;v=New line
I $P(GMRAPA(0),U,20)'["D" W !,"YOU CAN ONLY EDIT OBSERVED DRUG REACTIONS",! Q
;V=Old line
;I $P(GMRAPA(0),U,20)'["D"!($P(GMRAPA(0),U,6)'="o") W !,"YOU CAN ONLY EDIT OBSERVED DRUG REACTIONS",! Q
REP1 W @IOF,!,"P&T Report Completion"
D
.N DIE,DA,DR D
.S DIE="^GMR(120.85,"
.S DA=GMRAPA1,DIE("NO^")="OUTOK"
.S DR="23T;24T;25T;26T;26.1T;31.1;S:X'=""y"" Y=""@1"";27;@1"
.D ^DIE
.Q
I $D(Y) S GMRAOUT=1
I 'GMRAOUT,$P($G(^GMR(120.85,GMRAPA1,"PTC1")),U,10)="y" W @IOF D PN^GMRAPT I GMRAOUT D
.S GMRAOUT=0
.Q
K X,Y
Q:GMRAOUT
D
.N DIE,DA,DR
.S DIE="^GMR(120.85,"
.S DA=GMRAPA1,DIE("NO^")="OUTOK"
.;S DR="31.2;S:X'=""y"" Y=""@2"";28;S:'X Y=""@2"";29;@2;31.3;S:X'=""y"" Y=""@3"";30;@3"
.S DR="31.2;S:X'=""y"" Y=""@2"";28;S:'X Y=""@2"";29;@2"
.D ^DIE
.Q
I $D(Y) S GMRAOUT=1
Q:GMRAOUT
W ! D DISP,EDIT Q:GMRAOUT
D UNLOCK^GMRAUTL(120.85,GMRAPA1)
G EN1
Q
DISP ;DISPLAY AND EDIT COMMENTS
S GMRAOUT=0
I '$O(^GMR(120.85,GMRAPA1,"PTC2",0)) Q
W !,"P&T COMMITTEE ADDENDUM COMMENTS:"
S GMRAX=0 F S GMRAX=$O(^GMR(120.85,GMRAPA1,"PTC2",GMRAX)) Q:GMRAX<1 D Q:GMRAOUT
.S GMRAY=$P(^GMR(120.85,GMRAPA1,"PTC2",GMRAX,0),U)
.D PRINT
.Q
Q
PN ;ENTER PROGRESS NOTE FOR A MedWATCH REPORT
D EN1^GMRAPET0($P(GMRAPA(0),U),GMRAPA,"M",.GMRAOUT)
D ; Execute the event point for this reaction
.Q:'$D(GMRAPA) S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0)) Q:GMRAPA(0)=""
.Q:'$D(GMRAPA1) S GMRAPA1(0)=$G(^GMR(120.85,GMRAPA1,0)) Q:GMRAPA1(0)=""
.N OROLD,DFN S DFN=$P(GMRAPA(0),U)
.D INP^VADPT S X=$O(^ORD(101,"B","GMRA MEDWATCH DATA COMPLETE",0))_";ORD(101," D EN^XQOR:X K VAIN,X
.Q
Q
PRINT ;PRINT OUT THE DATA
W !!,"Date: ",$$DATE^GMRAUTL1(GMRAY)
I '$D(^GMR(120.85,GMRAPA1,"PTC2",GMRAX,1,0)) Q
S DIWL=5,DIWR=75,DIWF=""
K ^UTILITY($J,"W",DIWL)
S GMRAXX=0 F S GMRAXX=$O(^GMR(120.85,GMRAPA1,"PTC2",GMRAX,1,GMRAXX)) Q:GMRAXX<1 S X=^(GMRAXX,0) D ^DIWP
S GMRAXX=0 F S GMRAXX=$O(^UTILITY($J,"W",DIWL,GMRAXX)) Q:GMRAXX<1 D:$Y>(IOSL-3) HEAD Q:GMRAOUT W !,?5,^UTILITY($J,"W",DIWL,GMRAXX,0)
Q
HEAD ;
W !,"Press RETURN to continue or ""^"" to stop display or ""^^"" to QUIT: "
R X:DTIME S:'$T X="^^" S GMRAOUT=$S(X="^^":2,X="^":1,1:0) I "^^"[X K X W @IOF Q
W !,"ENTER 'RETURN' TO CONTINUE '^' TO STOP LISTING OR '^^' TO QUIT",$C(7)
G HEAD
Q
EDIT ;EDIT PT COMMENTS
Q:GMRAOUT=2
S GMRAOUT=0
I '$D(^GMR(120.85,GMRAPA1,"PTC2",0)) S ^(0)="^120.85315D^^"
D NOW^%DTC S DIC="^GMR(120.85,"_GMRAPA1_",""PTC2"",",DLAYGO=120.85,DA(1)=GMRAPA1,DIC(0)="L",X=% K DD,DO,DINUM D FILE^DICN K DLAYGO G EXIT:+Y'>0
S DA=+Y,DIE=DIC,DR="1" K DIC D ^DIE S:$D(Y) GMRAOUT=1
I '$O(^GMR(120.85,DA(1),"PTC2",DA,1,0)) S DIK=DIE D ^DIK
Q
EXIT ; EXIT OF ROUTINE
D:$D(GMRAPA1) UNLOCK^GMRAUTL(120.85,GMRAPA1)
EXIT1 ;EXIT IF NOT LOCKED
K ^TMP($J),^TMP("GMRA",$J)
D KILL^XUSCLEAN
Q