source: FOIAVistA/tag/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRAPST6.m@ 636

Last change on this file since 636 was 636, checked in by George Lilly, 14 years ago

WorldVistAEHR overlayed on FOIAVistA

File size: 3.7 KB
Line 
1GMRAPST6 ;HIRMFO/WAA- ADR OUTCOME REPORT ;3/5/97 15:16
2 ;;4.0;Adverse Reaction Tracking;**7**;Mar 29, 1996
3EN1 ; This routine will loop through the ADT entry point to get all
4 ; the entries in that date range.
5 S GMRAOUT=0
6 W !,"Select an Observed date range for this report."
7 D DT^GMRAPL G:GMRAOUT EXIT
8 D PRINTER
9EXIT ; Exit of program kill cleanup
10 D KILL^XUSCLEAN
11 K ^TMP($J,"GMRAPST6")
12 Q
13PRINTER ;Select printer
14 W ! K GMRAZIS D DEV^GMRAUTL I POP W !,"PLEASE TRY LATER" S GMRAOUT=1 Q
15 I $D(IO("Q")) D Q
16 . S ZTRTN="PRINT^GMRAPST6",(ZTSAVE("GMRAOUT"),ZTSAVE("GMAST"),ZTSAVE("GMAEN"))=""
17 . S ZTDESC="P&T Committee ADR Outcome Report" D ^%ZTLOAD
18 . W !!,$S($D(ZTSK):"Request queued...",1:"Request NOT queued please try Later.")
19 . Q
20 U IO D PRINT U IO(0)
21 Q
22PRINT ;Queue point for report
23 ;loop through the 120.85 file and look for the field that
24 K ^TMP($J,"GMRAPST6")
25 D NOW^%DTC S GMRADPDT=X
26 S GMRADATE=GMAST-.0001,GMRAPG=1
27 F S GMRADATE=$O(^GMR(120.85,"B",GMRADATE)) Q:GMRADATE<1 Q:GMRADATE>GMAEN D
28 .S GMRAPA1=0 F S GMRAPA1=$O(^GMR(120.85,"B",GMRADATE,GMRAPA1)) Q:GMRAPA1<1 D
29 ..S GMRAPA1(0)=$G(^GMR(120.85,GMRAPA1,0)) Q:GMRAPA1(0)="" ;Bad Node
30 ..S GMRADDT=$P(GMRAPA1(0),U) ; reaction date
31 ..S GMRAPA=$P(GMRAPA1(0),U,15) ; Get the 120.8 entry for this reaction in 120.85
32 ..S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0)) Q:GMRAPA(0)="" ; Bad node
33 ..Q:+$G(^GMR(120.8,GMRAPA,"ER")) ;entered in error data
34 ..S GMRACA=$P(GMRAPA(0),U,2) ; Causative Agent
35 ..S DFN=$P(GMRAPA(0),U),GMRACA=$E(GMRACA,1,22)_"-"_$E($P(^DPT(DFN,0),U),1)_$E($P(^(0),U,9),6,9)
36 ..S ^TMP($J,"GMRAPST6",GMRADDT,GMRACA,GMRAPA1)=""
37 ..Q
38 .Q
39 Q:GMRAOUT
40 I '$D(^TMP($J,"GMRAPST6")) D HEAD W !,"NO DATA FOR THIS REPORT..." Q
41 S GMRAOTH=$G(GMRAOTH,$O(^GMRD(120.83,"B","OTHER REACTION",0)))
42 S GMRADDT=0
43 F S GMRADDT=$O(^TMP($J,"GMRAPST6",GMRADDT)) Q:GMRADDT<1 D Q:GMRAOUT
44 .S GMRACA=""
45 .F S GMRACA=$O(^TMP($J,"GMRAPST6",GMRADDT,GMRACA)) Q:GMRACA="" D Q:GMRAOUT
46 ..S GMRAPA1=0
47 ..F S GMRAPA1=$O(^TMP($J,"GMRAPST6",GMRADDT,GMRACA,GMRAPA1)) Q:GMRAPA1<1 D Q:GMRAOUT
48 ...S GMRAPA1(0)=$G(^GMR(120.85,GMRAPA1,0))
49 ...Q:GMRAPA(0)=""
50 ...D HEAD Q:GMRAOUT
51 ...W !,$J($$FMTE^XLFDT(GMRADDT,"2D"),8) ; Obs Date
52 ...W ?8,"|",GMRACA ; Causative Agent
53 ...W ?38,"|"
54 ...S GMRAREC=0
55 ...S GMRAREC=$O(^GMR(120.85,GMRAPA1,2,0)) D:GMRAREC>0 SIGN("0",GMRAREC)
56 ...W ?58,"|" W:$P(GMRAPA1(0),U,4)="y" " Y" ; Req Tx with Rx
57 ...W ?63,"|" W:$P(GMRAPA1(0),U,7)="y" " Y" ; Req Hosp.
58 ...W ?68,"|" W:$P(GMRAPA1(0),U,10)="y" " Y" ; Disability
59 ...W ?73,"|" W:$P(GMRAPA1(0),U,3)="y" " Y" ; Death
60 ...F S GMRAREC=$O(^GMR(120.85,GMRAPA1,2,GMRAREC)) Q:GMRAREC<1 D SIGN("1",GMRAREC) Q:GMRAOUT
61 ...Q:GMRAOUT
62 ...D HEAD Q:GMRAOUT W !,?8,"|",?38,"|",?58,"|",?63,"|",?68,"|",?73,"|"
63 ...Q
64 ..Q
65 .Q
66 D CLOSE^GMRAUTL
67 Q
68SIGN(CNT,GMRAREC) ; Print Sign/Symptoms
69 N NAM,Y
70 S Y=$G(^GMR(120.85,GMRAPA1,2,GMRAREC,0))
71 S NAM=$S(+Y=GMRAOTH:$P(Y,U,2),$D(^GMRD(120.83,+Y,0)):$P(^GMRD(120.83,+Y,0),U),1:"")
72 I 'CNT W $E(NAM,1,19)
73 E D HEAD Q:GMRAOUT W !,?8,"|",?38,"|",$E(NAM,1,19),?58,"|",?63,"|",?68,"|",?73,"|"
74 Q
75HEAD ; Print header information
76 I GMRAPG'=1 Q:$Y<(IOSL-4)
77 I $E(IOST,1)="C" D Q:GMRAOUT
78 .I GMRAPG=1 W @IOF Q
79 .I GMRAPG'=1 D Q:GMRAOUT
80 ..N DIR S DIR(0)="E" D ^DIR I 'Y S GMRAOUT=1
81 ..K Y
82 ..Q
83 .Q
84 Q:GMRAOUT
85 I GMRAPG'=1 W @IOF
86 W "Report Date: ",$P($$FMTE^XLFDT(GMRADPDT),"@"),?70,"Page: ",GMRAPG
87 W !,?22,"P&T Committee ADR Outcome Report"
88 W !,?25,"From: ",$$FMTE^XLFDT(GMAST,"2D")," To: ",$$FMTE^XLFDT(GMAEN,"2D")
89 W !,$$REPEAT^XLFSTR("-",79)
90 W !,"Obsv.",?8,"|",?38,"|",?58,"|Req.",?63,"|Req.",?68,"|",?73,"|"
91 W !,"Date",?8,"|Causative agent-Pat. ID",?38,"|Sign/Symptoms",?58,"|Tx",?63,"|Hosp",?68,"|Dis.",?73,"|Death"
92 W !,$$REPEAT^XLFSTR("-",79)
93 S GMRAPG=GMRAPG+1
94 I $D(ZTQUEUED) S:$$STPCK^GMRAUTL1 GMRAOUT=1 ; Check if stopped by user
95 Q
Note: See TracBrowser for help on using the repository browser.