source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SCDXPOV3.m@ 1071

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

initial load of FOIAVistA 6/30/08 version

File size: 5.8 KB
Line 
1SCDXPOV3 ; ALB/SCK - VISIT REPORT BY NPCDB TRANSMISSION STATUS ; 05 Oct 98 8:38 PM
2 ;;5.3;Scheduling;**73,159,173**;AUG 13, 1993
3 Q
4VISIT(SCXDT,SCXP,SCXE,SCXET,SCXV,SCXC) ; Update visit count for this encounter
5 ; Input:
6 ; SCXDT - Visit date
7 ; SCXP - Patients DFN
8 ; SCXE - Vet Eligibility status of encounter
9 ; SCXET - Vet. or Non-Vet status
10 ; SCXV - Category of visit
11 ; SCXC - C&P status of encounter
12 ;
13 ; Variables:
14 ; SCHL - Current Hierarchy level
15 ; L1 - Local variable
16 ;
17 N L1,SCHL
18 ;
19 I $D(^TMP("SCDXV",$J,"ELG",SCXDT,SCXP)) D
20 . S SCHL=$P(^TMP("SCDXV",$J,"ELG",SCXDT,SCXP),U,3)
21 . S L1=$$ELGPRI^SCDXPOV2(SCXE,SCHL)
22 . S:$P(L1,U,2) ^TMP("SCDXV",$J,"ELG",SCXDT,SCXP)=SCXE_U_SCXET_U_$P(L1,U)
23 E S ^TMP("SCDXV",$J,"ELG",SCXDT,SCXP)=SCXE_U_SCXET_U_$P($$ELGPRI^SCDXPOV2(SCXE,0),U)
24 ;
25 I $D(^TMP("SCDXV",$J,"COV",SCXDT,SCXP)) D
26 . S SCHL=$P(^TMP("SCDXV",$J,"COV",SCXDT,SCXP),U,2)
27 . S L1=$$COVPRI^SCDXPOV2(SCXV,SCHL)
28 . S:$P(L1,U,2) ^TMP("SCDXV",$J,"COV",SCXDT,SCXP)=SCXV_U_$P(L1,U)
29 E S ^TMP("SCDXV",$J,"COV",SCXDT,SCXP)=SCXV_U_$P($$COVPRI^SCDXPOV2(SCXV,0),U)
30 ;
31 I SCXC,'$D(^TMP("SCDXV",$J,"CP",SCXDT,SCXP)) D
32 . S ^TMP("SCDXV",$J,"CP",SCXDT,SCXP)=1
33 Q
34 ;
35WRT ; Call procedures to initialize report data global, build the report global, and then print the report.
36 ;
37 ; Variables
38 ; DVN - Facility number from VASITE
39 ; DNAME - Facility name from VASITE
40 ;
41 N SDBDASH,SDASH,DNAME,DVN
42 S $P(SDBDASH,"=",75)="",$P(SDASH,"-",15)=""
43 U IO
44 ;
45 S DVN=$P($$SITE^VASITE(SCXBEG),U,3),DNAME=$P($$SITE^VASITE(SCXBEG),U,2)
46 D INIT^SCDXPOV("VISITS"),BLDRPT,VISRPT
47 Q
48 ;
49BLDRPT ; Build data global for report. Order through date/patient TMP global, and count the number of unique
50 ; visits. Increment the appropriate report data global.
51 ;
52 ; Variables
53 ; SCXDT - Date the Visit occurred (Encounter date)
54 ; SCXP - DFN of patient for this encounter
55 ; SCX - Node of TMP global visits are being counted from
56 ; LV1 - Local variable for incremneting report data global
57 ;
58 N SCXDT,SCXP,SCX,LV1
59 S SCXDT=""
60 ; Count visits for Vet./Non-Vet. eligibility
61 F S SCXDT=$O(^TMP("SCDXV",$J,"ELG",SCXDT)) Q:SCXDT'>0 D
62 . S SCXP="" F S SCXP=$O(^TMP("SCDXV",$J,"ELG",SCXDT,SCXP)) Q:'SCXP D
63 .. S SCX=^TMP("SCDXV",$J,"ELG",SCXDT,SCXP)
64 .. S LV1=$P($G(^TMP("SCDXPOV",$J,"VISITS",$S($P(SCX,U,2)="Y":"VELIG",1:"NVELIG"),$P(SCX,U))),U)
65 .. S $P(^TMP("SCDXPOV",$J,"VISITS",$S($P(SCX,U,2)="Y":"VELIG",1:"NVELIG"),$P(SCX,U)),U)=LV1+1
66 ;
67 ; Count visits for Category of Visit.
68 F S SCXDT=$O(^TMP("SCDXV",$J,"COV",SCXDT)) Q:SCXDT'>0 D
69 . S SCXP="" F S SCXP=$O(^TMP("SCDXV",$J,"COV",SCXDT,SCXP)) Q:'SCXP D
70 .. S LV1=$P(^TMP("SCDXPOV",$J,"VISITS","COV",$P(^TMP("SCDXV",$J,"COV",SCXDT,SCXP),U)),U)
71 .. S $P(^TMP("SCDXPOV",$J,"VISITS","COV",$P(^TMP("SCDXV",$J,"COV",SCXDT,SCXP),U)),U)=LV1+1
72 ;
73 ; Count visits with a type of appt. of C&P
74 F S SCXDT=$O(^TMP("SCDXV",$J,"CP",SCXDT)) Q:SCXDT'>0 D
75 . S SCXP="" F S SCXP=$O(^TMP("SCDXV",$J,"CP",SCXDT,SCXP)) Q:'SCXP D
76 .. S $P(^TMP("SCDXPOV",$J,"VISITS","CP"),U)=$P(^TMP("SCDXPOV",$J,"VISITS","CP"),U)+1
77 Q
78 ;
79VISRPT ; Print body of the Visit report consolidated by number of visits.
80 ;
81 ; Variables
82 ; SBTT - Subtotal of categories
83 ; NUM - local counting variable
84 ; SCDXABRT - Abort Printing (Screen only)
85 ;
86 N NUM,SBTT,L1
87 ;
88 D HDR
89 I $Y>(IOSL-8) D NEWPAGE G:SCXABRT VISQ
90 W !,?5,"VETERAN ELIGIBILITY",!
91 S (NUM,SBTT)=0
92 F S NUM=$O(^TMP("SCDXPOV",$J,"VISITS","VELIG",NUM)) Q:'NUM D I $Y>(IOSL-8) D NEWPAGE G:SCXABRT VISQ
93 . W !?8,$P(^DIC(8,NUM,0),U),?45,$J($P(^TMP("SCDXPOV",$J,"VISITS","VELIG",NUM),U),6)
94 . S SBTT=+$G(SBTT)+$P(^TMP("SCDXPOV",$J,"VISITS","VELIG",NUM),U)
95 ;
96 W !?42,SDASH,!,?5,"Veteran Sub-Total",?45,$J(SBTT,6)
97 I $Y>(IOSL-8) D NEWPAGE G:SCXABRT VISQ
98 ;
99 W !!,?5,"NON-VETERAN ELIGIBILITY",!
100 S (NUM,SBTT)=0
101 F S NUM=$O(^TMP("SCDXPOV",$J,"VISITS","NVELIG",NUM)) Q:'NUM D I $Y>(IOSL-8) D NEWPAGE G:SCXABRT VISQ
102 . W !?8,$P(^DIC(8,NUM,0),U),?45,$J($P(^TMP("SCDXPOV",$J,"VISITS","NVELIG",NUM),U),6)
103 . S SBTT=+$G(SBTT)+$P(^TMP("SCDXPOV",$J,"VISITS","NVELIG",NUM),U)
104 ;
105 W !?42,SDASH,!,?5,"Non-Veteran Sub-Total",?45,$J(SBTT,6)
106 I $Y>(IOSL-8) D NEWPAGE G:SCXABRT VISQ
107 ;
108 W !!,?5,"CATEGORY OF VISIT",!
109 S (NUM,SBTT)=0
110 F S NUM=$O(^TMP("SCDXPOV",$J,"VISITS","COV",NUM)) Q:'NUM D I $Y>(IOSL-8) D NEWPAGE G:SCXABRT VISQ
111 . W !?8,$P($T(VISIT+NUM^SCDXPOV1),";",3),?45,$J($P(^TMP("SCDXPOV",$J,"VISITS","COV",NUM),U),6)
112 . S SBTT=+$G(SBTT)+$P(^TMP("SCDXPOV",$J,"VISITS","COV",NUM),U)
113 ;
114 W !?42,SDASH,!,?5,"Category Sub-Total",?45,$J(SBTT,6)
115 I $Y>(IOSL-8) D NEWPAGE G:SCXABRT VISQ
116 ;
117 W !!,?8,"Compensation and Penison appointments are included in the above",!?8,"categories and totals and are shown here for information only"
118 W !!?8,"COMPENSATION AND PENSION",?45,$J($P(^TMP("SCDXPOV",$J,"VISITS","CP"),U),6)
119 ;
120VISQ Q
121 ;
122HDR ; Print the report header
123 ; Variables
124 ; LINEOUT - Message line for header
125 ; END - Timeout or Uparrow flag for read
126 ;
127 N END,LINEOUT,LL,HD1,HD2
128 ;
129 W @IOF
130 S HD2="VISIT REPORT FOR ACTIVITY TRANSMITTED TO NPCDB"
131 W !?(IOM-$L(HD2))/2,HD2
132 S HD1="FOR PERIOD "
133 S Y=SCXBEG D DTS^SDUTL
134 S HD1=HD1_Y_" THRU "
135 S Y=SCXEND D DTS^SDUTL
136 S HD1=HD1_Y
137 W !?2,"Facility: "_DNAME,?(IOM-$L(HD1))-5,HD1
138 W !!
139 F LL=0:1 S LINEOUT=$P($T(MSG+(LL+1)),";;",2) Q:LINEOUT["$$END" W !?8,LINEOUT
140 W !!?48,"VISITS"
141 W !,SDBDASH
142 Q
143 ;
144NEWPAGE ;
145 N LL
146 I IOST?1"C-".E S DIR(0)="E" D ^DIR S SCXABRT='+$G(Y) D CLEAR^SCDXPOV2
147 ;W !," Press RETURN to continue or '^' to exit: " R LL:DTIME S SCXABRT='$T!(LL="^")
148 I 'SCXABRT D HDR
149 Q
150 ;
151MSG ;
152 ;;*NOTE* This section consolidates all encounters into visits, where
153 ;;one visit is all encounters for a patient on a single day. For
154 ;;example, three encounters for a patient on one day, is one visit.
155 ;;$$END
Note: See TracBrowser for help on using the repository browser.