source: FOIAVistA/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRADSP4.m@ 1154

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

initial load of FOIAVistA 6/30/08 version

File size: 4.3 KB
Line 
1GMRADSP4 ;HIRMFO/YMP,RM,WAA,FT-PATIENT'S ALLERGIES PRINTOUT ;7/23/97 09:44
2 ;;4.0;Adverse Reaction Tracking;**5,7,8**;Mar 29, 1996
3EN1 ; Entry to PRINT PATIENT REACTION DATA option
4 W ! S DIC="^DPT(",DIC(0)="AEQM",DIC("A")="Select PATIENT: " D ^DIC K DIC,DLAYGO I +Y'>0 S GMRAOUT=1 G EXIT
5 S DFN=+Y
6 S GMRAEER=$$ERR(DFN)
7 I '$D(^GMR(120.86,DFN,0)) W !!,$C(7),"NO ",$S(GMRAEER:"ACTIVE ",1:""),"ALLERGY/ADVERSE REACTION DATA EXISTS FOR THIS PATIENT",! W:GMRAEER "HOWEVER, THERE IS DATA ENTERED IN ERROR ON FILE",! G EN1:'GMRAEER
8 I $P($G(^GMR(120.86,DFN,0)),U,2)=0 W !!,$C(7),"PATIENT HAS ANSWERED NKA",$S(GMRAEER:" BUT HAS ""ENTERED IN ERROR"" DATA ON FILE",1:"") G:'GMRAEER EN1 W !
9 S GMRAOUT=0,GMRALINE=$$REPEAT^XLFSTR("=",32),GMRASLIN=$$REPEAT^XLFSTR("-",32)
10 D DEM^VADPT
11 S GMRAHEAD(1)=$J("ALLERGY/ADVERSE REACTION REPORTS",53)
12 S GMRAHEAD(2)=$J($E(VADM(1),1,15),1)_$J(VA("PID"),21)_$J($P(VADM(3),"^",2),24)_$J($S(VADM(4):"("_VADM(4)_")",1:""),5) D KVAR^VADPT K VA S (GMRAHEAD(3),GMRAHEAD(4))="",$P(GMRAHEAD(3),"-",81)=""
13 S GMRANOW=$$NOW^XLFDT,GMRANOW=$$FMTE^XLFDT(GMRANOW,"2P")
14 S GMRAHEAD(1.5)=$J("Run Date/Time: "_GMRANOW,53)
15DIR1 K DIR S DIR("A",1)="Select 1:DRUG, 2:FOOD, 3:OTHER",DIR(0)="LO^1:3",DIR("A")="Type of allergy"
16E S DIR(0)=DIR(0)_"^I X[""."" W !,""DO NOT USE DECIMAL VALUES."",$C(7) K X Q"
17 D ^DIR K DIR
18 G:'$D(Y(0)) EN1 S GMRASEL1=Y(0)
19 S GMRATTMP="" F X=1:1:3 I GMRASEL1[X S GMRATTMP=GMRATTMP_$E("DFO",X)
20 S GMRASEL=GMRATTMP
21 K GMRATTMP
22 K DIR S DIR("A",1)="Select 1:ACTIVE, 2:ENTERED IN ERROR",DIR(0)="LO^1:2",DIR("A")="Which would you like to see?"
23 S DIR(0)=DIR(0)_"^I X[""."" W !,""DO NOT USE DECIMAL VALUES."",$C(7) K X Q"
24 D ^DIR K DIR
25 G:Y["^"!'$D(Y(0)) EN1 S GMRASEL2=Y(0)
26 K GMRAZIS D DEV^GMRAUTL I POP S GMRAOUT=1 G EXIT
27 I $D(IO("Q")) D TASK G EXIT
28BEGIN K ^TMP($J,"GMRADSP") S GMRANKA=0 F GMRARECN=0:0 S GMRARECN=$O(^GMR(120.8,"B",DFN,GMRARECN)) Q:GMRARECN'>0!GMRAOUT D SET
29 G PARSE
30 Q
31SET ; SET SORT ARRAY
32 S GMRANKA=$P($G(^GMR(120.86,DFN,0)),U,2) I GMRANKA'=1&(GMRASEL2'[2) Q
33 S GMRATEMP=^GMR(120.8,GMRARECN,0),GMRAKIND=$P(GMRATEMP,"^",20),GMRAEER=$S(+$G(^GMR(120.8,GMRARECN,"ER")):1,1:0)
34 F %=1:1:$L(GMRASEL) I GMRAKIND[$E(GMRASEL,%) Q:'$P(GMRATEMP,"^",12)&'GMRAEER S ^TMP($J,"GMRADSP",GMRAEER,GMRAKIND,$P(GMRATEMP,"^",2),GMRARECN)="" Q
35 Q
36PARSE ;
37 S GMRAPG=0,GMRAFG=0,GMRACNT=0 D HDR^GMRADSP3
38 I 'GMRANKA&(GMRASEL2'[2) W !," This patient has No Known Allergies." Q
39 F GMRAZK=1:1:$L(GMRASEL2,",")-1 S GMRACTIV=$S($P(GMRASEL2,",",GMRAZK)=1:0,$P(GMRASEL2,",",GMRAZK)=2:1,1:"") S GMRASTAT=$S(GMRACTIV=0:"ACTIVE",GMRACTIV=1:"E/E",1:"") D:GMRACTIV]"" PARSE2 Q:GMRAOUT
40 I 'GMRACNT W !!,"THERE IS NO DATA FOR THIS REPORT."
41EXIT ;Quit and kill
42 D CLOSE^GMRAUTL
43 K ^TMP($J,"GMRADSP")
44 D KILL^XUSCLEAN
45 Q
46PARSE2 ;
47 S GMRATYP=""
48 F S GMRATYP=$O(^TMP($J,"GMRADSP",GMRACTIV,GMRATYP)) Q:GMRATYP="" D PARSECD Q:GMRAOUT
49 Q
50PARSECD ;
51 W:$D(^TMP($J,"GMRADSP",GMRACTIV,GMRATYP)) !,"STATUS: "_GMRASTAT,!,$E(GMRASLIN,1,$L(GMRASTAT)+8)
52 S GMRARES=$$OUTTYPE^GMRAUTL(GMRATYP) W:GMRARES'=""&$D(^TMP($J,"GMRADSP",GMRACTIV,GMRATYP)) !,?2,"TYPE: ",GMRARES,!,?2,$E(GMRALINE,1,6+$L(GMRARES)),!
53 S GMRAALL=""
54 F GMRAZM=0:0 S GMRAALL=$O(^TMP($J,"GMRADSP",GMRACTIV,GMRATYP,GMRAALL)) Q:GMRAALL=""!GMRAOUT D
55 . S GMRAREC="" F S GMRAREC=$O(^TMP($J,"GMRADSP",GMRACTIV,GMRATYP,GMRAALL,GMRAREC)) Q:GMRAREC=""!GMRAOUT D
56 . . S GMRAPA(0)=$G(^GMR(120.8,GMRAREC,0))
57 . . S GMRANS="",GMRAPA=GMRAREC,GMRAAL=GMRAALL,GMRACNT=GMRACNT+1
58 . . S GMRADRUG=($O(^GMR(120.8,GMRAPA,2,0))!$O(^GMR(120.8,GMRAPA,3,0))!$P(GMRAPA(0),"^",20)["D"!$S($P(GMRAPA(0),"^",3)[";PS":1,$P(GMRAPA(0),"^",3)[120.82:$S($D(^GMRD(120.82,+$P(GMRAPA(0),"^",3),0)):$P(^(0),"^",2)["D",1:0),1:0))
59 . . S GMRAOTH=$O(^GMRD(120.83,"B","OTHER REACTION",""))
60 . . S GMRAPRNT=1 U:IO IO D EN1^GMRADSP2
61 . . I 'GMRAOUT W !,".............................................................................." S GMRAFG=1
62 . . Q
63 . Q
64 Q
65TASK ;
66 S ZTDESC="GMRA Print Complete List of Patient's Reactions",ZTRTN="BEGIN^GMRADSP4",ZTDTH="",ZTIO=ION,ZTSAVE("GMRA*")="",ZTSAVE("DFN")="" D ^%ZTLOAD
67 W !!,$S($D(ZTSK):"Request queued...",1:"Request NOT queued please try later...")
68 K ZTRTN,ZTDH,ZTSAVE,ZTDTH,ZTSK
69 Q
70ERR(DFN) ;Checks to see if patient has entered in error data
71 N ERR,NUM
72 S NUM=0,ERR=0
73 F S NUM=$O(^GMR(120.8,"B",DFN,NUM)) Q:'+NUM S:+$G(^GMR(120.8,NUM,"ER")) ERR=1 Q:ERR
74 Q ERR
Note: See TracBrowser for help on using the repository browser.