QAMPHIS1 ;HISC/GJC-ROUTINE TO GENERATE MONITOR SUMMARY REPORTS ;9/10/93 15:10
;;1.0;Clinical Monitoring System;;09/13/1993
;
S QAQDIC="^QA(743,",QAQDIC(0)="AEMNQZ",QAQDIC("A")="Select MONITOR: ",QAQUTIL="QAM MONITOR" D EN1^QAQSELCT G:QAQQUIT K2
D ^QAQDATE G:QAQQUIT K2
;*** Choose a device ***
K IOP,%ZIS S %ZIS="MQ" D ^%ZIS G:POP K2
I $D(IO("Q")) K IO("Q") S ZTDESC="Generate monitor summary reports.",ZTRTN="EN1^QAMPHIS1",(ZTSAVE("QAQ*"),ZTSAVE("^UTILITY($J,"))="" D ^%ZTLOAD G K1
;*** End choose device ***
EN1 U IO S QAMFOUND=0
K QAMST S QAMHDH=1,QAMUOUT="",$P(QAMST,"-",81)="",Y=DT X ^DD("DD") S QAMDT=Y
S QAM="" F S QAM=$O(^UTILITY($J,"QAM MONITOR",QAM)) Q:QAM="" S QAMPG(QAM)=0
S QAM="" F S QAM=$O(^UTILITY($J,"QAM MONITOR",QAM)) Q:QAM=""!(QAMUOUT="^") F QAM1=0:0 S QAM1=$O(^UTILITY($J,"QAM MONITOR",QAM,QAM1)) Q:QAM1'>0 I $D(^QA(743.2,"B",QAM1)) D HDER,PRNT1 Q:QAMUOUT="^"
I 'QAMFOUND S QAM=$O(^UTILITY($J,"QAM MONITOR","")) D HEAD W !!,"NO DATA FOUND FOR THIS REPORT"
K1 W ! D ^%ZISC,HOME^%ZIS
K2 K %ZIS,DIR,POP,QAM,QAM1,QAM2,QAMDT,QAMFOUND,QAMHDH,QAMND0,QAMND1,QAMND2,QAMPG,QAMST,QAMUOUT,QAQDIC,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK,^UTILITY($J,"QAM MONITOR")
D K^QAQDATE S:$D(ZTQUEUED) ZTREQ="@"
Q
HDER ;HEADER
S QAMFOUND=1 D HEAD
S QAMND0=$G(^QA(743,QAM1,0)),QAMND1=$S($D(^QA(743,QAM1,1)):^(1),1:"")
W !!,"CODE: ",$P(QAMND0,U)_$S($P(QAMND0,U,4):" (a)",1:" (m)"),?43,"TITLE: ",$P(QAMND0,U,2),!
W "THRESHOLD: ",$P(QAMND1,U,3),?21,$S($P(QAMND1,U,3)["%":"MINSAMPLE: ",1:"ALERT LEV: "),$P(QAMND1,U,2),?42,"TIM FR: ",$P($G(^QA(743.92,+QAMND1,0)),U),!
Q
HDH ;
I $E(IOST)="C" K DIR S DIR(0)="E" D ^DIR K DIR S QAMUOUT=$S(Y'>0:"^",1:"") Q:QAMUOUT="^"
D:QAMHDH HDER
Q
PRNT1 ;
F QAM2=0:0 S QAM2=$O(^QA(743.2,"B",QAM1,QAM2)) Q:QAM2'>0 D:$Y>(IOSL-5) HDH Q:QAMUOUT="^" S QAMND2=$S($D(^QA(743.2,QAM2,0)):^(0),1:"") I $P(QAMND2,U,2)'<QAQNBEG&($P(QAMND2,U,3)'>QAQNEND) D PRNT2
I QAMUOUT="" S QAMHDH=0 D:$O(^UTILITY($J,"QAM MONITOR",QAM))]"" HDH S QAMHDH=1
Q
PRNT2 ;
S Y=$P(QAMND2,U,2) X ^DD("DD") W !,"START: ",Y
W ?25,"FALLOUT: ",$P(QAMND2,U,4)
W ?50,"PERCENT: " I QAMND2]"",$P(QAMND2,U,4),$P(QAMND2,U,5),$P(QAMND2,U,5)>0 W $J(($P(QAMND2,U,4)/$P(QAMND2,U,5))*100,3,3)_"%"
S Y=$P(QAMND2,U,3) X ^DD("DD") W !,"END: ",Y
W ?25,"SAMPLE SIZE: ",$P(QAMND2,U,5)
W ?50,"THRESHOLD MET: ",$S($P(QAMND2,U,6)=1:"YES",1:"NO"),!
Q
HEAD ;
S QAMPG(QAM)=QAMPG(QAM)+1
W:(QAMPG(QAM)>1)!($E(IOST)="C") @IOF
W !?32,"MONITOR HISTORY",?68,QAMDT,!?68,"PAGE: ",QAMPG(QAM),!,QAMST
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HQAMPHIS1 2541 printed Dec 13, 2024@01:42:34 Page 2
QAMPHIS1 ;HISC/GJC-ROUTINE TO GENERATE MONITOR SUMMARY REPORTS ;9/10/93 15:10
+1 ;;1.0;Clinical Monitoring System;;09/13/1993
+2 ;
+3 SET QAQDIC="^QA(743,"
SET QAQDIC(0)="AEMNQZ"
SET QAQDIC("A")="Select MONITOR: "
SET QAQUTIL="QAM MONITOR"
DO EN1^QAQSELCT
if QAQQUIT
GOTO K2
+4 DO ^QAQDATE
if QAQQUIT
GOTO K2
+5 ;*** Choose a device ***
+6 KILL IOP,%ZIS
SET %ZIS="MQ"
DO ^%ZIS
if POP
GOTO K2
+7 IF $DATA(IO("Q"))
KILL IO("Q")
SET ZTDESC="Generate monitor summary reports."
SET ZTRTN="EN1^QAMPHIS1"
SET (ZTSAVE("QAQ*"),ZTSAVE("^UTILITY($J,"))=""
DO ^%ZTLOAD
GOTO K1
+8 ;*** End choose device ***
EN1 USE IO
SET QAMFOUND=0
+1 KILL QAMST
SET QAMHDH=1
SET QAMUOUT=""
SET $PIECE(QAMST,"-",81)=""
SET Y=DT
XECUTE ^DD("DD")
SET QAMDT=Y
+2 SET QAM=""
FOR
SET QAM=$ORDER(^UTILITY($JOB,"QAM MONITOR",QAM))
if QAM=""
QUIT
SET QAMPG(QAM)=0
+3 SET QAM=""
FOR
SET QAM=$ORDER(^UTILITY($JOB,"QAM MONITOR",QAM))
if QAM=""!(QAMUOUT="^")
QUIT
FOR QAM1=0:0
SET QAM1=$ORDER(^UTILITY($JOB,"QAM MONITOR",QAM,QAM1))
if QAM1'>0
QUIT
IF $DATA(^QA(743.2,"B",QAM1))
DO HDER
DO PRNT1
if QAMUOUT="^"
QUIT
+4 IF 'QAMFOUND
SET QAM=$ORDER(^UTILITY($JOB,"QAM MONITOR",""))
DO HEAD
WRITE !!,"NO DATA FOUND FOR THIS REPORT"
K1 WRITE !
DO ^%ZISC
DO HOME^%ZIS
K2 KILL %ZIS,DIR,POP,QAM,QAM1,QAM2,QAMDT,QAMFOUND,QAMHDH,QAMND0,QAMND1,QAMND2,QAMPG,QAMST,QAMUOUT,QAQDIC,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK,^UTILITY($JOB,"QAM MONITOR")
+1 DO K^QAQDATE
if $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 QUIT
HDER ;HEADER
+1 SET QAMFOUND=1
DO HEAD
+2 SET QAMND0=$GET(^QA(743,QAM1,0))
SET QAMND1=$SELECT($DATA(^QA(743,QAM1,1)):^(1),1:"")
+3 WRITE !!,"CODE: ",$PIECE(QAMND0,U)_$SELECT($PIECE(QAMND0,U,4):" (a)",1:" (m)"),?43,"TITLE: ",$PIECE(QAMND0,U,2),!
+4 WRITE "THRESHOLD: ",$PIECE(QAMND1,U,3),?21,$SELECT($PIECE(QAMND1,U,3)["%":"MINSAMPLE: ",1:"ALERT LEV: "),$PIECE(QAMND1,U,2),?42,"TIM FR: ",$PIECE($GET(^QA(743.92,+QAMND1,0)),U),!
+5 QUIT
HDH ;
+1 IF $EXTRACT(IOST)="C"
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
SET QAMUOUT=$SELECT(Y'>0:"^",1:"")
if QAMUOUT="^"
QUIT
+2 if QAMHDH
DO HDER
+3 QUIT
PRNT1 ;
+1 FOR QAM2=0:0
SET QAM2=$ORDER(^QA(743.2,"B",QAM1,QAM2))
if QAM2'>0
QUIT
if $Y>(IOSL-5)
DO HDH
if QAMUOUT="^"
QUIT
SET QAMND2=$SELECT($DATA(^QA(743.2,QAM2,0)):^(0),1:"")
IF $PIECE(QAMND2,U,2)'<QAQNBEG&($PIECE(QAMND2,U,3)'>QAQNEND)
DO PRNT2
+2 IF QAMUOUT=""
SET QAMHDH=0
if $ORDER(^UTILITY($JOB,"QAM MONITOR",QAM))]""
DO HDH
SET QAMHDH=1
+3 QUIT
PRNT2 ;
+1 SET Y=$PIECE(QAMND2,U,2)
XECUTE ^DD("DD")
WRITE !,"START: ",Y
+2 WRITE ?25,"FALLOUT: ",$PIECE(QAMND2,U,4)
+3 WRITE ?50,"PERCENT: "
IF QAMND2]""
IF $PIECE(QAMND2,U,4)
IF $PIECE(QAMND2,U,5)
IF $PIECE(QAMND2,U,5)>0
WRITE $JUSTIFY(($PIECE(QAMND2,U,4)/$PIECE(QAMND2,U,5))*100,3,3)_"%"
+4 SET Y=$PIECE(QAMND2,U,3)
XECUTE ^DD("DD")
WRITE !,"END: ",Y
+5 WRITE ?25,"SAMPLE SIZE: ",$PIECE(QAMND2,U,5)
+6 WRITE ?50,"THRESHOLD MET: ",$SELECT($PIECE(QAMND2,U,6)=1:"YES",1:"NO"),!
+7 QUIT
HEAD ;
+1 SET QAMPG(QAM)=QAMPG(QAM)+1
+2 if (QAMPG(QAM)>1)!($EXTRACT(IOST)="C")
WRITE @IOF
+3 WRITE !?32,"MONITOR HISTORY",?68,QAMDT,!?68,"PAGE: ",QAMPG(QAM),!,QAMST
+4 QUIT