source: WorldVistAEHR/trunk/r/PATIENT_REPRESENTATIVE-QAC/QACSPRD2.m@ 619

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

initial load of WorldVistAEHR

File size: 5.2 KB
Line 
1QACSPRD2 ;HINES/CEW - Spreadsheet report selections ;7/17/95 11:17
2 ;;2.0;Patient Representative;**3,9,12,17**;07/25/1995
3CODE ;
4 ;Sub-routine to count total number of issues for each issue code
5 S QACTITLE="Issue Code "
6 S QACRTN="CODETSK^QACSPRD2"
7 S QACIFLG=1
8 D ZIS1^QACSPRD(QACRTN,QACTITLE,.QACD0) G:$G(QACPOP) EXIT
9 I $G(QACXFLG) G EXIT
10CODETSK ;
11 ;Tasked entry point for CODE
12 S QACROU="CODETSK1^QACSPRD2"
13 D TSK
14 Q
15CODETSK1 ;
16 D ICLOOP
17 S QACRR=0
18 F S QACRR=$O(QACODE(QACRR)) Q:QACRR']"" D
19 . S ^TMP("QACSPRD2",$J,QACDIV,QACODE(QACRR),QACD0)=""
20 . ;D TALL^QACSPRD1(QACD0) ;Q
21 Q
22LOC ;
23 ;Sub-routine to count total number of issues for Location of Event
24 S QACTITLE="Location "
25 S QACRTN="LOCTSK^QACSPRD2"
26 S QACIFLG=1
27 D ZIS1^QACSPRD(QACRTN,QACTITLE,.QACD0) G:$G(QACPOP) EXIT
28 I $G(QACXFLG) G EXIT
29LOCTSK ;
30 ;Tasked entry point for LOC
31 S QACROU="LOCTSK1^QACSPRD2"
32 D TSK
33 Q
34LOCTSK1 ;
35 D ICLOOP
36 S QACLNUM=$P(^QA(745.1,QACD0,0),U,12) Q:QACLNUM="" D
37 . S QACLOC=$P($G(^SC(+QACLNUM,0)),U,1)
38 Q:$G(QACLOC)']""
39 S QACRR=0
40 F S QACRR=$O(QACODE(QACRR)) Q:QACRR']"" D
41 . S ^TMP("QACSPRD2",$J,QACDIV,QACLOC,QACODE(QACRR),QACD0)=""
42 . Q
43 Q
44SERVICE ;
45 ;Sub-routine to count total number of issues for Service
46 ;This field is the old service/section involved field, no longer used
47 ;after 10/01/97. Report is kept for records entered prior to that date.
48 K %ZIS,IOP S %ZIS="MQ" W ! D ^%ZIS G:POP EXIT
49 I $D(IO("Q")) D G EXIT
50 . S (ZTSAVE("QAQNBEG"),ZTSAVE("QAQNEND"))=""
51 . S ZTSAVE("^TMP(""QACSPRD2"",$J,")=""
52 . S ZTDESC="Patient Rep Service Spreadsheet"
53 . S ZTRTN="SERVTSK^QACSPRD2" D ^%ZTLOAD
54 . Q
55SERVTSK ;
56 ;Tasked entry point for SERVICE
57 U IO
58 S QACDT=QAQNBEG-.0000001 F S QACDT=$O(^QA(745.1,"D",QACDT)) Q:(QACDT'>0)!(QACDT>QAQNEND)!(QACDT\1'?7N) D
59 . S QACD0=0 F S QACD0=$O(^QA(745.1,"D",QACDT,QACD0)) Q:QACD0'>0 D
60 .. Q:'$D(^QA(745.1,QACD0,3,0))
61 .. S QACCN=0 F S QACCN=$O(^QA(745.1,QACD0,3,QACCN)) Q:QACCN'>0 D
62 ... S QACCIEN=$P($G(^QA(745.1,QACD0,3,QACCN,0)),U,1) Q:QACCIEN=""
63 ... S QACICODE=$P($G(^QA(745.2,QACCIEN,0)),U,1) Q:QACICODE="" D
64 .... Q:'$D(^QA(745.1,QACD0,3,QACCN,1,0))
65 .... S QACSIEN=0 F S QACSIEN=$O(^QA(745.1,QACD0,3,QACCN,1,"B",QACSIEN)) Q:QACSIEN'>0 D
66 ..... S QACSERV=$$EN4^QACUTIL(+QACSIEN)
67 ..... S ^TMP("QACSPRD2",$J,QACSERV,QACICODE,QACD0)=""
68 ..... Q
69 .... Q
70 ... Q
71 .. Q
72 . Q
73 S QACSERV="" F S QACSERV=$O(^TMP("QACSPRD2",$J,QACSERV)) Q:QACSERV="" D
74 . S QACICODE="",QACTOT=0 F S QACICODE=$O(^TMP("QACSPRD2",$J,QACSERV,QACICODE)) Q:QACICODE="" D
75 .. S QACREC=0 F S QACREC=$O(^TMP("QACSPRD2",$J,QACSERV,QACICODE,QACREC)) Q:QACREC'>0 D
76 ... S QACTOT=QACTOT+1
77 ... Q
78 .. Q
79 . W !,QACSERV_","_QACTOT
80 . Q
81 D EXIT
82 Q
83DISC ; Sub-routine to count total issue per discipline
84 S QACTITLE="Discipline "
85 S QACRTN="DISCTSK^QACSPRD2"
86 S QACIFLG=1
87 D ZIS1^QACSPRD(QACRTN,QACTITLE,.QACD0) G:$G(QACPOP) EXIT
88 I $G(QACXFLG) G EXIT
89DISCTSK ; Tasked entry point for DISCIPLINE
90 S QACROU="DISCTSK1^QACSPRD2"
91 D TSK
92 Q
93DISCTSK1 ;
94 D ICLOOP
95 S QACRR=0
96 F S QACRR=$O(QACODE(QACRR)) Q:QACRR'>0 D
97 . ;Q:'$D(^QA(745.1,QACD0,3,QACODE(QACRR),3,0))
98 . S QACWW=0
99 . F S QACWW=$O(^QA(745.1,QACD0,3,QACCODE(QACRR),3,"B",QACWW)) Q:QACWW'>0 D
100 . . S QACDIEN=$P(^QA(745.55,QACWW,0),U,3) Q:$G(QACDIEN)']""
101 . . S QACDISC=$$EN7^QACUTIL(+QACDIEN)
102 . . S ^TMP("QACSPRD2",$J,QACDIV,QACDISC,QACODE(QACRR),QACD0)=""
103 . . Q
104 . Q
105 Q
106EXIT ;
107 W ! D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
108 K ^TMP("QACSPRD2",$J),IOP,POP,ZTRTN,ZTSAVE,ZTDESC,%ZIS
109 K COUNT,QAC1,QAC1DIV,QAC2,QAC3,QAC4,QACCIEN,QACCODE,QACCN,QACD0
110 K QACDD,QACDIV,QACDIEN,QACDISC,QACDV,QACDNUM,QACDT,QACEE,QACICODE
111 K QACIFLG,QACISSUE,QACLOC,QACLNUM,QACMM,QACNUM,QACPN,QACPOP,QACREC
112 K QACROU,QACRR,QACRTN,QACSERV,QACSIEN,QACTITLE,QACTOT,QACWW,QACXFLG
113 K QAQNBEG,QAQNEND
114 Q
115ICLOOP ;
116 U IO
117 K QACODE
118 Q:'$D(^QA(745.1,QACD0,3,0))
119 S QACEE=0 F S QACEE=$O(^QA(745.1,QACD0,3,"B",QACEE)) Q:QACEE'>0 D
120 . S QACODE(QACEE)=$P($G(^QA(745.2,QACEE,0)),U,1) I QACODE(QACEE)="" K QACODE(QACEE) Q
121 . ;get the issue code IEN so that in DISCTSK1 can get the discpline
122 . S QACMM=0 S QACMM=$O(^QA(745.1,QACD0,3,"B",QACEE,QACMM)) I $G(QACMM)>0 S QACCODE(QACEE)=QACMM
123 Q
124COUNT ;
125 N QACCNT,QACCNT2,QACCNT3,QACCNT4,QACTOT
126 S QAC1=""
127 S (QACCNT2,QACCNT3,QACCNT4)=0
128 F S QAC1=$O(^TMP("QACSPRD2",$J,QAC1)) Q:QAC1']"" D
129 . I $D(QAC1DIV) D
130 . . I $G(QAC1)]"" S QACDV=QAC1
131 . . I $G(QAC1)=+$G(QAC1) D INST^QACUTL0(QAC1,.QACDV)
132 . . W !!?5,"Division: "_$S(QAC1=0:"Unknown",1:QACDV)
133 . S QAC2=""
134 . F S QAC2=$O(^TMP("QACSPRD2",$J,QAC1,QAC2)) Q:QAC2']"" D
135 . . S QACCNT2=$G(QACCNT2)+1
136 . . S QAC3=""
137 . . F S QAC3=$O(^TMP("QACSPRD2",$J,QAC1,QAC2,QAC3)) Q:QAC3']"" D
138 . . . S QACCNT3=$G(QACCNT3)+1
139 . . . S QAC4=""
140 . . . F S QAC4=$O(^TMP("QACSPRD2",$J,QAC1,QAC2,QAC3,QAC4)) Q:QAC4']"" D
141 . . . . S QACCNT4=$G(QACCNT4)+1
142 . . W !,QAC2_", "_$S($G(QACCNT4)>0:QACCNT4,1:QACCNT3) S (QACCNT3,QACCNT4)=0
143 . ;W !?5,QAC1_", "_$S($G(QACCNT3)>0:QACCNT3,1:QACCNT2) S (QACCNT3,QACCNT2)=0
144 ;. . S (QACCNT3,QACCNT4)=0
145 Q
146TSK ;
147 D LOOP1^QACSPRD(QACROU,QAQNBEG,QAQNEND,.QACD0)
148 ;D SET1^QACSPRD1
149 D WRIT^QACSPRD1
150 D COUNT
151 D EXIT
152 Q
153LOOP2 ;
154 S (QACDD,QACTOT)=0
155 F S QACDD=$O(^TMP("QACSPRD2",$J,QAC1,QAC2,QACDD)) Q:QACDD']"" D
156 . S QACTOT=QACTOT+1
157 W !,QAC2_", "_QACTOT
158 I $Y>(IOSL-5) D:$E(IOST)="C" PAUSE^QACGEN S QACPFLG=1 D WRIT^QACSPRD1
159 S QACTOT=0
160 K QACPFLG
161 Q
Note: See TracBrowser for help on using the repository browser.