source: FOIAVistA/trunk/r/PATIENT_REPRESENTATIVE-QAC/QACDISC.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 6.2 KB
Line 
1QACDISC ;WCIOFO/ERC - Report of Discipline Contacts ;8/15/97
2 ;;2.0;Patient Representative;**3,5,6,9,13,17,18**;07/25/1995
3DATE ;
4 N QACFLG
5 D DATDIV^QACUTL0 G:QAQPOP EXIT
6 S QACTEXT="Discipline "
7 S DIC="^QA(745.5,"
8 D DIR(QACTEXT,DIC,.Y)
9 I $G(QACQUIT)=1 G EXIT2
10 I $G(Y),+Y<0 D
11 . W !!,"No Discipline selected.",!!
12 . S QACTEXT="Discipline "
13 . S DIC="^QA(745.5,"
14 . D DIR(QACTEXT,DIC,.Y)
15 I $G(QACQUIT)=1 G EXIT2
16 I $G(QACFLG)=1 S QACDSC=$P(^QA(745.5,+Y,0),U,2),QACDSP=+Y
17 K %ZIS,IOP S %ZIS="MQ" W ! D ^%ZIS G:POP EXIT
18 I $D(IO("Q")) D G EXIT
19 . S ZTDESC="Patient Rep "_QACTEXT_"Report"
20 . S (ZTSAVE("QASDIS"),ZTSAVE("QACDSC"),ZTSAVE("QACDSP"))=""
21 . S (ZTSAVE("QACSRPT0"),ZTSAVE("QACSRPT1"),ZTSAVE("QACSRPT2"))=""
22 . S (ZTSAVE("QAQNBEG"),ZTSAVE("QAQNEND"))=""
23 . S (ZTSAVE("QACFLG"),ZTSAVE("QACTEXT"))=""
24 . S (ZTSAVE("QAC1DIV"),ZTSAVE("QACDIV"),ZTSAVE("QACDV"))=""
25 . S ZTRTN="TSK^QACDISC"
26 . D TASK^QACUTL0
27 . Q
28TSK ;
29 S QACPIECE=2
30 S QACSUB=1
31 D TSK1(QACPIECE,QACSUB)
32 Q
33TSK1(QACPIECE,QACSUB) ;
34 K ^TMP("QACSRPT0",$J),^TMP("QACSRPT1",$J),^TMP("QACSRPT2",$J)
35 ;I '$D(QAC1DIV) S (^TMP("QACSRPT0",$J),^TMP("QACSRPT1",$J),^TMP("QACSRPT2",$J))=0
36 I $G(QAC1DIV)]"" S (^TMP("QACSRPT0",$J,QAC1DIV),^TMP("QACSRPT1",$J,QAC1DIV),^TMP("QACSRPT2",$J,QAC1DIV))=0
37 ;I $G(QAC1DIV)']"" D
38 ;. S QACDIV(0)=0
39 ;. S (^TMP("QACSRPT0",$J,QACDIV(0)),^TMP("QACSRPT1",$J,QACDIV(0)),^TMP("QACSRPT2",$J,QACDIV(0)))=0
40 ;. S QACEE=0
41 ;. F S QACEE=$O(^QA(740,1,"QAC2",QACEE)) Q:QACEE'>0 D
42 ;. . S QACDIV(QACEE)=^QA(740,1,"QAC2",QACEE,0)
43 ;. . S (^TMP("QACSRPT0",$J,QACDIV(QACEE)),^TMP("QACSRPT1",$J,QACDIV(QACEE)),^TMP("QACSRPT2",$J,QACDIV(QACEE)))=0
44 U IO
45 K QACDT,QACD0,QACCN,QACDIEN,QACCIEN,QACINM,QACHDNM,QACHDIEN
46 S QACDT=QAQNBEG-.0000001 F S QACDT=$O(^QA(745.1,"D",QACDT)) Q:(QACDT'>0)!(QACDT>QAQNEND)!(QACDT\1'?7N) D
47 . S QACD0=0 F S QACD0=$O(^QA(745.1,"D",QACDT,QACD0)) Q:QACD0'>0 D
48 . . S QACDIV=$P(^QA(745.1,QACD0,0),U,16)
49 . . I $G(QACDIV)']"" S QACDIV=0
50 . . I $G(QAC1DIV)]"" Q:$G(QAC1DIV)'=$G(QACDIV)
51 . . S QACCN=0 F S QACCN=$O(^QA(745.1,QACD0,3,QACCN)) Q:QACCN'>0 D
52 . . . S QACDN=0 F S QACDN=$O(^QA(745.1,QACD0,3,QACCN,3,QACDN)) Q:QACDN'>0 D
53 . . . . S QACDIEN=$P($G(^QA(745.1,QACD0,3,QACCN,3,QACDN,0)),U,QACPIECE) Q:QACDIEN=""
54 . . . . I $G(QACFLG)=1 I $G(QACDSP)'=QACDIEN Q
55 . . . . I QACSUB=1 S QACDIS=$$EN7^QACUTIL(QACDIEN)
56 . . . . I QACSUB=2 S QACDIS=$$EN8^QACUTIL(QACDIEN)
57 . . . . S QACCIEN=$P($G(^QA(745.1,QACD0,3,QACCN,0)),U,1) Q:QACCIEN=""
58 . . . . S QACICODE=$P($G(^QA(745.2,QACCIEN,0)),U,1) Q:QACICODE=""
59 . . . . I $E(QACICODE,1,2)?2A S QACHD=$E(QACICODE,1,2)
60 . . . . E S QACHD=$E(QACICODE,1)
61 . . . . S QACHDIEN=0 F S QACHDIEN=$O(^QA(745.2,"B",QACHD,QACHDIEN)) Q:QACHDIEN'>0 D SET
62 . . . . Q
63 . . . Q
64 . . Q
65 . Q
66PRINT ;
67 ;This is the header information on each page and the data by service.
68 N QACCC,QACE,QACF,QACTTL
69 K QACUNDL S $P(QACUNDL,"-",81)="",QACQUIT=0,QACPG=1
70 S QACCC=$O(^TMP("QACSRPT0",$J,""))
71 I $G(QACCC)="" S QACDSC="" D HEAD W !!,"No data found for the date range selected!" Q
72 I $G(^TMP("QACSRPT0",$J,QACCC))=0 S QACDSC="" D HEAD W !!,"No data found for the date range selected!" Q
73 K QACDIS,QACHDIEN,QACHD,QACCIEN,QACICODE,QACSTOT,QACCTOT,QACHDTOT
74 I $D(QAC1DIV) D PRT1
75 D ^%ZISC
76 D EXIT
77 Q
78PRT1 ;print report for all disciplines by division
79 S QACDD=""
80 F S QACDD=$O(^TMP("QACSRPT0",$J,QACDD)) Q:(QACDD']"")!(QACQUIT) D
81 . S QACDSC=""
82 . F S QACDSC=$O(^TMP("QACSRPT0",$J,QACDD,QACDSC)) Q:(QACDSC']"")!($G(QACQUIT)) D PRT4
83 Q
84PRT4 ;print report for each discipline by division
85 S QACSTOT=$G(^TMP("QACSRPT0",$J,QACDD,QACDSC)) Q:QACSTOT=""
86 D HEAD
87 I $G(QACDD)=0 S QACDV="Unknown"
88 I $G(QACDD)>0 D INST^QACUTL0(QACDD,.QACDV)
89 W !!?25,"Issues for Division: ",QACDV
90 W !?15,"Total Issues for ",QACDSC," = ",QACSTOT
91 S QACHD="" F S QACHD=$O(^TMP("QACSRPT1",$J,QACDD,QACDSC,QACHD)) Q:(QACHD="")!(QACQUIT) D
92 . S QACHDIEN=$P(QACHD,"^",2)
93 . S QACHDNM=$$EN6^QACUTIL(QACHDIEN)
94 . S QACHDTOT=$G(^TMP("QACSRPT1",$J,QACDD,QACDSC,QACHD)) Q:(QACHDTOT="")!(QACQUIT)
95 . W !!?5,QACHDNM,?77,QACHDTOT
96 . S QACICODE="" F S QACICODE=$O(^TMP("QACSRPT2",$J,QACDD,QACDSC,QACHD,QACICODE)) Q:(QACICODE="")!(QACQUIT) D
97 . . S QACCIEN=$P(QACICODE,"^",2)
98 . . S QACCNM=$$EN5^QACUTIL(QACCIEN)
99 . . S QACCTOT=$P($G(^TMP("QACSRPT2",$J,QACDD,QACDSC,QACHD,QACICODE)),U,1) Q:(QACCTOT="")!(QACQUIT)
100 . . W !,QACCNM,?77,QACCTOT
101 . . I $Y>(IOSL-5) D:$E(IOST)="C" PAUSE Q:QACQUIT D HEAD
102 . . Q
103 . Q
104 W ! D PAUSE
105 Q
106EXIT ;
107 W ! D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
108EXIT2 K DIR,DIROUT,DIRUT,DTOUT
109 K IOP,POP,%ZIS,ZTSAVE,ZTDESC,ZTREQ,ZTRTN,ZTQUEUED,ZTSK
110 K QAC1DIV,QACCIEN,QACCN,QACCTOT,QACD0,QACDT,QACICODE,QACDIEN,QACDIS
111 K QACDIV,QACDSC,QACDSP,QACDV,QACGDREC,QACHD
112 K QACHEAD,QACHDIEN,QACHDNM,QACHDTOT,QACINAME,QACCNM,QACDN
113 K QACPG,QACQUIT,QACRED,QACHTOT,QACTOT,QACUNDL
114 K QAQNBEG,QAQNEND,QAQPOP,QAQQUIT
115 K ^TMP("QACSRPT0",$J),^TMP("QACSRPT1",$J),^TMP("QACSRPT2",$J)
116 K QACDD,QACEE
117 K QAQ2HED,QAQNBEG,QAQNEND,QAQPOP
118 D K^QAQDATE
119 Q
120HEAD ;
121 W:($E(IOST)="C")!(QACPG>1) @IOF
122 W !,QACTEXT_"Issue Report for ",QACDSC S Y=DT D DD^%DT W ?60,"Date: ",Y,!
123 W QAQ2HED,?60,"Page: ",QACPG
124 W !,QACUNDL,! S QACPG=QACPG+1
125 Q
126PAUSE ;
127 I $E(IOST)="C" K DIR S DIR(0)="E" D ^DIR S QACQUIT=$S(Y'>0:1,1:0)
128 Q
129SET ;Counts the records.
130 I '$D(QAC1DIV) D
131 . S ^TMP("QACSRPT0",$J,QACDIS)=$G(^TMP("QACSRPT0",$J,QACDIS))+1
132 . S ^TMP("QACSRPT1",$J,QACDIS,QACHD_"^"_QACHDIEN)=$G(^TMP("QACSRPT1",$J,QACDIS,QACHD_"^"_QACHDIEN))+1
133 . S ^TMP("QACSRPT2",$J,QACDIS,QACHD_"^"_QACHDIEN,QACICODE_"^"_QACCIEN)=$G(^TMP("QACSRPT2",$J,QACDIS,QACHD_"^"_QACHDIEN,QACICODE_"^"_QACCIEN))+1
134 . Q
135 I $D(QAC1DIV) D
136 . S ^TMP("QACSRPT0",$J,QACDIV)=$G(^TMP("QACSRPT0",$J,QACDIV))+1
137 . S ^TMP("QACSRPT0",$J,QACDIV,QACDIS)=$G(^TMP("QACSRPT0",$J,QACDIV,QACDIS))+1
138 . S ^TMP("QACSRPT1",$J,QACDIV,QACDIS,QACHD_"^"_QACHDIEN)=$G(^TMP("QACSRPT1",$J,QACDIV,QACDIS,QACHD_"^"_QACHDIEN))+1
139 . S ^TMP("QACSRPT2",$J,QACDIV,QACDIS,QACHD_"^"_QACHDIEN,QACICODE_"^"_QACCIEN)=$G(^TMP("QACSRPT2",$J,QACDIV,QACDIS,QACHD_"^"_QACHDIEN,QACICODE_"^"_QACCIEN))+1
140 . Q
141 Q
142DIR(QACTEXT,DIC,Y) ;
143 S QACFLG=0
144 S DIR(0)="YOA"
145 S DIR("A")="Would you like this report for one "_QACTEXT_"only? "
146 S DIR("B")="NO"
147 S DIR("?")="Enter 'Y' if you want only one "_QACTEXT_"."
148 D ^DIR
149 K DIR I $D(DTOUT)!($D(DUOUT)) K DTOUT,DUOUT S QACQUIT=1 Q
150 I Y=1 S QACFLG=1
151 I $G(QACFLG)=1 S DIC(0)="AEMNZQ" D ^DIC K DIC Q:+Y<1 ; S QACDSC=$P(^QA(745.5,+Y,0),U,2)
152 Q
Note: See TracBrowser for help on using the repository browser.