source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LR7OGG.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: 6.0 KB
Line 
1LR7OGG ;DALOI/STAFF- Interim report rpc grid ; Feb 9, 2005
2 ;;5.2;LAB SERVICE;**187,290,364**;Sep 27, 1994;Build 3
3 ;
4TEST ; test use only
5 N CNT,I K ^TMP("LR7OGX",$J)
6 S ^TMP("LR7OGX",$J,"INPUT",1)="2^2970202^2920202"
7 S CNT=1
8 ;F I=1:1:10 I $D(^LAB(60,I,0)) S CNT=CNT+1,^TMP("LR7OGX",$J,"INPUT",CNT)=I
9 F I=7,173,9,1 I $D(^LAB(60,I,0)) S CNT=CNT+1,^TMP("LR7OGX",$J,"INPUT",CNT)=I
10 D GRIDDATA
11 S I=0 F S I=$O(^TMP("LR7OGX",$J,"OUTPUT",I)) Q:I<1 W !,^(I)
12 K ^TMP("LR7OGX",$J)
13 Q
14 ;
15GRID(ROOT,DFN,DATE1,DATE2,SPEC,TESTS) ; from ORWLRR
16 N CNT,NUM
17 K ^TMP("LR7OGX",$J,"INPUT"),^("OUTPUT")
18 S ROOT=$NA(^TMP("LR7OGX",$J,"OUTPUT"))
19 S ^TMP("LR7OGX",$J,"INPUT",1)=DFN_U_DATE1_U_DATE2_U_+SPEC
20 S CNT=1,NUM=0 F S NUM=$O(TESTS(NUM)) Q:NUM<1 D
21 .S CNT=CNT+1
22 .S ^TMP("LR7OGX",$J,"INPUT",CNT)=+TESTS(NUM)
23 D GRIDDATA
24 Q
25 ;
26GRIDDATA ;
27 ; input format
28 ; ^TMP("LR7OGX",$J,"INPUT",1)=dfn^start date^end date^spec^all tests
29 ; ^TMP("LR7OGX",$J,"INPUT",#)=test# (tests displayed in this order)
30 ; (these tests should, be atomic, subscript - ch, type - both or output)
31 ;
32 S ^TMP("LR7OGX",$J,"OUTPUT",1)="0^0^0^1"
33 N ABCNT,ABDCNT,ABLINE,ABTCNT,ABTLINE,ADCNT,ADSEQ,AGE,ATCNT,ATSEQ,CDT,CHSUB,COMCNT,COMMENT,DATACNT,DATESEQ,DFN,EDATE,EDT,FLAG,IDT
34 N LINE,LRCW,LRDFN,LRX,NUM,ONLYSPEC,OUTCNT,PNM,PRNTCODE,RESULT,SDATE,SEX,SPEC,SPECNAME,TESTNAME,TESTNUM,TESTSEQ,TESTZERO,X,ZERO,INEXACT,DISPDATE
35 K ^TMP("LR7OG",$J)
36 S DFN=+^TMP("LR7OGX",$J,"INPUT",1),SDATE=+$P(^(1),U,2),EDATE=+$P(^(1),U,3),ONLYSPEC=+$P(^(1),U,4)
37 D DEMO^LR7OGU(DFN,.LRDFN,.PNM,.AGE,.SEX)
38 Q:'DFN Q:'SDATE Q:'EDATE Q:'LRDFN
39 S OUTCNT=1,(ADCNT,ADSEQ,ATCNT,ATSEQ,COMCNT,DATACNT,DATESEQ,TESTSEQ,TCNT)=0
40 S NUM=1
41 F S NUM=$O(^TMP("LR7OGX",$J,"INPUT",NUM)) Q:NUM<1 S TESTNUM=+^(NUM) D
42 . S TESTZERO=$G(^LAB(60,TESTNUM,0))
43 . S CHSUB=$P($P(TESTZERO,U,5),";",2)
44 . I 'CHSUB Q
45 . S TESTNAME=$P($G(^LAB(60,TESTNUM,.1)),U),PRNTCODE=$P($G(^(.1)),U,3)
46 . I TESTNAME="" S TESTNAME=$P(TESTZERO,U)
47 . S TESTSEQ=TESTSEQ+1
48 . S LINE=TESTSEQ_U_TESTNUM_U_TESTNAME_U_PRNTCODE
49 . S ^TMP("LR7OG",$J,"TEST",CHSUB)=LINE
50 . S OUTCNT=OUTCNT+1
51 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE
52 S ^TMP("LR7OGX",$J,"OUTPUT",1)=TESTSEQ
53 S EDATE=EDATE\1
54 S IDT=9999999-SDATE,EDT=9999999-EDATE
55 F S IDT=$O(^LR(LRDFN,"CH",IDT)) Q:IDT<1 Q:IDT>EDT D
56 . S ZERO=^LR(LRDFN,"CH",IDT,0)
57 . I '$P(ZERO,U,3) Q
58 . S CDT=+ZERO,INEXACT=$P(ZERO,U,2),SPEC=+$P(ZERO,U,5),SPECNAME=$P($G(^LAB(61,SPEC,0)),U),COMMENT=$S($O(^LR(LRDFN,"CH",IDT,1,0)):"**",1:"")
59 . I ONLYSPEC,SPEC'=ONLYSPEC Q
60 . S CHSUB=1
61 . F S CHSUB=$O(^LR(LRDFN,"CH",IDT,CHSUB)) Q:CHSUB="" D
62 . . I '$D(^TMP("LR7OG",$J,"TEST",CHSUB)) Q
63 . . I '$D(^TMP("LR7OG",$J,"DATE",IDT)) S ^(IDT)="" D
64 . . . S DATESEQ=DATESEQ+1
65 . . . S OUTCNT=OUTCNT+1
66 . . . S DISPDATE=$S(INEXACT:CDT\1,1:CDT)
67 . . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=DATESEQ_U_CDT_U_SPEC_U_SPECNAME_U_COMMENT_U_DISPDATE
68 . . . I COMMENT'="" D
69 . . . . S COMCNT=COMCNT+1
70 . . . . S ^TMP("LR7OG",$J,"COMMENT",COMCNT)=$P($$FMTE^XLFDT(CDT),":",1,2)_" ** Comments:"
71 . . . . S NUM=0
72 . . . . F S NUM=$O(^LR(LRDFN,"CH",IDT,1,NUM)) Q:NUM<1 S LINE=$G(^(NUM,0)) D
73 . . . . . S COMCNT=COMCNT+1
74 . . . . . S ^TMP("LR7OG",$J,"COMMENT",COMCNT)=LINE
75 . . . . S COMCNT=COMCNT+1
76 . . . . S ^TMP("LR7OG",$J,"COMMENT",COMCNT)=""
77 . . S LRX=$$TSTRES^LRRPU(LRDFN,"CH",IDT,CHSUB,"")
78 . . S RESULT=$P(LRX,"^"),FLAG=$P(LRX,U,2)
79 . . S PRNTCODE=$P(^TMP("LR7OG",$J,"TEST",CHSUB),U,4)
80 . . I PRNTCODE'="" S X=RESULT,LRCW=8 S @("RESULT="_PRNTCODE)
81 . . E S RESULT=$J(RESULT,8)
82 . . S RESULT=$$STRIP^LR7OGU(RESULT)
83 . . I FLAG'="" D
84 . . . S ABTLINE=^TMP("LR7OG",$J,"TEST",CHSUB)
85 . . . I '$D(^TMP("LR7OG",$J,"ABTSEQ",+ABTLINE)) S ^(+ABTLINE)=U_$P(ABTLINE,U,2,3)
86 . . . I '$D(^TMP("LR7OG",$J,"ABDSEQ",IDT)) S ^(IDT)=U_CDT_U_SPEC_U_SPECNAME_U_COMMENT
87 . . . S ^TMP("LR7OG",$J,"ABDATA",IDT,+ABTLINE)=RESULT_U_FLAG
88 . . S TESTSEQ=+^TMP("LR7OG",$J,"TEST",CHSUB)
89 . . S DATACNT=DATACNT+1
90 . . S ^TMP("LR7OG",$J,"DATA",DATACNT)=DATESEQ_U_TESTSEQ_U_RESULT_U_FLAG
91 . . D TESTSPEC(CHSUB,SPEC,SPECNAME,AGE,SEX)
92 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,2,3)=DATESEQ_U_DATACNT
93 S DATACNT=0
94 F S DATACNT=$O(^TMP("LR7OG",$J,"DATA",DATACNT)) Q:DATACNT<1 S LINE=^(DATACNT) D
95 . S OUTCNT=OUTCNT+1,^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE
96 S OUTCNT=OUTCNT+1,ABLINE=OUTCNT
97 S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="0^0^0"
98 ;
99 S (ABTCNT,ATSEQ)=0
100 F S ATSEQ=$O(^TMP("LR7OG",$J,"ABTSEQ",ATSEQ)) Q:ATSEQ<1 D
101 . S ABTCNT=ABTCNT+1
102 . S $P(^TMP("LR7OG",$J,"ABTSEQ",ATSEQ),U)=ABTCNT
103 . S OUTCNT=OUTCNT+1
104 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=^TMP("LR7OG",$J,"ABTSEQ",ATSEQ)
105 ;
106 S (ABDCNT,ADSEQ)=0
107 F S ADSEQ=$O(^TMP("LR7OG",$J,"ABDSEQ",ADSEQ)) Q:ADSEQ<1 D
108 . S ABDCNT=ABDCNT+1
109 . S $P(^TMP("LR7OG",$J,"ABDSEQ",ADSEQ),U)=ABDCNT
110 . S OUTCNT=OUTCNT+1
111 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=^TMP("LR7OG",$J,"ABDSEQ",ADSEQ)
112 ;
113 S (ABCNT,ADSEQ)=0
114 F S ADSEQ=$O(^TMP("LR7OG",$J,"ABDATA",ADSEQ)) Q:ADSEQ<1 D
115 . S ADCNT=+^TMP("LR7OG",$J,"ABDSEQ",ADSEQ)
116 . S ATSEQ=0
117 . F S ATSEQ=$O(^TMP("LR7OG",$J,"ABDATA",ADSEQ,ATSEQ)) Q:ATSEQ<1 D
118 . . S ATCNT=+^TMP("LR7OG",$J,"ABTSEQ",ATSEQ)
119 . . S ABCNT=ABCNT+1
120 . . S OUTCNT=OUTCNT+1
121 . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=ADCNT_U_ATCNT_U_^TMP("LR7OG",$J,"ABDATA",ADSEQ,ATSEQ)
122 ;
123 S ^TMP("LR7OGX",$J,"OUTPUT",ABLINE)=ABTCNT_U_ABDCNT_U_ABCNT
124 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,4)=OUTCNT
125 S TESTSEQ=0
126 F S TESTSEQ=$O(^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ)) Q:TESTSEQ<1 D
127 . S SPEC=0
128 . F S SPEC=$O(^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ,SPEC)) Q:SPEC<1 S LINE=^(SPEC) D
129 . . S OUTCNT=OUTCNT+1
130 . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE
131 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,5)=OUTCNT
132 ;
133 S NUM=0
134 F S NUM=$O(^TMP("LR7OG",$J,"COMMENT",NUM)) Q:NUM<1 S LINE=^(NUM) D
135 . S OUTCNT=OUTCNT+1
136 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE
137 K ^TMP("LR7OG",$J)
138 Q
139 ;
140 ;
141TESTSPEC(CHSUB,SPEC,SPECNAME,AGE,SEX) ;
142 N RANGE,TESTNAME,TESTNUM,TESTSEQ,UNITS
143 S TESTSEQ=+$P(^TMP("LR7OG",$J,"TEST",CHSUB),U),TESTNUM=+$P(^(CHSUB),U,2),TESTNAME=$P(^(CHSUB),U,3)
144 I $D(^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ,SPEC)) Q
145 D URANGE^LR7OGU(TESTNUM,SPEC,AGE,SEX,.UNITS,.RANGE)
146 S ^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ,SPEC)=TESTNUM_U_SPECNAME_U_SPEC_U_UNITS_U_$P(RANGE," - ")_U_$P($P(RANGE," - ",2)," (")
147 Q
Note: See TracBrowser for help on using the repository browser.