source: WorldVistAEHR/trunk/r/WOMENS_HEALTH-WV/WVRPSCR1.m@ 1154

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

initial load of WorldVistAEHR

File size: 6.2 KB
Line 
1WVRPSCR1 ;HCIOFO/FT,JR-Display Compliance Rates (cont.) ;6/17/99 11:47
2 ;;1.0;WOMEN'S HEALTH;**3,7**;Sep 30, 1998
3 ;; Original routine created by IHS/ANMC/MWR
4 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
5 ;; THIS REPORT WILL DISPLAY COMPLIANCE RATES FOR PAPS & MAMS.
6 ;; ENTRY POINTS CALLED BY WVRPSCR.
7DATA ;EP
8 ;---> SORT AND STORE ARRAY IN ^TMP("WV",$J
9 K WVTMP,^TMP("WV",$J),^TMP("WVP",$J),WVPR
10 ;---> WVBEGDT1=ONE SECOND BEFORE BEGIN DATE.
11 ;---> WVENDDT1=THE LAST SECOND OF END DATE.
12 F WVCNT=20,30,40,50,60,70,200 S WVAGRG(WVCNT)=""
13 S WVBEGDT1=WVBEGDT-.0001,WVENDDT1=WVENDDT+.9999
14 ;
15 S WVDATE=WVBEGDT1,WVTOT=$$ACTIVE^WVRPSCR2(WVBEGDT,WVENDDT1,WVAGRG)
16 F S WVDATE=$O(^WV(790.1,"D",WVDATE)) Q:'WVDATE!(WVDATE>WVENDDT1) D
17 .S WVIEN=0
18 .F S WVIEN=$O(^WV(790.1,"D",WVDATE,WVIEN)) Q:'WVIEN D
19 ..S Y=^WV(790.1,WVIEN,0)
20 ..S WVDFN=$P(Y,U,2),WVPCDN=$P(Y,U,4),WVRES=$P(Y,U,5)
21 ..;
22 ..;---> QUIT IF THIS PROCEDURE HAS A RESULT OF "ERROR/DISREGARD".
23 ..Q:WVRES=8
24 ..;
25 ..;---> QUIT IF NEITHER A PAP (IEN=1) NOR A SCREENING MAM (IEN=28).
26 ..Q:((WVPCDN'=1)&(WVPCDN'=28))
27 ..;
28 ..;---> QUIT IS PATIENT IS NOT WITHIN AGE RANGE.
29 ..S WVAGE=+$$AGE^WVUTL9(WVDFN)
30 ..I WVAGRG'=1 Q:((WVAGE<$P(WVAGRG,"-"))!(WVAGE>$P(WVAGRG,"-",2)))
31 ..;
32 ..;---> GET VALUE OF RESULT: 0=NORMAL, 1=ABNORMAL, 2=NO RESULT
33 ..S WVNORM=$$NORMAL^WVUTL4(WVRES) S:WVNORM=2 WVNORM=0
34 ..;
35 ..S ^TMP("WV",$J,WVDFN,WVNORM,WVPCDN,WVIEN)=""
36 ..I WVPCDN=1 D
37 ...S WVJPAPR=$P($G(^WV(790,WVDFN,0)),U,16)
38 ...I WVJPAPR'>0 S WVJPAPR="NOT SPECIFIED"
39 ...E S WVJPAPR=$P($G(^WV(790.03,WVJPAPR,0)),U)
40 ...S ^TMP("WVP",$J,WVJPAPR,WVDFN,WVNORM,WVPCDN,WVIEN)=""
41 ..I WVPCDN=28 D
42 ...S WVJ=$O(WVAGRG(WVAGE))
43 ...S WVJAGER=$S(WVJ=20:"<20",WVJ=30:"20-29",WVJ=40:"30-39",WVJ=50:"40-49",WVJ=60:"50-59",WVJ=70:"60-69",WVJ=200:">70",1:"AGE UNKNOWN")
44 ...S ^TMP("WVP",$J,WVJAGER,WVDFN,WVNORM,WVPCDN,WVIEN)=""
45 ;
46 ;---> NOW COLLATE DATA FROM ^TMP ARRAY INTO LOCAL WVTMP REPORT ARRAY.
47 ;---> FIRST, SEED LOCAL ARRAY WITH ZEROS.
48 F M=1,28 D
49 .N I F I=1:1:5 S WVTMP("RES",M,I)=0
50 ;
51 ;---> COLLATE DATA.
52 S N=0
53 F S N=$O(^TMP("WV",$J,N)) Q:'N D
54 .F M=1,28 D
55 ..Q:$D(^TMP("WV",$J,N,1,M))
56 ..S P=0,Q=0
57 ..F S P=$O(^TMP("WV",$J,N,0,M,P)) Q:'P S Q=Q+1
58 ..Q:'Q
59 ..I '$D(WVTMP("RES",M,Q)) S WVTMP("RES",M,Q)=1 Q
60 ..S WVTMP("RES",M,Q)=WVTMP("RES",M,Q)+1
61 ;
62 ;---> STORE ALL NODES >5 IN THE 5+ NODE.
63 F M=1,28 D
64 .S Q=5
65 .F S Q=$O(WVTMP("RES",M,Q)) Q:'Q D
66 ..S WVTMP("RES",M,5)=WVTMP("RES",M,5)+WVTMP("RES",M,Q)
67 ..K WVTMP("RES",M,Q)
68 ;
69 ;---> FIGURE PERCENTAGES OF WOMEN AND STORE IN ARRAY.
70 F M=1,28 D
71 .F Q=1:1:5 S $P(WVTMP("RES",M,Q),U,2)=$J((+WVTMP("RES",M,Q)/WVTOT),0,2)
72 ;
73 ;---> BUILD DISPLAY ARRAY.
74 N WVNODE K ^TMP("WV",$J)
75 ;
76 ;---> PAPS SUBHEADER LINE.
77 S WVNODE=$$S(40)_"SCREENING PAPS"
78 D WRITE(1,WVNODE)
79 S WVNODE=$$S(39)_"----------------"
80 D WRITE(2,WVNODE)
81 S WVNODE=" # of PAPs: 1 2 3 4 5+"
82 D WRITE(4,WVNODE)
83 S WVNODE=" ----------- ----- ----- ----- ----- -----"
84 D WRITE(5,WVNODE)
85 ;
86 ;---> PAPS NUMBER OF WOMEN DATA LINE.
87 S WVNODE=" # of Women: "
88 F Q=1:1:5 S WVNODE=WVNODE_$J($P(WVTMP("RES",1,Q),U),6)
89 D WRITE(6,WVNODE)
90 S WVNODE=" % of Women: "
91 F Q=1:1:5 S WVNODE=WVNODE_$J(($P(WVTMP("RES",1,Q),U,2)*100),5)_"%"
92 D WRITE(7,WVNODE)
93 ;
94 ;---> LINE FEEDS BETWEEN PAPS AND MAMS.
95 S WVNODE="" D WRITE(8,WVNODE) S WVNODE="" D WRITE(9,WVNODE)
96 ;
97 ;---> MAMS SUBHEADER LINE.
98 S WVNODE=$$S(40)_"SCREENING MAMS"
99 D WRITE(10,WVNODE)
100 S WVNODE=$$S(39)_"----------------"
101 D WRITE(11,WVNODE)
102 S WVNODE=" # of MAMs: 1 2 3 4 5+"
103 D WRITE(13,WVNODE)
104 S WVNODE=" ----------- ----- ----- ----- ----- -----"
105 D WRITE(14,WVNODE)
106 ;
107 ;---> PAPS NUMBER OF WOMEN DATA LINE.
108 S WVNODE=" # of Women: "
109 F Q=1:1:5 S WVNODE=WVNODE_$J($P(WVTMP("RES",28,Q),U),6)
110 D WRITE(15,WVNODE)
111 S WVNODE=" % of Women: "
112 F Q=1:1:5 S WVNODE=WVNODE_$J(($P(WVTMP("RES",28,Q),U,2)*100),5)_"%"
113 D WRITE(16,WVNODE)
114 Q
115 ;
116WRITE(I,Y) ;EP
117 S ^TMP("WV",$J,I,0)=Y
118 Q
119 ;
120S(S) ;EP
121 ;---> SPACES.
122 Q $$S^WVUTL7($G(S))
123 ;
124 ;
125AGERNG(WVAGRG,WVPOP) ;EP
126 ;---> ASK AGE RANGE.
127 ;---> RETURN AGE RANGE IN WVAGRG.
128 N DIR,DIRUT,Y S WVPOP=0
129 W !!?3,"Do you wish to limit this report to an age range?"
130 S DIR(0)="Y",DIR("B")="NO" D HELP1
131 S DIR("A")=" Enter Yes or No"
132 D ^DIR K DIR W !
133 S:$D(DIRUT) WVPOP=1
134 ;---> IF NOT DISPLAYING BY AGE RANGE, SET WVAGRG (AGE RANGE)=1, QUIT.
135 I 'Y S WVAGRG=1 Q
136BYAGE1 ;
137 W !?5,"Enter the age range you wish to select in the form of: 40-75"
138 W !?5,"Use a dash ""-"" to separate the limits of the range."
139 W !?5,"To select only one age, simply enter that age, with no dash."
140 W !?5,"(NOTE: Patient ages will reflect the age they are today.)",!
141 K DIR
142 S DIR(0)="FOA",DIR("A")=" Enter age range: "
143 S:$D(^WV(790.72,DUZ,0)) DIR("B")=$P(^(0),U,3)
144 D ^DIR K DIR
145 I $D(DIRUT) S WVPOP=1 Q
146 D CHECK(.Y)
147 I Y="" D G BYAGE1
148 .W !!?5,"* INVALID AGE RANGE. Please begin again."
149 ;---> WVAGRG=SELECTED AGE RANGE(S).
150 S WVAGRG=Y
151 D DIC^WVFMAN(790.72,"L",.Y,"","","","`"_DUZ)
152 Q:Y<0
153 D DIE^WVFMAN(790.72,".03////"_WVAGRG,+Y,.WVPOP,1)
154 Q
155 ;
156HELP1 ;EP
157 ;;Answer "YES" to display screening rates for a specific age range.
158 ;;If you choose to display for an age range, you will be given the
159 ;;opportunity to select the age range. For example, you might choose
160 ;;to display from ages 50-75.
161 ;;Answer "NO" to display screening rates for all ages.
162 S WVTAB=5,WVLINL="HELP1" D HELPTX
163 Q
164 ;
165PRINTX ;EP
166 N I,T,X S T=$$REPEAT^XLFSTR(" ",WVTAB)
167 F I=1:1 S X=$T(@WVLINL+I) Q:X'[";;" W !,T,$P(X,";;",2)
168 Q
169 ;
170HELPTX ;EP
171 ;---> CREATES DIR ARRAY FOR DIR. REQUIRED VARIABLES: WVTAB,WVLINL.
172 N I,T,X S T=$$REPEAT^XLFSTR(" ",WVTAB)
173 F I=1:1 S X=$T(@WVLINL+I) Q:X'[";;" S DIR("?",I)=T_$P(X,";;",2)
174 S DIR("?")=DIR("?",I-1) K DIR("?",I-1)
175 Q
176 ;
177CHECK(X) ;EP
178 ;---> CHECK SYNTAX OF AGE RANGE STRING.
179 ;---> IF X=ONE AGE ONLY, SET IT IN THE FORM X-X AND QUIT.
180 I X?1N.N S X=X_"-"_X Q
181 ;
182 N FAIL,I,Y1,Y2
183 S FAIL=0
184 ;---> CHECK EACH RANGE.
185 S Y1=$P(X,"-"),Y2=$P(X,"-",2)
186 ;---> EACH END OF EACH RANGE SHOULD BE A NUMBER.
187 I (Y1'?1N.N)!(Y2'?1N.N) S X="" Q
188 ;---> THE LOWER NUMBER SHOULD BE FIRST.
189 I Y2<Y1 S FAIL=1
190 I FAIL S X="" Q
191 Q
Note: See TracBrowser for help on using the repository browser.