source: WorldVistAEHR/trunk/r/PATIENT_REPRESENTATIVE-QAC/QACBYLOC.m@ 1147

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

initial load of WorldVistAEHR

File size: 3.9 KB
Line 
1QACBYLOC ;WCIOFO/ERC - Report by Location ;03/23/99
2 ;;2.0;Patient Representative;**9**;07/25/1995
3 ;
4 N QACDV,QACDIV,QAC1DIV,QACDVFLG
5 S QACRTN="QACBYLOC"
6 D DATDIV^QACUTL0 G:QAQPOP EXIT
7 I QACDV=0!(QACDV']"") S QACDVFLG=1
8 ;if just for 1 division, get name of division
9 I +$G(QAC1DIV) D INST^QACUTL0(QAC1DIV,.QACDVNAM)
10 ;
11 S QACDESC="Issue Totals by Location"
12 K %ZIS,IOP S %ZIS="MQ" W ! D ^%ZIS I POP D EXIT Q
13 I $D(IO("Q")) D Q
14 . S ZTDESC=QACDESC
15 . S ZTRTN="START^QACBYLOC"
16 . S ZTSAVE("QAQRANG")=""
17 . S ZTSAVE("QACRTN")=""
18 . D TASK^QACUTL0
19 ;
20START ;
21 D SETUP^QACEMPE
22 S QACROU="SET^QACBYLOC"
23 ;loop through "D" crossreference (date range)
24 D LOOP1^QACSPRD(QACROU,QAQNBEG,QAQNEND,.QACD0)
25 D REPORT
26 D EXIT
27 Q
28SET ;set array variables for each ROC in date range
29 K QACDATA,QACDIV,QACIC,QACISS,QACLOC
30 D ISSLOOP
31 I '$D(QACIC) Q
32 D GETS^DIQ(745.1,QACD0,"14;37","NIE","QACDATA")
33 S QACD0X=QACD0_","
34 ;if not integrated, division set to 0 for sorting purposes in ^TMP
35 S QACDIV=$S('$G(QACDVFLG):$G(QACDATA(745.1,QACD0X,37,"E"),"Unknown"),1:0)
36 S QACLOC=$G(QACDATA(745.1,QACD0X,14,"E"),"Unknown")
37 D SETMP
38 Q
39ISSLOOP ;loop through issue codes for the ROC
40 S QACEE=0
41 F S QACEE=$O(^QA(745.1,QACD0,3,QACEE)) Q:QACEE'>0 D
42 . S QACIC(QACEE)=^QA(745.1,QACD0,3,QACEE,0)
43 Q
44SETMP ;set ^TMP global for report
45 S QACEE=""
46 F S QACEE=$O(QACIC(QACEE)) Q:QACEE']"" D
47 . S QACISS=QACIC(QACEE)
48 . D GETS^DIQ(745.2,QACISS,".01;2","E","QACICEXT")
49 . S QACISSX=QACISS_","
50 . S QACISSC=$G(QACICEXT(745.2,QACISSX,.01,"E"))
51 . I $G(QACISSC)']"" Q
52 . S QACICHDR=$E($G(QACICEXT(745.2,QACISSX,.01,"E")),1,2)
53 . S QACNAME=$G(QACICEXT(745.2,QACISSX,2,"E"))
54 . S ^TMP(QACRTN,$J,"ROC",QACDIV,QACLOC,QACICHDR,QACISS)=$G(^TMP(QACRTN,$J,"ROC",QACDIV,QACLOC,QACICHDR,QACISS))+1
55 . S ^TMP(QACRTN,$J,"COUNT","TOT")=$G(^TMP(QACRTN,$J,"COUNT","TOT"))+1
56 . S ^TMP(QACRTN,$J,"COUNT",QACDIV)=$G(^TMP(QACRTN,$J,"COUNT",QACDIV))+1
57 . S ^TMP(QACRTN,$J,"COUNT",QACDIV,QACLOC)=$G(^TMP(QACRTN,$J,"COUNT",QACDIV,QACLOC))+1
58 . S QACICHDR=$E($G(QACICEXT(745.2,QACISSX,.01,"E")),1,2)
59 . S QACNAME=$G(QACICEXT(745.2,QACISSX,2,"E"))
60 . S ^TMP(QACRTN,$J,"ISS",QACISS)=QACISSC_" "_QACNAME
61 . S ^TMP(QACRTN,$J,"COUNT",QACDIV,QACLOC,QACICHDR)=$G(^TMP(QACRTN,$J,"COUNT",QACDIV,QACLOC,QACICHDR))+1
62 Q
63REPORT ;
64 U IO
65 S QACAA=""
66 F S QACAA=$O(^TMP(QACRTN,$J,"ROC",QACAA)) Q:QACAA']"" D Q:QACQUIT
67 . S QACBB=""
68 . F S QACBB=$O(^TMP(QACRTN,$J,"ROC",QACAA,QACBB)) Q:QACBB']"" D Q:QACQUIT
69 . . D HEADER Q:QACQUIT
70 . . ;if not integrated this next line will not print
71 . . I $G(QACAA)'=0 W !?15,"Total Issues for Division: "_QACAA_" "_^TMP(QACRTN,$J,"COUNT",QACAA)
72 . . W !?10,"Total Issues for Location: "_QACBB_" "_^TMP(QACRTN,$J,"COUNT",QACAA,QACBB)
73 . . S QACCC=""
74 . . F S QACCC=$O(^TMP(QACRTN,$J,"ROC",QACAA,QACBB,QACCC)) Q:QACCC']"" D Q:QACQUIT
75 . . . I $Y>(IOSL-6) D HEADER Q:QACQUIT
76 . . . W !?5,QACCC_" "_$P(^QA(745.2,$O(^QA(745.2,"B",QACCC,0)),0),U,3)
77 . . . W ?72,^TMP(QACRTN,$J,"COUNT",QACAA,QACBB,QACCC)
78 . . . S QACDD=0
79 . . . F S QACDD=$O(^TMP(QACRTN,$J,"ROC",QACAA,QACBB,QACCC,QACDD)) Q:QACDD'>0 D Q:QACQUIT
80 . . . . I $Y>(IOSL-6) D HEADER Q:QACQUIT
81 . . . . W !,^TMP(QACRTN,$J,"ISS",QACDD),?72,^TMP(QACRTN,$J,"ROC",QACAA,QACBB,QACCC,QACDD)
82 I '$D(^TMP(QACRTN,$J,"ROC")) D
83 . D HEADER
84 . W !!!?25,"No data to report."
85 Q
86HEADER ;
87 S QACPAGE=$G(QACPAGE)+1
88 I QACPAGE>1 D Q:QACQUIT
89 . W $C(7)
90 . I $E(IOST)="C" K DIR S DIR(0)="E" D ^DIR S QACQUIT=$S(Y'>0:1,1:0)
91 W:$E(IOST)="C"!(QACPAGE>1) @IOF
92 W !,QACDESC,?48,QACTODAY,?70,"PAGE ",QACPAGE
93 W !?(80-$L(QACHDR2))/2,QACHDR2
94 W !,"Issue Code",?25,"Issue Code Name",?70,"Total"
95 W !,QACUNDL,!
96 Q
97EXIT ;
98 W ! D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
99 D K^QAQDATE
100 K ^TMP(QACRTN,$J)
101 K DIQ,DIR,IOSL,POP
102 K QAC1DIV,QACAA,QACBB,QACCC,QACD0,QACD0X,QACDATA,QACDESC,QACDD,QACDIV
103 K QACDV,QACDVNAM,QACDVFLG,QACHDR2,QACIC,QACICEXT,QACICHDR
104 K QACEE,QACISS,QACISSC,QACISSX,QACLOC,QACNAME
105 K QACPAGE,QACQUIT,QACROU,QACRTN,QACTIME,QACTODAY,QACUNDL
106 K QAQNBEG,QAQNEND,QAQPOP,QAQRANG
107 K X,Y,ZTDESC,ZTRTN,ZTSAVE
108 Q
Note: See TracBrowser for help on using the repository browser.