source: FOIAVistA/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRAPHR1.m@ 1071

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

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1GMRAPHR1 ;HIRMFO/WAA,FT-ADD/DELETE/EDIT CONCOMITANT DRUGS ;4/6/05 14:18
2 ;;4.0;Adverse Reaction Tracking;**5,23**;Mar 29, 1996
3EN1 ;
4 Q:GMRAOUT
5 W @IOF N DIE,DA,GMRAXXX,GMRAX,GMRAGHC
6 K ^UTILITY("PSG",$J),^UTILITY("PSIV",$J),GMRARRAY
7 S GMRADT=$P(^GMR(120.85,GMRAPA1,0),U)
8 D ^GMRADSP7 G:'GMRAPA EXIT
9SELECT W ! D LST
10 ;SELECT ACTION
11 K DIR S DIR(0)="SOMBA^A:ADD;D:DELETE;E:EDIT",DIR("A")="Select Action (A/D/E): "
12 S DIR("?",1)="ENTER A TO ADD A NEW DRUG, D TO DELETE A DRUG OR"
13 S DIR("?")="E TO EDIT A DRUG ON FILE FOR THIS PATIENT"
14 D ^DIR I "^^"[Y S GMRAOUT=$L(Y) G EXIT
15 S GMRASEL=Y K DIR
16 I GMRASEL="A" S GMRALOOK=0 W ! D ADD K GMRALOOK G:GMRAOUT EXIT K GMRALOOK G SELECT
17 I GMRASEL="D" W ! D DEL G:GMRAOUT EXIT G SELECT
18 I GMRASEL="E" W ! D EDIT G:GMRAOUT EXIT G SELECT
19 G SELECT
20EDIT ;EDIT A DRUG
21 I '$O(^GMR(120.85,GMRAPA1,13,0)) W !,?3,"YOU CANNOT EDIT WHEN THERE IS NO DATA ON FILE.",$C(7) Q
22EDITLST ; DISPLAY TO EDIT FIELD
23 W !,"Select the DRUG RX you want to edit:",!
24 D LST
25EEDT K DA,DO,DIC,DIE,DLAYGO,DR
26 S DA(1)=GMRAPA1,DIC="^GMR(120.85,"_DA(1)_",13,",DIC(0)="AMQEZ" D ^DIC K DIC
27 I $D(DUOUT)!($D(DTOUT))!(Y=-1) S GMRAOUT=1 G QE
28 S DA(1)=GMRAPA1,DIE="^GMR(120.85,"_DA(1)_",13,",DA=+Y,DR=".01;1;2;3;4" D ^DIE
29QE K GMRAX,DA,DIE,DR,DIC,DLAYGO
30 Q
31ADD ;SELECT ON OF THE DRUG OR FREE TEXT
32 D DISP^GMRAPHR0 I GMRAOUT S GMRAOUT=GMRAOUT-1 Q:GMRAOUT
33 K % I '$D(GMRARRAY) D ADD2 Q:X=""!(X="^") G ADD
34ADDED W !,"Enter the number(s) of the DRUG to ADD or ""N"" for NEW: "
35 R GMRAX:DTIME S:'$T GMRAX="^^" I "^^"[GMRAX S GMRAOUT=$L(GMRAX) Q
36 I "??"[GMRAX W !,"ENTER THE NUMBER(S) OF THE ENTRY YOU WANT OR ""N"" FOR A NEW DRUG" G:$L(GMRAX)=1 ADDED G ADD
37 I GMRAX="n" S GMRAX="N"
38 I GMRAX="N" D ADD2 Q:X="" G ADD
39 I '$$VALST^GMRAPHR2(GMRAX,"PH") W !,$C(7),"INVALID SELECTION PLEASE SELECT ONE OF THE DRUGS LISTED OR ""N"" FOR A NEW DRUG" G ADD
40 S GMRALST=0 F S GMRALST=$O(GMRALST(GMRALST)) Q:GMRALST<1 S GMRAX=GMRALST D Q:GMRAOUT
41 .S X=$P(GMRARRAY("PH",GMRAX),U,2)
42 .I $D(^GMR(120.85,GMRAPA1,13,"B",X)) D Q:GMRAOUT!(%-1) K %
43 ..W !,"You already have a ",X," drug on file."
44 ..S %=2 F W !,"Do You still want to add this one" D YN^DICN S:%=-1 %=2,GMRAOUT=1 Q:% W !,"ENTER YES TO ADD THE DRUG or NO TO SELECT ANOTHER"
45 ..Q
46 .K DD,DO
47 .I '$O(^GMR(120.85,GMRAPA1,13,0)) S ^(0)="^120.8513^^"
48 .S DA(1)=GMRAPA1,DIC="^GMR(120.85,"_GMRAPA1_",13,",DIC(0)="L",DLAYGO=120.85 D FILE^DICN Q:(+Y<1)
49 .S DA=+Y,DIE=DIC K DIC
50 .I $P(GMRARRAY("PH",GMRAX),U)="OP" S DR="3////"_$P(GMRARRAY("PH",GMRAX),U,4)_";4////"_$E($P(GMRARRAY("PH",GMRAX),U,3),1,30)
51 .I $P(GMRARRAY("PH",GMRAX),U)="D" D
52 ..S DR="1////"_$P(GMRARRAY("PH",GMRAX),U,6)_";2////"_$P($P(GMRARRAY("PH",GMRAX),U,7),".") ;23 Only get date
53 ..S DR=DR_";4////"_$P(GMRARRAY("PH",GMRAX),U,3)_" "_$P(GMRARRAY("PH",GMRAX),U,4)_" "_$P(GMRARRAY("PH",GMRAX),U,5)
54 ..Q
55 .I $P(GMRARRAY("PH",GMRAX),U)="IV" D
56 ..S DR="1////"_$P(GMRARRAY("PH",GMRAX),U,6)_";2////"_$P($P(GMRARRAY("PH",GMRAX),U,7),".") ;23 Get date not time
57 ..S DR=DR_";4////"_$P(GMRARRAY("PH",GMRAX),U,3)_" IV "_$P(GMRARRAY("PH",GMRAX),U,4)_" "_$P(GMRARRAY("PH",GMRAX),U,5)
58 ..Q
59 .D ^DIE K DIE,DA,DR,GMRAX
60 .Q
61 ;G ADD
62 Q
63ADD2 ;
64 I '$O(^GMR(120.85,GMRAPA1,13,0)) S ^(0)="^120.8513^^"
65 S DA=GMRAPA1,DIE="^GMR(120.85,",DLAYGO=120.85,DR="13" D ^DIE
66 K DIE,DA,DR
67 Q
68DEL ;
69 I '$D(^GMR(120.85,GMRAPA1,13,0)) W !,"THERE ARE NO DRUGS SELECTED FOR THIS PATIENT." Q
70 K DA,DO,DIC,DIE,DLAYGO,DR
71 S DA(1)=GMRAPA1,DIC="^GMR(120.85,"_DA(1)_",13,",DIC(0)="AMQEZ" D ^DIC
72 I $D(DUOUT)!($D(DTOUT))!(Y=-1) S GMRAOUT=1 G DQ
73 K DIC,DA,DO
74 S DA(1)=GMRAPA1,DIK="^GMR(120.85,"_DA(1)_",13,",DA=+Y D ^DIK W "DELETED.."
75DQ K DIC,DIC,DA,DO,DLAYGO,DIK,Y
76 Q
77LST I '$O(^GMR(120.85,GMRAPA1,13,0)) W !,"THIS PATIENT HAS NO CONCOMITANT DRUGS ON FILE" Q
78 W !!,"This patient has the following Drugs selected: ",!
79 S GMRAX=0 F GMRAXX=1:1 S GMRAX=$O(^GMR(120.85,GMRAPA1,13,GMRAX)) Q:GMRAX<1 W !,?10,$P(^(GMRAX,0),U)
80 W ! K GMRAXX,GMRAX
81 Q
82EXIT ;EXIT LINE
83 K DIR,Y,GMRALST,GMRASEL,GMRABGDT,GMRAENDT,^UTILITY("PSG",$J),^UTILITY("PSIV",$J),GMRARRAY
84 Q
Note: See TracBrowser for help on using the repository browser.