source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LRRP1.m@ 1154

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

initial load of FOIAVistA 6/30/08 version

File size: 4.1 KB
Line 
1LRRP1 ;DALOI/RWF/BA-PRINT THE DATA FOR INTERIM REPORTS ;11/9/88 17:31
2 ;;5.2;LAB SERVICE;**153,221,283,286,356**;Sep 27, 1994;Build 8
3 ;from LRRP, LRRP2, LRRP3
4 ;
5PRINT S:'$L($G(SEX)) SEX="M" S:'$L($G(DOB)) DOB="UNKNOWN"
6 S LRAAO=0 F S LRAAO=$O(^TMP("LR",$J,"TP",LRAAO)) Q:LRAAO<1 D ORDER Q:LRSTOP
7 K ^TMP("LR",$J,"TP")
8 Q
9 ;
10 ;
11ORDER N LRCAN
12 S LRCDT=0
13 F S LRCDT=$O(^TMP("LR",$J,"TP",LRAAO,LRCDT)) Q:LRCDT<1 D
14 . S LRCAN=0
15 . I LRSS="CH" D
16 . . S LRIDT=+^TMP("LR",$J,"TP",LRAAO,LRCDT,-2)
17 . . F S LRCAN=+$O(^LR(LRDFN,"CH",LRIDT,1,LRCAN)) Q:LRCAN<1 Q:$E($G(^(LRCAN,0)))="*"
18 . D TEST Q:LRSTOP
19 Q
20 ;
21 ;
22TEST ;
23 S LRIDT=+^TMP("LR",$J,"TP",LRAAO,LRCDT,-2)
24 S LRSS=$P(^TMP("LR",$J,"TP",LRAAO),U,2)
25 S LR0=$S($D(^(LRAAO,LRCDT))#2:^(LRCDT),1:""),LRTC=$P(LR0,U,12)
26 I LRSS="MI" D Q
27 . S LRH=1 D:LRFOOT FOOT Q:LRSTOP
28 . D EN1^LRMIPC
29 . S LRHF=1,LRFOOT=0
30 . K A,Z,LRH
31 . S:LREND LREND=0,LRSTOP=1
32 ;
33 Q:'$G(LRCAN)&('$P(LR0,U,3)) D @$S(LRHF:"HDR",1:"CHECK") Q:LRSTOP
34 S LRSPEC=+$P(LR0,U,5),X=$P(LR0,U,10) D DOC^LRX
35 ;
36 W !!,?7,"Provider: ",LRDOC
37 W !,?7,"Specimen: ",$P(^LAB(61,LRSPEC,0),U)
38 D ORU
39 W !!,?30,"Specimen Collection Date: ",$$FMTE^XLFDT(LRCDT,"M")
40 W !?5,"Test name",?30,"Result units",?51,"Ref. range",?66,"Site Code"
41 S LRPO=0
42 F S LRPO=$O(^TMP("LR",$J,"TP",LRAAO,LRCDT,LRPO)) Q:LRPO'>0 S LRDATA=^(LRPO) D DATA Q:LRSTOP
43 Q:LRSTOP
44 ;
45 I $D(^TMP("LR",$J,"TP",LRAAO,LRCDT,"C")) D
46 . W !,"Comment: " S LRCMNT=0
47 . F S LRCMNT=+$O(^TMP("LR",$J,"TP",LRAAO,LRCDT,"C",LRCMNT)) Q:LRCMNT<1 D Q:LRSTOP
48 . . W ^TMP("LR",$J,"TP",LRAAO,LRCDT,"C",LRCMNT)
49 . . D CONT Q:LRSTOP
50 . . W:$O(^TMP("LR",$J,"TP",LRAAO,LRCDT,"C",LRCMNT)) !?9
51 Q:LRSTOP D EQUALS^LRX
52 W !?7,"KEY: ""L""=Abnormal low, ""H""=Abnormal high, ""*""=Critical value"
53 S LRFOOT=1
54 Q
55 ;
56 ;
57DATA ;
58 N LR63DATA
59 ;
60 S LRTSTS=+LRDATA,LRPC=$P(LRDATA,U,5),LRSUB=$P(LRDATA,U,6)
61 S X=$P(LRDATA,U,7) Q:X=""
62 S LR63DATA=$$TSTRES^LRRPU(LRDFN,LRSS,LRIDT,$P(LRDATA,U,10),LRTSTS)
63 S LRLO=$P(LR63DATA,"^",3),LRHI=$P(LR63DATA,"^",4),LRPLS=$P(LR63DATA,"^",6),LRTHER=$P(LR63DATA,"^",7)
64 I LRPLS S LRPLS(LRPLS)=LRPLS
65 ;
66 W !?5,$S($L($P(LRDATA,U,2))>20:$P(LRDATA,U,3),1:$P(LRDATA,U,2))
67 S X=$P(LR63DATA,"^")
68 W ?27,@$S(LRPC="":"$J(X,LRCW)",1:LRPC)," ",$P(LR63DATA,"^",2)
69 I $X>39 W !
70 W ?40,$P(LR63DATA,U,5)
71 I $X>50 W !
72 W ?51
73 I LRLO'="",LRHI'="" W $J(LRLO,4)_" to "_$J(LRHI,4)
74 I LRLO'="",LRHI="" W $J($S(LRLO?.AP:LRLO,1:"low: "_LRLO),4)
75 I LRLO="",LRHI'="" W $J($S(LRHI?.AP:LRHI,1:"high: "_LRHI),4)
76 ;
77 I LRPLS'="" D
78 . I $X>67 W !
79 . W ?68,"[",LRPLS,"]"
80 D CONT Q:LRSTOP
81 ;
82 I $O(^TMP("LR",$J,"TP",LRAAO,LRCDT,LRPO,0))>0 D Q:LRSTOP
83 . S LRINTP=0
84 . F S LRINTP=+$O(^TMP("LR",$J,"TP",LRAAO,LRCDT,LRPO,LRINTP)) Q:LRINTP<1 W !?7,"Eval: ",^(LRINTP) D CONT Q:LRSTOP
85 ;
86 Q
87 ;
88 ;
89CHECK I LRTC+11>(IOSL-$Y) D FOOT Q:LRSTOP D HDR
90 Q
91 ;
92 ;
93CONT I $Y+5>IOSL D FOOT Q:LRSTOP D HDR W !?20,">> CONTINUATION OF ",$P(LR0,U,6)," <<",!
94 Q
95FOOT ;from LRRP, LRRP2, LRRP3
96 Q:LRSTOP F I=$Y:1:IOSL-4 W !
97 I $E(IOST,1,2)'="C-" W !,PNM,?40," ",SSN," ",$$HTE^XLFDT($H,"M"),! Q
98 W !,PNM,?25," ",SSN," ",$$HTE^XLFDT($H,"MP"),?59," PRESS '^' TO STOP "
99 R X:DTIME S:X="" X=1 S:(".^"[X)!('$T) LRSTOP=1
100 Q
101 ;
102 ;
103HDR ; Add Printed at, page #, change age to dob 7/2002 cka
104 W:($G(LRJ02))!($G(LRJ0))!($E(IOST,1,2)="C-") @IOF
105 S LRHF=0,LRJ02=1
106 I '$D(LRPG) S LRPG=0
107 S LRPG=LRPG+1
108 I $E(IOST,1)="P" D
109 .W !!!!
110 .S X="CLINICAL LABORATORY REPORT"
111 .W ?(80-$L(X)\2),X,!
112 I $D(DUZ("AG")),$L(DUZ("AG")),"ARMYAFN"[DUZ("AG") D ^LRAIPRIV W !
113 W "Printed at: ",?65,"page ",LRPG
114 W !,$$NAME^XUAF4(DUZ(2))," (",DUZ(2),")"
115 S X=$$PADD^XUAF4(DUZ(2))
116 W !,$P(X,U)," ",$P(X,U,2),", ",$P(X,U,3)," ",$P(X,U,4)
117 W !!,PNM,?44,"Report date: ",$$HTE^XLFDT($H,"M")
118 W !?5,"SSN: ",SSN," SEX: ",SEX," DOB: ",$$FMTE^XLFDT(DOB)," LOC: ",LROC
119 Q
120 ;
121ORU ; Display remote ordering info if available
122 N LRX,IENS
123 S LRX=$G(^LR(LRDFN,"CH",LRIDT,"ORU")),IENS=LRIDT_","_LRDFN_","
124 D EN^DDIOL("Accession [UID]: "_$P(LR0,"^",6)_" ["_$P(LRX,"^")_"]","","!")
125 I $P(LRX,"^",3) D
126 . D EN^DDIOL("Ordering Site: "_$$GET1^DIQ(63.04,IENS,.33,""),"","!?2")
127 . D EN^DDIOL(" Ordering Site UID: "_$P(LRX,"^",5),"","?43")
128 I $P(LRX,"^",2) D EN^DDIOL("Collecting Site: "_$$GET1^DIQ(63.04,IENS,.32,""),"","!")
129 Q
Note: See TracBrowser for help on using the repository browser.