source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRSORA.m@ 1258

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

initial load of WorldVistAEHR

File size: 4.3 KB
Line 
1LRSORA ;DRH/DALISC - HIGH/LOW VALUE REPORT ;2/19/91 11:42 ;
2 ;;5.2;LAB SERVICE;**344,357,369**;Sep 27, 1994;Build 2
3MAIN D INIT,GDT,GAA:'LREND,GLRT:'LREND,GLOG:'LREND,SORTBY^LRSORA1:'LREND
4 D PATS^LRSORA1:'LREND,LOCS^LRSORA1:'LREND,GDV:'LREND,RUN:'LREND
5 D STOP
6 Q
7RUN ;
8 K ^TMP("LR",$J)
9 S:$D(ZTQUEUED) ZTREQ="@" U IO
10 S (LRPAG,LREND)=0,$P(LRDASH,"-",IOM)="-"
11 K %DT S X=$P(LRSDT,"."),%DT="X" D ^%DT,DD^LRX S LRSDAT=Y
12 K %DT S X=LREDT,%DT="X" D ^%DT,DD^LRX S LREDAT=Y
13 S LRHDR2="For date range: "_LREDAT_" to "_LRSDAT
14 D:'LREND START^LRSORA2
15 D:$D(ZTQUEUED) STOP
16 Q
17STOP ;
18 D STOP^LRSORA0
19 Q
20GAA ;
21 D GAA^LRSORA0
22 Q
23GLRT ;
24 W ! K LRTST S LRTST=1
25 F I=0:0 D GTSC Q:'$D(LRTST(LRTST,1)) W ! S LRTST=LRTST+1
26 K LRTST(LRTST) S LRTST=LRTST-1 Q
27GTSC ;
28 S LRA=1
29 F I=0:0 D @$S(LRA=2:"SPEC",LRA=3:"CND",LRA=4:"GV",1:"TST") Q:LRA=0
30 Q
31TST ;
32 K DIC S DIC="^LAB(60,",DIC(0)="AEMOQ"
33 S DIC("S")="I $P(^(0),U,5)[""CH"",""BO""[$P(^(0),U,3)" D ^DIC
34 S LRA=$S(Y>0:2,1:0)
35 S:X["^" LREND=1
36 I Y>0 S $P(LRTST(LRTST,3),"^",1)=$P($P(^LAB(60,+Y,0),U,5),";",2)
37 I S $P(LRTST(LRTST,2),"^",1)=$P(Y,"^",2)
38 Q
39SPEC ;
40 S LRCNT=LRCNT+1
41 K DIC S DIC="^LAB(61,",DIC(0)="AEMOQ"
42 S DIC("A")="Select SPECIMEN/SITE: ANY// " D ^DIC
43 S:Y<1 $P(LRTST(LRTST,3),"^",2)="",$P(LRTST(LRTST,2),"^",2)=""
44 S LRA=$S(X["^":1,1:3)
45 I Y>0 S $P(LRTST(LRTST,3),"^",2)=+Y,$P(LRTST(LRTST,2),"^",2)=$P(Y,"^",2)
46 Q
47CND ;
48 W !,"Select CONDITION: " R X:DTIME S:'$T X="^"
49 D @$S(X?1.N1":"1.N:"RNG",1:"GC") Q
50RNG ;
51 N Y
52 S LRV=+$P(X,":",1),LRV2=+$P(X,":",2),LRA=0
53 S:LRV>LRV2 X=LRV,LRV=LRV2,LRV2=X
54 S $P(LRTST(LRTST,2),U,3)="BETWEEN "_LRV_" AND "_LRV2
55 S X=$P(LRTST(LRTST,3),U,1)
56 S Y="I $D(^("_X
57 S Y=Y_")) S LRVX=$P(^("_X
58 S Y=Y_"),U),LRVX=$S(LRVX?1A.E:LRVX,"
59 S Y=Y_"""<>""[$E(LRVX):$E(LRVX,2,$L(LRVX)),1:LRVX)"
60 S LRTST(LRTST,1)=Y_" I LRVX>"_LRV_",LRVX<"_LRV2
61 D ASPC Q
62GC ;
63 S DIC="^DOPT(""DIS"",",DIC(0)="EMQZ",DIC("S")="I $L($P(^(0),U,2))"
64 D ^DIC K DIC
65 S LRA=$S(X["^":2,Y<0:3,1:4) D:X["?" HLP1 W:'$L(X) " ??" Q:Y<0
66GV ;
67 N LY,ALPHA,DEC,II,TT
68 W !,"Enter VALUE: "
69 R X:DTIME S:'$T X="^"
70 S LRA=$S(X["^":3,"?"[X:4,1:0)
71 W:X="" " ??" D:X["?" HLP2 Q:LRA
72 S:"<>"[$P(Y(0),U,2) X=+X
73 S $P(LRTST(LRTST,2),"^",3)=$P(Y(0),"^",1)_" "_X
74 ;
75 ; determine if entered value is alphanumeric
76 S (ALPHA,DEC)=0
77 F II=1:1 S TT=$E(X,II) Q:TT="" D Q:ALPHA
78 . I TT?1N Q
79 . I TT?1"." S DEC=DEC+1 S:DEC>1 ALPHA=1 Q
80 . S ALPHA=1
81 I X="""""" S ALPHA=0 ;ADDED FOR LR*5.2*357
82 ;
83 S LY="I $D(^("_$P(LRTST(LRTST,3),U)
84 S LY=LY_")) S LRVX=$P(^("
85 S LY=LY_$P(LRTST(LRTST,3),U)
86 S LY=LY_"),U),LRVX=$S(LRVX?1A.E:LRVX,"
87 S LY=LY_"""<>""[$E(LRVX):$E(LRVX,2,$L(LRVX)),1:LRVX) I LRVX"
88 S LRTST(LRTST,1)=LY_$P(Y(0),U,2)_$S(ALPHA:""""_X_"""",1:X) D ASPC Q
89ASPC ;
90 S:$L($P(LRTST(LRTST,3),U,2)) LRTST(LRTST,1)=LRTST(LRTST,1)_",$P(^(0),U,5)="_$P(LRTST(LRTST,3),U,2) Q
91INIT ;
92 S LRCNT=0
93 S U="^"
94 S LREND=0
95 S LRLONG=0
96 S LRSDT="TODAY"
97 S LREDT="T-1"
98 S LRTW=.00001
99 S:'$D(DTIME) DTIME=300
100 W !,"SPECIAL REPORT - Search for high/low values" Q
101GDT ;
102 F W=0:0 D SDF,GSD Q:LREND S LRSDT=Y D GED I Y>0 S LREDT=Y S:LREDT>LRSDT X=LREDT,LREDT=LRSDT,LRSDT=X D CXR W:Y'>0 !!,"No data for the year selected.",! Q:Y>0
103 K %DT S X=$P(LRSDT,"."),%DT="X" D ^%DT,DD^LRX S LRSDAT=Y
104 K %DT S X=$P(LREDT,"."),%DT="X" D ^%DT,DD^LRX S LREDAT=Y
105 S LRHDR2="For date range: "_LREDAT_" to "_LRSDAT
106 K LRSDAT,LREDAT,%DT Q
107GSD ;
108 S %DT("A")="Enter START date: ",%DT("B")=LRSDT,%DT="AET"
109 D ^%DT S LREND=Y<1 Q
110GED ;
111 S %DT("A")="Enter END date: ",%DT("B")=LREDT D ^%DT Q
112CXR ;
113 S Y=$E(LREDT,1,3)_"0000" F I=0:0 S Y=$O(^LRO(69,Y)) Q:Y=""!($D(^LRO(69,+Y,1,"AN")))
114 I Y>LREDT D DD^LRX W !,"The earliest date in the X-ref is ",Y,". Long search required.",! D CXR1
115 Q
116CXR1 ;
117 F I=0:0 S %=2 W " OK to continue" D YN^DICN S:%=2!(%<0) LREND=1 S:%=1 LRLONG=1 Q:% W !,"Enter 'YES' for the long search, 'NO' to exit.",!
118 Q
119SDF ;
120 I LRSDT?1.7N S Y=LRSDT D DD^LRX S LRSDT=Y
121 I LREDT?1.7N S Y=LREDT D DD^LRX S LREDT=Y
122 Q
123GLOG ;
124 S:LRTST=1 LRTST(0)="A" D:LRTST>1 EN^LRSORA1 S:LRTST<1 LREND=1 Q
125GDV ;
126 S %ZIS="Q" D ^%ZIS K %ZIS I POP S LREND=1 Q
127 I $D(IO("Q")) K IO("Q") S (LRQUE,LREND)=1,ZTRTN="RUN^LRSORA",ZTDESC="Lab Special Report",ZTSAVE("LR*")="" D ^%ZTLOAD
128 Q
129HLP1 ;
130 W !,"A VALUE RANGE may also be entered (value:value).",!," For Example, 100:200 will search for values between 100 and 200.",!
131 Q
132HLP2 ;
133 W !,"Enter a value for the comparison: "
134 W $P(LRTST(LRTST,2),U,1)," ",$P(Y(0),U,1)_" _____."
135 Q
136XX ;
137WAIT K DIR S DIR(0)="E" D ^DIR S:($D(DUOUT))!($D(DTOUT)) LREND=1
138 Q
Note: See TracBrowser for help on using the repository browser.