Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: GMRAPST7

GMRAPST7.m

Go to the documentation of this file.
  1. GMRAPST7 ;HIRMFO/WAA- ADVERSE DRUG REACTION REPORT ;3/5/97 15:17
  1. ;;4.0;Adverse Reaction Tracking;**7,33**;Mar 29, 1996;Build 5
  1. EN1 ; This routine will loop through the ADT entry point to get all
  1. ; the entries in that date range.
  1. S GMRAOUT=0
  1. W !,"Select an Observed date range for this report."
  1. D DT^GMRAPL G:GMRAOUT EXIT
  1. D PRINTER
  1. EXIT ; Exit of program kill cleanup
  1. D KILL^XUSCLEAN
  1. K ^TMP($J,"GMRAPST7")
  1. Q
  1. PRINTER ;Select printer
  1. W !!,"This report required a 132 column printer."
  1. K GMRAZIS S GMRAZIS="M132" D DEV^GMRAUTL I POP W !,"PLEASE TRY LATER" S GMRAOUT=1 Q
  1. I $D(IO("Q")) D Q
  1. . S ZTRTN="PRINT^GMRAPST7",(ZTSAVE("GMRAOUT"),ZTSAVE("GMAST"),ZTSAVE("GMAEN"))=""
  1. . S ZTDESC="P&T Committee ADR Report" D ^%ZTLOAD
  1. . W !!,$S($D(ZTSK):"Request queued...",1:"Request NOT queued please try Later.")
  1. . Q
  1. U IO D PRINT U IO(0)
  1. Q
  1. PRINT ;Queue point for report
  1. ;loop through the 120.85 file and look for the field that
  1. K ^TMP($J,"GMRAPST7")
  1. D NOW^%DTC S GMRADPDT=X
  1. S GMRADATE=GMAST-.0001,GMRAPG=1
  1. F S GMRADATE=$O(^GMR(120.85,"B",GMRADATE)) Q:GMRADATE<1 Q:GMRADATE>GMAEN D
  1. .S GMRAPA1=0 F S GMRAPA1=$O(^GMR(120.85,"B",GMRADATE,GMRAPA1)) Q:GMRAPA1<1 D
  1. ..S GMRAPA1(0)=$G(^GMR(120.85,GMRAPA1,0)) Q:GMRAPA1(0)="" ;Bad Node
  1. ..S GMRADDT=$P(GMRAPA1(0),U) ; reaction date
  1. ..S GMRAPA=$P(GMRAPA1(0),U,15) ; Get the 120.8 entry for this reaction in 120.85
  1. ..S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0)) Q:GMRAPA(0)="" ; Bad node
  1. ..Q:+$G(^GMR(120.8,GMRAPA,"ER")) ;Entered in error data
  1. ..S GMRACA=$P(GMRAPA(0),U,2) ; Causative Agent
  1. ..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)
  1. ..Q:'$$PRDTST^GMRAUTL1(DFN) ;GMRA*4*33 Exclude test patients from report if production or legacy environment.
  1. ..S ^TMP($J,"GMRAPST7",GMRADDT,GMRACA,GMRAPA1)=GMRAPA
  1. ..Q
  1. .Q
  1. Q:GMRAOUT
  1. I '$D(^TMP($J,"GMRAPST7")) D HEAD W !,"NO DATA FOR THIS REPORT..." Q
  1. S GMRAOTH=$G(GMRAOTH,$O(^GMRD(120.83,"B","OTHER REACTION",0)))
  1. S GMRADDT=0
  1. F S GMRADDT=$O(^TMP($J,"GMRAPST7",GMRADDT)) Q:GMRADDT<1 D Q:GMRAOUT
  1. .S GMRACA=""
  1. .F S GMRACA=$O(^TMP($J,"GMRAPST7",GMRADDT,GMRACA)) Q:GMRACA="" D Q:GMRAOUT
  1. ..S GMRAPA1=0
  1. ..F S GMRAPA1=$O(^TMP($J,"GMRAPST7",GMRADDT,GMRACA,GMRAPA1)) Q:GMRAPA1<1 D Q:GMRAOUT
  1. ...S GMRAPA=$G(^TMP($J,"GMRAPST7",GMRADDT,GMRACA,GMRAPA1))
  1. ...Q:GMRAPA=""
  1. ...S GMRAPA1(0)=$G(^GMR(120.85,GMRAPA1,0))
  1. ...Q:GMRAPA1(0)=""
  1. ...S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0))
  1. ...Q:GMRAPA(0)=""
  1. ...D HEAD Q:GMRAOUT
  1. ...W !,$J($$FMTE^XLFDT(GMRADDT,"2D"),8) ; Obs Date
  1. ...W ?8,"|",GMRACA ; Causative Agent
  1. ...W ?38,"|"
  1. ...S GMRAREC=0
  1. ...S GMRAREC=$O(^GMR(120.85,GMRAPA1,2,0)) D:GMRAREC>0 SIGN("0",GMRAREC)
  1. ...W ?58,"| " W $P(GMRAPA(0),U,14) ; Mechanism
  1. ...W ?63,"|" W $S($P(GMRAPA1(0),U,14)=1:"MILD",$P(GMRAPA1(0),U,14)=2:"MOD.",$P(GMRAPA1(0),U,14)=3:"SVR.",1:"") ; Severity
  1. ...W ?68,"|"
  1. ...K ^TMP($J,"GMRAWORD") D WORD^GMRAWORD(GMRAPA,"OVE",60)
  1. ...S GMRACNT=1 W $G(^TMP($J,"GMRAWORD",GMRACNT))
  1. ...F S GMRAREC=$O(^GMR(120.85,GMRAPA1,2,GMRAREC)) Q:GMRAREC<1 D SIGN("1",GMRAREC) Q:GMRAOUT
  1. ...F S GMRACNT=$O(^TMP($J,"GMRAWORD",GMRACNT)) Q:GMRACNT<1 D Q:GMRAOUT
  1. ....D HEAD Q:GMRAOUT W !,?8,"|",?38,"|",?58,"|",?63,"|",?68,"|"
  1. ....Q:GMRAOUT
  1. ....W $G(^TMP($J,"GMRAWORD",GMRACNT))
  1. ....Q
  1. ...K ^TMP($J,"GMRAWORD")
  1. ...Q:GMRAOUT
  1. ...D HEAD Q:GMRAOUT W !,?8,"|",?38,"|",?58,"|",?63,"|",?68,"|"
  1. ...Q
  1. ..Q
  1. .Q
  1. D CLOSE^GMRAUTL
  1. Q
  1. SIGN(CNT,GMRAREC) ; Print Sign/Symptoms
  1. N NAM,Y
  1. S Y=$G(^GMR(120.85,GMRAPA1,2,GMRAREC,0))
  1. S NAM=$S(+Y=GMRAOTH:$P(Y,U,2),$D(^GMRD(120.83,+Y,0)):$P(^GMRD(120.83,+Y,0),U),1:"")
  1. I 'CNT W $E(NAM,1,19)
  1. E D
  1. .D HEAD Q:GMRAOUT W !,?8,"|",?38,"|",$E(NAM,1,19),?58,"|",?63,"|",?68,"|"
  1. .I $D(^TMP($J,"GMRAWORD",(GMRACNT+1))) S GMRACNT=GMRACNT+1 W $G(^TMP($J,"GMRAWORD",GMRACNT))
  1. .Q
  1. Q
  1. I GMRAPG'=1 Q:$Y<(IOSL-4)
  1. I $E(IOST,1)="C" D Q:GMRAOUT
  1. .I GMRAPG=1 W @IOF Q
  1. .I GMRAPG'=1 D Q:GMRAOUT
  1. ..N DIR S DIR(0)="E" D ^DIR I 'Y S GMRAOUT=1
  1. ..K Y
  1. ..Q
  1. .Q
  1. Q:GMRAOUT
  1. I GMRAPG'=1 W @IOF
  1. N Z
  1. W "Report Date: ",$P($$FMTE^XLFDT(GMRADPDT),"@"),?125,"Page: ",GMRAPG
  1. W !,?48,"P&T Committee ADR Report"
  1. W !,?51,"From: ",$$FMTE^XLFDT(GMAST,"2D")," To: ",$$FMTE^XLFDT(GMAEN,"2D")
  1. W !,$$REPEAT^XLFSTR("-",130)
  1. W !,"Obsv.",?8,"|",?38,"|",?58,"|ADR",?63,"|ADR",?68,"|"
  1. W !,"Date",?8,"|Causative agent-Pat. ID",?38,"|Sign/Symptoms",?58,"|Mech",?63,"|Svr.",?68,"|Comments"
  1. W !,$$REPEAT^XLFSTR("-",130)
  1. S GMRAPG=GMRAPG+1
  1. I $D(ZTQUEUED) S:$$STPCK^GMRAUTL1 GMRAOUT=1 ; Check if stopped by user
  1. Q