source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORDV03.m@ 619

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

initial load of WorldVistAEHR

File size: 6.8 KB
Line 
1ORDV03 ; slc/dcm - OE/RR Report Extracts ;10/8/03 11:17
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**109,208,215,243**;Dec 17, 1997;Build 242
3RI(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology impression
4 ;External Calls: MAIN^GMTSRAE(1)
5 ;
6 ; ^TMP("GMTSRAD",$J) used via DBIA 4333
7 ; ^TMP("RAE",$J) used via DBIA 3968
8 N ORDT,ORX0,ORJ,ORCNT,GMDATA,GMTSI,GMW,MAX,TEST,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE,GO
9 Q:'$L(OREXT)
10 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
11 Q:'$L($T(@GO))
12 S IOST=$G(IOST),GMTSNDM=$S(+$G(ORMAX)>0:ORMAX,1:999),GMTS2=ORALPHA,GMTS1=OROMEGA
13 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
14 K ^TMP("ORDATA",$J),^TMP("RAE",$J) ;DBIA 3968
15 D @GO
16 S ORDT=GMTS1,ORCNT=0
17 F S ORDT=$O(^TMP("RAE",$J,ORDT)) Q:(ORDT'>0)!(ORDT>GMTS2) D
18 . S ORJ=0 F S ORJ=$O(^TMP("RAE",$J,ORDT,ORJ)) Q:'ORJ I $G(^(ORJ,0)) S ORX0=^(0) D
19 .. S ORCNT=ORCNT+1
20 .. S SITE=$S($L($G(^TMP("RAE",$J,ORDT,ORJ,"facility"))):^("facility"),1:ORSITE)
21 .. S ^TMP("ORDATA",$J,ORCNT,"WP",1)="1^"_SITE ;Station ID
22 .. S ^TMP("ORDATA",$J,ORCNT,"WP",2)="2^"_$$DATE^ORDVU($P(ORX0,U)) ;date
23 .. S ^TMP("ORDATA",$J,ORCNT,"WP",3)="3^"_$P(ORX0,U,2) ;procedure
24 .. S ^TMP("ORDATA",$J,ORCNT,"WP",4)="4^"_$P(ORX0,U,4) ;report status
25 .. S ^TMP("ORDATA",$J,ORCNT,"WP",5)="5^"_$P(ORX0,U,7) ;cpt code
26 .. D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"I")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",6)),6) ;impression
27 .. I $O(^TMP("RAE",$J,ORDT,ORJ,"I",0)) S ^TMP("ORDATA",$J,ORCNT,"WP",8)="8^[+]" ;flag for detail
28 K ^TMP("RAE",$J)
29 S ROOT=$NA(^TMP("ORDATA",$J))
30 Q
31RR(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology report
32 ;External Calls: MAIN^GMTSRAE(2)
33 I $L($T(GCPR^OMGCOAS1)) D ; Call if FHIE station 200
34 . N BEG,END,MAX
35 . Q:'$G(ORALPHA) Q:'$G(OROMEGA)
36 . S MAX=$S(+$G(ORMAX)>0:ORMAX,1:999)
37 . S BEG=9999999-OROMEGA,END=9999999-ORALPHA
38 . D GCPR^OMGCOAS1(DFN,"RR",BEG,END,MAX)
39 N ORDT,ORX0,ORJ,ORCNT,GMDATA,GMTSI,GMW,MAX,TEST,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE,GO,ORMORE
40 Q:'$L(OREXT)
41 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
42 Q:'$L($T(@GO))
43 K ^TMP("ORDATA",$J)
44 S GMTSNDM=$S(+$G(ORMAX)>0:ORMAX,1:999),GMTS1=OROMEGA,GMTS2=ORALPHA
45 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
46 I '$L($T(GCPR^OMGCOAS1)) D
47 . K ^TMP("RAE",$J)
48 . D @GO
49 S ORDT=GMTS1,ORCNT=0
50 F S ORDT=$O(^TMP("RAE",$J,ORDT)) Q:(ORDT'>0) D
51 . S ORJ=0 F S ORJ=$O(^TMP("RAE",$J,ORDT,ORJ)) Q:'ORJ D
52 .. S ORCNT=ORCNT+1,ORMORE=0
53 .. S ORX0=$G(^TMP("RAE",$J,ORDT,ORJ,0))
54 .. S SITE=$S($L($G(^TMP("RAE",$J,ORDT,ORJ,"facility"))):^("facility"),1:ORSITE)
55 .. S ^TMP("ORDATA",$J,ORCNT,"WP",1)="1^"_SITE ;Site ID
56 .. S ^TMP("ORDATA",$J,ORCNT,"WP",2)="2^"_$$DATE^ORDVU($P(ORX0,U)) ;date
57 .. S ^TMP("ORDATA",$J,ORCNT,"WP",3)="3^"_$P(ORX0,U,2) ;procedure
58 .. S ^TMP("ORDATA",$J,ORCNT,"WP",4)="4^"_$S($L($P(ORX0,U,4)):$P(ORX0,U,4),1:"No Report") ;report status
59 .. S ^TMP("ORDATA",$J,ORCNT,"WP",5)="5^"_$P(ORX0,U,7) ;cpt code
60 .. I $O(^TMP("RAE",$J,ORDT,ORJ,"S",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"S")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",6,1)),6) ;reason for study
61 .. I $O(^TMP("RAE",$J,ORDT,ORJ,"H",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"H")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",7,1)),7) ;clinical history
62 .. I $O(^TMP("RAE",$J,ORDT,ORJ,"I",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"I")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",8,1)),8) ;impression
63 .. I $O(^TMP("RAE",$J,ORDT,ORJ,"R",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"R")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",9,1)),9) ;report
64 .. I ORMORE S ^TMP("ORDATA",$J,ORCNT,"WP",10)="10^[+]" ;flag for detail
65 K ^TMP("RAE",$J)
66 S ROOT=$NA(^TMP("ORDATA",$J))
67 Q
68RRDOD(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology report
69 ;External Calls: MAIN^GMTSRAE(2)
70 ;
71 I $L($T(GCPR^OMGCOAS1)) D ; Call if FHIE station 200
72 . N BEG,END,MAX
73 . Q:'$G(ORALPHA) Q:'$G(OROMEGA)
74 . S MAX=$S(+$G(ORMAX)>0:ORMAX,1:999)
75 . S BEG=9999999-OROMEGA,END=9999999-ORALPHA
76 . D GCPR^OMGCOAS1(DFN,"RR",BEG,END,MAX)
77 ;
78 N ORDT,ORX0,ORJ,ORCNT,GMDATA,GMTSI,GMW,MAX,TEST,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE,GO,ORMORE
79 Q:'$L(OREXT)
80 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
81 Q:'$L($T(@GO))
82 K ^TMP("ORDATA",$J)
83 S GMTSNDM=$S(+$G(ORMAX)>0:ORMAX,1:999),GMTS1=OROMEGA,GMTS2=ORALPHA
84 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
85 I '$L($T(GCPR^OMGCOAS1)) D
86 . K ^TMP("RAE",$J)
87 . D @GO
88 S ORDT=GMTS1,ORCNT=0
89 F S ORDT=$O(^TMP("RAE",$J,ORDT)) Q:(ORDT'>0) D
90 . S ORJ=0 F S ORJ=$O(^TMP("RAE",$J,ORDT,ORJ)) Q:'ORJ D
91 .. S ORCNT=ORCNT+1,ORMORE=0
92 .. S ORX0=$G(^TMP("RAE",$J,ORDT,ORJ,0))
93 .. S SITE=$S($L($G(^TMP("RAE",$J,ORDT,ORJ,"facility"))):^("facility"),1:ORSITE)
94 .. S ^TMP("ORDATA",$J,ORCNT,"WP",1)="1^"_SITE ;Site ID
95 .. S ^TMP("ORDATA",$J,ORCNT,"WP",2)="2^"_$$DATE^ORDVU($P(ORX0,U)) ;date
96 .. S ^TMP("ORDATA",$J,ORCNT,"WP",3)="3^"_$P(ORX0,U,2) ;procedure
97 .. S ^TMP("ORDATA",$J,ORCNT,"WP",4)="4^"_$S($L($P(ORX0,U,4)):$P(ORX0,U,4),1:"No Report") ;report status
98 .. S ^TMP("ORDATA",$J,ORCNT,"WP",5)="5^"_$P(ORX0,U,7) ;cpt code
99 .. I $O(^TMP("RAE",$J,ORDT,ORJ,"H",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"H")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",6,1)),6) ;clinical history
100 .. I $O(^TMP("RAE",$J,ORDT,ORJ,"I",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"I")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",7,1)),7) ;impression
101 .. I $O(^TMP("RAE",$J,ORDT,ORJ,"R",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"R")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",8,1)),8) ;report
102 .. I ORMORE S ^TMP("ORDATA",$J,ORCNT,"WP",9)="9^[+]" ;flag for detail
103 K ^TMP("RAE",$J)
104 S ROOT=$NA(^TMP("ORDATA",$J))
105 Q
106RS(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology status
107 ;External calls: GET^GMTSRAD
108 N ORSITE,SITE,CNT,ORDT,ORDA,ORDA2,REC,GMTSEND,GMTSBEG,GO,STAT
109 Q:'$L(OREXT)
110 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
111 Q:'$L($T(@GO))
112 S GMTSBEG=ORDBEG,GMTSEND=ORDEND
113 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
114 K ^TMP("GMTSRAD",$J) ;DBIA 4333
115 D @GO
116 S CNT=0,ORDT=OROMEGA
117 F S ORDT=$O(^TMP("GMTSRAD",$J,ORDT)) Q:(ORDT'>0)!(ORDT>ORALPHA)!(CNT'<ORMAX) D
118 .S ORDA=0
119 .F S ORDA=$O(^TMP("GMTSRAD",$J,ORDT,ORDA)) Q:'ORDA!(CNT'<ORMAX) D
120 ..S ORDA2=0
121 ..F S ORDA2=$O(^TMP("GMTSRAD",$J,ORDT,ORDA,ORDA2)) Q:'ORDA2!(CNT'<ORMAX) S REC=^(ORDA2),STAT=$P(REC,"^",2) D
122 ...S CNT=CNT+1
123 ...S SITE=$S($L($G(^TMP("GMTSRAD",$J,ORDT,ORDA,ORDA2,"facility"))):^("facility"),1:ORSITE)
124 ...S ^TMP("ORDATA",$J,ORDT,"WP",1)="1^"_SITE
125 ...S ^TMP("ORDATA",$J,ORDT,"WP",2)="2^"_$$DATE^ORDVU($P(REC,"^"))
126 ...S ^TMP("ORDATA",$J,ORDT,"WP",3)="3^"_$S(STAT="d":"Discontinued",STAT="c":"Complete",STAT="h":"Hold",STAT="p":"Pending",STAT="a":"Active",STAT="s":"Scheduled",STAT="u":"Unreleased",1:STAT)
127 ...S ^TMP("ORDATA",$J,ORDT,"WP",4)="4^"_$P(REC,"^",3)
128 ...S ^TMP("ORDATA",$J,ORDT,"WP",5)="5^"_$$DATE^ORDVU($P(REC,"^",4))
129 ...S ^TMP("ORDATA",$J,ORDT,"WP",6)="6^"_$P(REC,"^",5)
130 S ROOT=$NA(^TMP("ORDATA",$J))
131 Q
132RAD1 ;Get radiology impression
133 D MAIN^GMTSRAE(1)
134 Q
135RAD2 ;Get radiology report
136 D MAIN^GMTSRAE(2)
137 Q
Note: See TracBrowser for help on using the repository browser.