PXQZIS ;ISL/JVS - QUEUEING UTILITY (%ZTLOAD) ;8/29/96 10:34
;;1.0;PCE PATIENT CARE ENCOUNTER;**4**;Aug 12, 1996
;
Q1 S ZTDTH=$H
QUEZ K IO("Q") I '$D(ZTIO),$D(ION),ION="" S ZTIO=""
I '$D(ZTDESC) S ZTDESC=$S($D(DGPGM):DGPGM,$D(PGM):PGM,1:"MAS UNKNOWN OPTION")
I '$D(ZTRTN) S DGPGM=$S($D(DGPGM):DGPGM,$D(PGM):PGM,1:"") G:DGPGM="" CLOSE S ZTRTN="DQ^DGUTQ"
S DGZTSAVE=$S($D(DGVAR):DGVAR,$D(VAR):VAR,1:"*") D SAVE
I $D(DGPGM),'$D(ZTSAVE("DGPGM")) S ZTSAVE("DGPGM")=""
LOAD D ^%ZTLOAD W:'$D(DGUTQND) !!,$S($D(ZTSK):"Request Queued!",1:"Request Cancelled!") S:'$D(ZTSK) X="^" S:$D(ZTSK) X="" G CLOSE:$D(ZTSK),END
Q
ZIS W ! K IOP,IO("Q") S POP=0,%ZIS="QMP" D ^%ZIS K %ZIS,IOP Q:POP I $D(IO("Q")) D
.I $G(OPTION)=1 D QUE1
.I $G(OPTION)=2 D QUE2
.I $G(OPTION)=3 D QUE3
.I $G(OPTION)=4 D QUE4
.I $G(OPTION)="5D" D QUE5D
.I $G(OPTION)="5E" D QUE5E
.I $G(OPTION)="5S" D QUE5S
.I $G(OPTION)="5A" D QUE5A
.I $G(OPTION)="6D" D QUE6D
.I $G(OPTION)="6E" D QUE6E
.I $G(OPTION)="6S" D QUE6S
.I $G(OPTION)="6A" D QUE6A
.I $G(OPTION)=7 D QUE7
.I $G(OPTION)="9P" D QUE9P
.I $G(OPTION)="9L" D QUE9L
.I $G(OPTION)=10 D QUE10
.S POP=1
I POP=1 G CLOSE
U IO Q
QUE1 ;--DEPENDENT ENTRY COUNTS (VISITS AND ENCOUNTERS)
S ZTDESC="PCE DEBUGGING UTILITIES DEPENDENT ENTRY COUNTS"
S ZTRTN="DEP^PXQMAIN"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
I $G(ZTSK) W !,"Task number is "_$G(ZTSK)
Q
QUE2 ;--EXPANDED DEPENDENT ENTRY COUNTS
S ZTDESC="PCE DEBUGGING UTILITIES EXPANDED DEPENDENT ENTRY COUNTS"
S ZTRTN="EXP^PXQMAIN"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE3 ;--INTERNAL VIEW OF VISITS
S ZTDESC="PCE DEBUGGING UTILITIES INTERNAL VIEW OF VISITS"
S ZTRTN="INT^PXQMAIN"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE4 ;--SOURCE OF THE PCE DATA
S ZTDESC="PCE DEBUGGING UTILITIES SOURCE OF THE PCE DATA"
S ZTRTN="INT^PXQMAIN"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE5D ;--VISIT IEN-DEPENDENT ENTRIES
S ZTDESC="PCE DEBUGGING UTILITIES VISIT IEN-DEPENDENT ENTRIES"
S ZTRTN="DEC5D^PXQMAIN1"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE5E ;--VISIT IEN-EXPANDED
S ZTDESC="PCE DEBUGGING UTILITIES VISIT IEN-EXPANDED"
S ZTRTN="EXP5E^PXQMAIN1"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE5S ;--VISIT IEN-SOURCES
S ZTDESC="PCE DEBUGGING UTILITIES VISIT IEN-SOURCE"
S ZTRTN="SOR5S^PXQMAIN1"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE5A ;--VISIT IEN-ALL
S ZTDESC="PCE DEBUGGING UTILITIES VISIT IEN-ALL"
S ZTRTN="ALL5A^PXQMAIN1"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE6D ;--ENCOUNTER IEN-DEPENDENT ENTRIES
S ZTDESC="PCE DEBUGGING UTILITIES ENCOUNTER IEN-DEPENDENT ENTRIES"
S ZTRTN="DEC6D^PXQMAIN3"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE6E ;--ENCOUNTER IEN-EXPANDED
S ZTDESC="PCE DEBUGGING UTILITIES ENCOUNTER IEN-EXPANDED"
S ZTRTN="EXP6E^PXQMAIN3"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE6S ;--ENCOUNTER IEN-SOURCES
S ZTDESC="PCE DEBUGGING UTILITIES ENCOUNTER IEN-SOURCE"
S ZTRTN="SOR6S^PXQMAIN3"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE6A ;--ENCOUNTER IEN-ALL
S ZTDESC="PCE DEBUGGING UTILITIES ENOCUNTER IEN-ALL"
S ZTRTN="ALL6A^PXQMAIN3"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE7 ;--PCE/VISIT PARAMETER SETUP
S ZTDESC="PCE DEBUGGING UTILITIES PCE/VISIT PARAMETERS SETUP"
S ZTRTN="SET7^PXQMAIN"
S ZTSAVE("PXQRECI")=0
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE9P ;--PATIENT/IHS AND LOCATION FILES
S ZTDESC="PCE DEBUGGING UTILITIES PATIENT FILES"
S ZTRTN="PAT9P^PXQMAIN2"
S ZTSAVE("PXQRECI")=0
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE9L ;--PATIENT/IHS AND LOCATION FILES
S ZTDESC="PCE DEBUGGING UTILITIES LOCATION FILES"
S ZTRTN="LOC9L^PXQMAIN2"
S ZTSAVE("PXQRECI")=0
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
QUE10 ;--USER VISIT REVIEW
S ZTDESC="PCE DEBUGGING UTILITIES USER VISIT REVIEW"
S ZTRTN="REPORT^PXQMAIN4"
S ZTSAVE("PXQRECI")=0
S ZTSAVE("VISIT")=""
S ZTSAVE("PXQFORM")=""
S ZTSAVE("IEN")=""
D ^%ZTLOAD
W !,"Task number is "_ZTSK
Q
SAVE D:DGZTSAVE["#" ARRAY F DGI=1:1 S DGVAR=$P(DGZTSAVE,"^",DGI) Q:DGVAR']"" I '$D(ZTSAVE(DGVAR)) S ZTSAVE(DGVAR)="" S:$E(DGVAR,$L(DGVAR))="(" ZTSAVE($E(DGVAR,1,($L(DGVAR)-1)))=""
Q
ARRAY F DGJ=1:1:$L(DGZTSAVE) I $E(DGZTSAVE,DGJ)="#" S DGZTSAVE=$E(DGZTSAVE,1,(DGJ-1))_"("_$E(DGZTSAVE,DGJ+1,$L(DGZTSAVE))
Q
CLOSE Q:$D(ZTQUEUED) N POP D ^%ZISC
END K ZTSK,ZTDESC,ZTRTN,ZTREQ,ZTSAVE,ZTIO,ZTDTH,ZTUCI,DGUTQND,DGVAR,VAR,DGPGM,PGM,DGZTSAVE,DGI,IO("Q"),IO("C")
Q
DQ D @($S($D(DGPGM):DGPGM,$D(PGM):PGM,1:"CLOSE"))
D KILL^%ZTLOAD,CLOSE
Q
DTQ I $D(ZTSK("D")) S DGX=ZTSK("D"),%H=$P(DGX,",") D YMD^%DTC S DGX=$P(DGX,",",2),Z=X_((DGX#3600\60)/100+(DGX\3600)/100) ;Find time queued
Q
PXQZIS ;ISL/JVS - QUEUEING UTILITY (%ZTLOAD) ;8/29/96 10:34
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**4**;Aug 12, 1996
+2 ;
Q1 SET ZTDTH=$HOROLOG
QUEZ KILL IO("Q")
IF '$DATA(ZTIO)
IF $DATA(ION)
IF ION=""
SET ZTIO=""
+1 IF '$DATA(ZTDESC)
SET ZTDESC=$SELECT($DATA(DGPGM):DGPGM,$DATA(PGM):PGM,1:"MAS UNKNOWN OPTION")
+2 IF '$DATA(ZTRTN)
SET DGPGM=$SELECT($DATA(DGPGM):DGPGM,$DATA(PGM):PGM,1:"")
IF DGPGM=""
GOTO CLOSE
SET ZTRTN="DQ^DGUTQ"
+3 SET DGZTSAVE=$SELECT($DATA(DGVAR):DGVAR,$DATA(VAR):VAR,1:"*")
DO SAVE
+4 IF $DATA(DGPGM)
IF '$DATA(ZTSAVE("DGPGM"))
SET ZTSAVE("DGPGM")=""
LOAD DO ^%ZTLOAD
IF '$DATA(DGUTQND)
WRITE !!,$SELECT($DATA(ZTSK):"Request Queued!",1:"Request Cancelled!")
IF '$DATA(ZTSK)
SET X="^"
IF $DATA(ZTSK)
SET X=""
IF $DATA(ZTSK)
GOTO CLOSE
GOTO END
+1 QUIT
ZIS WRITE !
KILL IOP,IO("Q")
SET POP=0
SET %ZIS="QMP"
DO ^%ZIS
KILL %ZIS,IOP
IF POP
QUIT
IF $DATA(IO("Q"))
Begin DoDot:1
+1 IF $GET(OPTION)=1
DO QUE1
+2 IF $GET(OPTION)=2
DO QUE2
+3 IF $GET(OPTION)=3
DO QUE3
+4 IF $GET(OPTION)=4
DO QUE4
+5 IF $GET(OPTION)="5D"
DO QUE5D
+6 IF $GET(OPTION)="5E"
DO QUE5E
+7 IF $GET(OPTION)="5S"
DO QUE5S
+8 IF $GET(OPTION)="5A"
DO QUE5A
+9 IF $GET(OPTION)="6D"
DO QUE6D
+10 IF $GET(OPTION)="6E"
DO QUE6E
+11 IF $GET(OPTION)="6S"
DO QUE6S
+12 IF $GET(OPTION)="6A"
DO QUE6A
+13 IF $GET(OPTION)=7
DO QUE7
+14 IF $GET(OPTION)="9P"
DO QUE9P
+15 IF $GET(OPTION)="9L"
DO QUE9L
+16 IF $GET(OPTION)=10
DO QUE10
+17 SET POP=1
End DoDot:1
+18 IF POP=1
GOTO CLOSE
+19 USE IO
QUIT
QUE1 ;--DEPENDENT ENTRY COUNTS (VISITS AND ENCOUNTERS)
+1 SET ZTDESC="PCE DEBUGGING UTILITIES DEPENDENT ENTRY COUNTS"
+2 SET ZTRTN="DEP^PXQMAIN"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 IF $GET(ZTSK)
WRITE !,"Task number is "_$GET(ZTSK)
+8 QUIT
QUE2 ;--EXPANDED DEPENDENT ENTRY COUNTS
+1 SET ZTDESC="PCE DEBUGGING UTILITIES EXPANDED DEPENDENT ENTRY COUNTS"
+2 SET ZTRTN="EXP^PXQMAIN"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 WRITE !,"Task number is "_ZTSK
+8 QUIT
QUE3 ;--INTERNAL VIEW OF VISITS
+1 SET ZTDESC="PCE DEBUGGING UTILITIES INTERNAL VIEW OF VISITS"
+2 SET ZTRTN="INT^PXQMAIN"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 WRITE !,"Task number is "_ZTSK
+8 QUIT
QUE4 ;--SOURCE OF THE PCE DATA
+1 SET ZTDESC="PCE DEBUGGING UTILITIES SOURCE OF THE PCE DATA"
+2 SET ZTRTN="INT^PXQMAIN"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 WRITE !,"Task number is "_ZTSK
+8 QUIT
QUE5D ;--VISIT IEN-DEPENDENT ENTRIES
+1 SET ZTDESC="PCE DEBUGGING UTILITIES VISIT IEN-DEPENDENT ENTRIES"
+2 SET ZTRTN="DEC5D^PXQMAIN1"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 WRITE !,"Task number is "_ZTSK
+8 QUIT
QUE5E ;--VISIT IEN-EXPANDED
+1 SET ZTDESC="PCE DEBUGGING UTILITIES VISIT IEN-EXPANDED"
+2 SET ZTRTN="EXP5E^PXQMAIN1"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 WRITE !,"Task number is "_ZTSK
+8 QUIT
QUE5S ;--VISIT IEN-SOURCES
+1 SET ZTDESC="PCE DEBUGGING UTILITIES VISIT IEN-SOURCE"
+2 SET ZTRTN="SOR5S^PXQMAIN1"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 WRITE !,"Task number is "_ZTSK
+8 QUIT
QUE5A ;--VISIT IEN-ALL
+1 SET ZTDESC="PCE DEBUGGING UTILITIES VISIT IEN-ALL"
+2 SET ZTRTN="ALL5A^PXQMAIN1"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 WRITE !,"Task number is "_ZTSK
+8 QUIT
QUE6D ;--ENCOUNTER IEN-DEPENDENT ENTRIES
+1 SET ZTDESC="PCE DEBUGGING UTILITIES ENCOUNTER IEN-DEPENDENT ENTRIES"
+2 SET ZTRTN="DEC6D^PXQMAIN3"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 WRITE !,"Task number is "_ZTSK
+8 QUIT
QUE6E ;--ENCOUNTER IEN-EXPANDED
+1 SET ZTDESC="PCE DEBUGGING UTILITIES ENCOUNTER IEN-EXPANDED"
+2 SET ZTRTN="EXP6E^PXQMAIN3"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 WRITE !,"Task number is "_ZTSK
+8 QUIT
QUE6S ;--ENCOUNTER IEN-SOURCES
+1 SET ZTDESC="PCE DEBUGGING UTILITIES ENCOUNTER IEN-SOURCE"
+2 SET ZTRTN="SOR6S^PXQMAIN3"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 WRITE !,"Task number is "_ZTSK
+8 QUIT
QUE6A ;--ENCOUNTER IEN-ALL
+1 SET ZTDESC="PCE DEBUGGING UTILITIES ENOCUNTER IEN-ALL"
+2 SET ZTRTN="ALL6A^PXQMAIN3"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("IEN")=""
+6 DO ^%ZTLOAD
+7 WRITE !,"Task number is "_ZTSK
+8 QUIT
QUE7 ;--PCE/VISIT PARAMETER SETUP
+1 SET ZTDESC="PCE DEBUGGING UTILITIES PCE/VISIT PARAMETERS SETUP"
+2 SET ZTRTN="SET7^PXQMAIN"
+3 SET ZTSAVE("PXQRECI")=0
+4 DO ^%ZTLOAD
+5 WRITE !,"Task number is "_ZTSK
+6 QUIT
QUE9P ;--PATIENT/IHS AND LOCATION FILES
+1 SET ZTDESC="PCE DEBUGGING UTILITIES PATIENT FILES"
+2 SET ZTRTN="PAT9P^PXQMAIN2"
+3 SET ZTSAVE("PXQRECI")=0
+4 DO ^%ZTLOAD
+5 WRITE !,"Task number is "_ZTSK
+6 QUIT
QUE9L ;--PATIENT/IHS AND LOCATION FILES
+1 SET ZTDESC="PCE DEBUGGING UTILITIES LOCATION FILES"
+2 SET ZTRTN="LOC9L^PXQMAIN2"
+3 SET ZTSAVE("PXQRECI")=0
+4 DO ^%ZTLOAD
+5 WRITE !,"Task number is "_ZTSK
+6 QUIT
QUE10 ;--USER VISIT REVIEW
+1 SET ZTDESC="PCE DEBUGGING UTILITIES USER VISIT REVIEW"
+2 SET ZTRTN="REPORT^PXQMAIN4"
+3 SET ZTSAVE("PXQRECI")=0
+4 SET ZTSAVE("VISIT")=""
+5 SET ZTSAVE("PXQFORM")=""
+6 SET ZTSAVE("IEN")=""
+7 DO ^%ZTLOAD
+8 WRITE !,"Task number is "_ZTSK
+9 QUIT
SAVE IF DGZTSAVE["#"
DO ARRAY
FOR DGI=1:1
SET DGVAR=$PIECE(DGZTSAVE,"^",DGI)
IF DGVAR']""
QUIT
IF '$DATA(ZTSAVE(DGVAR))
SET ZTSAVE(DGVAR)=""
IF $EXTRACT(DGVAR,$LENGTH(DGVAR))="("
SET ZTSAVE($EXTRACT(DGVAR,1,($LENGTH(DGVAR)-1)))=""
+1 QUIT
ARRAY FOR DGJ=1:1:$LENGTH(DGZTSAVE)
IF $EXTRACT(DGZTSAVE,DGJ)="#"
SET DGZTSAVE=$EXTRACT(DGZTSAVE,1,(DGJ-1))_"("_$EXTRACT(DGZTSAVE,DGJ+1,$LENGTH(DGZTSAVE))
+1 QUIT
CLOSE IF $DATA(ZTQUEUED)
QUIT
NEW POP
DO ^%ZISC
END KILL ZTSK,ZTDESC,ZTRTN,ZTREQ,ZTSAVE,ZTIO,ZTDTH,ZTUCI,DGUTQND,DGVAR,VAR,DGPGM,PGM,DGZTSAVE,DGI,IO("Q"),IO("C")
+1 QUIT
DQ DO @($SELECT($DATA(DGPGM):DGPGM,$DATA(PGM):PGM,1:"CLOSE"))
+1 DO KILL^%ZTLOAD
DO CLOSE
+2 QUIT
DTQ ;Find time queued
IF $DATA(ZTSK("D"))
SET DGX=ZTSK("D")
SET %H=$PIECE(DGX,",")
DO YMD^%DTC
SET DGX=$PIECE(DGX,",",2)
SET Z=X_((DGX#3600\60)/100+(DGX\3600)/100)
+1 QUIT