source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORDV03.m@ 1535

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

initial load of FOIAVistA 6/30/08 version

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