source: FOIAVistA/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPRPCER.m@ 1783

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

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1RMPRPCER ;HIN/RVD-PRINT PCE DATA ;7/3/01
2 ;;3.0;PROSTHETICS;**62**;Feb 09, 1996
3 ;RVD 7/3/01 patch #62 - PCE data print
4 ;
5 D DIV4^RMPRSIT I $D(Y),(Y<0) Q
6 ; Prompt for Start Date
7STDT ;RMPRSDT is start date in FM internal form.
8 K %DT,X,Y
9 S %DT("A")="Starting Date: "
10 S %DT(0)=-DT
11 S %DT="AEP"
12 D ^%DT I Y<0 G EXIT1
13 S RMPRSDT=$P(Y,".",1)
14 S %DT("A")="Ending Date: ",%DT="AEX" D ^%DT G:Y<0 EXIT1
15 S RMPREDT=$P(Y,".",1)
16 I RMPRSDT>RMPREDT W !,$C(7),"Invalid Date Range Selection!!" G STDT
17 ;
18CONT G:'$D(RMPRSDT) EXIT1 S %ZIS="MQ" K IOP D ^%ZIS G:POP EXIT1 I '$D(IO("Q")) U IO G PRINT
19 K IO("Q") S ZTDESC="PROSTHETIC PCE DATA",ZTRTN="PRINT^RMPRPCER",ZTIO=ION,ZTSAVE("RMPRSDT")=""
20 S ZTSAVE("RMPR(""STA"")")="",ZTSAVE("RMPR(")="",ZTSAVE("RMPREDT")=""
21 D ^%ZTLOAD W:$D(ZTSK) !,"REQUEST QUEUED!" H 1 G EXIT
22 ;
23PRINT I $E(IOST)["C" W !!,"Processing report......."
24 K ^TMP($J)
25 K %DT,X,Y
26 S X="NOW" D ^%DT S RMRDAT=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3)
27 S RMPAGE=1,(RMTOBAL,RMPREND)=0,RS=RMPR("STA")
28 S RDT=RMPRSDT-1,RET=RMPREDT+1,RS=RMPR("STA")
29 S Y=RMPRSDT D DD^%DT S RMSDAT=Y
30 S Y=RMPREDT D DD^%DT S RMEDAT=Y
31 D BUILD
32 I '$D(^TMP($J)) D HEAD,NONE G EXIT
33 D HEAD,HEAD1
34 D WRITE
35 G EXIT
36 ;
37BUILD ;build a tmp global.
38 F RI=RDT:0:RET S RI=$O(^RMPR(660,"B",RI)) Q:(RI'>0)!(RMPREND)!(RI>RMPREDT) F RJ=0:0 S RJ=$O(^RMPR(660,"B",RI,RJ)) Q:(RJ'>0) D
39 .S RM0=$G(^RMPR(660,RJ,0))
40 .S RM10=$G(^RMPR(660,RJ,10))
41 .Q:$P(RM10,U,12)'>0
42 .I $P(RM0,U,10)=RS D
43 ..S RMDFN=$P(RM0,U,2)
44 ..S RMITIEN=$P(RM0,U,6)
45 ..S (RMITEM,RMPAT)=""
46 ..I RMITIEN,($D(^RMPR(661,RMITIEN,0))),($D(^PRC(441,$P(^RMPR(661,RMITIEN,0),U,1),0))) D
47 ...S RMITEM=$P(^PRC(441,$P(^RMPR(661,RMITIEN,0),U,1),0),U,2)
48 ..S RMITEM=$E(RMITEM,1,8)
49 ..I $D(^DPT(RMDFN,0)) S RMPAT=$E($P(^DPT(RMDFN,0),U,1),U,10)
50 ..S RMSUSP=$P(RM10,U,1)
51 ..S RMRXDT=$P(RM10,U,2)
52 ..S RMIADT=$P(RM10,U,3)
53 ..S RCDT=$P(RM10,U,4)
54 ..S RMTYRE=$P(RM10,U,5)
55 ..S RMSURE=$P(RM10,U,6)
56 ..S RMPRDI=$P(RM10,U,7)
57 ..S RMICD9=$P(RM10,U,8)
58 ..S RMCOSU=$P(RM10,U,9)
59 ..S RMSUST=$P(RM10,U,11)
60 ..S RMPCEP=$P(RM10,U,12)
61 ..S RPDT=$P(RM10,U,13)
62 ..I RMICD9,($D(^ICD9(RMICD9,0))) S RMICD=$P(^ICD9(RMICD9,0),U,1)
63 ..E S RMICD=""
64 ..S:RMTYRE'="" RMTYRE=$E(RMTYRE,1,8)
65 ..I RMSURE,($D(^VA(200,RMSURE,0))) S RMSURE=$E($P(^VA(200,RMSURE,0),U,1),1,9)
66 ..S RDDT=$E(RI,4,5)_"/"_$E(RI,6,7)_"/"_$E(RI,2,3)
67 ..S:RPDT'="" RPDT=$E(RPDT,4,5)_"/"_$E(RPDT,6,7)_"/"_$E(RPDT,2,3)
68 ..S:RCDT'="" RCDT=$E(RCDT,4,5)_"/"_$E(RCDT,6,7)_"/"_$E(RCDT,2,3)
69 ..S ^TMP($J,RI,RMPAT)=RMITEM_"^"_RDDT_"^"_RMTYRE_"^"_RMSURE_"^"_RMICD_"^"_RPDT_"^"_$E(RMPRDI,1,9)
70 Q
71 ;
72WRITE ;write report to a selected device
73 S RI=0
74 F S RI=$O(^TMP($J,RI)) Q:RI'>0!$G(RMPREND) S RJ="" F S RJ=$O(^TMP($J,RI,RJ)) Q:RJ=""!$G(RMPREND) D
75 .S RMDAT=$G(^TMP($J,RI,RJ))
76 .S RMPAT=RJ
77 .S RMITEM=$P(RMDAT,U,1)
78 .S RDDT=$P(RMDAT,U,2)
79 .S RMTYRE=$P(RMDAT,U,3)
80 .S RMSURE=$P(RMDAT,U,4)
81 .S RMICD=$P(RMDAT,U,5)
82 .S RPDT=$P(RMDAT,U,6)
83 .S RMPRDI=$E($P(RMDAT,U,7),1,12)
84 .W !,RDDT,?10,RMPAT,?21,RMITEM,?30,RMTYRE,?40,RMSURE,?51,RMICD,?58,RPDT,?68,RMPRDI
85 .S RMPRFLG=1
86 .I $E(IOST)["C"&($Y>(IOSL-7)) S DIR(0)="E" D ^DIR S:$D(DTOUT)!(Y=0) RMPREND=1 Q:RMPREND W @IOF D HEAD,HEAD1 Q
87 .I $Y>(IOSL-6) W @IOF D HEAD,HEAD1 K RMPRFLG Q
88 W !,RMPR("L")
89 W !,"<End of Report>"
90 Q
91 ;
92HEAD W !,"*** PROSTHETICS PCE DATA *** Run Date: ",RMRDAT,?70,"PAGE: ",RMPAGE
93 W !,"Start Date: ",RMSDAT,?26,"End Date: ",RMEDAT,?51,"station: ",$E($P($G(^DIC(4,RS,0)),U,1),1,19)
94 S RMPAGE=RMPAGE+1
95 Q
96 ;
97HEAD1 I $E(IOST)["C"&($Y>(IOSL-7)) S DIR(0)="E" D ^DIR S:$D(DTOUT)!(Y=0) RMPREND=1 Q:RMPREND W @IOF D HEAD
98 I $E(IOST)'["C"&($Y>(IOSL-6)) W @IOF D HEAD
99 W !,RMPR("L")
100 W !?30,"TYPE OF",?42,"CPRS",?60,"PCE"
101 W !,"DATE",?10,"PATIENT",?21,"ITEM",?30,"REQUEST",?40,"REQUESTOR",?51,"ICD9",?60,"DATE",?68,"DIAGNOSIS"
102 W !,"----",?10,"-------",?21,"----",?30,"-------",?40,"---------",?51,"----",?58,"--------",?68,"---------"
103 S RMPRFLG=1
104 Q
105 ;
106EXIT I $E(IOST)["C",'RMPREND K DIR S DIR(0)="E" D ^DIR
107EXIT1 D ^%ZISC
108 K ^TMP($J)
109 N RMPR,RMPRSITE D KILL^XUSCLEAN
110 Q
111NONE W !!,"NO DATA TO PRINT !!!!!"
112 Q
Note: See TracBrowser for help on using the repository browser.