DGNTR1 ;ALB/RPM - N/T RADIUM PENDING VERIFICATION REPORT ; 10/4/01 11:05am
;;5.3;Registration;**397**;Aug 13, 1993
;
;This report lists all patients with an entry in the NTR HISTORY
;file (#28.11) that are pending verification.
;The report can be tasked using TaskMan and the EN^DGNTR1 entry point.
;The option allows manual generation of the report using a user selected
;output device.
;
Q ;No direct entry
;
EN ;Entry point
I '$D(ZTQUEUED) D MAN Q
;
QEN ;Start point for TaskMan queuing
D START
Q
;
MAN ;Start point for manual report allows sort order and device selection
N DGSORT
S DGSORT=$$ASKSTAT^DGNTQ("Enter the sort type","NAME","SM^N:NAME;D:DATE")
Q:DGSORT=0
I $$DEVICE() D START
Q
;
DEVICE() ;Allow user selection of output device
; Input: none
;
; Output: Function value Interpretation
; 0 User decides to queue or not print report.
; 1 Device selected to generate report NOW.
;
N OK,IOP,POP,%ZIS,DGX
S OK=1
S %ZIS="MQ"
D ^%ZIS
S:POP OK=0
I OK,$D(IO("Q")) D
. N ZTRTN,ZTDESC,ZTSAVE,ZTSK
. S ZTRTN="START^DGNTR1"
. S ZTSAVE("DGSORT")=""
. S ZTDESC="Current N/T Radium Treatment Pending Verification report."
. F DGX=1:1:20 D ^%ZTLOAD Q:$G(ZTSK)
. W !,$S($D(ZTSK):"Request "_ZTSK_" Queued!",1:"Request Cancelled!"),!
. D HOME^%ZIS
. S OK=0
Q OK
;
START ;
D LOOP(DGSORT)
D PRINT(DGSORT)
D EXIT
Q
;
LOOP(DGSORT) ;Locate all entries that are pending verification
;and build ^TMP("DGNT",$J, with data
N DGIEN ;NTR record IEN
N DGSTAT ;Screening Status
K ^TMP("DGNT",$J)
S DGIEN=0
F DGSTAT=2,3 D
. F S DGIEN=$O(^DGNT(28.11,"AST",DGSTAT,1,DGIEN)) Q:'DGIEN D
. . D BLDTMP(DGIEN,DGSORT,DGSTAT)
Q
;
BLDTMP(DGIEN,DGSORT,DGST) ;^TMP("DGNT",$J global builder
; Build TMP file based on sort selection
;
; Input:
; DGIEN - IEN to patient's NTR record
; DGSORT - sort type ("N"ame or "D"ate)
; DGST - screening status (2-Pend Doc, 3-Pend DX)
;
N DGX,DGNT,DFN
N DGNAME,DGSSN,DGHNC,DGNTR,DGAVI,DGSUB,DGDATE,VADM
N X,X1,X2,Y
;validate input parameters
Q:'$G(DGIEN)
Q:'$G(DGST)
S DGSORT=$G(DGSORT)
;
S DGX=$S(DGSORT="D":"DGDATE",1:"DGNAME")
Q:'$$GETREC^DGNTAPI(DGIEN,"DGNT")
S DFN=+$G(DGNT("DFN"))
I DFN>0 D
. Q:'+$G(DGNT("PRIM")) ;if not NTR PRIMARY ENTRY, quit out
. D ^VADPT
. S DGNAME=VADM(1)
. S DGSSN=$P(VADM(2),U,2)
. S DGNTR=$P($G(DGNT("NTR")),"^")
. S DGAVI=$P($G(DGNT("AVI")),"^")
. S DGSUB=$P($G(DGNT("SUB")),"^")
. S DGDATE=$G(DGNT("EDT"))
. S ^TMP("DGNT",$J,DGST,@DGX,DGIEN)=DGNAME_U_DGSSN_U_DGNTR_U_DGAVI_U_DGSUB_U_DGDATE
. S ^TMP("DGNT",$J,"TOT"_DGST)=$G(^TMP("DGNT",$J,"TOT"_DGST))+1
. S ^TMP("DGNT",$J,"TOT")=$G(^TMP("DGNT",$J,"TOT"))+1
Q
;
PRINT(DGSORT) ;
U IO
N DGST
N DGX,DGIEN
N DGFIRST,DGLINE
N DGSITE,DGSTNUM,DGSTTN,DGSTN
N DGQUIT,DGPAGE
N DGDDT ;current date/time for header display
S DGSORT=$G(DGSORT)
S DGSITE=$$SITE^VASITE
S DGSTNUM=$P(DGSITE,U,3),DGSTN=$P(DGSITE,U,2)
S DGSTTN=$$NAME^VASITE(DT)
S DGSTN=$S($G(DGSTTN)]"":DGSTTN,1:$G(DGSTN))
S DGQUIT=0
S DGPAGE=0
S DGX=$S(DGSORT="D":"DGDATE",1:"DGNAME")
S DGDDT=$$FMTE^XLFDT($$NOW^XLFDT,"D")
D HEAD(DGDDT)
I '$D(^TMP("DGNT",$J)) D Q
. W !!!?20,"**** No records to report. ****"
S @DGX=""
F DGST=2,3 D
. F S @DGX=$O(^TMP("DGNT",$J,DGST,@DGX)) Q:@DGX']"" D Q:DGQUIT
.. S DGIEN=""
.. F S DGIEN=$O(^TMP("DGNT",$J,DGST,@DGX,DGIEN)) Q:DGIEN="" D Q:DGQUIT
... D:$Y>(IOSL-4) HEAD(DGDDT)
... Q:DGQUIT
... S DGLINE=$G(^TMP("DGNT",$J,DGST,@DGX,DGIEN))
... W !,$P(DGLINE,U),?30,$P(DGLINE,U,2),?43,$P(DGLINE,U,3),?47,$P(DGLINE,U,4),?51,$P(DGLINE,U,5),?54,$$FMTE^XLFDT($P(DGLINE,U,6))
. Q:DGQUIT
. W !!?5,"Total Patients Pending "_$S(DGST=2:"Documentation",1:"Diagnosis")_" Verification: "_+$G(^TMP("DGNT",$J,"TOT"_DGST))
. I DGST=2 D HEAD(DGDDT)
;
;Shutdown if stop task requested
I DGQUIT W:$D(ZTQUEUED) !!,"REPORT STOPPED AT USER REQUEST" Q
;
W !!?5,"Total Patients Pending Verification: "_$G(^TMP("DGNT",$J,"TOT"))
I $G(DGPAGE)>0,$E(IOST)="C" K DIR S DIR(0)="E" D ^DIR K DIR S:+Y=0 DGQUIT=1
Q
;
HEAD(DGDT) ;Print/Display page header
;
; Input:
; DGDT - current date/time for display
; Output
; none
;
I $D(ZTQUEUED),$$S^%ZTLOAD S (ZTSTOP,DGQUIT)=1 Q
I $G(DGPAGE)>0,$E(IOST)="C" K DIR S DIR(0)="E" D ^DIR K DIR S:+Y=0 DGQUIT=1
Q:DGQUIT
W @IOF
S DGPAGE=$G(DGPAGE)+1
W !,DGDT,?15,"N/T RADIUM TREATMENT PENDING VERIFICATION REPORT",?70,"Page: ",$G(DGPAGE)
W !,"STATION: "_$G(DGSTN)
W !!,"Patient Name",?30,"SSN",?42,"NT",?46,"Avi",?50,"Sub",?54,"Date/Time Entered"
W !,"-----------------------",?30,"-----------",?42,"---",?46,"---",?50,"---",?54,"----------------------"
Q
;
EXIT ;
I $D(ZTQUEUED) S ZTREQ="@"
K ^TMP("DGNT",$J)
I '$D(ZTQUEUED) D
. K %ZIS,POP
. D ^%ZISC,HOME^%ZIS
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGNTR1 4942 printed Dec 13, 2024@02:46:17 Page 2
DGNTR1 ;ALB/RPM - N/T RADIUM PENDING VERIFICATION REPORT ; 10/4/01 11:05am
+1 ;;5.3;Registration;**397**;Aug 13, 1993
+2 ;
+3 ;This report lists all patients with an entry in the NTR HISTORY
+4 ;file (#28.11) that are pending verification.
+5 ;The report can be tasked using TaskMan and the EN^DGNTR1 entry point.
+6 ;The option allows manual generation of the report using a user selected
+7 ;output device.
+8 ;
+9 ;No direct entry
QUIT
+10 ;
EN ;Entry point
+1 IF '$DATA(ZTQUEUED)
DO MAN
QUIT
+2 ;
QEN ;Start point for TaskMan queuing
+1 DO START
+2 QUIT
+3 ;
MAN ;Start point for manual report allows sort order and device selection
+1 NEW DGSORT
+2 SET DGSORT=$$ASKSTAT^DGNTQ("Enter the sort type","NAME","SM^N:NAME;D:DATE")
+3 if DGSORT=0
QUIT
+4 IF $$DEVICE()
DO START
+5 QUIT
+6 ;
DEVICE() ;Allow user selection of output device
+1 ; Input: none
+2 ;
+3 ; Output: Function value Interpretation
+4 ; 0 User decides to queue or not print report.
+5 ; 1 Device selected to generate report NOW.
+6 ;
+7 NEW OK,IOP,POP,%ZIS,DGX
+8 SET OK=1
+9 SET %ZIS="MQ"
+10 DO ^%ZIS
+11 if POP
SET OK=0
+12 IF OK
IF $DATA(IO("Q"))
Begin DoDot:1
+13 NEW ZTRTN,ZTDESC,ZTSAVE,ZTSK
+14 SET ZTRTN="START^DGNTR1"
+15 SET ZTSAVE("DGSORT")=""
+16 SET ZTDESC="Current N/T Radium Treatment Pending Verification report."
+17 FOR DGX=1:1:20
DO ^%ZTLOAD
if $GET(ZTSK)
QUIT
+18 WRITE !,$SELECT($DATA(ZTSK):"Request "_ZTSK_" Queued!",1:"Request Cancelled!"),!
+19 DO HOME^%ZIS
+20 SET OK=0
End DoDot:1
+21 QUIT OK
+22 ;
START ;
+1 DO LOOP(DGSORT)
+2 DO PRINT(DGSORT)
+3 DO EXIT
+4 QUIT
+5 ;
LOOP(DGSORT) ;Locate all entries that are pending verification
+1 ;and build ^TMP("DGNT",$J, with data
+2 ;NTR record IEN
NEW DGIEN
+3 ;Screening Status
NEW DGSTAT
+4 KILL ^TMP("DGNT",$JOB)
+5 SET DGIEN=0
+6 FOR DGSTAT=2,3
Begin DoDot:1
+7 FOR
SET DGIEN=$ORDER(^DGNT(28.11,"AST",DGSTAT,1,DGIEN))
if 'DGIEN
QUIT
Begin DoDot:2
+8 DO BLDTMP(DGIEN,DGSORT,DGSTAT)
End DoDot:2
End DoDot:1
+9 QUIT
+10 ;
BLDTMP(DGIEN,DGSORT,DGST) ;^TMP("DGNT",$J global builder
+1 ; Build TMP file based on sort selection
+2 ;
+3 ; Input:
+4 ; DGIEN - IEN to patient's NTR record
+5 ; DGSORT - sort type ("N"ame or "D"ate)
+6 ; DGST - screening status (2-Pend Doc, 3-Pend DX)
+7 ;
+8 NEW DGX,DGNT,DFN
+9 NEW DGNAME,DGSSN,DGHNC,DGNTR,DGAVI,DGSUB,DGDATE,VADM
+10 NEW X,X1,X2,Y
+11 ;validate input parameters
+12 if '$GET(DGIEN)
QUIT
+13 if '$GET(DGST)
QUIT
+14 SET DGSORT=$GET(DGSORT)
+15 ;
+16 SET DGX=$SELECT(DGSORT="D":"DGDATE",1:"DGNAME")
+17 if '$$GETREC^DGNTAPI(DGIEN,"DGNT")
QUIT
+18 SET DFN=+$GET(DGNT("DFN"))
+19 IF DFN>0
Begin DoDot:1
+20 ;if not NTR PRIMARY ENTRY, quit out
if '+$GET(DGNT("PRIM"))
QUIT
+21 DO ^VADPT
+22 SET DGNAME=VADM(1)
+23 SET DGSSN=$PIECE(VADM(2),U,2)
+24 SET DGNTR=$PIECE($GET(DGNT("NTR")),"^")
+25 SET DGAVI=$PIECE($GET(DGNT("AVI")),"^")
+26 SET DGSUB=$PIECE($GET(DGNT("SUB")),"^")
+27 SET DGDATE=$GET(DGNT("EDT"))
+28 SET ^TMP("DGNT",$JOB,DGST,@DGX,DGIEN)=DGNAME_U_DGSSN_U_DGNTR_U_DGAVI_U_DGSUB_U_DGDATE
+29 SET ^TMP("DGNT",$JOB,"TOT"_DGST)=$GET(^TMP("DGNT",$JOB,"TOT"_DGST))+1
+30 SET ^TMP("DGNT",$JOB,"TOT")=$GET(^TMP("DGNT",$JOB,"TOT"))+1
End DoDot:1
+31 QUIT
+32 ;
PRINT(DGSORT) ;
+1 USE IO
+2 NEW DGST
+3 NEW DGX,DGIEN
+4 NEW DGFIRST,DGLINE
+5 NEW DGSITE,DGSTNUM,DGSTTN,DGSTN
+6 NEW DGQUIT,DGPAGE
+7 ;current date/time for header display
NEW DGDDT
+8 SET DGSORT=$GET(DGSORT)
+9 SET DGSITE=$$SITE^VASITE
+10 SET DGSTNUM=$PIECE(DGSITE,U,3)
SET DGSTN=$PIECE(DGSITE,U,2)
+11 SET DGSTTN=$$NAME^VASITE(DT)
+12 SET DGSTN=$SELECT($GET(DGSTTN)]"":DGSTTN,1:$GET(DGSTN))
+13 SET DGQUIT=0
+14 SET DGPAGE=0
+15 SET DGX=$SELECT(DGSORT="D":"DGDATE",1:"DGNAME")
+16 SET DGDDT=$$FMTE^XLFDT($$NOW^XLFDT,"D")
+17 DO HEAD(DGDDT)
+18 IF '$DATA(^TMP("DGNT",$JOB))
Begin DoDot:1
+19 WRITE !!!?20,"**** No records to report. ****"
End DoDot:1
QUIT
+20 SET @DGX=""
+21 FOR DGST=2,3
Begin DoDot:1
+22 FOR
SET @DGX=$ORDER(^TMP("DGNT",$JOB,DGST,@DGX))
if @DGX']""
QUIT
Begin DoDot:2
+23 SET DGIEN=""
+24 FOR
SET DGIEN=$ORDER(^TMP("DGNT",$JOB,DGST,@DGX,DGIEN))
if DGIEN=""
QUIT
Begin DoDot:3
+25 if $Y>(IOSL-4)
DO HEAD(DGDDT)
+26 if DGQUIT
QUIT
+27 SET DGLINE=$GET(^TMP("DGNT",$JOB,DGST,@DGX,DGIEN))
+28 WRITE !,$PIECE(DGLINE,U),?30,$PIECE(DGLINE,U,2),?43,$PIECE(DGLINE,U,3),?47,$PIECE(DGLINE,U,4),?51,$PIECE(DGLINE,U,5),?54,$$FMTE^XLFDT($PIECE(DGLINE,U,6))
End DoDot:3
if DGQUIT
QUIT
End DoDot:2
if DGQUIT
QUIT
+29 if DGQUIT
QUIT
+30 WRITE !!?5,"Total Patients Pending "_$SELECT(DGST=2:"Documentation",1:"Diagnosis")_" Verification: "_+$GET(^TMP("DGNT",$JOB,"TOT"_DGST))
+31 IF DGST=2
DO HEAD(DGDDT)
End DoDot:1
+32 ;
+33 ;Shutdown if stop task requested
+34 IF DGQUIT
if $DATA(ZTQUEUED)
WRITE !!,"REPORT STOPPED AT USER REQUEST"
QUIT
+35 ;
+36 WRITE !!?5,"Total Patients Pending Verification: "_$GET(^TMP("DGNT",$JOB,"TOT"))
+37 IF $GET(DGPAGE)>0
IF $EXTRACT(IOST)="C"
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
if +Y=0
SET DGQUIT=1
+38 QUIT
+39 ;
HEAD(DGDT) ;Print/Display page header
+1 ;
+2 ; Input:
+3 ; DGDT - current date/time for display
+4 ; Output
+5 ; none
+6 ;
+7 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET (ZTSTOP,DGQUIT)=1
QUIT
+8 IF $GET(DGPAGE)>0
IF $EXTRACT(IOST)="C"
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
if +Y=0
SET DGQUIT=1
+9 if DGQUIT
QUIT
+10 WRITE @IOF
+11 SET DGPAGE=$GET(DGPAGE)+1
+12 WRITE !,DGDT,?15,"N/T RADIUM TREATMENT PENDING VERIFICATION REPORT",?70,"Page: ",$GET(DGPAGE)
+13 WRITE !,"STATION: "_$GET(DGSTN)
+14 WRITE !!,"Patient Name",?30,"SSN",?42,"NT",?46,"Avi",?50,"Sub",?54,"Date/Time Entered"
+15 WRITE !,"-----------------------",?30,"-----------",?42,"---",?46,"---",?50,"---",?54,"----------------------"
+16 QUIT
+17 ;
EXIT ;
+1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 KILL ^TMP("DGNT",$JOB)
+3 IF '$DATA(ZTQUEUED)
Begin DoDot:1
+4 KILL %ZIS,POP
+5 DO ^%ZISC
DO HOME^%ZIS
End DoDot:1
+6 QUIT