- GMRAPST2 ;HIRMFO/WAA- PRINT SUM LISTING OF OUT COMES ;3/5/97 14:50
- ;;4.0;Adverse Reaction Tracking;**7,33**;Mar 29, 1996;Build 5
- EN1 ; This routine will loop through the ADT entry point to get all
- ; the entries in that date range.
- S GMRAOUT=0
- W !,"Select an Observed date range for this report."
- D DT^GMRAPL G:GMRAOUT EXIT
- D PRINTER
- EXIT ; Exit of program kill cleanup
- D KILL^XUSCLEAN
- Q
- PRINTER ;Select printer
- W ! K GMRAZIS D DEV^GMRAUTL I POP W !,"PLEASE TRY LATER" S GMRAOUT=1 Q
- I $D(IO("Q")) D Q
- . S ZTRTN="PRINT^GMRAPST2",(ZTSAVE("GMRAOUT"),ZTSAVE("GMAST"),ZTSAVE("GMAEN"))=""
- . S ZTDESC="Summary of Outcomes" D ^%ZTLOAD
- . W !!,$S($D(ZTSK):"Request queued...",1:"Request NOT queued please try Later.")
- . Q
- U IO D PRINT U IO(0)
- Q
- PRINT ;Queue point for report
- ;loop through the 120.85 file and look for the field that
- D NOW^%DTC S GMRADPDT=X
- S GMRADATE=GMAST-.0001,GMRAPG=1
- S (GMRARRAY("YES"),GMRARRAY("NO"),GMRARRAY("NULL"))="",GMRATOT=0
- F S GMRADATE=$O(^GMR(120.85,"B",GMRADATE)) Q:GMRADATE<1 Q:GMRADATE>GMAEN D
- .S GMRAPA1=0 F S GMRAPA1=$O(^GMR(120.85,"B",GMRADATE,GMRAPA1)) Q:GMRAPA1<1 D
- ..S GMRAPA1(0)=$G(^GMR(120.85,GMRAPA1,0)) Q:GMRAPA1(0)="" ;Bad Node
- ..Q:+$G(^GMR(120.8,$P(GMRAPA1(0),U,15),"ER")) ;Entered in Error data
- ..Q:'$$PRDTST^GMRAUTL1($P(GMRAPA1(0),U,2)) ;GMRA*4*33 Exclude test patient from report if production or legacy environment.
- ..S GMRATOT=GMRATOT+1
- ..F GMRALAB=1:1 S GMRALINE=$T(TEXT+GMRALAB) Q:$P(GMRALINE,";",3)="" D
- ...S GMRAP=$P(GMRALINE,";",4)
- ...I $P(GMRAPA1(0),U,GMRAP)="y" S $P(GMRARRAY("YES"),U,GMRAP)=$P(GMRARRAY("YES"),U,GMRAP)+1
- ...I $P(GMRAPA1(0),U,GMRAP)="n" S $P(GMRARRAY("NO"),U,GMRAP)=$P(GMRARRAY("NO"),U,GMRAP)+1
- ...I $P(GMRAPA1(0),U,GMRAP)="" S $P(GMRARRAY("NULL"),U,GMRAP)=$P(GMRARRAY("NULL"),U,GMRAP)+1
- ...Q
- ..Q
- .Q
- Q:GMRAOUT
- D HEAD
- S (GMRAY,GMRAN,GMRANU)=0
- F GMRALAB=1:1 S GMRALINE=$T(TEXT+GMRALAB) Q:$P(GMRALINE,";",3)="" D
- .N GMRAP,GMRATAB
- .S GMRAP=$P(GMRALINE,";",4)
- .S GMRATAB=40-$L($P(GMRALINE,";",3))
- .W !,?GMRATAB,$P(GMRALINE,";",3)
- .W ?42,$P(GMRARRAY("YES"),U,GMRAP)
- .S GMRAY=GMRAY+$P(GMRARRAY("YES"),U,GMRAP)
- .W ?53,"| ",$P(GMRARRAY("NO"),U,GMRAP)
- .S GMRAN=GMRAN+$P(GMRARRAY("NO"),U,GMRAP)
- .W ?63,"| ",$P(GMRARRAY("NULL"),U,GMRAP)
- .S GMRANU=GMRANU+$P(GMRARRAY("NULL"),U,GMRAP)
- .Q
- W !,?30," ---------------------------------------"
- W !,?32,"Totals: ",?42,GMRAY,?53,"| ",GMRAN,?63,"| ",GMRANU
- W !!,?22,"Total number of records processed ",GMRATOT
- D CLOSE^GMRAUTL
- Q
- ;has the patient died within the date
- HEAD ; Print header information
- I GMRAPG'=1 Q:$Y<(IOSL-4)
- I $E(IOST,1)="C" D Q:GMRAOUT
- .I GMRAPG=1 W @IOF Q
- .I GMRAPG'=1 D Q:GMRAOUT
- ..N DIR S DIR(0)="E" D ^DIR I 'Y S GMRAOUT=1
- ..K Y
- ..Q
- .Q
- Q:GMRAOUT
- I GMRAPG'=1 W @IOF
- W "Report Date: ",$P($$FMTE^XLFDT(GMRADPDT),"@"),?70,"Page: ",GMRAPG
- W !,?30,"Summary of Outcomes"
- W !,?25,"From: ",$$FMTE^XLFDT(GMAST,"2D")," To: ",$$FMTE^XLFDT(GMAEN,"2D")
- W !,?42,"Yes",?55,"No",?65,"No Response"
- W !,$$REPEAT^XLFSTR("-",79)
- S GMRAPG=GMRAPG+1
- I $D(ZTQUEUED) S:$$STPCK^GMRAUTL1 GMRAOUT=1 ; Check if stopped by user
- Q
- TEXT ;;these are the labels that will denote the field data
- ;;Patients that Died: ;3
- ;;Reactions treated with RX drugs: ;4
- ;;Life Threatening illness: ;5
- ;;Required ER/MD visit: ;6
- ;;Required hospitalization: ;7
- ;;Prolonged Hospitalization: ;9
- ;;Resulted in permanent disability: ;10
- ;;Patient recovered: ;11
- ;;Congenital Anomaly: ;16
- ;;Required intervention: ;17
- ;;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRAPST2 3579 printed Apr 23, 2025@17:54:43 Page 2
- GMRAPST2 ;HIRMFO/WAA- PRINT SUM LISTING OF OUT COMES ;3/5/97 14:50
- +1 ;;4.0;Adverse Reaction Tracking;**7,33**;Mar 29, 1996;Build 5
- EN1 ; This routine will loop through the ADT entry point to get all
- +1 ; the entries in that date range.
- +2 SET GMRAOUT=0
- +3 WRITE !,"Select an Observed date range for this report."
- +4 DO DT^GMRAPL
- if GMRAOUT
- GOTO EXIT
- +5 DO PRINTER
- EXIT ; Exit of program kill cleanup
- +1 DO KILL^XUSCLEAN
- +2 QUIT
- PRINTER ;Select printer
- +1 WRITE !
- KILL GMRAZIS
- DO DEV^GMRAUTL
- IF POP
- WRITE !,"PLEASE TRY LATER"
- SET GMRAOUT=1
- QUIT
- +2 IF $DATA(IO("Q"))
- Begin DoDot:1
- +3 SET ZTRTN="PRINT^GMRAPST2"
- SET (ZTSAVE("GMRAOUT"),ZTSAVE("GMAST"),ZTSAVE("GMAEN"))=""
- +4 SET ZTDESC="Summary of Outcomes"
- DO ^%ZTLOAD
- +5 WRITE !!,$SELECT($DATA(ZTSK):"Request queued...",1:"Request NOT queued please try Later.")
- +6 QUIT
- End DoDot:1
- QUIT
- +7 USE IO
- DO PRINT
- USE IO(0)
- +8 QUIT
- PRINT ;Queue point for report
- +1 ;loop through the 120.85 file and look for the field that
- +2 DO NOW^%DTC
- SET GMRADPDT=X
- +3 SET GMRADATE=GMAST-.0001
- SET GMRAPG=1
- +4 SET (GMRARRAY("YES"),GMRARRAY("NO"),GMRARRAY("NULL"))=""
- SET GMRATOT=0
- +5 FOR
- SET GMRADATE=$ORDER(^GMR(120.85,"B",GMRADATE))
- if GMRADATE<1
- QUIT
- if GMRADATE>GMAEN
- QUIT
- Begin DoDot:1
- +6 SET GMRAPA1=0
- FOR
- SET GMRAPA1=$ORDER(^GMR(120.85,"B",GMRADATE,GMRAPA1))
- if GMRAPA1<1
- QUIT
- Begin DoDot:2
- +7 ;Bad Node
- SET GMRAPA1(0)=$GET(^GMR(120.85,GMRAPA1,0))
- if GMRAPA1(0)=""
- QUIT
- +8 ;Entered in Error data
- if +$GET(^GMR(120.8,$PIECE(GMRAPA1(0),U,15),"ER"))
- QUIT
- +9 ;GMRA*4*33 Exclude test patient from report if production or legacy environment.
- if '$$PRDTST^GMRAUTL1($PIECE(GMRAPA1(0),U,2))
- QUIT
- +10 SET GMRATOT=GMRATOT+1
- +11 FOR GMRALAB=1:1
- SET GMRALINE=$TEXT(TEXT+GMRALAB)
- if $PIECE(GMRALINE,";",3)=""
- QUIT
- Begin DoDot:3
- +12 SET GMRAP=$PIECE(GMRALINE,";",4)
- +13 IF $PIECE(GMRAPA1(0),U,GMRAP)="y"
- SET $PIECE(GMRARRAY("YES"),U,GMRAP)=$PIECE(GMRARRAY("YES"),U,GMRAP)+1
- +14 IF $PIECE(GMRAPA1(0),U,GMRAP)="n"
- SET $PIECE(GMRARRAY("NO"),U,GMRAP)=$PIECE(GMRARRAY("NO"),U,GMRAP)+1
- +15 IF $PIECE(GMRAPA1(0),U,GMRAP)=""
- SET $PIECE(GMRARRAY("NULL"),U,GMRAP)=$PIECE(GMRARRAY("NULL"),U,GMRAP)+1
- +16 QUIT
- End DoDot:3
- +17 QUIT
- End DoDot:2
- +18 QUIT
- End DoDot:1
- +19 if GMRAOUT
- QUIT
- +20 DO HEAD
- +21 SET (GMRAY,GMRAN,GMRANU)=0
- +22 FOR GMRALAB=1:1
- SET GMRALINE=$TEXT(TEXT+GMRALAB)
- if $PIECE(GMRALINE,";",3)=""
- QUIT
- Begin DoDot:1
- +23 NEW GMRAP,GMRATAB
- +24 SET GMRAP=$PIECE(GMRALINE,";",4)
- +25 SET GMRATAB=40-$LENGTH($PIECE(GMRALINE,";",3))
- +26 WRITE !,?GMRATAB,$PIECE(GMRALINE,";",3)
- +27 WRITE ?42,$PIECE(GMRARRAY("YES"),U,GMRAP)
- +28 SET GMRAY=GMRAY+$PIECE(GMRARRAY("YES"),U,GMRAP)
- +29 WRITE ?53,"| ",$PIECE(GMRARRAY("NO"),U,GMRAP)
- +30 SET GMRAN=GMRAN+$PIECE(GMRARRAY("NO"),U,GMRAP)
- +31 WRITE ?63,"| ",$PIECE(GMRARRAY("NULL"),U,GMRAP)
- +32 SET GMRANU=GMRANU+$PIECE(GMRARRAY("NULL"),U,GMRAP)
- +33 QUIT
- End DoDot:1
- +34 WRITE !,?30," ---------------------------------------"
- +35 WRITE !,?32,"Totals: ",?42,GMRAY,?53,"| ",GMRAN,?63,"| ",GMRANU
- +36 WRITE !!,?22,"Total number of records processed ",GMRATOT
- +37 DO CLOSE^GMRAUTL
- +38 QUIT
- +39 ;has the patient died within the date
- HEAD ; Print header information
- +1 IF GMRAPG'=1
- if $Y<(IOSL-4)
- QUIT
- +2 IF $EXTRACT(IOST,1)="C"
- Begin DoDot:1
- +3 IF GMRAPG=1
- WRITE @IOF
- QUIT
- +4 IF GMRAPG'=1
- Begin DoDot:2
- +5 NEW DIR
- SET DIR(0)="E"
- DO ^DIR
- IF 'Y
- SET GMRAOUT=1
- +6 KILL Y
- +7 QUIT
- End DoDot:2
- if GMRAOUT
- QUIT
- +8 QUIT
- End DoDot:1
- if GMRAOUT
- QUIT
- +9 if GMRAOUT
- QUIT
- +10 IF GMRAPG'=1
- WRITE @IOF
- +11 WRITE "Report Date: ",$PIECE($$FMTE^XLFDT(GMRADPDT),"@"),?70,"Page: ",GMRAPG
- +12 WRITE !,?30,"Summary of Outcomes"
- +13 WRITE !,?25,"From: ",$$FMTE^XLFDT(GMAST,"2D")," To: ",$$FMTE^XLFDT(GMAEN,"2D")
- +14 WRITE !,?42,"Yes",?55,"No",?65,"No Response"
- +15 WRITE !,$$REPEAT^XLFSTR("-",79)
- +16 SET GMRAPG=GMRAPG+1
- +17 ; Check if stopped by user
- IF $DATA(ZTQUEUED)
- if $$STPCK^GMRAUTL1
- SET GMRAOUT=1
- +18 QUIT
- TEXT ;;these are the labels that will denote the field data
- +1 ;;Patients that Died: ;3
- +2 ;;Reactions treated with RX drugs: ;4
- +3 ;;Life Threatening illness: ;5
- +4 ;;Required ER/MD visit: ;6
- +5 ;;Required hospitalization: ;7
- +6 ;;Prolonged Hospitalization: ;9
- +7 ;;Resulted in permanent disability: ;10
- +8 ;;Patient recovered: ;11
- +9 ;;Congenital Anomaly: ;16
- +10 ;;Required intervention: ;17
- +11 ;;