VistA-WorldVistAEHR/r/OCCURRENCE_SCREEN-QAO/QAOSPDQ1.m

35 lines
1.9 KiB
Mathematica

QAOSPDQ1 ;HISC/DAD-DELINQUENT REVIEWS REPORT ;9/14/92 10:39
;;3.0;Occurrence Screen;;09/14/1993
S QAOSQUIT=0,PAGE=1,X="T",%DT="" D ^%DT X ^DD("DD") S TODAY=Y K UNDL S $P(UNDL,"-",81)="" D HEAD
I '$D(^TMP($J,"QAOSPDQ")) W !!,"NO DATA FOUND FOR THIS REPORT" G EXIT
S QAOSSERV="" F QAOSSERV(0)=0:0 S QAOSSERV=$O(^TMP($J,"QAOSPDQ",QAOSSERV)) Q:QAOSSERV=""!QAOSQUIT D LOOP1
EXIT ;
Q
LOOP1 ;
W !!?3,"SERVICE: ",$S(QAOSSERV["~":$P(QAOSSERV,"~",2),1:QAOSSERV),! D CHK
S QAOSNAME="" F QAOSNAME(0)=0:0 S QAOSNAME=$O(^TMP($J,"QAOSPDQ",QAOSSERV,QAOSNAME)) Q:QAOSNAME=""!QAOSQUIT F QAOSDATE=0:0 S QAOSDATE=$O(^TMP($J,"QAOSPDQ",QAOSSERV,QAOSNAME,QAOSDATE)) Q:QAOSDATE'>0!QAOSQUIT D LOOP2
Q
LOOP2 ;
S QAOS=^TMP($J,"QAOSPDQ",QAOSSERV,QAOSNAME,QAOSDATE),Y=QAOSDATE\1 X ^DD("DD") S QAOSDT=Y,Y=$P(QAOS,"^",3) X ^DD("DD") S QAOSPDUE=Y,Y=$P(QAOS,"^",4) X ^DD("DD") S QAOSMDUE=Y,QAOSSCRN=$P(QAOS,"^"),QAOSSN=$P(QAOS,"^",2)
W !,QAOSNAME,?32,QAOSDT,?45,QAOSSCRN,?53,QAOSPDUE,?68,QAOSMDUE D CHK W !,QAOSSN S (QAOSP,QAOSM)=.0001
LOOP3 ;
D PLOOP:QAOSP,MLOOP:QAOSM W ! D CHK G:(QAOSQUIT'>0)&(QAOSP+QAOSM) LOOP3
Q
PLOOP ;
S QAOSP=$O(^TMP($J,"QAOSPDQ",QAOSSERV,QAOSNAME,QAOSDATE,"P",QAOSP)) Q:QAOSP'>0 S Y=^TMP($J,"QAOSPDQ",QAOSSERV,QAOSNAME,QAOSDATE,"P",QAOSP) X ^DD("DD") W ?53,$S(Y]"":Y,1:" ---")
Q
MLOOP ;
S QAOSM=$O(^TMP($J,"QAOSMDQ",QAOSSERV,QAOSNAME,QAOSDATE,"M",QAOSM)) Q:QAOSM'>0 S Y=^TMP($J,"QAOSMDQ",QAOSSERV,QAOSNAME,QAOSDATE,"M",QAOSM) X ^DD("DD") W ?53,$S(Y]"":Y,1:" ---")
Q
CHK ;
I $Y>(IOSL-6) D:$E(IOST)="C" PAUSE Q:QAOSQUIT D HEAD
Q
PAUSE ;
K DIR S DIR(0)="E" D ^DIR S QAOSQUIT=$S(Y'>0:1,1:0)
Q
HEAD ;
W:(PAGE>1)!($E(IOST)="C") @IOF
W !!?31,"DELINQUENT REVIEWS",?68,TODAY,!?31,"AS OF ",TODAY,?68,"PAGE: ",PAGE,!?QAQTART,QAQ2HED S PAGE=PAGE+1 D EN6^QAQAUTL
W !,"PATIENT",?32,"OCCURRENCE",?45,"SCREEN",?53,"PEER:",?68,"MANAGEMENT:",!,"SSN",?32,"DATE",?53,"DUE DATE",?68,"DUE DATE",!?53,"COMPLETED",?68,"COMPLETED",!,UNDL
Q