source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRRP2.m@ 1800

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

initial load of WorldVistAEHR

File size: 6.6 KB
Line 
1LRRP2 ;DALOI/RWF-INTERIM REPORT ;8/11/97
2 ;;5.2;LAB SERVICE;**106,121,221,283,300**;Sep 27, 1994
3 ;from option LRRP2
4BEGIN D INIT K DIC S LRPRTPG=0 D ^LRDPA D:LRDFN>0 START G:LRDFN<0 END G BEGIN
5END D ^LRRK
6 Q
7CUM ;ENTRY POINT FOR CUMULATIVE OPTIONS- LRAC PT,LRAC 1 PAGE, LRAC MANUAL
8 S LRPRTPG=1
9SUM ;ENTRY POINT FROM SUM^LRACM2- PRINT A FULL PATIENT SUMMARY
10 D INIT K DIC D ^LRDPA D:LRDFN>0 START G:LRDFN<0 END
11 Q
12START I $O(^LR(LRDFN,0))="" W !,"NO LAB DATA ON THIS PATIENT!",$C(7) Q
13 S LRLAB=$S($D(LRLABKY):1,1:0)
14 I $D(LRCUM) S LRIDT=0,LREDT=9999999
15 E D
16 . S LREDT="T-7" D ^LRWU3 Q:LREND
17 . S LRIDT=9999999-LRSDT,LREDT=9999999-LREDT
18 I LREND Q
19 ;
20ASKPG I '$G(LRPRTPG) D
21 . S DIR(0)="Y",DIR("A")="Print address page",DIR("B")="NO",LRPRTPG=0
22 . D ^DIR K DIR
23 . I Y S LRPRTPG=1
24 S %ZIS="Q",ZTSAVE("DFN")="",ZTSAVE("LR*")="",ZTRTN="SDQ^LRRP2"
25 D IO^LRWU
26 Q
27 ;
28 ;
29SDQ ; dequeued
30 S:$D(ZTQUEUED) ZTREQ="@" U IO D PT^LRX
31 F S LRCNIDT=+$O(^LR(LRDFN,"CH",LRIDT)),LRMNIDT=+$O(^LR(LRDFN,"MI",LRIDT)) Q:'LRCNIDT&'LRMNIDT D SWITCH Q:LREND!LRSTOP!(LRIDT>LREDT)
32 D FOOT^LRRP1
33 D:$G(LRPRTPG) PLSPG
34 Q
35 ;
36SWITCH I LRCNIDT=LRMNIDT S LRIDT=LRCNIDT Q:LRIDT>LREDT D CH,MI Q
37 I 'LRMNIDT S LRIDT=LRCNIDT Q:LRIDT>LREDT D CH Q
38 I 'LRCNIDT S LRIDT=LRMNIDT Q:LRIDT>LREDT D MI Q
39 I LRCNIDT<LRMNIDT S LRIDT=LRCNIDT Q:LRIDT>LREDT D CH Q
40 S LRIDT=LRMNIDT Q:LRIDT>LREDT D MI
41 Q
42 ;
43GENP W !!,"Too many tests! Will use alternate format. May show extra tests.",!
44 S LREDT="T-7" D ^LRWU3 Q:LREND S LRSDT=9999999-LRSDT,LREDT=9999999-LREDT
45 K ^TMP("LR",$J,"T"),LRORD,LRTSTS S ZTSAVE("^TMP(""LR"",$J,")="",ZTSAVE("DFN")="",ZTRTN="GDQ^LRRP2" D IO^LRWU
46 Q
47 ;
48GDQ ;dequeued
49 S:$D(ZTQUEUED) ZTREQ="@" U IO D PT^LRX
50 S LRSUB="" F S LRSUB=$O(^TMP("LR",$J,"TMP",LRSUB)) Q:LRSUB="" S X=+$P(LRSUB,";",2),^TMP("LR",$J,"T",X)=""
51 S LRIDT=LRSDT F S LRIDT=$O(^LR(LRDFN,"CH",LRIDT)) Q:LRIDT<1!(LRIDT>LREDT) D GEN2 Q:LREND!LRSTOP
52 K ^TMP("LR",$J,"T"),^TMP("LR",$J,"TMP"),LRSDT,LREDT,LRTSTS,LRSUB,LRIDT
53 Q
54 ;
55GEN2 S LRTN=0 F S LRTN=$O(^LR(LRDFN,"CH",LRIDT,LRTN)) Q:LRTN<1 I $D(^TMP("LR",$J,"T",LRTN)) D CH Q
56 I '$P($G(^LR(LRDFN,"CH",LRIDT,0)),U,3),$O(^LR(LRDFN,"CH",LRIDT,1,0)) D Q:'$G(LRCAN) D CH
57 . S LRCAN=0 F S LRCAN=+$O(^LR(LRDFN,"CH",LRIDT,1,LRCAN)) Q:LRCAN<1 Q:$E($G(^(LRCAN,0)))="*"
58 Q
59 ;
60 ;
61AIDQUE ;
62 D INIT
63 S LRLAB=$S($D(LRLABKY):1,1:0)
64 K ^TMP($J)
65 S LROCE=$S($D(LROC):LROC,1:""),LROC=$S(LROCE="":$O(^LAB(64.6,"AI","")),1:LROC)
66 D:LROC'="" AI2
67 F S LROC=$O(^LAB(64.6,"AI",LROC)) Q:LROC=""!($L(LROCE)&(LROC'=LROCE)) D AI2
68 S LROC="UNKNOWN" D AI2
69 ;
70PRT ; Print sorted data
71 U IO K VA D KVAR^VADPT S LREND=0
72 I $O(^TMP($J,0))="" D Q
73 . W !!?10,"No Interim report Patients to Print "
74 . W !?20,$$HTE^XLFDT($H),!!
75 . D QUIT
76 S LROC=""
77 F S LROC=$O(^TMP($J,LROC)) Q:LROC=""!($G(LREND)) D
78 . S LRPHY=""
79 . F S LRPHY=$O(^TMP($J,LROC,LRPHY)) Q:LRPHY=""!($G(LREND)) D
80 . . S LRSSN=""
81 . . F S LRSSN=$O(^TMP($J,LROC,LRPHY,LRSSN)) Q:LRSSN=""!($G(LREND)) D
82 . . . S LRDFN=0
83 . . . F S LRHF=1,LRDFN=$O(^TMP($J,LROC,LRPHY,LRSSN,LRDFN)) Q:LRDFN<1!($G(LREND)) D
84 . . . . S LRIDT=0
85 . . . . F S LRIDT=$O(^TMP($J,LROC,LRPHY,LRSSN,LRDFN,LRIDT)) Q:LRIDT<1!($G(LREND)) D
86 . . . . . S LRSS="",PNM=^(LRIDT),SSN=$P(PNM,U,2),AGE=$P(PNM,U,3),SEX=$P(PNM,U,4),PNM=$P(PNM,U),LRFOOT=0
87 . . . . . D:$D(^LR(LRDFN,"CH",LRIDT,0))#2 CH
88 . . . . . S LRFOOT=0
89 . . . . . I $D(^LR(LRDFN,"MI",LRIDT,0))#2 D
90 . . . . . . I $G(LRSS)="CH" D FOOT^LRRP1 D:$G(LRPRTPG) PLSPG
91 . . . . . . D MI
92 . . . . . I $G(LRSS)="CH" D FOOT^LRRP1 D:$G(LRPRTPG) PLSPG
93 D QUIT
94 Q
95 ;
96 ;
97QUIT ;
98 S:$D(ZTQUEUED) ZTREQ="@"
99 D ^%ZISC,^LRRK
100 Q
101 ;
102 ;
103AI2 ;
104 Q:'$L($G(LROC))
105 F LRDFN=0:0 S LRDFN=$O(^LRO(69,"AN",LROC,LRDFN)) Q:LRDFN<1 I $D(^LR(LRDFN,0))#2 D
106 . S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX Q:LREND
107 . I '$G(VAERR) D AI3
108 Q
109AI3 ;
110 Q:$G(LREND) N LRCAN
111 S LRSSN=$P(PNM,",")_SSN(1)
112 F LRIDT=0:0 S LRIDT=$O(^LRO(69,"AN",LROC,LRDFN,LRIDT)) Q:LRIDT<1 D
113 . S LRND=$S($G(^LR(LRDFN,"CH",LRIDT,0)):^(0),$G(^LR(LRDFN,"MI",LRIDT,0)):^(0),1:"") D
114 . . I $G(^LR(LRDFN,"CH",LRIDT,0)) D
115 . . . I $O(^LR(LRDFN,"CH",LRIDT,1)),$P(LRND,U,3) D AI3SET Q ; Print verified results.
116 . . . I $O(^LR(LRDFN,"CH",LRIDT,1)) Q ; Don't print unverified results.
117 . . . S LRCAN=0 F S LRCAN=+$O(^LR(LRDFN,"CH",LRIDT,1,LRCAN)) Q:LRCAN<1 Q:($E(^(LRCAN,0))="*")
118 . . . I $G(LRCAN) D AI3SET ; Print if cancel comment and no unverified results.
119 . . I $P($G(^LR(LRDFN,"MI",LRIDT,0)),U,3) D
120 . . . S I=$O(^LR(LRDFN,"MI",LRIDT,0)) Q:I'=99 D AI3SET
121 Q
122AI3SET S LRPHY=$P($G(^VA(200,+$P(LRND,U,10),0)),U) S:LRPHY="" LRPHY="UNKNOWN"
123 S ^TMP($J,LROC,LRPHY,LRSSN,LRDFN,LRIDT)=PNM_U_SSN_U_AGE_U_SEX
124 Q
125CH ;Also used by DVBC Package
126 Q:'$G(^LR(LRDFN,"CH",LRIDT,0))
127 N LROC,LRCAN
128 K ^TMP("LR",$J,"TP"),LRTP S LR0=^LR(LRDFN,"CH",LRIDT,0)
129 Q:$O(^LR(LRDFN,"CH",LRIDT,1))&('$P(LR0,U,3))
130 I '$P(LR0,U,3),$O(^LR(LRDFN,"CH",LRIDT,1,0)) D Q:'$G(LRCAN)
131 . S LRCAN=0 F S LRCAN=+$O(^LR(LRDFN,"CH",LRIDT,1,LRCAN)) Q:LRCAN<1 Q:$E($G(^(LRCAN,0)))="*"
132 S LRCDT=+LR0,LRSS="CH",LROC=$P(LR0,U,11),LRAA="",LRAAO=1,LRTC=0,LRSPEC=$P(LR0,U,5)
133 D CH^LRRP
134 Q
135MI ;Also used by DVBC package
136 S LRCDT=9999999-LRIDT,^TMP("LR",$J,"TP",1)="^MI",^(1,LRCDT)="",^(LRCDT,-1)="",LRSS="MI",LRH=1 D:LRFOOT FOOT^LRRP1 Q:LRSTOP D EN1^LRMIPC S LRHF=1,LRFOOT=0 K A,Z,LRH S:LREND LREND=0,LRSTOP=1
137 Q
138 ;
139INIT D EN^LRPARAM
140 S (LREND,LRSTOP,LRPG,LRFOOT)=0,LRCW=8,LRHF=1,(LRONESPC,LRONETST)=""
141 K LRPLS
142 Q
143 ;
144EN69 ;entry point for surgery pkg
145 D START,^LRRK
146 Q
147GEN ;from LRGEN test overflow
148 S LRLAB=$S($D(LRLABKY):1,1:0) D INIT,GENP,^LRRK
149 Q
150DS ;from LRRD, LRRS
151 D INIT S DFN=$P(^LR(LRDFN,0),U,3),LRDPF=$P(^(0),U,2) D SDQ
152 Q
153 ;
154 ;
155AIDQ ;tasked from LRTASK DAILY INTERIM,LRTASK CUM
156 N LRLAB,LRH,LRWRDVEW,LRPRTPG
157 S (LRH,LRWRDVEW)="",LRPRTPG=1
158 D AIDQUE
159 K ^TMP($J)
160 Q
161 ;
162 ;
163DQ ;tasked from LRVER3 thru LRTP for IMMEDIATE INTERIM REPORTING
164 S:$D(ZTQUEUED) ZTREQ="@" D INIT S LRLAB=0,LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX D CH D FOOT^LRRP1 D ^%ZISC
165 Q
166 ;
167OR ;OE/RR entry point
168 Q:'$D(ORVP) S KILL=1 I '$D(LRPARAM) D EN^LRPARAM S KILL=0
169 S (LREND,LRSTOP)=0,LRCW=8,LRHF=1,LRFOOT=0,(LRONESPC,LRONETST)=""
170 D DT^LRX K DIC,LRTP S LRTP=0,DFN=+ORVP,LRDPF=+$P(@("^"_$P(ORVP,";",2)_"0)"),"^",2)_"^"_$P(ORVP,";",2) D END^LRDPA Q:LRDFN<1
171 D START,^LRRK
172 I 'KILL K LRBLOOD,LRDT0,LRPARAM,LRPLASMA,LRSERUM,LRSB,LRTP,LRUNKNOW,LRURINE
173 K KILL
174 Q
175 ;
176 ;
177PLSPG ;PRINT LAST PAGE WITH PERFORMING LAB SITE NAMES AND ADDRESSES
178 W @IOF
179 I $D(LRPG) D
180 .S LRPG=LRPG+1
181 .W !?65,"page ",LRPG
182 W !,PNM,?30,SSN,?50,$$FMTE^XLFDT($$NOW^XLFDT,"5FMPZ")
183 W !!,"PERFORMING LAB SITES"
184 W !!!!
185 S LRPLS=0
186 F S LRPLS=$O(LRPLS(LRPLS)) Q:LRPLS="" D
187 .W "[",LRPLS,"] ",$$NAME^XUAF4(LRPLS)," "
188 .S X=$$PADD^XUAF4(LRPLS)
189 .W $P(X,U)," ",$P(X,U,2),", ",$P(X,U,3)," ",$P(X,U,4)
190 .W !
191 Q
Note: See TracBrowser for help on using the repository browser.