source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORDV04.m@ 1375

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

revised back to 6/30/08 version

File size: 8.7 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**;Dec 17,1997;Build 20
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 N ORPROBNO,ORXREC0,ORLOC,I,K,X,ORSITE,SITE,ORMORE
75 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
76 K ^TMP("ORDATA",$J),^TMP("GMPLHS",$J) ;DBIA #1183
77 D @GO
78 I '$D(^TMP("GMPLHS",$J)) Q
79 S ORPROBNO=0
80 F I=1:1:ORMAX S ORPROBNO=$O(^TMP("GMPLHS",$J,ORPROBNO)) Q:'ORPROBNO D
81 . S ORXREC0=$G(^TMP("GMPLHS",$J,ORPROBNO,0)),ORMORE=0
82 . S SITE=$S($L($G(^TMP("GMPLHS",$J,ORPROBNO,"facility"))):^("facility"),1:ORSITE)
83 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",1)="1^"_SITE ;Station ID
84 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",2)="2^"_$P(ORXREC0,U,5) ;status
85 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",3)="3^"_$G(^TMP("GMPLHS",$J,ORPROBNO,"N")) ;provider narrative
86 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",4)="4^"_$$DATE^ORDVU($P(ORXREC0,U,6)) ;onset date
87 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",5)="5^"_$$DATE^ORDVU($P(ORXREC0,U,2)) ;last modified date
88 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",6)="6^"_$P(ORXREC0,U,7) ;provider
89 . S ORLOC=0,K=0
90 . F S ORLOC=$O(^TMP("GMPLHS",$J,ORPROBNO,"C",ORLOC)) Q:'ORLOC D
91 .. S X=0
92 .. F S X=$O(^TMP("GMPLHS",$J,ORPROBNO,"C",ORLOC,X)) Q:'X D
93 ... S K=K+1,ORMORE=1
94 ... S ^TMP("ORDATA",$J,ORPROBNO,"WP",7,K)="7^"_$P($G(^TMP("GMPLHS",$J,ORPROBNO,"C",ORLOC,X,0)),U) ;note narrative
95 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",8)="8^"_$P(ORXREC0,U,14) ;exposures
96 . I ORMORE S ^TMP("ORDATA",$J,ORPROBNO,"WP",9)="9^[+]" ;flag for details
97 K ^TMP("GMPLHS",$J)
98 S ROOT=$NA(^TMP("ORDATA",$J))
99 Q
100SR(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Surgery Report
101 ;External call to ^ORDV04A (external calls are noted in that routine)
102 N ORCNT
103 S ORCNT=0
104 K ^TMP("ORDATA",$J)
105 D ENSR^ORDV04A
106 S ROOT=$NA(^TMP("ORDATA",$J))
107 Q
108VS(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; get vital Signs
109 ;External calls to GMRVUT0
110 I $L($T(GCPR^OMGCOAS1)) D Q ; OMGCOAS1 routine only on Station 200
111 . D GCPR^OMGCOAS1(DFN,"VIT",ORDBEG,ORDEND,ORMAX)
112 . S ROOT=$NA(^TMP("ORDATA",$J))
113 N ORDT,I,TYPE,IEN,GMRVSTR,ORSITE,SITE,PLACE,GO
114 Q:'$L(OREXT)
115 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
116 Q:'$L($T(@GO))
117 K ^UTILITY($J,"GMRVD"),^TMP("ORDATA",$J)
118 S GMRVSTR="T;P;R;BP;HT;WT;PN;PO2;CVP;CG",GMRVSTR(0)=ORDBEG_"^"_ORDEND_"^"_ORMAX_"^"_1
119 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
120 D @GO
121 S ORDT=0
122 F I=1:1 S ORDT=$O(^UTILITY($J,"GMRVD",ORDT)) Q:'+ORDT!(I>ORMAX) D ;DBIA 10061
123 . S SITE=$S($L($G(^TMP("GMRVD",$J,ORDT,"facility"))):^("facility"),1:ORSITE) ;DBIA 10061
124 . S ^TMP("ORDATA",$J,"WP",ORDT,1)="1^"_SITE
125 . S ^TMP("ORDATA",$J,"WP",ORDT,2)="2^"_$$DATE^ORDVU(9999999-ORDT) ;date vitals taken
126 . S TYPE=""
127 . F S TYPE=$O(^UTILITY($J,"GMRVD",ORDT,TYPE)) Q:TYPE="" D
128 .. S IEN=$O(^UTILITY($J,"GMRVD",ORDT,TYPE,0)) Q:'IEN
129 .. 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)
130 .. S ^TMP("ORDATA",$J,"WP",ORDT,PLACE)=PLACE_"^"_$P($G(^UTILITY($J,"GMRVD",ORDT,TYPE,IEN)),"^",8) ;Get value of vitals from global
131 K ^UTILITY($J,"GMRVD")
132 S ROOT=$NA(^TMP("ORDATA",$J))
133 Q
134TIUPRG(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; TIU version of progress reports
135 ;External calls to TIUSRVLO,TIUSRVR1,VASITE
136 I $L($T(GCPR^OMGCOAS1)) D Q ; Call if FHIE station 200
137 . D GCPR^OMGCOAS1(DFN,"PN",ORDBEG,ORDEND,ORMAX)
138 . S ROOT=$NA(^TMP("ORDATA",$J))
139 N ORDT,DATE,ORCI,ORGLOB,ORGLOBA,ORTEMP,ORSITE,SITE,I,ORNODE,GO,ORIMAG
140 Q:'$L(OREXT)
141 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
142 Q:'$L($T(@GO))
143 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
144 D @GO
145 I '$D(@ORGLOB) Q
146 S ORNODE=0,ORCI=0
147 K ^TMP("ORDATA",$J)
148 F S ORNODE=$O(@ORGLOB@(ORNODE)) Q:'ORNODE!(ORCI'<ORMAX) D
149 . S ORTEMP=@ORGLOB@(ORNODE)
150 . S ORIMAG=$P($$RESOLVE^TIUSRVLO($P(ORTEMP,U)),U,10)
151 . S DATE=$P(ORTEMP,U,3) ;date
152 . S SITE=$S($L($G(@ORGLOB@(ORNODE,"facility"))):^("facility"),1:ORSITE)
153 . S ^TMP("ORDATA",$J,ORNODE,"WP",1)="1^"_SITE ;Station ID
154 . S ^TMP("ORDATA",$J,ORNODE,"WP",2)="2^"_$P(ORTEMP,U) ;TIU ien
155 . S ^TMP("ORDATA",$J,ORNODE,"WP",3)="3^"_$$DATE^ORDVU(DATE) ;date
156 . S ^TMP("ORDATA",$J,ORNODE,"WP",4)="4^"_$P(ORTEMP,U,2) ;type
157 . S ^TMP("ORDATA",$J,ORNODE,"WP",5)="5^"_$P($P(ORTEMP,U,5),";",2) ;author
158 . S ORCI=ORCI+1
159 . D TGET^TIUSRVR1(.ORGLOBA,$P(ORTEMP,U)) ;Call back to get note text
160 . D SPMRG^ORDVU($NA(@ORGLOBA),$NA(^TMP("ORDATA",$J,ORNODE,"WP",6)),6) ;Notes Text
161 . I $O(@ORGLOBA@(0)) S ^TMP("ORDATA",$J,ORNODE,"WP",7)="7^[+]"
162 . S ^TMP("ORDATA",$J,ORNODE,"WP",8)="8^"_ORIMAG
163 . K @ORGLOBA
164 K @ORGLOB
165 S ROOT=$NA(^TMP("ORDATA",$J))
166 Q
167TPRG ;Jump here for Tiu Progress Notes
168 D CONTEXT^TIUSRVLO(.ORGLOB,3,5,DFN,ORDBEG,ORDEND,,ORMAX)
169 Q
170TIUDCS(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; Discharge Summaries
171 ;External calls to VASITE, DIQ1, TIUSRVLO
172 I $L($T(GCPR^OMGCOAS1)) D Q ; Call if FHIE station 200
173 . D GCPR^OMGCOAS1(DFN,"DS",ORDBEG,ORDEND,ORMAX)
174 . S ROOT=$NA(^TMP("ORDATA",$J))
175 N ORGLOB,ORGLOBA,ORI,ORNODE,ORICDIEN,ORARRAY,ORTEMP,ORSITE,SITE,DIC,DR,DIQ,DA,GO
176 Q:'$L(OREXT)
177 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
178 Q:'$L($T(@GO))
179 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
180 D @GO
181 I '$D(@ORGLOB) Q
182 K ^TMP("ORDATA",$J)
183 S ORNODE=0,ORI=0
184 F S ORNODE=$O(@ORGLOB@(ORNODE)) Q:'ORNODE!(ORI'<ORMAX) D
185 . S ORTEMP=@ORGLOB@(ORNODE)
186 . S SITE=$S($L($G(@ORGLOB@(ORNODE,"facility"))):^("facility"),1:ORSITE)
187 . S ^TMP("ORDATA",$J,ORNODE,"WP",1)="1^"_SITE ;Station ID
188 . K ORARRAY S DIC=8925,DA=$P(ORTEMP,U),DR=".05;.07;.08;1202;1502",DIQ="ORARRAY"
189 . D EN^DIQ1
190 . S DIQ="ORARRAY(8925,"_DA_")"
191 . S ^TMP("ORDATA",$J,ORNODE,"WP",2)="2^"_$$DATEMMM^ORDVU($G(@DIQ@(.07))) ;episode begin date/time
192 . S ^TMP("ORDATA",$J,ORNODE,"WP",3)="3^"_$$DATEMMM^ORDVU($G(@DIQ@(.08))) ;episode end date/time
193 . S ^TMP("ORDATA",$J,ORNODE,"WP",4)="4^"_$G(@DIQ@(1202)) ;author/dicator
194 . S ^TMP("ORDATA",$J,ORNODE,"WP",5)="5^"_$G(@DIQ@(1502)) ;signed by
195 . S ^TMP("ORDATA",$J,ORNODE,"WP",6)="6^"_$G(@DIQ@(.05)) ;status
196 . S ORI=ORI+1
197 . D TGET^TIUSRVR1(.ORGLOBA,$P(ORTEMP,U)) ;Call back to get summary text
198 . D SPMRG^ORDVU($NA(@ORGLOBA),$NA(^TMP("ORDATA",$J,ORNODE,"WP",7)),7) ;summary Text
199 . I $O(@ORGLOBA@(0)) S ^TMP("ORDATA",$J,ORNODE,"WP",8)="8^[+]" ;detail flag
200 . K @ORGLOBA
201 K @ORGLOB
202 S ROOT=$NA(^TMP("ORDATA",$J))
203 Q
204TDCS ;Jump here for TIU Discharge Summary
205 D CONTEXT^TIUSRVLO(.ORGLOB,244,5,DFN,ORDBEG,ORDEND,,ORMAX)
206 Q
Note: See TracBrowser for help on using the repository browser.