source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORDV04.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: 7.4 KB
Line 
1ORDV04 ; SLC/DAN/dcm - OE/RR ;7/21/04 15:32
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**109,148,160,208,195,241,215,274,256,243**;Dec 17,1997;Build 242
3 ;OE/RR COMPONENT
4 ;
5 ; ^TMP("GMPLHS",$J) DBIA 1183
6 ; ^UTILITY & ^TMP("GMRVD") DBIA 10061
7 ;
8ORC(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; Current Orders
9 ;Calls 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 ;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 ;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 ;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 ;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" active problems
71 ; STATUS = "I" inactive problems
72 ; STATUS = "ALL" all problems
73 ;
74 I $L($T(GCPR^OMGCOAS1)) D Q ; Call if FHIE station 200
75 . S ORDBEG=0,ORDEND=9999999,ORMAX=99999
76 . D GCPR^OMGCOAS1(DFN,"PLL",ORDBEG,ORDEND,ORMAX)
77 . S ROOT=$NA(^TMP("ORDATA",$J))
78 N ORPROBNO,ORXREC0,ORLOC,I,K,X,ORSITE,SITE,ORMORE
79 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
80 K ^TMP("ORDATA",$J),^TMP("GMPLHS",$J) ;DBIA #1183
81 D @GO
82 I '$D(^TMP("GMPLHS",$J)) Q
83 S ORPROBNO=0
84 F I=1:1 S ORPROBNO=$O(^TMP("GMPLHS",$J,ORPROBNO)) Q:'ORPROBNO D
85 . S ORXREC0=$G(^TMP("GMPLHS",$J,ORPROBNO,0)),ORMORE=0
86 . S SITE=$S($L($G(^TMP("GMPLHS",$J,ORPROBNO,"facility"))):^("facility"),1:ORSITE)
87 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",1)="1^"_SITE ;Station ID
88 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",2)="2^"_$P(ORXREC0,U,5) ;status
89 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",3)="3^"_$G(^TMP("GMPLHS",$J,ORPROBNO,"N")) ;provider narrative
90 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",4)="4^"_$$DATE^ORDVU($P(ORXREC0,U,6)) ;onset date
91 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",5)="5^"_$$DATE^ORDVU($P(ORXREC0,U,2)) ;last modified date
92 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",6)="6^"_$P(ORXREC0,U,7) ;provider
93 . S ORLOC=0,K=0
94 . F S ORLOC=$O(^TMP("GMPLHS",$J,ORPROBNO,"C",ORLOC)) Q:'ORLOC D
95 .. S X=0
96 .. F S X=$O(^TMP("GMPLHS",$J,ORPROBNO,"C",ORLOC,X)) Q:'X D
97 ... S K=K+1,ORMORE=1
98 ... S ^TMP("ORDATA",$J,ORPROBNO,"WP",7,K)="7^"_$P($G(^TMP("GMPLHS",$J,ORPROBNO,"C",ORLOC,X,0)),U) ;note narrative
99 . S ^TMP("ORDATA",$J,ORPROBNO,"WP",8)="8^"_$P(ORXREC0,U,14) ;exposures
100 . I ORMORE S ^TMP("ORDATA",$J,ORPROBNO,"WP",9)="9^[+]" ;flag for details
101 K ^TMP("GMPLHS",$J)
102 S ROOT=$NA(^TMP("ORDATA",$J))
103 Q
104SR(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Surgery Report
105 ;Call ^ORDV04A
106 N ORCNT
107 S ORCNT=0
108 K ^TMP("ORDATA",$J)
109 D ENSR^ORDV04A
110 S ROOT=$NA(^TMP("ORDATA",$J))
111 Q
112VS(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; get vital Signs
113 D VS^ORDV04A
114 Q
115TIUPRG(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; TIU version of progress reports
116 ;Calls to TIUSRVLO,TIUSRVR1,VASITE
117 I $L($T(GCPR^OMGCOAS1)) D Q ; Call if FHIE station 200
118 . D GCPR^OMGCOAS1(DFN,"PN",ORDBEG,ORDEND,ORMAX)
119 . S ROOT=$NA(^TMP("ORDATA",$J))
120 N ORDT,DATE,ORCI,ORGLOB,ORGLOBA,ORTEMP,ORSITE,SITE,I,ORNODE,GO,ORIMAG
121 Q:'$L(OREXT)
122 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
123 Q:'$L($T(@GO))
124 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
125 D @GO
126 I '$D(@ORGLOB) Q
127 S ORNODE=0,ORCI=0
128 K ^TMP("ORDATA",$J)
129 F S ORNODE=$O(@ORGLOB@(ORNODE)) Q:'ORNODE!(ORCI'<ORMAX) D
130 . S ORTEMP=@ORGLOB@(ORNODE)
131 . S ORIMAG=$P($$RESOLVE^TIUSRVLO($P(ORTEMP,U)),U,10)
132 . S DATE=$P(ORTEMP,U,3) ;date
133 . S SITE=$S($L($G(@ORGLOB@(ORNODE,"facility"))):^("facility"),1:ORSITE)
134 . S ^TMP("ORDATA",$J,ORNODE,"WP",1)="1^"_SITE ;Station ID
135 . S ^TMP("ORDATA",$J,ORNODE,"WP",2)="2^"_$P(ORTEMP,U) ;TIU ien
136 . S ^TMP("ORDATA",$J,ORNODE,"WP",3)="3^"_$$DATE^ORDVU(DATE) ;date
137 . S ^TMP("ORDATA",$J,ORNODE,"WP",4)="4^"_$P(ORTEMP,U,2) ;type
138 . S ^TMP("ORDATA",$J,ORNODE,"WP",5)="5^"_$P($P(ORTEMP,U,5),";",2) ;author
139 . S ORCI=ORCI+1
140 . D TGET^TIUSRVR1(.ORGLOBA,$P(ORTEMP,U)) ;Call back to get note text
141 . D SPMRG^ORDVU($NA(@ORGLOBA),$NA(^TMP("ORDATA",$J,ORNODE,"WP",6)),6) ;Notes Text
142 . I $O(@ORGLOBA@(0)) S ^TMP("ORDATA",$J,ORNODE,"WP",7)="7^[+]"
143 . S ^TMP("ORDATA",$J,ORNODE,"WP",8)="8^"_ORIMAG
144 . K @ORGLOBA
145 K @ORGLOB
146 S ROOT=$NA(^TMP("ORDATA",$J))
147 Q
148TPRG ;TIU Progress Notes
149 D CONTEXT^TIUSRVLO(.ORGLOB,3,5,DFN,ORDBEG,ORDEND,,ORMAX)
150 Q
151TIUDCS(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; Discharge Summaries
152 ;Calls VASITE, DIQ1, TIUSRVLO
153 I $L($T(GCPR^OMGCOAS1)) D Q ; Call if FHIE station 200
154 . D GCPR^OMGCOAS1(DFN,"DS",ORDBEG,ORDEND,ORMAX)
155 . S ROOT=$NA(^TMP("ORDATA",$J))
156 N ORGLOB,ORGLOBA,ORI,ORNODE,ORICDIEN,ORARRAY,ORTEMP,ORSITE,SITE,DIC,DR,DIQ,DA,GO
157 Q:'$L(OREXT)
158 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
159 Q:'$L($T(@GO))
160 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
161 D @GO
162 I '$D(@ORGLOB) Q
163 K ^TMP("ORDATA",$J)
164 S ORNODE=0,ORI=0
165 F S ORNODE=$O(@ORGLOB@(ORNODE)) Q:'ORNODE!(ORI'<ORMAX) D
166 . S ORTEMP=@ORGLOB@(ORNODE)
167 . S SITE=$S($L($G(@ORGLOB@(ORNODE,"facility"))):^("facility"),1:ORSITE)
168 . S ^TMP("ORDATA",$J,ORNODE,"WP",1)="1^"_SITE ;Station ID
169 . K ORARRAY S DIC=8925,DA=$P(ORTEMP,U),DR=".05;.07;.08;1202;1502",DIQ="ORARRAY"
170 . D EN^DIQ1
171 . S DIQ="ORARRAY(8925,"_DA_")"
172 . S ^TMP("ORDATA",$J,ORNODE,"WP",2)="2^"_$$DATEMMM^ORDVU($G(@DIQ@(.07))) ;episode begin date/time
173 . S ^TMP("ORDATA",$J,ORNODE,"WP",3)="3^"_$$DATEMMM^ORDVU($G(@DIQ@(.08))) ;episode end date/time
174 . S ^TMP("ORDATA",$J,ORNODE,"WP",4)="4^"_$G(@DIQ@(1202)) ;author/dicator
175 . S ^TMP("ORDATA",$J,ORNODE,"WP",5)="5^"_$G(@DIQ@(1502)) ;signed by
176 . S ^TMP("ORDATA",$J,ORNODE,"WP",6)="6^"_$G(@DIQ@(.05)) ;status
177 . S ORI=ORI+1
178 . D TGET^TIUSRVR1(.ORGLOBA,$P(ORTEMP,U)) ;Call to get summary text
179 . D SPMRG^ORDVU($NA(@ORGLOBA),$NA(^TMP("ORDATA",$J,ORNODE,"WP",7)),7) ;summary Text
180 . I $O(@ORGLOBA@(0)) S ^TMP("ORDATA",$J,ORNODE,"WP",8)="8^[+]" ;detail flag
181 . K @ORGLOBA
182 K @ORGLOB
183 S ROOT=$NA(^TMP("ORDATA",$J))
184 Q
185TDCS ;TIU Discharge Summary
186 D CONTEXT^TIUSRVLO(.ORGLOB,244,5,DFN,ORDBEG,ORDEND,,ORMAX)
187 Q
Note: See TracBrowser for help on using the repository browser.