source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORDV04.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: 8.8 KB
Line 
1ORDV04 ; SLC/DAN - OE/RR ;7/21/04 15:32
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**109,148,160,208,195,241,215,274,256**;Dec 17,1997;Build 5
3 ;OE/RR COMPONENT
4 ;
5 ; ^TMP("GMPLHS",$J) used per DBIA 1183
6 ; ^UTILITY and ^TMP("GMRVD") used per DBIA 10061
7 ;
8ORC(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; Current Orders
9 ;External calls to EN^ORQ1, ^OR(100
10 N ORCNT,ORJ,ORSITE,SITE,ORX0,ORLIST,GO
11 Q:'$L(OREXT)
12 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
13 Q:'$L($T(@GO))
14 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
15 K ^TMP("ORR",$J),^TMP("ORDATA",$J)
16 D @GO
17 I '$D(^TMP("ORR",$J)) Q
18 S ORCNT=0,ORJ=0
19 F S ORJ=$O(^TMP("ORR",$J,ORLIST,ORJ)) Q:'+ORJ!(ORCNT'<ORMAX) S ORX0=^(ORJ) D
20 . S ORCNT=ORCNT+1,SITE=$S($L($G(^TMP("ORR",$J,ORLIST,ORJ,"facility"))):^("facility"),1:ORSITE)
21 . S ^TMP("ORDATA",$J,ORLIST,ORJ,"WP",1)="1^"_SITE ;Station ID
22 . D SPMRG^ORDVU("^TMP(""ORR"","_$J_","""_ORLIST_""","_ORJ_",""TX"")","^TMP(""ORDATA"","_$J_","""_ORLIST_""","_ORJ_",""WP"",2)",2) ;order text
23 . S ^TMP("ORDATA",$J,ORLIST,ORJ,"WP",3)="3^"_$P(ORX0,"^",6) ; status
24 . S ^TMP("ORDATA",$J,ORLIST,ORJ,"WP",4)="4^"_$$DATE^ORDVU($P(ORX0,"^",4)) ;start date
25 . S ^TMP("ORDATA",$J,ORLIST,ORJ,"WP",5)="5^"_$$DATE^ORDVU($P(ORX0,"^",5)) ;stop date
26 . S ^TMP("ORDATA",$J,ORLIST,ORJ,"WP",7)="7^"_$P(^TMP("ORR",$J,ORLIST,ORJ),U) ;Order Number
27 . I $O(^TMP("ORR",$J,ORLIST,ORJ,"TX",1)) S ^TMP("ORDATA",$J,ORLIST,ORJ,"WP",6)="6^[+]" ;flag for details
28 K ^TMP("ORR",$J)
29 S ROOT=$NA(^TMP("ORDATA",$J))
30 Q
31ORCVA ;VA call to get Current Orders
32 N ORVP
33 S ORVP=DFN_";DPT("
34 I '$D(^OR(100,"AC",ORVP)) Q
35 D EN^ORQ1(ORVP,,2,,ORDBEG,ORDEND,1) ;get current orders. ORLIST is set in ORQ1
36 Q
37PLAILALL(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Problem list API returns ALL problems
38 N GO
39 Q:'$L(OREXT)
40 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
41 Q:'$L($T(@GO))
42 D PLAIL
43 Q
44PLALL ;Jump here for All Problems
45 D GETLIST^GMPLHS(DFN,"ALL")
46 Q
47PLAILI(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Problem list API returns INACTIVE problems
48 N GO
49 Q:'$L(OREXT)
50 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
51 Q:'$L($T(@GO))
52 D PLAIL
53 Q
54PLI ;Jump here for Inactive Problems
55 D GETLIST^GMPLHS(DFN,"I")
56 Q
57PLAILA(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Problem list API returns ACTIVE problems
58 N GO
59 Q:'$L(OREXT)
60 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
61 Q:'$L($T(@GO))
62 D PLAIL
63 Q
64PLA ;Jump here for Active Problems
65 D GETLIST^GMPLHS(DFN,"A")
66 Q
67PLAIL ;problems(active, inactive or all)
68 ;External calls to ^GMPLHS
69 ; input:
70 ; STATUS = "A" to produce active problems
71 ; STATUS = "I" to produce inactive problems
72 ; STATUS = "ALL" to produce all problems
73 ;
74 I $L($T(GCPR^OMGCOAS1)) D Q ; Call if FHIE station 200
75 . D GCPR^OMGCOAS1(DFN,"PLL",ORDBEG,ORDEND,ORMAX)
76 . S ROOT=$NA(^TMP("ORDATA",$J))
77 N ORPROBNO,ORXREC0,ORLOC,I,K,X,ORSITE,SITE,ORMORE
78 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
79 K ^TMP("ORDATA",$J),^TMP("GMPLHS",$J) ;DBIA #1183
80 D @GO
81 I '$D(^TMP("GMPLHS",$J)) Q
82 S ORPROBNO=0
83 F I=1:1:ORMAX S ORPROBNO=$O(^TMP("GMPLHS",$J,ORPROBNO)) Q:'ORPROBNO D
84 . S ORXREC0=$G(^TMP("GMPLHS",$J,ORPROBNO,0)),ORMORE=0
85 . S SITE=$S($L($G(^TMP("GMPLHS",$J,ORPROBNO,"facility"))):^("facility"),1:ORSITE)
86 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",1)="1^"_SITE ;Station ID
87 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",2)="2^"_$P(ORXREC0,U,5) ;status
88 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",3)="3^"_$G(^TMP("GMPLHS",$J,ORPROBNO,"N")) ;provider narrative
89 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",4)="4^"_$$DATE^ORDVU($P(ORXREC0,U,6)) ;onset date
90 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",5)="5^"_$$DATE^ORDVU($P(ORXREC0,U,2)) ;last modified date
91 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",6)="6^"_$P(ORXREC0,U,7) ;provider
92 . S ORLOC=0,K=0
93 . F S ORLOC=$O(^TMP("GMPLHS",$J,ORPROBNO,"C",ORLOC)) Q:'ORLOC D
94 .. S X=0
95 .. F S X=$O(^TMP("GMPLHS",$J,ORPROBNO,"C",ORLOC,X)) Q:'X D
96 ... S K=K+1,ORMORE=1
97 ... S ^TMP("ORDATA",$J,ORPROBNO,"WP",7,K)="7^"_$P($G(^TMP("GMPLHS",$J,ORPROBNO,"C",ORLOC,X,0)),U) ;note narrative
98 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",8)="8^"_$P(ORXREC0,U,14) ;exposures
99 . I ORMORE S ^TMP("ORDATA",$J,ORPROBNO,"WP",9)="9^[+]" ;flag for details
100 K ^TMP("GMPLHS",$J)
101 S ROOT=$NA(^TMP("ORDATA",$J))
102 Q
103SR(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Surgery Report
104 ;External call to ^ORDV04A (external calls are noted in that routine)
105 N ORCNT
106 S ORCNT=0
107 K ^TMP("ORDATA",$J)
108 D ENSR^ORDV04A
109 S ROOT=$NA(^TMP("ORDATA",$J))
110 Q
111VS(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; get vital Signs
112 ;External calls to GMRVUT0
113 I $L($T(GCPR^OMGCOAS1)) D Q ; OMGCOAS1 routine only on Station 200
114 . D GCPR^OMGCOAS1(DFN,"VIT",ORDBEG,ORDEND,ORMAX)
115 . S ROOT=$NA(^TMP("ORDATA",$J))
116 N ORDT,I,TYPE,IEN,GMRVSTR,ORSITE,SITE,PLACE,GO
117 Q:'$L(OREXT)
118 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
119 Q:'$L($T(@GO))
120 K ^UTILITY($J,"GMRVD"),^TMP("ORDATA",$J)
121 S GMRVSTR="T;P;R;BP;HT;WT;PN;PO2;CVP;CG",GMRVSTR(0)=ORDBEG_"^"_ORDEND_"^"_ORMAX_"^"_1
122 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
123 D @GO
124 S ORDT=0
125 F I=1:1 S ORDT=$O(^UTILITY($J,"GMRVD",ORDT)) Q:'+ORDT!(I>ORMAX) D ;DBIA 10061
126 . S SITE=$S($L($G(^TMP("GMRVD",$J,ORDT,"facility"))):^("facility"),1:ORSITE) ;DBIA 10061
127 . S ^TMP("ORDATA",$J,"WP",ORDT,1)="1^"_SITE
128 . S ^TMP("ORDATA",$J,"WP",ORDT,2)="2^"_$$DATE^ORDVU(9999999-ORDT) ;date vitals taken
129 . S TYPE=""
130 . F S TYPE=$O(^UTILITY($J,"GMRVD",ORDT,TYPE)) Q:TYPE="" D
131 .. S IEN=$O(^UTILITY($J,"GMRVD",ORDT,TYPE,0)) Q:'IEN
132 .. S PLACE=$S(TYPE="T":3,TYPE="P":4,TYPE="R":5,TYPE="BP":6,TYPE="HT":7,TYPE="WT":8,TYPE="PN":9,TYPE="PO2":10,TYPE="CVP":11,TYPE="CG":12,1:13)
133 .. S ^TMP("ORDATA",$J,"WP",ORDT,PLACE)=PLACE_"^"_$P($G(^UTILITY($J,"GMRVD",ORDT,TYPE,IEN)),"^",8) ;Get value of vitals from global
134 K ^UTILITY($J,"GMRVD")
135 S ROOT=$NA(^TMP("ORDATA",$J))
136 Q
137TIUPRG(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; TIU version of progress reports
138 ;External calls to TIUSRVLO,TIUSRVR1,VASITE
139 I $L($T(GCPR^OMGCOAS1)) D Q ; Call if FHIE station 200
140 . D GCPR^OMGCOAS1(DFN,"PN",ORDBEG,ORDEND,ORMAX)
141 . S ROOT=$NA(^TMP("ORDATA",$J))
142 N ORDT,DATE,ORCI,ORGLOB,ORGLOBA,ORTEMP,ORSITE,SITE,I,ORNODE,GO,ORIMAG
143 Q:'$L(OREXT)
144 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
145 Q:'$L($T(@GO))
146 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
147 D @GO
148 I '$D(@ORGLOB) Q
149 S ORNODE=0,ORCI=0
150 K ^TMP("ORDATA",$J)
151 F S ORNODE=$O(@ORGLOB@(ORNODE)) Q:'ORNODE!(ORCI'<ORMAX) D
152 . S ORTEMP=@ORGLOB@(ORNODE)
153 . S ORIMAG=$P($$RESOLVE^TIUSRVLO($P(ORTEMP,U)),U,10)
154 . S DATE=$P(ORTEMP,U,3) ;date
155 . S SITE=$S($L($G(@ORGLOB@(ORNODE,"facility"))):^("facility"),1:ORSITE)
156 . S ^TMP("ORDATA",$J,ORNODE,"WP",1)="1^"_SITE ;Station ID
157 . S ^TMP("ORDATA",$J,ORNODE,"WP",2)="2^"_$P(ORTEMP,U) ;TIU ien
158 . S ^TMP("ORDATA",$J,ORNODE,"WP",3)="3^"_$$DATE^ORDVU(DATE) ;date
159 . S ^TMP("ORDATA",$J,ORNODE,"WP",4)="4^"_$P(ORTEMP,U,2) ;type
160 . S ^TMP("ORDATA",$J,ORNODE,"WP",5)="5^"_$P($P(ORTEMP,U,5),";",2) ;author
161 . S ORCI=ORCI+1
162 . D TGET^TIUSRVR1(.ORGLOBA,$P(ORTEMP,U)) ;Call back to get note text
163 . D SPMRG^ORDVU($NA(@ORGLOBA),$NA(^TMP("ORDATA",$J,ORNODE,"WP",6)),6) ;Notes Text
164 . I $O(@ORGLOBA@(0)) S ^TMP("ORDATA",$J,ORNODE,"WP",7)="7^[+]"
165 . S ^TMP("ORDATA",$J,ORNODE,"WP",8)="8^"_ORIMAG
166 . K @ORGLOBA
167 K @ORGLOB
168 S ROOT=$NA(^TMP("ORDATA",$J))
169 Q
170TPRG ;Jump here for Tiu Progress Notes
171 D CONTEXT^TIUSRVLO(.ORGLOB,3,5,DFN,ORDBEG,ORDEND,,ORMAX)
172 Q
173TIUDCS(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; Discharge Summaries
174 ;External calls to VASITE, DIQ1, TIUSRVLO
175 I $L($T(GCPR^OMGCOAS1)) D Q ; Call if FHIE station 200
176 . D GCPR^OMGCOAS1(DFN,"DS",ORDBEG,ORDEND,ORMAX)
177 . S ROOT=$NA(^TMP("ORDATA",$J))
178 N ORGLOB,ORGLOBA,ORI,ORNODE,ORICDIEN,ORARRAY,ORTEMP,ORSITE,SITE,DIC,DR,DIQ,DA,GO
179 Q:'$L(OREXT)
180 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
181 Q:'$L($T(@GO))
182 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
183 D @GO
184 I '$D(@ORGLOB) Q
185 K ^TMP("ORDATA",$J)
186 S ORNODE=0,ORI=0
187 F S ORNODE=$O(@ORGLOB@(ORNODE)) Q:'ORNODE!(ORI'<ORMAX) D
188 . S ORTEMP=@ORGLOB@(ORNODE)
189 . S SITE=$S($L($G(@ORGLOB@(ORNODE,"facility"))):^("facility"),1:ORSITE)
190 . S ^TMP("ORDATA",$J,ORNODE,"WP",1)="1^"_SITE ;Station ID
191 . K ORARRAY S DIC=8925,DA=$P(ORTEMP,U),DR=".05;.07;.08;1202;1502",DIQ="ORARRAY"
192 . D EN^DIQ1
193 . S DIQ="ORARRAY(8925,"_DA_")"
194 . S ^TMP("ORDATA",$J,ORNODE,"WP",2)="2^"_$$DATEMMM^ORDVU($G(@DIQ@(.07))) ;episode begin date/time
195 . S ^TMP("ORDATA",$J,ORNODE,"WP",3)="3^"_$$DATEMMM^ORDVU($G(@DIQ@(.08))) ;episode end date/time
196 . S ^TMP("ORDATA",$J,ORNODE,"WP",4)="4^"_$G(@DIQ@(1202)) ;author/dicator
197 . S ^TMP("ORDATA",$J,ORNODE,"WP",5)="5^"_$G(@DIQ@(1502)) ;signed by
198 . S ^TMP("ORDATA",$J,ORNODE,"WP",6)="6^"_$G(@DIQ@(.05)) ;status
199 . S ORI=ORI+1
200 . D TGET^TIUSRVR1(.ORGLOBA,$P(ORTEMP,U)) ;Call back to get summary text
201 . D SPMRG^ORDVU($NA(@ORGLOBA),$NA(^TMP("ORDATA",$J,ORNODE,"WP",7)),7) ;summary Text
202 . I $O(@ORGLOBA@(0)) S ^TMP("ORDATA",$J,ORNODE,"WP",8)="8^[+]" ;detail flag
203 . K @ORGLOBA
204 K @ORGLOB
205 S ROOT=$NA(^TMP("ORDATA",$J))
206 Q
207TDCS ;Jump here for TIU Discharge Summary
208 D CONTEXT^TIUSRVLO(.ORGLOB,244,5,DFN,ORDBEG,ORDEND,,ORMAX)
209 Q
Note: See TracBrowser for help on using the repository browser.