source: WorldVistAEHR/trunk/r/UTILIZATION_MGMT_ROLLUP_LOCAL-IBQ/IBQLD3.m@ 846

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

initial load of WorldVistAEHR

File size: 4.2 KB
RevLine 
[613]1IBQLD3 ;LEB/MRY - PATIENT/PROVIDER REVIEW DOWNLOAD ; 1-SEP-95
2 ;;1.0;UTILIZATION MGMT ROLLUP LOCAL;;Oct 01, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 I '$D(DT) D DT^DICRW
6DATE W ! D DATE^IBOUTL
7 I IBBDT=""!(IBEDT="") G END
8 S X1=IBEDT,X2=IBBDT D ^%DTC I X>365 W !,"<<< please report 1 years of information only. >>>" G DATE
9PHY S DIR(0)="SA^A:Admitting Provider;T:Attending Provider;R:Resident Provider",DIR("A")="Provider Type? [A/T/R]: "
10 W ! D ^DIR G:$D(DUOUT)!($D(DTOUT)) END K DIR
11 S IBTY=Y,IBTYD=Y(0)
12 S IBTY2=$S(IBTY="T":1,IBTY="R":2,IBTY="A":3)
13 S DIR(0)="SA^A:All "_IBTYD_";I:Individual "_IBTYD,DIR("A")="Display ALL or INDIVIDUAL "_IBTYD_"? [A/I]: "
14 D ^DIR G:$D(DUOUT)!($D(DTOUT)) END K DIR
15 S IBTY1=Y G:IBTY1="A" DEV
16PHYI S DIR(0)="PO^200:AEQZ",DIR("A")="Enter "_IBTYD
17 D ^DIR G:$D(DUOUT)!($D(DTOUT)) END K DIR I X="" G:$O(IBPHY(""))="" PHYI G DEV
18 S IBPHY(+Y)="" G PHYI
19DEV ; -- select device, run option
20 W !!,"Set your Device settings to '0;255;9999'"
21 W ! D ^%ZIS G:POP END
22 S DIR(0)="FO",DIR("A")="Initiate File Capture Procedure and Press Return" D ^DIR I $D(DTOUT) G END
23 W !,"Working...",!
24 U IO
25 ;
26START ;
27 K ^TMP("IBQLD3",$J) S IBDDT=IBBDT-.01,(IBPAG,IBQUIT,IBLVH)=0
28 F S IBDDT=$O(^IBQ(538,"ADIS",IBDDT)) Q:'IBDDT!(IBDDT>IBEDT) D
29 .S IBTRN="" F S IBTRN=$O(^IBQ(538,"ADIS",IBDDT,IBTRN)) Q:'IBTRN D DATA
30 ;
31 I $$STOP,$G(ZTSTOP) G END
32 D PRINT^IBQLD3A
33END ; -- Clean up
34 W ! K ^TMP("IBQLD3",$J),IB,IBDDT,IBBDT,IBEDT,IBTRN,IBTRND,IBTY,IBTY1,IBPHY,IBTEXT,IBDATA,IBHDR,IBQUIT,IBPAG,IBREA,IBLV,IBLVH,I,N,X,IBIEN,IBQLR3,IBORDER,DGPM,IBPHYN,IBPHYZ,IBPHYD
35 I $D(ZTQUEUED) S ZTREQ="@" Q
36 D ^%ZISC
37 Q
38 ;
39DATA ;
40 ; -- get Admission Review info.
41 S IBLV=0 D ADMIT^IBQL538 S IBIEN=$E(IB(.01),4,999)
42 S IBQUIT=0,IBQLR3=1,IBTRNSV=IBTRN,IBTRN=IBIEN D ORDCHK^IBQLLD2 S IBTRN=IBTRNSV K IBTRNSV
43 D PHYZ S IBRIEN=IBORDER(1) D PHYZR
44 G:'IBPHY STAY G:IBTY1="I"&('$D(IBPHY(IBPHY))) STAY
45 S IBDATA=IB(.09)_"^"_IB(.04)_"^"_IB(.05)_"^"_IB(.06)_"^"_IB(.07)_"^"_IB(.08)_"^"_IB("ACUTE ADMISSION")_"^"_$S('IB("ACUTE ADMISSION"):1,1:"")_"^"_IB(1.03)
46 S ^TMP("IBQLD3",$J,IBPHY,IB(.1),IB(.03))=IBDATA
47 S ^("LOS")=$G(^TMP("IBQLD3",$J,IBPHY,IB(.1),IB(.03),"LOS"))+1
48 I IB("ACUTE ADMISSION") S ^("S-AC")=$G(^TMP("IBQLD3",$J,IBPHY,IB(.1),IB(.03),"S-AC"))+1
49 E S ^("S-NAC")=$G(^TMP("IBQLD3",$J,IBPHY,IB(.1),IB(.03),"S-NAC"))+1
50STAY ; -- get Stay Review info.
51 S IBRN=1,IBTRV=0 F S IBRN=$O(IBORDER(IBRN)) Q:'IBRN S IBRIEN=IBORDER(IBRN) D
52 .S IBTRV=IBTRV+1 D STAY^IBQL538
53 .D PHYZR Q:'IBPHY I IBTY1="I",'$D(IBPHY(IBPHY)) Q
54 .I '$G(^TMP("IBQLD3",$J,IBPHY,IB(.1),IB(.03))) D
55 ..S IBDATA=IB(.09)_"^"_IB(.04)_"^"_IB(.05)_"^"_IB(.06)_"^"_IB(.07)_"^"_IB(.08)_"^"_"^"_"^"
56 ..S ^TMP("IBQLD3",$J,IBPHY,IB(.1),IB(.03))=IBDATA
57 .F I=1:1:3 S REA=$P(IB(13.06)," ",I) Q:'REA D
58 ..I '$G(^TMP("IBQLD3",$J,IBPHY,IB(.1),IB(.03),+REA)) S IBLV=IBLV+1
59 ..S ^(+REA)=$G(^TMP("IBQLD3",$J,IBPHY,IB(.1),IB(.03),+REA))+1
60 .S ^("LOS")=$G(^TMP("IBQLD3",$J,IBPHY,IB(.1),IB(.03),"LOS"))+1
61 .I IB("ACUTE STAY") S ^("S-AC")=$G(^TMP("IBQLD3",$J,IBPHY,IB(.1),IB(.03),"S-AC"))+1
62 .E S ^("S-NAC")=$G(^TMP("IBQLD3",$J,IBPHY,IB(.1),IB(.03),"S-NAC"))+1
63 .I IBLV>IBLVH S IBLVH=IBLV
64 Q
65 ;
66PHYZ ; -- organize requested providers in array IBPHYZ
67 S DGPM=$P(^IBT(356,IBIEN,0),"^",5)
68 S IBPHYN=0 K IBPHYZ
69 F S IBPHYN=$O(^IBT(356.94,"C",DGPM,IBPHYN)) Q:'IBPHYN S IBPHYD=^IBT(356.94,IBPHYN,0) D
70 .I 'IBPHYD!('$P(IBPHYD,"^"))!('$P(IBPHYD,"^",3))!('$P(IBPHYD,"^",4)) Q
71 .S IBPHYZ($P(IBPHYD,"^",4),$P(IBPHYD,"^"))=$P(IBPHYD,"^",3)
72 I IBTY2=1 D
73 .S IB1=$O(IBPHYZ(1,"")) Q:'IB1 S IB3=$O(IBPHYZ(3,"")) Q:'IB3
74 .I IB1'=IB3 Q
75 .S X1=IB1,X2=1 D C^%DTC S IBPHYZ(1,X)=IBPHYZ(1,IB1) K IBPHYZ(1,IB1)
76 I IBTY2=3 D
77 .S IB1=$O(IBPHYZ(1,"")) Q:'IB1 S IB3=$O(IBPHYZ(3,"")) Q:'IB3
78 .I IB3=IB1 D
79 ..S X1=IB3,X2=1 D C^%DTC S IBPHYZ(3,X)=""
80 .I IB1'=IB3 S IBPHYZ(3,IB1)=""
81 K IBPHYN,IBPHYD Q
82 ;
83PHYZR ; -- return requested provider.
84 S VAINDT=$$VNDT^IBTRV(IBRIEN),VAINDT=$P(VAINDT,".")
85 S (IBPHY,IBPHYDT)=""
86 F S IBPHYDT=$O(IBPHYZ(IBTY2,IBPHYDT)) Q:'IBPHYDT D
87 .I IBPHYDT>VAINDT Q
88 .S IBPHY=IBPHYZ(IBTY2,IBPHYDT)
89 Q
90 ;
91STOP() ; determine if user has requested the queued report to stop
92 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ I +$G(IBPAG) W !,"***TASK STOPPED BY USER***"
93 Q +$G(ZTSTOP)
Note: See TracBrowser for help on using the repository browser.