source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGNTR1.m@ 1046

Last change on this file since 1046 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.7 KB
Line 
1DGNTR1 ;ALB/RPM - N/T RADIUM PENDING VERIFICATION REPORT ; 10/4/01 11:05am
2 ;;5.3;Registration;**397**;Aug 13, 1993
3 ;
4 ;This report lists all patients with an entry in the NTR HISTORY
5 ;file (#28.11) that are pending verification.
6 ;The report can be tasked using TaskMan and the EN^DGNTR1 entry point.
7 ;The option allows manual generation of the report using a user selected
8 ;output device.
9 ;
10 Q ;No direct entry
11 ;
12EN ;Entry point
13 I '$D(ZTQUEUED) D MAN Q
14 ;
15QEN ;Start point for TaskMan queuing
16 D START
17 Q
18 ;
19MAN ;Start point for manual report allows sort order and device selection
20 N DGSORT
21 S DGSORT=$$ASKSTAT^DGNTQ("Enter the sort type","NAME","SM^N:NAME;D:DATE")
22 Q:DGSORT=0
23 I $$DEVICE() D START
24 Q
25 ;
26DEVICE() ;Allow user selection of output device
27 ; Input: none
28 ;
29 ; Output: Function value Interpretation
30 ; 0 User decides to queue or not print report.
31 ; 1 Device selected to generate report NOW.
32 ;
33 N OK,IOP,POP,%ZIS,DGX
34 S OK=1
35 S %ZIS="MQ"
36 D ^%ZIS
37 S:POP OK=0
38 I OK,$D(IO("Q")) D
39 . N ZTRTN,ZTDESC,ZTSAVE,ZTSK
40 . S ZTRTN="START^DGNTR1"
41 . S ZTSAVE("DGSORT")=""
42 . S ZTDESC="Current N/T Radium Treatment Pending Verification report."
43 . F DGX=1:1:20 D ^%ZTLOAD Q:$G(ZTSK)
44 . W !,$S($D(ZTSK):"Request "_ZTSK_" Queued!",1:"Request Cancelled!"),!
45 . D HOME^%ZIS
46 . S OK=0
47 Q OK
48 ;
49START ;
50 D LOOP(DGSORT)
51 D PRINT(DGSORT)
52 D EXIT
53 Q
54 ;
55LOOP(DGSORT) ;Locate all entries that are pending verification
56 ;and build ^TMP("DGNT",$J, with data
57 N DGIEN ;NTR record IEN
58 N DGSTAT ;Screening Status
59 K ^TMP("DGNT",$J)
60 S DGIEN=0
61 F DGSTAT=2,3 D
62 . F S DGIEN=$O(^DGNT(28.11,"AST",DGSTAT,1,DGIEN)) Q:'DGIEN D
63 . . D BLDTMP(DGIEN,DGSORT,DGSTAT)
64 Q
65 ;
66BLDTMP(DGIEN,DGSORT,DGST) ;^TMP("DGNT",$J global builder
67 ; Build TMP file based on sort selection
68 ;
69 ; Input:
70 ; DGIEN - IEN to patient's NTR record
71 ; DGSORT - sort type ("N"ame or "D"ate)
72 ; DGST - screening status (2-Pend Doc, 3-Pend DX)
73 ;
74 N DGX,DGNT,DFN
75 N DGNAME,DGSSN,DGHNC,DGNTR,DGAVI,DGSUB,DGDATE,VADM
76 N X,X1,X2,Y
77 ;validate input parameters
78 Q:'$G(DGIEN)
79 Q:'$G(DGST)
80 S DGSORT=$G(DGSORT)
81 ;
82 S DGX=$S(DGSORT="D":"DGDATE",1:"DGNAME")
83 Q:'$$GETREC^DGNTAPI(DGIEN,"DGNT")
84 S DFN=+$G(DGNT("DFN"))
85 I DFN>0 D
86 . Q:'+$G(DGNT("PRIM")) ;if not NTR PRIMARY ENTRY, quit out
87 . D ^VADPT
88 . S DGNAME=VADM(1)
89 . S DGSSN=$P(VADM(2),U,2)
90 . S DGNTR=$P($G(DGNT("NTR")),"^")
91 . S DGAVI=$P($G(DGNT("AVI")),"^")
92 . S DGSUB=$P($G(DGNT("SUB")),"^")
93 . S DGDATE=$G(DGNT("EDT"))
94 . S ^TMP("DGNT",$J,DGST,@DGX,DGIEN)=DGNAME_U_DGSSN_U_DGNTR_U_DGAVI_U_DGSUB_U_DGDATE
95 . S ^TMP("DGNT",$J,"TOT"_DGST)=$G(^TMP("DGNT",$J,"TOT"_DGST))+1
96 . S ^TMP("DGNT",$J,"TOT")=$G(^TMP("DGNT",$J,"TOT"))+1
97 Q
98 ;
99PRINT(DGSORT) ;
100 U IO
101 N DGST
102 N DGX,DGIEN
103 N DGFIRST,DGLINE
104 N DGSITE,DGSTNUM,DGSTTN,DGSTN
105 N DGQUIT,DGPAGE
106 N DGDDT ;current date/time for header display
107 S DGSORT=$G(DGSORT)
108 S DGSITE=$$SITE^VASITE
109 S DGSTNUM=$P(DGSITE,U,3),DGSTN=$P(DGSITE,U,2)
110 S DGSTTN=$$NAME^VASITE(DT)
111 S DGSTN=$S($G(DGSTTN)]"":DGSTTN,1:$G(DGSTN))
112 S DGQUIT=0
113 S DGPAGE=0
114 S DGX=$S(DGSORT="D":"DGDATE",1:"DGNAME")
115 S DGDDT=$$FMTE^XLFDT($$NOW^XLFDT,"D")
116 D HEAD(DGDDT)
117 I '$D(^TMP("DGNT",$J)) D Q
118 . W !!!?20,"**** No records to report. ****"
119 S @DGX=""
120 F DGST=2,3 D
121 . F S @DGX=$O(^TMP("DGNT",$J,DGST,@DGX)) Q:@DGX']"" D Q:DGQUIT
122 .. S DGIEN=""
123 .. F S DGIEN=$O(^TMP("DGNT",$J,DGST,@DGX,DGIEN)) Q:DGIEN="" D Q:DGQUIT
124 ... D:$Y>(IOSL-4) HEAD(DGDDT)
125 ... Q:DGQUIT
126 ... S DGLINE=$G(^TMP("DGNT",$J,DGST,@DGX,DGIEN))
127 ... 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))
128 . Q:DGQUIT
129 . W !!?5,"Total Patients Pending "_$S(DGST=2:"Documentation",1:"Diagnosis")_" Verification: "_+$G(^TMP("DGNT",$J,"TOT"_DGST))
130 . I DGST=2 D HEAD(DGDDT)
131 ;
132 ;Shutdown if stop task requested
133 I DGQUIT W:$D(ZTQUEUED) !!,"REPORT STOPPED AT USER REQUEST" Q
134 ;
135 W !!?5,"Total Patients Pending Verification: "_$G(^TMP("DGNT",$J,"TOT"))
136 I $G(DGPAGE)>0,$E(IOST)="C" K DIR S DIR(0)="E" D ^DIR K DIR S:+Y=0 DGQUIT=1
137 Q
138 ;
139HEAD(DGDT) ;Print/Display page header
140 ;
141 ; Input:
142 ; DGDT - current date/time for display
143 ; Output
144 ; none
145 ;
146 I $D(ZTQUEUED),$$S^%ZTLOAD S (ZTSTOP,DGQUIT)=1 Q
147 I $G(DGPAGE)>0,$E(IOST)="C" K DIR S DIR(0)="E" D ^DIR K DIR S:+Y=0 DGQUIT=1
148 Q:DGQUIT
149 W @IOF
150 S DGPAGE=$G(DGPAGE)+1
151 W !,DGDT,?15,"N/T RADIUM TREATMENT PENDING VERIFICATION REPORT",?70,"Page: ",$G(DGPAGE)
152 W !,"STATION: "_$G(DGSTN)
153 W !!,"Patient Name",?30,"SSN",?42,"NT",?46,"Avi",?50,"Sub",?54,"Date/Time Entered"
154 W !,"-----------------------",?30,"-----------",?42,"---",?46,"---",?50,"---",?54,"----------------------"
155 Q
156 ;
157EXIT ;
158 I $D(ZTQUEUED) S ZTREQ="@"
159 K ^TMP("DGNT",$J)
160 I '$D(ZTQUEUED) D
161 . K %ZIS,POP
162 . D ^%ZISC,HOME^%ZIS
163 Q
Note: See TracBrowser for help on using the repository browser.