source: WorldVistAEHR/trunk/r/UTILIZATION_MGMT_ROLLUP_LOCAL-IBQ/IBQLR3.m@ 1375

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

initial load of WorldVistAEHR

File size: 4.2 KB
RevLine 
[613]1IBQLR3 ;LEB/MRY - PATIENT/PROVIDER REVIEW REPORT ; 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 ! S %ZIS="QM" D ^%ZIS G:POP END
21 I $D(IO("Q")) F I="IBTY","IBTYD","IBBDT","IBEDT","IBPHY(","IBTY1","IBTY2" S ZTSAVE(I)=""
22 I $D(IO("Q")) S ZTRTN="START^IBQLR3",ZTDESC="UM - PROVIDER REPORT" D ^%ZTLOAD K IO("Q"),ZTSK D HOME^%ZIS G END
23 U IO
24 ;
25START ;
26 K ^TMP("IBQLR3",$J) S IBDDT=IBBDT-.01,(IBPAG,IBQUIT,IBLVH)=0
27 F S IBDDT=$O(^IBQ(538,"ADIS",IBDDT)) Q:'IBDDT!(IBDDT>IBEDT) D
28 .S IBTRN="" F S IBTRN=$O(^IBQ(538,"ADIS",IBDDT,IBTRN)) Q:'IBTRN D DATA
29 ;
30 I $$STOP,$G(ZTSTOP) G END
31 D PRINT^IBQLR3A
32END ; -- Clean up
33 W ! K ^TMP("IBQLR3",$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
34 I $D(ZTQUEUED) S ZTREQ="@" Q
35 D ^%ZISC
36 Q
37 ;
38DATA ;
39 ; -- get Admission Review info.
40 S IBLV=0 D ADMIT^IBQL538 S IBIEN=$E(IB(.01),4,999)
41 S IBQUIT=0,IBQLR3=1,IBTRNSV=IBTRN,IBTRN=IBIEN D ORDCHK^IBQLLD2 S IBTRN=IBTRNSV K IBTRNSV
42 D PHYZ S IBRIEN=IBORDER(1) D PHYZR
43 G:'IBPHY STAY G:IBTY1="I"&('$D(IBPHY(IBPHY))) STAY
44 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)
45 S ^TMP("IBQLR3",$J,IBPHY,IB(.1),IB(.03))=IBDATA
46 S ^("LOS")=$G(^TMP("IBQLR3",$J,IBPHY,IB(.1),IB(.03),"LOS"))+1
47 I IB("ACUTE ADMISSION") S ^("S-AC")=$G(^TMP("IBQLR3",$J,IBPHY,IB(.1),IB(.03),"S-AC"))+1
48 E S ^("S-NAC")=$G(^TMP("IBQLR3",$J,IBPHY,IB(.1),IB(.03),"S-NAC"))+1
49STAY ; -- get Stay Review info.
50 S IBRN=1,IBTRV=0 F S IBRN=$O(IBORDER(IBRN)) Q:'IBRN S IBRIEN=IBORDER(IBRN) D
51 .S IBTRV=IBTRV+1 D STAY^IBQL538
52 .D PHYZR Q:'IBPHY I IBTY1="I",'$D(IBPHY(IBPHY)) Q
53 .I '$G(^TMP("IBQLR3",$J,IBPHY,IB(.1),IB(.03))) D
54 ..S IBDATA=IB(.09)_"^"_IB(.04)_"^"_IB(.05)_"^"_IB(.06)_"^"_IB(.07)_"^"_IB(.08)_"^"_"^"_"^"
55 ..S ^TMP("IBQLR3",$J,IBPHY,IB(.1),IB(.03))=IBDATA
56 .F I=1:1:3 S REA=$P(IB(13.06)," ",I) Q:'REA D
57 ..I '$G(^TMP("IBQLR3",$J,IBPHY,IB(.1),IB(.03),+REA)) S IBLV=IBLV+1
58 ..S ^(+REA)=$G(^TMP("IBQLR3",$J,IBPHY,IB(.1),IB(.03),+REA))+1
59 .S ^("LOS")=$G(^TMP("IBQLR3",$J,IBPHY,IB(.1),IB(.03),"LOS"))+1
60 .I IB("ACUTE STAY") S ^("S-AC")=$G(^TMP("IBQLR3",$J,IBPHY,IB(.1),IB(.03),"S-AC"))+1
61 .E S ^("S-NAC")=$G(^TMP("IBQLR3",$J,IBPHY,IB(.1),IB(.03),"S-NAC"))+1
62 .I IBLV>IBLVH S IBLVH=IBLV
63 Q
64 ;
65PHYZ ; -- organize requested providers in array IBPHYZ
66 S DGPM=$P(^IBT(356,IBIEN,0),"^",5)
67 S IBPHYN=0 K IBPHYZ
68 F S IBPHYN=$O(^IBT(356.94,"C",DGPM,IBPHYN)) Q:'IBPHYN S IBPHYD=$G(^IBT(356.94,IBPHYN,0)) D
69 .I 'IBPHYD!('$P(IBPHYD,"^"))!('$P(IBPHYD,"^",3))!('$P(IBPHYD,"^",4)) Q
70 .S IBPHYZ($P(IBPHYD,"^",4),$P(IBPHYD,"^"))=$P(IBPHYD,"^",3)
71 I IBTY2=1 D
72 .S IB1=$O(IBPHYZ(1,"")) Q:'IB1 S IB3=$O(IBPHYZ(3,"")) Q:'IB3
73 .I IB1'=IB3 Q
74 .S X1=IB1,X2=1 D C^%DTC S IBPHYZ(1,X)=IBPHYZ(1,IB1) K IBPHYZ(1,IB1)
75 I IBTY2=3 D
76 .S IB1=$O(IBPHYZ(1,"")) Q:'IB1 S IB3=$O(IBPHYZ(3,"")) Q:'IB3
77 .I IB3=IB1 D
78 ..S X1=IB3,X2=1 D C^%DTC S IBPHYZ(3,X)=""
79 .I IB1'=IB3 S IBPHYZ(3,IB1)=""
80 K IBPHYN,IBPHYD,X,IB1,IB3 Q
81 ;
82PHYZR ; -- return requested provider.
83 S VAINDT=$$VNDT^IBTRV(IBRIEN),VAINDT=$P(VAINDT,".")
84 S (IBPHY,IBPHYDT)=""
85 F S IBPHYDT=$O(IBPHYZ(IBTY2,IBPHYDT)) Q:'IBPHYDT D
86 .I IBPHYDT>VAINDT Q
87 .S IBPHY=$P(IBPHYZ(IBTY2,IBPHYDT),"^")
88 Q
89 ;
90STOP() ; determine if user has requested the queued report to stop
91 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ I +$G(IBPAG) W !,"***TASK STOPPED BY USER***"
92 Q +$G(ZTSTOP)
Note: See TracBrowser for help on using the repository browser.