ACDPVHST ;IHS/ADC/EDE/KML - DISPLAY PATIENT VISIT HISTORY;
;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
;
; This routine displays a patient's CDMIS visit history.
;
START ;
F D PATLOOP Q:ACDQ
D EOJ
Q
;
PATLOOP ; DISPLAY PATIENTS UNTIL DONE
D GETPAT
Q:ACDQ
D GETVSITS^ACDDEU
Q:ACDQ
I '$D(^TMP("ACD",$J,"VISITS")) W !!,"No CDMIS VISIT history for patient ",ACDDFN,! Q
I $D(IO("Q")) D Q
. S ZTRTN="DISPLAY^ACDPVHST",ZTDESC="CDMIS VISIT HISTORY",ZTDTH=$H,ZTSAVE("ACD*")="",ZTSAVE("^TMP(""ACD"",$J,""VISITS"",")=""
. D ^%ZTLOAD
. Q
D DISPLAY
I '$D(ACDSLAVE),$E(IOST,1,2)'="P-" D PAUSE^ACDDEU
D DEV^ACDDEU Q:ACDQ
I $D(ACDSLAVE)!(IO'=IO(0)) D DISPLAY
K ACDSLAVE S IO=IO(0)
Q
;
DISPLAY ; EP - FOR TASKMAN
I $D(ACDSLAVE) S IOP=ACDSLAVE D ^%ZIS
U IO
W:IO'=IO(0) @IOF
D DSPHIST^ACDDEU
I $D(ACDSLAVE) W @IOF D ^%ZISC
U 0
I $D(ZTQUEUED) D EOJ S ZTREQ="@"
Q
;
GETPAT ; GET PATIENT
S ACDQ=1
S AUPNLK("ALL")=1
S DIC="^AUPNPAT(",DIC(0)="AEMQ",DIC("S")="I $D(^ACDVIS(""D"",+Y))" D DIC^ACDFMC
K AUPNLK("ALL")
Q:Y<0
S ACDDFNP=+Y,ACDDFN=$P(^DPT(ACDDFNP,0),U)
S ACDQ=0
Q
;
EOJ ;
D ^%ZISC
D ^ACDKILL
Q
ACDPVHST ;IHS/ADC/EDE/KML - DISPLAY PATIENT VISIT HISTORY;
+1 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
+2 ;
+3 ; This routine displays a patient's CDMIS visit history.
+4 ;
START ;
+1 FOR
DO PATLOOP
IF ACDQ
QUIT
+2 DO EOJ
+3 QUIT
+4 ;
PATLOOP ; DISPLAY PATIENTS UNTIL DONE
+1 DO GETPAT
+2 IF ACDQ
QUIT
+3 DO GETVSITS^ACDDEU
+4 IF ACDQ
QUIT
+5 IF '$DATA(^TMP("ACD",$JOB,"VISITS"))
WRITE !!,"No CDMIS VISIT history for patient ",ACDDFN,!
QUIT
+6 IF $DATA(IO("Q"))
Begin DoDot:1
+7 SET ZTRTN="DISPLAY^ACDPVHST"
SET ZTDESC="CDMIS VISIT HISTORY"
SET ZTDTH=$HOROLOG
SET ZTSAVE("ACD*")=""
SET ZTSAVE("^TMP(""ACD"",$J,""VISITS"",")=""
+8 DO ^%ZTLOAD
+9 QUIT
End DoDot:1
QUIT
+10 DO DISPLAY
+11 IF '$DATA(ACDSLAVE)
IF $EXTRACT(IOST,1,2)'="P-"
DO PAUSE^ACDDEU
+12 DO DEV^ACDDEU
IF ACDQ
QUIT
+13 IF $DATA(ACDSLAVE)!(IO'=IO(0))
DO DISPLAY
+14 KILL ACDSLAVE
SET IO=IO(0)
+15 QUIT
+16 ;
DISPLAY ; EP - FOR TASKMAN
+1 IF $DATA(ACDSLAVE)
SET IOP=ACDSLAVE
DO ^%ZIS
+2 USE IO
+3 IF IO'=IO(0)
WRITE @IOF
+4 DO DSPHIST^ACDDEU
+5 IF $DATA(ACDSLAVE)
WRITE @IOF
DO ^%ZISC
+6 USE 0
+7 IF $DATA(ZTQUEUED)
DO EOJ
SET ZTREQ="@"
+8 QUIT
+9 ;
GETPAT ; GET PATIENT
+1 SET ACDQ=1
+2 SET AUPNLK("ALL")=1
+3 SET DIC="^AUPNPAT("
SET DIC(0)="AEMQ"
SET DIC("S")="I $D(^ACDVIS(""D"",+Y))"
DO DIC^ACDFMC
+4 KILL AUPNLK("ALL")
+5 IF Y<0
QUIT
+6 SET ACDDFNP=+Y
SET ACDDFN=$PIECE(^DPT(ACDDFNP,0),U)
+7 SET ACDQ=0
+8 QUIT
+9 ;
EOJ ;
+1 DO ^%ZISC
+2 DO ^ACDKILL
+3 QUIT