source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LR7OSAP1.m@ 1800

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

initial load of FOIAVistA 6/30/08 version

File size: 4.6 KB
Line 
1LR7OSAP1 ;slc/dcm/wty/kll - Silent AP rpt cont. ;3/28/2002
2 ;;5.2;LAB SERVICE;**121,227,230,259,317**;Sep 27, 1994
3 Q:'$D(^XUSEC("LRLAB",DUZ))
4 D LN
5 S $P(LR("%"),"-",GIOM)="",^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,LR("%"))
6 D LN
7 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"SNOMED/ICD codes:")
8 S C=0
9 F S C=$O(^LR(LRDFN,LRSS,LRI,2,C)) Q:'C S T=+^(C,0),T=^LAB(61,T,0) D
10 . D LN
11 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"T-"_$P(T,"^",2)_": "),X=$P(T,"^")
12 . D:LR(69.2,.05) C^LRUA
13 . S ^(0)=^TMP("LRC",$J,GCNT,0)_X
14 . D M
15 D LINE^LR7OSUM4
16 S C=0
17 F S C=$O(^LR(LRDFN,LRSS,LRI,3,C)) Q:'C S X=+^(C,0),X=$G(^ICD9(X,0)) I $L(X) D
18 . S X(9)=$P(X,"^"),X=$P(X,"^",3)
19 . D LN
20 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"ICD code: "_X(9))
21 . D:LR(69.2,.05) C^LRUA
22 . S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(20,CCNT,X)
23 Q
24M ;
25 S B=0
26 F S B=$O(^LR(LRDFN,LRSS,LRI,2,C,2,B)) Q:'B S M=+^(B,0),M=$G(^LAB(61.1,M,0)) I $L(M) D
27 . D LN
28 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,"M-"_$P(M,"^",2)_": "),X=$P(M,"^")
29 . D:LR(69.2,.05) C^LRUA
30 . S ^(0)=^TMP("LRC",$J,GCNT,0)_X
31 . D EX
32 F B=1.4,3.3,4.5 S F=0 F S F=$O(^LR(LRDFN,LRSS,LRI,2,C,$P(B,"."),F)) Q:'F D A
33 Q
34A ;
35 S M=+^LR(LRDFN,LRSS,LRI,2,C,$P(B,"."),F,0),E="61."_$P(B,".",2),M=^LAB(E,M,0)
36 D LN
37 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$S(B=1.4:"D-",B=3.3:"F-",B=4.5:"P-",1:"")_$P(M,"^",2)),X=$P(M,"^")
38 D:LR(69.2,.05) C^LRUA
39 S ^(0)=^TMP("LRC",$J,GCNT,0)_": "_X
40 Q
41EX ;
42 S G=0
43 F S G=$O(^LR(LRDFN,LRSS,LRI,2,C,2,B,1,G)) Q:'G S E=+^(G,0),E=$G(^LAB(61.2,E,0)) I $L(E) D
44 . D LN
45 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(10,CCNT,"E-"_$P(E,"^",2)_": "),X=$P(E,"^")
46 . D:LR(69.2,.05) C^LRUA
47 . S ^(0)=^TMP("LRC",$J,GCNT,0)_X
48 Q
49LN ;Increment the counter
50 S GCNT=GCNT+1,CCNT=1
51 Q
52MOD ;Modified report stuff
53 N A,B
54 D LN
55 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(28,CCNT,"*+* MODIFIED REPORT *+*")
56 D LN
57 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"(Last modified: ")
58 S B=0
59 F A=0:0 S A=$O(^LR(LRDFN,LRSS,LRI,LR(0),A)) Q:'A S B=A
60 Q:'$D(^LR(LRDFN,LRSS,LRI,LR(0),B,0)) S A=^(0),Y=+A,A=$P(A,"^",2),A=$P($G(^VA(200,A,0),A),"^")
61 D D^LRU
62 S ^(0)=^TMP("LRC",$J,GCNT,0)_Y_" typed by "_A_")"
63 D:$D(LRQ(9)) M1
64 Q
65MODSR ;Modified Supplementary Report Audit Info
66 N LRTEXT,LRSP1,LRSP2,LRFILE,LRIENS,LRR1,LRR2
67 S LRFILE=$S(LRSS="CY":63.9072,LRSS="SP":63.8172,LRSS="EM":63.2072,1:"")
68 Q:LRFILE=""
69 D LN
70 S LRTEXT="SUPPLEMENTARY REPORT HAS BEEN ADDED/MODIFIED"
71 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(14,CCNT,"*+* "_LRTEXT_" *+*")
72 D LN
73 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"(Added/Last modified: ")
74 S LRIENS=C_","_LRI_","_LRDFN_","
75 S LRSP1=0
76 F S LRSP1=$O(^LR(LRDFN,LRSS,LRI,1.2,C,2,LRSP1)) Q:'LRSP1 D
77 .S LRSP2=LRSP1
78 Q:'$D(^LR(LRDFN,LRSS,LRI,1.2,C,2,LRSP2,0))
79 S LRS2=^(0),Y=+LRS2,LRS2A=$P(LRS2,"^",2),LRSGN=" typed by "
80 ;If supp rpt is released, display 'signed by' instead of 'typed by'
81 I $P(LRS2,"^",3) S Y=$P(LRS2,"^",4),LRS2A=$P(LRS2,"^",3),LRSGN=" signed by "
82 D D^LRU
83 S LRS2A=$S($D(^VA(200,LRS2A,0)):$P(^(0),"^"),1:LRS2A)
84 S LRR1=Y,LRR2=LRS2A
85 S ^(0)=^TMP("LRC",$J,GCNT,0)_LRR1_LRSGN_LRR2_")"
86 ;If RELEASED SUPP REPORT MODIFIED set to 1, display "NOT VERIFIED"
87 I $P(^LR(LRDFN,LRSS,LRI,1.2,C,0),"^",3)=1 D
88 .D LN
89 .S LRTEXT="NOT VERIFIED"
90 .S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(25,CCNT,"**-* "_LRTEXT_" *-**")
91 Q
92M1 ;
93 S A=0
94 F S A=$O(^LR(LRDFN,LRSS,LRI,LR(0),A)) Q:'A S LRT=^(A,0),Y=+LRT,X=$P(LRT,"^",2),X=$P($G(^VA(200,X,0),X),"^") D
95 . D D^LRU,LN
96 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"Date modified:"_Y_" typed by "_X)
97 . D F
98 S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(13,CCNT,"==========Text below appears on final report==========")
99 Q
100 ;
101F ;
102 S B=0
103 F S B=$O(^LR(LRDFN,LRSS,LRI,LR(0),A,1,B)) Q:'B S LRT=^(B,0),X=LRT D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,X)
104 Q
105WRAP(ROOT,FMT) ;Wrap text
106 I '$L($G(ROOT)) Q ""
107 S:'$G(FMT) FMT=79
108 N X,LRI,LRTX,LRINDX
109 S LRINDX=0,LRI=0
110 F S LRI=$O(@ROOT@(LRI)) Q:LRI'>0 D
111 . S X=$S($L($G(@ROOT@(LRI))):@ROOT@(LRI),$L($G(@ROOT@(LRI,0))):@ROOT@(LRI,0),1:""),LRINDX=LRINDX+1
112 . S X=$$FMT(FMT,.LRINDX,X)
113 S LRI=0
114 F S LRI=$O(LRTX(LRI)) Q:'LRI D LN^LR7OSAP S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,LRTX(LRI))
115 Q
116FMT(LENGTH,INDEX,TEXT) ;Format text
117 N X,Y,J
118 S Y=1
119 S:'$D(LRTX(INDEX)) LRTX(INDEX)=""
120 S X=$L(TEXT)+$L(LRTX(INDEX))+1
121 I X<255 S TEXT=$S($L(LRTX(INDEX)):LRTX(INDEX)_" "_TEXT,1:TEXT)
122 I X'<255 S INDEX=INDEX+1,LRTX(INDEX)=""
123 S LRTX(INDEX)=""
124 F J=1:1 S X=$P(TEXT," ",J) Q:J>$L(TEXT," ") D
125 . Q:'$L(X)
126 . I ($L(X)+$L(LRTX(INDEX)))>LENGTH S Y=1,INDEX=INDEX+1,LRTX(INDEX)=""
127 . S LRTX(INDEX)=$S(Y:X,1:LRTX(INDEX)_" "_X),Y=0
128 S LRTX(INDEX)=$$STRIP(LRTX(INDEX))
129 Q INDEX
130STRIP(TEXT) ; Strips white space from text
131 N LRI,LRX
132 S LRX="" F LRI=1:1:$L(TEXT," ") S:$A($P(TEXT," ",LRI))>0 LRX=LRX_$S(LRI=1:"",1:" ")_$P(TEXT," ",LRI)
133 S TEXT=LRX
134 Q TEXT
Note: See TracBrowser for help on using the repository browser.