source: WorldVistAEHR/trunk/r/AUTOMATED_INFO_COLLECTION_SYS-IBD/IBDFCNOF.m@ 1801

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

initial load of WorldVistAEHR

File size: 4.3 KB
RevLine 
[613]1IBDFCNOF ;ALB/CJM - AICS clinics with no forms ; JUL 20,1993
2 ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
3 ;
4% ; -- list of clinics that have no encounter forms in use.
5 ;
6 N C,X,Y,SERV,SERVICE,CLINIC,IBHDT,IBDFIFN,IBDCNO,IBDFCNO,IBDFNODE,PAGE,IBQUIT,DIVIS,DIVNAM,VAUTD,MULTI
7 W !!,"AICS List of Clinics with No Encounter Form in Use",!!
8 S IBQUIT=0
9 D DIVIS G:IBQUIT EXIT
10 D DEVICE G:IBQUIT EXIT
11 D DQ
12 Q
13 ;
14EXIT ; -- end of report
15 K ^TMP($J,"IBDCN")
16 I $D(ZTQUEUED) S ZTREQ="@" Q
17 D ^%ZISC
18 K ZTSK,ZTDESC,ZTSAVE,ZTRTN
19 Q
20 ;
21DQ ; -- entry point from taskmanager
22 K ^TMP($J,"IBDCN")
23 S IBQUIT=0,PAGE=1
24 S IBHDT=$$HTE^XLFDT($H,1)
25 D SET,LIST G EXIT
26 Q
27 ;
28SET ; -- build list into temporary array
29 N IBDFCL,DIVIS,DIVNAM,SERVICE,CLINNAM,IBDFNODE,IBQUIT
30 F IBDFIFN=0:0 S IBDFIFN=$O(^SC(IBDFIFN)) Q:'IBDFIFN S IBDCNO=$G(^SC(IBDFIFN,0)) I $P(IBDCNO,"^",3)="C" D
31 .S DIVIS=+$P(IBDCNO,"^",15) I DIVIS=0 S DIVIS=$S(MULTI=0:$P($G(^DG(43,1,"GL")),"^",3),1:"Unknown")
32 .S DIVNAM=$P($G(^DG(40.8,+DIVIS,0)),"^") S:DIVNAM="" DIVNAM="Unknown"
33 .S CLINNAM=$P(IBDCNO,"^")
34 .S Y=$P(IBDCNO,"^",8),C=$P(^DD(44,9,0),"^",2) D Y^DIQ S SERVICE=Y S:SERVICE="" SERVICE="Unknown"
35 .I $O(^SD(409.95,"B",IBDFIFN,0)) D ; else follows
36 ..S IBDFCL=$O(^SD(409.95,"B",IBDFIFN,0))
37 ..S IBDFNODE=^SD(409.95,IBDFCL,0)
38 ..S IBQUIT=0 F X=2:1:9 S:$P(IBDFNODE,"^",X)&("^1^2^3^4^5^6^8^9^"[X) IBQUIT=1 Q:IBQUIT
39 ..I 'IBQUIT S ^TMP($J,"IBDCN",DIVIS,DIVNAM,SERVICE,CLINNAM)=IBDFIFN_"^"_$S($P(IBDFNODE,"^",7)]"":"FORM IN PROGRESS",1:"") S ^TMP($J,"IBDCN",DIVIS,0)=$G(^TMP($J,"IBDCN",DIVIS,0))+1
40 .I '$O(^SD(409.95,"B",IBDFIFN,0)) S ^TMP($J,"IBDCN",DIVIS,DIVNAM,SERVICE,CLINNAM)=IBDFIFN,^TMP($J,"IBDCN",DIVIS,0)=$G(^TMP($J,"IBDCN",DIVIS,0))+1
41 Q
42 ;
43HEADER ; -- writes the report header
44 I $E(IOST,1,2)="C-",$Y>1,PAGE>1 D PAUSE Q:IBQUIT
45 I PAGE>1 W @IOF
46 W !,"List of Clinics Without Encounter Forms",?IOM-32,IBHDT," PAGE ",PAGE
47 W !,"For Division: ",DIVNAM
48 ;W !,"CLINICS",?27,"SERVICE",?47,"DIVISION"
49 W !,"CLINICS",?27,"SERVICE",?47,"COMMENT"
50 W !,$TR($J(" ",IOM)," ","-")
51 S PAGE=PAGE+1
52 Q
53 ;
54PAUSE ; -- hold crt screen
55 N DIR,X,Y
56 F Q:$Y>(IOSL-2) W !
57 S DIR(0)="E" D ^DIR S IBQUIT=$S(+Y:0,1:1)
58 Q
59 ;
60LIST ; -- lists the clinics using FORM
61 N CLINIC,COUNT,DIR,NEWDIV,NAME,OLDDIV
62 W:$E(IOST,1,2)="C-" @IOF
63 I $D(^TMP($J,"IBDCN"))=0 W ?15,"No active clinics found without an assigned encounter form"
64 S (NEWDIV,COUNT)=0,OLDDIV=""
65 S DIVIS="" F S DIVIS=$O(^TMP($J,"IBDCN",DIVIS)) Q:DIVIS=""!(IBQUIT) D
66 .I 'VAUTD,'$D(VAUTD(DIVIS)) Q
67 .I 'VAUTD,'$D(^TMP($J,"IBDCN",DIVIS)) S DIVNAM=$P($G(^DG(40.8,+DIVIS,0)),"^") D HEADER W !,"No clinics found for division '",DIVNAM,"'",! Q
68 .S DIVNAM=$O(^TMP($J,"IBDCN",DIVIS,0)) Q:DIVNAM=""
69 .S NEWDIV=1
70 .S SERV="" F S SERV=$O(^TMP($J,"IBDCN",DIVIS,DIVNAM,SERV)) Q:SERV=""!(IBQUIT) D
71 ..S NAME="" F S NAME=$O(^TMP($J,"IBDCN",DIVIS,DIVNAM,SERV,NAME)) Q:NAME=""!(IBQUIT) S CLINIC=+^(NAME) D ONELINE
72 I 'IBQUIT W:OLDDIV'="" !,"----------------",!,"Division Count = ",COUNT
73 Q
74 ;
75ONELINE ; -- print line of report
76 I $G(NEWDIV) D NEWDIV Q:IBQUIT
77 I $Y>(IOSL-3) D HEADER Q:IBQUIT
78 ;W !,$E(NAME,1,25),?27,$E(SERV,1,18),?47,$E(DIVNAM,1,15)
79 W !,$E(NAME,1,25),?27,$E(SERV,1,18)
80 W ?47,$P(^TMP($J,"IBDCN",DIVIS,DIVNAM,SERV,NAME),"^",2)," "
81 I '$$ACLN(CLINIC) W ?4,"(Clinic Currently Inactive)"
82 S COUNT=COUNT+1
83 Q
84 ;
85NEWDIV ; -- print division totals and start new division
86 I 'IBQUIT W:OLDDIV'="" !,"----------------",!,"Division Count = ",COUNT
87 S OLDDIV=DIVIS
88 D HEADER Q:IBQUIT
89 W !?10,"Division: ",DIVNAM,! S NEWDIV=0,COUNT=0
90 Q
91 ;
92DEVICE ; -- select device
93 I $D(ZTQUEUED) Q
94 S %ZIS="MQ" D ^%ZIS I POP S IBQUIT=1 Q
95 I $D(IO("Q")) S ZTRTN="DQ^IBDFCNOF",ZTDESC="IBD - Clinics with No Forms",ZTSAVE("VA*")="",ZTSAVE("MULTI")="" D ^%ZTLOAD W !,$S($D(ZTSK):"Request Queued Task="_ZTSK,1:"Request Canceled") D HOME^%ZIS S IBQUIT=1 Q
96 U IO
97 Q
98 ;
99DIVIS ; -- Select division
100 N X,Y S VAUTD=1,MULTI=0
101 I $P($G(^DG(43,1,"GL")),"^",2) S MULTI=1 D DIVISION^VAUTOMA S:Y=-1 IBQUIT=1
102 I 'VAUTD S X="" F S X=$O(VAUTD(X)) Q:'X S ^TMP($J,"IBDCN",X)=""
103 Q
104 ;
105ACLN(SC) ; function
106 ; -- is clinic currently active
107 ; Input SC := pointer to 44
108 ; Output := 1 if currently active
109 ; 0 if currently inactive
110 ;
111 N FLAG,SDIN,SDRE S FLAG=1
112 I $D(^SC(SC,"I")) S Y=^("I"),SDIN=+Y,SDRE=+$P(Y,U,2)
113 I $G(SDIN),SDIN'>DT,SDRE,SDRE>DT S FLAG=0
114 I $G(SDIN),SDIN'>DT,'SDRE S FLAG=0
115ACLNQ Q FLAG
Note: See TracBrowser for help on using the repository browser.