- Timestamp:
- Dec 4, 2009, 12:11:15 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ0P.m
r613 r623 1 OCXOZ0P ;SLC/RJS,CLA - Order Check Scan ;NOV 8,2009 at 18:442 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,221,243**;Dec 17,1997;Build 242 3 4 5 6 7 8 9 10 11 12 13 R24R1B 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 R28R1A 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 R28R1B 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 R32R1A 93 94 95 96 97 98 99 100 101 102 103 104 105 R32R1B 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 CKSUM(STR) 138 139 140 141 142 143 144 GETDATA(DFN,OCXL,OCXDFI) 145 146 147 148 149 150 MCE42() 151 152 153 154 155 156 157 158 159 MCE60() 160 161 162 163 164 165 166 167 MCE61() 168 169 170 171 172 173 174 175 NEWRULE(OCXDFN,OCXORD,OCXRUL,OCXREL,OCXNOTF,OCXMESS) 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 SETAP(ROOT,DD,DATA,DA) 237 238 239 240 241 242 243 1 OCXOZ0P ;SLC/RJS,CLA - Order Check Scan ;DEC 27,2007 at 06:00 2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,221**;Dec 17,1997 3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998 4 ; 5 ; *************************************************************** 6 ; ** Warning: This routine is automatically generated by the ** 7 ; ** Rule Compiler (^OCXOCMP) and ANY changes to this routine ** 8 ; ** will be lost the next time the rule compiler executes. ** 9 ; *************************************************************** 10 ; 11 Q 12 ; 13 R24R1B ; Send Order Check, Notication messages and/or Execute code for Rule #24 'ORDERER FLAGGED RESULTS AVAILABLE' Relation #1 'ORDER FLAGGED FOR RESULTS AND (LAB RESULT OR IMAGI...' 14 ; Called from R24R1A+14^OCXOZ0O. 15 ; 16 Q:$G(OCXOERR) 17 ; 18 ; Local Extrinsic Functions 19 ; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE 20 ; NEWRULE( ---------> NEW RULE MESSAGE 21 ; 22 Q:$D(OCXRULE("R24R1B")) 23 ; 24 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD 25 S OCXCMSG="" 26 S OCXNMSG="Requested results available: "_$$GETDATA(DFN,"5^49^55^101",96) 27 ; 28 Q:$G(OCXOERR) 29 ; 30 ; Send Notification 31 ; 32 S (OCXDUZ,OCXDATA)="",OCXNUM=0 33 I ($G(OCXOSRC)="GENERIC HL7 MESSAGE ARRAY") D 34 .S OCXDATA=$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",2))_"|"_$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",3)) 35 .S OCXDATA=$TR(OCXDATA,"^","@"),OCXNUM=+OCXDATA 36 I ($G(OCXOSRC)="CPRS ORDER PROTOCOL") D 37 .I $P($G(OCXORD),U,3) S OCXDUZ(+$P(OCXORD,U,3))="" 38 .S OCXNUM=+$P(OCXORD,U,2) 39 S:($G(OCXOSRC)="CPRS ORDER PRESCAN") OCXNUM=+$P(OCXPSD,"|",5) 40 S OCXRULE("R24R1B")="" 41 I $$NEWRULE(DFN,OCXNUM,24,1,33,OCXNMSG) D I 1 42 .D:($G(OCXTRACE)<5) EN^ORB3(33,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA) 43 Q 44 ; 45 R28R1A ; Verify all Event/Elements of Rule #28 'STAT ORDER PLACED' Relation #1 'NEW OBR STAT OR NEW ORC STAT' 46 ; Called from EL60+5^OCXOZ0H, and EL61+5^OCXOZ0H. 47 ; 48 Q:$G(OCXOERR) 49 ; 50 ; Local Extrinsic Functions 51 ; MCE60( -----------> Verify Event/Element: 'NEW OBR STAT ORDER' 52 ; MCE61( -----------> Verify Event/Element: 'NEW ORC STAT ORDER' 53 ; 54 Q:$G(^OCXS(860.2,28,"INACT")) 55 ; 56 I $$MCE60 D R28R1B 57 I $$MCE61 D R28R1B 58 Q 59 ; 60 R28R1B ; Send Order Check, Notication messages and/or Execute code for Rule #28 'STAT ORDER PLACED' Relation #1 'NEW OBR STAT OR NEW ORC STAT' 61 ; Called from R28R1A+11. 62 ; 63 Q:$G(OCXOERR) 64 ; 65 ; Local Extrinsic Functions 66 ; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE 67 ; NEWRULE( ---------> NEW RULE MESSAGE 68 ; 69 Q:$D(OCXRULE("R28R1B")) 70 ; 71 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD 72 S OCXCMSG="" 73 S OCXNMSG="STAT order: "_$$GETDATA(DFN,"60^61",96) 74 ; 75 Q:$G(OCXOERR) 76 ; 77 ; Send Notification 78 ; 79 S (OCXDUZ,OCXDATA)="",OCXNUM=0 80 I ($G(OCXOSRC)="GENERIC HL7 MESSAGE ARRAY") D 81 .S OCXDATA=$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",2))_"|"_$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",3)) 82 .S OCXDATA=$TR(OCXDATA,"^","@"),OCXNUM=+OCXDATA 83 I ($G(OCXOSRC)="CPRS ORDER PROTOCOL") D 84 .I $P($G(OCXORD),U,3) S OCXDUZ(+$P(OCXORD,U,3))="" 85 .S OCXNUM=+$P(OCXORD,U,2) 86 S:($G(OCXOSRC)="CPRS ORDER PRESCAN") OCXNUM=+$P(OCXPSD,"|",5) 87 S OCXRULE("R28R1B")="" 88 I $$NEWRULE(DFN,OCXNUM,28,1,43,OCXNMSG) D I 1 89 .D:($G(OCXTRACE)<5) EN^ORB3(43,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA) 90 Q 91 ; 92 R32R1A ; Verify all Event/Elements of Rule #32 'PATIENT TRANSFERRED FROM PSYCHIATRY TO A...' Relation #1 'FROM PSYCH WARD' 93 ; Called from EL42+5^OCXOZ0H. 94 ; 95 Q:$G(OCXOERR) 96 ; 97 ; Local Extrinsic Functions 98 ; MCE42( -----------> Verify Event/Element: 'PATIENT TRANSFERRED FROM PSYCH WARD' 99 ; 100 Q:$G(^OCXS(860.2,32,"INACT")) 101 ; 102 I $$MCE42 D R32R1B 103 Q 104 ; 105 R32R1B ; Send Order Check, Notication messages and/or Execute code for Rule #32 'PATIENT TRANSFERRED FROM PSYCHIATRY TO A...' Relation #1 'FROM PSYCH WARD' 106 ; Called from R32R1A+10. 107 ; 108 Q:$G(OCXOERR) 109 ; 110 ; Local Extrinsic Functions 111 ; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE 112 ; NEWRULE( ---------> NEW RULE MESSAGE 113 ; 114 Q:$D(OCXRULE("R32R1B")) 115 ; 116 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD 117 S OCXCMSG="" 118 S OCXNMSG="Transfer from Psych ward: "_$$GETDATA(DFN,"42^",95)_" to ward: "_$$GETDATA(DFN,"42^",90) 119 ; 120 Q:$G(OCXOERR) 121 ; 122 ; Send Notification 123 ; 124 S (OCXDUZ,OCXDATA)="",OCXNUM=0 125 I ($G(OCXOSRC)="GENERIC HL7 MESSAGE ARRAY") D 126 .S OCXDATA=$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",2))_"|"_$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",3)) 127 .S OCXDATA=$TR(OCXDATA,"^","@"),OCXNUM=+OCXDATA 128 I ($G(OCXOSRC)="CPRS ORDER PROTOCOL") D 129 .I $P($G(OCXORD),U,3) S OCXDUZ(+$P(OCXORD,U,3))="" 130 .S OCXNUM=+$P(OCXORD,U,2) 131 S:($G(OCXOSRC)="CPRS ORDER PRESCAN") OCXNUM=+$P(OCXPSD,"|",5) 132 S OCXRULE("R32R1B")="" 133 I $$NEWRULE(DFN,OCXNUM,32,1,36,OCXNMSG) D I 1 134 .D:($G(OCXTRACE)<5) EN^ORB3(36,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA) 135 Q 136 ; 137 CKSUM(STR) ; Compiler Function: GENERATE STRING CHECKSUM 138 ; 139 N CKSUM,PTR,ASC S CKSUM=0 140 S STR=$TR(STR,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ") 141 F PTR=$L(STR):-1:1 S ASC=$A(STR,PTR)-42 I (ASC>0),(ASC<51) S CKSUM=CKSUM*2+ASC 142 Q +CKSUM 143 ; 144 GETDATA(DFN,OCXL,OCXDFI) ; This Local Extrinsic Function returns runtime data 145 ; 146 N OCXE,VAL,PC S VAL="" 147 F PC=1:1:$L(OCXL,U) S OCXE=$P(OCXL,U,PC) I OCXE S VAL=$G(^TMP("OCXCHK",$J,DFN,OCXE,OCXDFI)) Q:$L(VAL) 148 Q VAL 149 ; 150 MCE42() ; Verify Event/Element: PATIENT TRANSFERRED FROM PSYCH WARD 151 ; 152 ; OCXDF(37) -> PATIENT IEN data field 153 ; 154 N OCXRES 155 S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(42,37)=OCXDF(37) 156 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),42)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),42)) 157 Q 0 158 ; 159 MCE60() ; Verify Event/Element: NEW OBR STAT ORDER 160 ; 161 ; 162 N OCXRES 163 I $L(OCXDF(37)) S OCXRES(60,37)=OCXDF(37) 164 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),60)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),60)) 165 Q 0 166 ; 167 MCE61() ; Verify Event/Element: NEW ORC STAT ORDER 168 ; 169 ; 170 N OCXRES 171 I $L(OCXDF(37)) S OCXRES(61,37)=OCXDF(37) 172 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),61)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),61)) 173 Q 0 174 ; 175 NEWRULE(OCXDFN,OCXORD,OCXRUL,OCXREL,OCXNOTF,OCXMESS) ; Has this rule already been triggered for this order number 176 ; 177 ; 178 Q:'$G(OCXDFN) 0 Q:'$G(OCXRUL) 0 179 Q:'$G(OCXREL) 0 Q:'$G(OCXNOTF) 0 Q:'$L($G(OCXMESS)) 0 180 S OCXORD=+$G(OCXORD),OCXDFN=+OCXDFN 181 ; 182 N OCXNDX,OCXDATA,OCXDFI,OCXELE,OCXGR,OCXTIME,OCXCKSUM,OCXTSP,OCXTSPL 183 ; 184 S OCXTIME=(+$H) 185 S OCXCKSUM=$$CKSUM(OCXMESS) 186 ; 187 S OCXTSP=($H*86400)+$P($H,",",2) 188 S OCXTSPL=($G(^OCXD(860.7,"AT",OCXTIME,OCXDFN,OCXRUL,+OCXORD,OCXCKSUM))+$G(OCXTSPI,300)) 189 ; 190 Q:(OCXTSPL>OCXTSP) 0 191 ; 192 K OCXDATA 193 S OCXDATA(OCXDFN,0)=OCXDFN 194 S OCXDATA("B",OCXDFN,OCXDFN)="" 195 S OCXDATA("AT",OCXTIME,OCXDFN,OCXRUL,+OCXORD,OCXCKSUM)=OCXTSP 196 ; 197 S OCXGR="^OCXD(860.7" 198 D SETAP(OCXGR_")",0,.OCXDATA,OCXDFN) 199 ; 200 K OCXDATA 201 S OCXDATA(OCXRUL,0)=OCXRUL_U_(OCXTIME)_U_(+OCXORD) 202 S OCXDATA(OCXRUL,"M")=OCXMESS 203 S OCXDATA("B",OCXRUL,OCXRUL)="" 204 S OCXGR=OCXGR_","_OCXDFN_",1" 205 D SETAP(OCXGR_")","860.71P",.OCXDATA,OCXRUL) 206 ; 207 K OCXDATA 208 S OCXDATA(OCXREL,0)=OCXREL 209 S OCXDATA("B",OCXREL,OCXREL)="" 210 S OCXGR=OCXGR_","_OCXRUL_",1" 211 D SETAP(OCXGR_")","860.712",.OCXDATA,OCXREL) 212 ; 213 S OCXELE=0 F S OCXELE=$O(^OCXS(860.2,OCXRUL,"C","C",OCXELE)) Q:'OCXELE D 214 .; 215 .N OCXGR1 216 .S OCXGR1=OCXGR_","_OCXREL_",1" 217 .K OCXDATA 218 .S OCXDATA(OCXELE,0)=OCXELE 219 .S OCXDATA(OCXELE,"TIME")=OCXTIME 220 .S OCXDATA(OCXELE,"LOG")=$G(OCXOLOG) 221 .S OCXDATA("B",OCXELE,OCXELE)="" 222 .K ^OCXD(860.7,OCXDFN,1,OCXRUL,1,OCXREL,1,OCXELE) 223 .D SETAP(OCXGR1_")","860.7122P",.OCXDATA,OCXELE) 224 .; 225 .S OCXDFI=0 F S OCXDFI=$O(^TMP("OCXCHK",$J,OCXDFN,OCXELE,OCXDFI)) Q:'OCXDFI D 226 ..N OCXGR2 227 ..S OCXGR2=OCXGR1_","_OCXELE_",1" 228 ..K OCXDATA 229 ..S OCXDATA(OCXDFI,0)=OCXDFI 230 ..S OCXDATA(OCXDFI,"VAL")=^TMP("OCXCHK",$J,OCXDFN,OCXELE,OCXDFI) 231 ..S OCXDATA("B",OCXDFI,OCXDFI)="" 232 ..D SETAP(OCXGR2_")","860.71223P",.OCXDATA,OCXDFI) 233 ; 234 Q 1 235 ; 236 SETAP(ROOT,DD,DATA,DA) ; Set Rule Event data 237 M @ROOT=DATA 238 I +$G(DD) S @ROOT@(0)="^"_($G(DD))_"^"_($P($G(@ROOT@(0)),U,3)+1)_"^"_$G(DA) 239 I '$G(DD) S $P(@ROOT@(0),U,3,4)=($P($G(@ROOT@(0)),U,3)+1)_"^"_$G(DA) 240 ; 241 Q 242 ; 243 ;
Note:
See TracChangeset
for help on using the changeset viewer.