GMRAU851 ;HIRMFO/RFM,WAA-UTILITIES FOR FILE 120.85 ;12/22/04 11:02
;;4.0;Adverse Reaction Tracking;**21**;Mar 29, 1996
HLP ;
N DIR
I '$D(^GMR(120.8,"B",DFN)) W !?4,"There are no reactions on file for this patient." Q
D HLP12085(DFN,"$$OBSDRG^GMRAU85(GMRAX)")
Q
HLP12085(DFN,SCR) ; THIS WILL LIST ENTRIES FOR PATIENT (DFN) IN FILE
; 120.85. AN OPTIONAL SCREEN (SCR), EXECUTABLE BOOLEAN FXN, WILL BE
; USED TO SCREEN OUT ENTRIES, WHILE USING SCREEN, GMRAX WILL BE 120.8
; IEN. GMRAOUT WILL BE SET TRUE IF ^/TIME OUT.
N GMRAL,GMRAX,GMRAY
I $G(SCR)="" S SCR="SCR=SCR"
S GMRAX="" F S GMRAX=$O(^GMR(120.8,"B",DFN,GMRAX)) Q:GMRAX'>0 S GMRAY=$P($G(^GMR(120.8,GMRAX,0)),U,2) I GMRAY]"",@SCR S GMRAL(GMRAY,GMRAX)=""
W #,!!,"CHOOSE FROM:" S GMRAY="" F Q:GMRAOUT S GMRAY=$O(GMRAL(GMRAY)) Q:GMRAY="" S GMRAX="" F S GMRAX=$O(GMRAL(GMRAY,GMRAX)) Q:GMRAX'>0 D Q:GMRAOUT
. I $Y>(IOSL-3) D ENDPG^GMRADSP3 Q:GMRAOUT W #
. W !?3,GMRAY
. Q
Q
HLP1 ;
I '$D(^GMR(120.85,"C",GMRAPA)) W !?4,"There are no observed date/times on file for this reaction." Q
S X="??",DIC="^GMR(120.85,",DIC(0)="EQ",DIC("S")="I $P(^(0),U,2)=DFN,$P(^(0),U,15)=GMRAPA",DIC("W")="" D ^DIC K DIC
Q
RXN ;ENTRY TO EDIT THE OBSERVED A/AR DATA
N GMRAR0 ;21
S GMRANDT=1
S GMRAPA=$P($G(^GMR(120.85,GMRAPA1,0)),U,15),GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0))
S GMRAOTH=$O(^GMRD(120.83,"B","OTHER REACTION",0))
F GMRAX=0:0 S GMRAX=$O(^GMR(120.85,GMRAPA1,2,GMRAX)) Q:GMRAX'>0 S Y=$S($D(^GMR(120.85,GMRAPA1,2,GMRAX,0)):^(0),1:""),X=$S(+Y=GMRAOTH:$P(Y,"^",2),$D(^GMRD(120.83,+Y,0)):$P(^(0),"^"),1:"") I X'="",Y'="" S GMRARPR(X,+Y)=X_"^"_$P(Y,"^",3)
D SITE^GMRAUTL
S GMRAY=GMRASITE
I GMRAY>0 F GMRAX=1:1:10 S X=$S($D(^GMRD(120.84,GMRAY,1,GMRAX,0)):$P(^(0),"^"),1:""),Y=$S($D(^GMRD(120.83,+X,0)):^(0),1:""),GMRAR10(GMRAX)=$S(X'=""!(Y'=""):X_"^"_Y,1:"")
D EN1^GMRAPER0 Q:GMRAOUT S:'$D(^GMR(120.85,GMRAPA1,2,0)) ^(0)="^120.8502P^^" S:'$D(^GMR(120.8,GMRAPA,10,0)) ^(0)="^120.81P^^" ;21
F GMRAREC=0:0 S GMRAREC=$O(GMRARAD(GMRAREC)) Q:GMRAREC'>0 S GMRAR0=GMRAREC_"^^"_DUZ D ADREAC ;21
S GMRAREC="" F GMRAX=0:0 S GMRAREC=$O(GMRAROT(GMRAREC)) Q:GMRAREC="" S GMRAR0=GMRAOTH_"^"_GMRAREC_"^"_DUZ D ADREAC ;21
F GMRAREC=0:0 S GMRAREC=$O(GMRARDL(GMRAREC)) Q:GMRAREC'>0 D DELREAC ;21
S GMRAREC="" F GMRAX=0:0 S GMRAREC=$O(GMRAROTD(GMRAREC)) Q:GMRAREC="" D DELREACO ;21
Q
ADREAC ; ADD ENTRY TO SIGNS/SYMPTOMS MULTIPLE
S GMRAZN=$P(^GMR(120.85,GMRAPA1,2,0),"^",3,4),DA=$P(GMRAZN,"^")+1 F DA=DA:1 Q:'$D(^GMR(120.85,GMRAPA1,2,DA,0))
S ^GMR(120.85,GMRAPA1,2,DA,0)=GMRAR0 S DIK="^GMR(120.85,DA(1),2,",DA(1)=GMRAPA1 D IX1^DIK S $P(^GMR(120.85,GMRAPA1,2,0),"^",3,4)=DA_"^"_($P(GMRAZN,"^",2)+1)
S GMRAZN=$P(^GMR(120.8,GMRAPA,10,0),"^",3,4),DA=$P(GMRAZN,"^")+1 F DA=DA:1 Q:'$D(^GMR(120.8,GMRAPA,10,DA,0)) ;21
S ^GMR(120.8,GMRAPA,10,DA,0)=GMRAR0_"^"_DT S DIK="^GMR(120.8,DA(1),10,",DA(1)=GMRAPA D IX1^DIK S $P(^GMR(120.8,GMRAPA,10,0),"^",3,4)=DA_"^"_($P(GMRAZN,"^",2)+1) ;21
Q
;
DELREAC ;Delete reactions from 120.85 and 120.8 entire section added in patch 21
S DA(1)=GMRAPA1,DIK="^GMR(120.85,"_DA(1)_",2,"
F DA=0:0 S DA=$O(^GMR(120.85,DA(1),2,"B",GMRAREC,DA)) Q:DA'>0 D ^DIK
S DA(1)=GMRAPA,DIK="^GMR(120.8,"_DA(1)_",10,"
F DA=0:0 S DA=$O(^GMR(120.8,DA(1),10,"B",GMRAREC,DA)) Q:DA'>0 D ^DIK
Q
;
DELREACO ;Delete free text reactions, added in 21
S DA(1)=GMRAPA1,DIK="^GMR(120.85,"_DA(1)_",2,"
F DA=0:0 S DA=$O(^GMR(120.85,DA(1),2,"B",GMRAOTH,DA)) Q:DA'>0 I $D(^GMR(120.85,DA(1),2,DA,0)),$P(^(0),U,2)=GMRAREC D ^DIK
S DA(1)=GMRAPA,DIK="^GMR(120.8,"_DA(1)_",10,"
F DA=0:0 S DA=$O(^GMR(120.8,DA(1),10,"B",GMRAOTH,DA)) Q:DA'>0 I $D(^GMR(120.8,DA(1),10,DA,0)),$P(^(0),U,2)=GMRAREC D ^DIK
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRAU851 3726 printed Dec 13, 2024@01:40:35 Page 2
GMRAU851 ;HIRMFO/RFM,WAA-UTILITIES FOR FILE 120.85 ;12/22/04 11:02
+1 ;;4.0;Adverse Reaction Tracking;**21**;Mar 29, 1996
HLP ;
+1 NEW DIR
+2 IF '$DATA(^GMR(120.8,"B",DFN))
WRITE !?4,"There are no reactions on file for this patient."
QUIT
+3 DO HLP12085(DFN,"$$OBSDRG^GMRAU85(GMRAX)")
+4 QUIT
HLP12085(DFN,SCR) ; THIS WILL LIST ENTRIES FOR PATIENT (DFN) IN FILE
+1 ; 120.85. AN OPTIONAL SCREEN (SCR), EXECUTABLE BOOLEAN FXN, WILL BE
+2 ; USED TO SCREEN OUT ENTRIES, WHILE USING SCREEN, GMRAX WILL BE 120.8
+3 ; IEN. GMRAOUT WILL BE SET TRUE IF ^/TIME OUT.
+4 NEW GMRAL,GMRAX,GMRAY
+5 IF $GET(SCR)=""
SET SCR="SCR=SCR"
+6 SET GMRAX=""
FOR
SET GMRAX=$ORDER(^GMR(120.8,"B",DFN,GMRAX))
if GMRAX'>0
QUIT
SET GMRAY=$PIECE($GET(^GMR(120.8,GMRAX,0)),U,2)
IF GMRAY]""
IF @SCR
SET GMRAL(GMRAY,GMRAX)=""
+7 WRITE #,!!,"CHOOSE FROM:"
SET GMRAY=""
FOR
if GMRAOUT
QUIT
SET GMRAY=$ORDER(GMRAL(GMRAY))
if GMRAY=""
QUIT
SET GMRAX=""
FOR
SET GMRAX=$ORDER(GMRAL(GMRAY,GMRAX))
if GMRAX'>0
QUIT
Begin DoDot:1
+8 IF $Y>(IOSL-3)
DO ENDPG^GMRADSP3
if GMRAOUT
QUIT
WRITE #
+9 WRITE !?3,GMRAY
+10 QUIT
End DoDot:1
if GMRAOUT
QUIT
+11 QUIT
HLP1 ;
+1 IF '$DATA(^GMR(120.85,"C",GMRAPA))
WRITE !?4,"There are no observed date/times on file for this reaction."
QUIT
+2 SET X="??"
SET DIC="^GMR(120.85,"
SET DIC(0)="EQ"
SET DIC("S")="I $P(^(0),U,2)=DFN,$P(^(0),U,15)=GMRAPA"
SET DIC("W")=""
DO ^DIC
KILL DIC
+3 QUIT
RXN ;ENTRY TO EDIT THE OBSERVED A/AR DATA
+1 ;21
NEW GMRAR0
+2 SET GMRANDT=1
+3 SET GMRAPA=$PIECE($GET(^GMR(120.85,GMRAPA1,0)),U,15)
SET GMRAPA(0)=$GET(^GMR(120.8,GMRAPA,0))
+4 SET GMRAOTH=$ORDER(^GMRD(120.83,"B","OTHER REACTION",0))
+5 FOR GMRAX=0:0
SET GMRAX=$ORDER(^GMR(120.85,GMRAPA1,2,GMRAX))
if GMRAX'>0
QUIT
SET Y=$SELECT($DATA(^GMR(120.85,GMRAPA1,2,GMRAX,0)):^(0),1:"")
SET X=$SELECT(+Y=GMRAOTH:$PIECE(Y,"^",2),$DATA(^GMRD(120.83,+Y,0)):$PIECE(^(0),"^"),1:"")
IF X'=""
IF Y'=""
SET GMRARPR(X,+Y)=X_"^"_$PIECE(Y,"^",3)
+6 DO SITE^GMRAUTL
+7 SET GMRAY=GMRASITE
+8 IF GMRAY>0
FOR GMRAX=1:1:10
SET X=$SELECT($DATA(^GMRD(120.84,GMRAY,1,GMRAX,0)):$PIECE(^(0),"^"),1:"")
SET Y=$SELECT($DATA(^GMRD(120.83,+X,0)):^(0),1:"")
SET GMRAR10(GMRAX)=$SELECT(X'=""!(Y'=""):X_"^"_Y,1:"")
+9 ;21
DO EN1^GMRAPER0
if GMRAOUT
QUIT
if '$DATA(^GMR(120.85,GMRAPA1,2,0))
SET ^(0)="^120.8502P^^"
if '$DATA(^GMR(120.8,GMRAPA,10,0))
SET ^(0)="^120.81P^^"
+10 ;21
FOR GMRAREC=0:0
SET GMRAREC=$ORDER(GMRARAD(GMRAREC))
if GMRAREC'>0
QUIT
SET GMRAR0=GMRAREC_"^^"_DUZ
DO ADREAC
+11 ;21
SET GMRAREC=""
FOR GMRAX=0:0
SET GMRAREC=$ORDER(GMRAROT(GMRAREC))
if GMRAREC=""
QUIT
SET GMRAR0=GMRAOTH_"^"_GMRAREC_"^"_DUZ
DO ADREAC
+12 ;21
FOR GMRAREC=0:0
SET GMRAREC=$ORDER(GMRARDL(GMRAREC))
if GMRAREC'>0
QUIT
DO DELREAC
+13 ;21
SET GMRAREC=""
FOR GMRAX=0:0
SET GMRAREC=$ORDER(GMRAROTD(GMRAREC))
if GMRAREC=""
QUIT
DO DELREACO
+14 QUIT
ADREAC ; ADD ENTRY TO SIGNS/SYMPTOMS MULTIPLE
+1 SET GMRAZN=$PIECE(^GMR(120.85,GMRAPA1,2,0),"^",3,4)
SET DA=$PIECE(GMRAZN,"^")+1
FOR DA=DA:1
if '$DATA(^GMR(120.85,GMRAPA1,2,DA,0))
QUIT
+2 SET ^GMR(120.85,GMRAPA1,2,DA,0)=GMRAR0
SET DIK="^GMR(120.85,DA(1),2,"
SET DA(1)=GMRAPA1
DO IX1^DIK
SET $PIECE(^GMR(120.85,GMRAPA1,2,0),"^",3,4)=DA_"^"_($PIECE(GMRAZN,"^",2)+1)
+3 ;21
SET GMRAZN=$PIECE(^GMR(120.8,GMRAPA,10,0),"^",3,4)
SET DA=$PIECE(GMRAZN,"^")+1
FOR DA=DA:1
if '$DATA(^GMR(120.8,GMRAPA,10,DA,0))
QUIT
+4 ;21
SET ^GMR(120.8,GMRAPA,10,DA,0)=GMRAR0_"^"_DT
SET DIK="^GMR(120.8,DA(1),10,"
SET DA(1)=GMRAPA
DO IX1^DIK
SET $PIECE(^GMR(120.8,GMRAPA,10,0),"^",3,4)=DA_"^"_($PIECE(GMRAZN,"^",2)+1)
+5 QUIT
+6 ;
DELREAC ;Delete reactions from 120.85 and 120.8 entire section added in patch 21
+1 SET DA(1)=GMRAPA1
SET DIK="^GMR(120.85,"_DA(1)_",2,"
+2 FOR DA=0:0
SET DA=$ORDER(^GMR(120.85,DA(1),2,"B",GMRAREC,DA))
if DA'>0
QUIT
DO ^DIK
+3 SET DA(1)=GMRAPA
SET DIK="^GMR(120.8,"_DA(1)_",10,"
+4 FOR DA=0:0
SET DA=$ORDER(^GMR(120.8,DA(1),10,"B",GMRAREC,DA))
if DA'>0
QUIT
DO ^DIK
+5 QUIT
+6 ;
DELREACO ;Delete free text reactions, added in 21
+1 SET DA(1)=GMRAPA1
SET DIK="^GMR(120.85,"_DA(1)_",2,"
+2 FOR DA=0:0
SET DA=$ORDER(^GMR(120.85,DA(1),2,"B",GMRAOTH,DA))
if DA'>0
QUIT
IF $DATA(^GMR(120.85,DA(1),2,DA,0))
IF $PIECE(^(0),U,2)=GMRAREC
DO ^DIK
+3 SET DA(1)=GMRAPA
SET DIK="^GMR(120.8,"_DA(1)_",10,"
+4 FOR DA=0:0
SET DA=$ORDER(^GMR(120.8,DA(1),10,"B",GMRAOTH,DA))
if DA'>0
QUIT
IF $DATA(^GMR(120.8,DA(1),10,DA,0))
IF $PIECE(^(0),U,2)=GMRAREC
DO ^DIK
+5 QUIT