OCXDI02K ;SLC/RJS,CLA - OCX PACKAGE DIAGNOSTIC ROUTINES ;SEP 7,1999 at 10:30
;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
;
S ;
;
D DOT^OCXDIAG
;
;
K REMOTE,LOCAL,OPCODE,REF
F LINE=1:1:500 S TEXT=$P($T(DATA+LINE),";",2,999) Q:TEXT I $L(TEXT) D Q:QUIT
.S ^TMP("OCXDIAG",$J,$O(^TMP("OCXDIAG",$J,"A"),-1)+1)=TEXT
;
G ^OCXDI02L
;
Q
;
DATA ;
;
;;D^ ; ;
;;R^"860.8:",100,14
;;D^ ; S ZTSAVE("ORN")="" ; notification identifier (required)
;;R^"860.8:",100,15
;;D^ ; S ZTSAVE("ORBDFN")="" ; patient identifier (required)
;;R^"860.8:",100,16
;;D^ ; S ZTSAVE("ORNUM")="" ; order number - used to determine ordering provider
;;R^"860.8:",100,17
;;D^ ; S ZTSAVE("ORBADUZ")="" ; array of package-identified recipients
;;R^"860.8:",100,18
;;D^ ; S ZTSAVE("ORBPMSG")="" ; package-defined message
;;R^"860.8:",100,19
;;D^ ; S ZTSAVE("ORBPDATA")="" ; package-defined data for follow-up action
;;R^"860.8:",100,20
;;D^ ; ;
;;R^"860.8:",100,21
;;D^ ; D ^%ZTLOAD
;;R^"860.8:",100,22
;;D^ ; ;
;;R^"860.8:",100,23
;;D^ ; Q 0
;;R^"860.8:",100,24
;;D^ ; ;
;;EOR^
;;KEY^860.8:^LOCAL TERM LOOKUP
;;R^"860.8:",.01,"E"
;;D^LOCAL TERM LOOKUP
;;R^"860.8:",.02,"E"
;;D^TERMLKUP
;;R^"860.8:",1,1
;;D^
;;R^"860.8:",1,2
;;D^ This function allows a local site to define to Order Checking
;;R^"860.8:",1,3
;;D^ a term specific to that site. (ie. Lab Test Name, Radiology
;;R^"860.8:",1,4
;;D^ procedure name, etc.)
;;R^"860.8:",1,5
;;D^
;;R^"860.8:",100,1
;;D^ ;TERMLKUP(OCXTERM,OCXFILE) ;
;;R^"860.8:",100,2
;;D^ ; ;
;;R^"860.8:",100,3
;;D^ ; Q
;;R^"860.8:",100,4
;;D^ ; ;
;;EOR^
;;KEY^860.8:^GET LOCAL LIST FOR STANDARD TERM
;;R^"860.8:",.01,"E"
;;D^GET LOCAL LIST FOR STANDARD TERM
;;EOR^
;;KEY^860.8:^GENERATE STRING CHECKSUM
;;R^"860.8:",.01,"E"
;;D^GENERATE STRING CHECKSUM
;;R^"860.8:",.02,"E"
;;D^CKSUM
;;R^"860.8:",100,1
;;D^ ;CKSUM(STR) ;
;;R^"860.8:",100,2
;;D^ ; ;
;;R^"860.8:",100,3
;;D^ ; N CKSUM,PTR,ASC S CKSUM=0
;;R^"860.8:",100,4
;;D^ ; S STR=$TR(STR,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
;;R^"860.8:",100,5
;;D^ ; F PTR=$L(STR):-1:1 S ASC=$A(STR,PTR)-42 I (ASC>0),(ASC<51) S CKSUM=CKSUM*2+ASC
;;R^"860.8:",100,6
;;D^ ; Q +CKSUM
;;R^"860.8:",100,7
;;D^ ; ;
;;EOR^
;;KEY^860.8:^EQUALS TERM OPERATOR
;;R^"860.8:",.01,"E"
;;D^EQUALS TERM OPERATOR
;;R^"860.8:",.02,"E"
;;D^EQTERM
;;R^"860.8:",100,1
;;D^ ;EQTERM(DATA,TERM) ;
;;R^"860.8:",100,2
;;D^ ; ;
;;R^"860.8:",100,3
;;D^T+; I $G(OCXTRACE) W !,"%%%%",?20," Execution trace DATA: ",$G(DATA)," TERM: ",$G(TERM)
;;R^"860.8:",100,4
;;D^ ; N OCXF,OCXL
;;R^"860.8:",100,5
;;D^ ; ;
;;R^"860.8:",100,6
;;D^ ; S OCXL="",OCXF=$$TERMLKUP(TERM,.OCXL)
;;R^"860.8:",100,7
;;D^T-; Q:'OCXF 0
;;R^"860.8:",100,8
;;D^T+; I 'OCXF W:$G(OCXTRACE) !,"%%%%",?20," Term '",TERM,"' not in Order Check National Term File" Q 0
;;R^"860.8:",100,9
;;D^T+; I '$O(OCXL(0)) W:$G(OCXTRACE) !,"%%%%",?20," There are no local terms listed for the National Term '",TERM,"'." Q 0
;;R^"860.8:",100,10
;;D^T+; I ($D(OCXL(DATA))!$D(OCXL("B",DATA))) W:$G(OCXTRACE) !,"%%%%",?20," Data equals Term" Q 1
;;R^"860.8:",100,11
;;D^T-; I ($D(OCXL(DATA))!$D(OCXL("B",DATA))) Q 1
;;R^"860.8:",100,12
;;D^T-; Q 0
;;R^"860.8:",100,13
;;D^T+; W:$G(OCXTRACE) !,"%%%%",?20," Data does not equal Term" Q 0
;;R^"860.8:",100,14
;;D^ ; ;
;;EOR^
;;KEY^860.8:^RECENT CREATININE LAB PROCEDURE
;;R^"860.8:",.01,"E"
;;D^RECENT CREATININE LAB PROCEDURE
;;R^"860.8:",.02,"E"
;;D^RECCREAT
;;R^"860.8:",100,1
;;D^ ;RECCREAT(ORDFN,ORDAYS) ;extrinsic function to return most recent
;;R^"860.8:",100,2
;;D^ ; ;SERUM CREATININE within <ORDAYS> in format:
;;R^"860.8:",100,3
;;D^ ; ; test id^result units flag ref range collection d/t
;;R^"860.8:",100,4
;;D^ ; N BDT,CDT,ORY,ORX,ORZ,X,TEST,ORI,ORJ,CREARSLT,LABFILE,SPECFILE
;;R^"860.8:",100,5
;;D^ ; Q:'$L($G(ORDFN)) "0^"
;;R^"860.8:",100,6
;;D^ ; Q:'$L($G(ORDAYS)) "0^"
;;R^"860.8:",100,7
;;D^ ; D NOW^%DTC
;;R^"860.8:",100,8
;;D^ ; S BDT=$$FMADD^XLFDT(%,"-"_ORDAYS,"","","")
;;R^"860.8:",100,9
;;D^ ; K %
;;R^"860.8:",100,10
;;D^ ; Q:'$L($G(BDT)) "0^"
;;R^"860.8:",100,11
;;D^ ; S LABFILE=$$TERMLKUP^ORB31(.ORY,"SERUM CREATININE")
;;R^"860.8:",100,12
;;D^ ; Q:$G(LABFILE)'=60 "0^"
;;R^"860.8:",100,13
;;D^ ; S SPECFILE=$$TERMLKUP^ORB31(.ORX,"SERUM SPECIMEN")
;;R^"860.8:",100,14
;;D^ ; Q:$G(SPECFILE)'=61 "0^"
;;R^"860.8:",100,15
;;D^ ; F ORI=1:1:ORY I +$G(CREARSLT)<1 D
;;R^"860.8:",100,16
;;D^ ; .S TEST=$P(ORY(ORI),U)
;;R^"860.8:",100,17
;;D^ ; .Q:+$G(TEST)<1
;;R^"860.8:",100,18
;;D^ ; .F ORJ=1:1:ORX I +$G(CREARSLT)<1 D
;;R^"860.8:",100,19
;;D^ ; ..S SPECIMEN=$P(ORX(ORJ),U)
;;R^"860.8:",100,20
;;D^ ; ..Q:+$G(SPECIMEN)<1
;;R^"860.8:",100,21
;;D^ ; ..S ORZ=$$LOCL^ORQQLR1(ORDFN,TEST,SPECIMEN)
;;R^"860.8:",100,22
;;D^ ; ..Q:'$L($G(ORZ))
;;R^"860.8:",100,23
;;D^ ; ..S CDT=$P(ORZ,U,7)
;1;
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HOCXDI02K 5255 printed Nov 22, 2024@17:33:58 Page 2
OCXDI02K ;SLC/RJS,CLA - OCX PACKAGE DIAGNOSTIC ROUTINES ;SEP 7,1999 at 10:30
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
+2 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
+3 ;
S ;
+1 ;
+2 DO DOT^OCXDIAG
+3 ;
+4 ;
+5 KILL REMOTE,LOCAL,OPCODE,REF
+6 FOR LINE=1:1:500
SET TEXT=$PIECE($TEXT(DATA+LINE),";",2,999)
if TEXT
QUIT
IF $LENGTH(TEXT)
Begin DoDot:1
+7 SET ^TMP("OCXDIAG",$JOB,$ORDER(^TMP("OCXDIAG",$JOB,"A"),-1)+1)=TEXT
End DoDot:1
if QUIT
QUIT
+8 ;
+9 GOTO ^OCXDI02L
+10 ;
+11 QUIT
+12 ;
DATA ;
+1 ;
+2 ;;D^ ; ;
+3 ;;R^"860.8:",100,14
+4 ;;D^ ; S ZTSAVE("ORN")="" ; notification identifier (required)
+5 ;;R^"860.8:",100,15
+6 ;;D^ ; S ZTSAVE("ORBDFN")="" ; patient identifier (required)
+7 ;;R^"860.8:",100,16
+8 ;;D^ ; S ZTSAVE("ORNUM")="" ; order number - used to determine ordering provider
+9 ;;R^"860.8:",100,17
+10 ;;D^ ; S ZTSAVE("ORBADUZ")="" ; array of package-identified recipients
+11 ;;R^"860.8:",100,18
+12 ;;D^ ; S ZTSAVE("ORBPMSG")="" ; package-defined message
+13 ;;R^"860.8:",100,19
+14 ;;D^ ; S ZTSAVE("ORBPDATA")="" ; package-defined data for follow-up action
+15 ;;R^"860.8:",100,20
+16 ;;D^ ; ;
+17 ;;R^"860.8:",100,21
+18 ;;D^ ; D ^%ZTLOAD
+19 ;;R^"860.8:",100,22
+20 ;;D^ ; ;
+21 ;;R^"860.8:",100,23
+22 ;;D^ ; Q 0
+23 ;;R^"860.8:",100,24
+24 ;;D^ ; ;
+25 ;;EOR^
+26 ;;KEY^860.8:^LOCAL TERM LOOKUP
+27 ;;R^"860.8:",.01,"E"
+28 ;;D^LOCAL TERM LOOKUP
+29 ;;R^"860.8:",.02,"E"
+30 ;;D^TERMLKUP
+31 ;;R^"860.8:",1,1
+32 ;;D^
+33 ;;R^"860.8:",1,2
+34 ;;D^ This function allows a local site to define to Order Checking
+35 ;;R^"860.8:",1,3
+36 ;;D^ a term specific to that site. (ie. Lab Test Name, Radiology
+37 ;;R^"860.8:",1,4
+38 ;;D^ procedure name, etc.)
+39 ;;R^"860.8:",1,5
+40 ;;D^
+41 ;;R^"860.8:",100,1
+42 ;;D^ ;TERMLKUP(OCXTERM,OCXFILE) ;
+43 ;;R^"860.8:",100,2
+44 ;;D^ ; ;
+45 ;;R^"860.8:",100,3
+46 ;;D^ ; Q
+47 ;;R^"860.8:",100,4
+48 ;;D^ ; ;
+49 ;;EOR^
+50 ;;KEY^860.8:^GET LOCAL LIST FOR STANDARD TERM
+51 ;;R^"860.8:",.01,"E"
+52 ;;D^GET LOCAL LIST FOR STANDARD TERM
+53 ;;EOR^
+54 ;;KEY^860.8:^GENERATE STRING CHECKSUM
+55 ;;R^"860.8:",.01,"E"
+56 ;;D^GENERATE STRING CHECKSUM
+57 ;;R^"860.8:",.02,"E"
+58 ;;D^CKSUM
+59 ;;R^"860.8:",100,1
+60 ;;D^ ;CKSUM(STR) ;
+61 ;;R^"860.8:",100,2
+62 ;;D^ ; ;
+63 ;;R^"860.8:",100,3
+64 ;;D^ ; N CKSUM,PTR,ASC S CKSUM=0
+65 ;;R^"860.8:",100,4
+66 ;;D^ ; S STR=$TR(STR,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
+67 ;;R^"860.8:",100,5
+68 ;;D^ ; F PTR=$L(STR):-1:1 S ASC=$A(STR,PTR)-42 I (ASC>0),(ASC<51) S CKSUM=CKSUM*2+ASC
+69 ;;R^"860.8:",100,6
+70 ;;D^ ; Q +CKSUM
+71 ;;R^"860.8:",100,7
+72 ;;D^ ; ;
+73 ;;EOR^
+74 ;;KEY^860.8:^EQUALS TERM OPERATOR
+75 ;;R^"860.8:",.01,"E"
+76 ;;D^EQUALS TERM OPERATOR
+77 ;;R^"860.8:",.02,"E"
+78 ;;D^EQTERM
+79 ;;R^"860.8:",100,1
+80 ;;D^ ;EQTERM(DATA,TERM) ;
+81 ;;R^"860.8:",100,2
+82 ;;D^ ; ;
+83 ;;R^"860.8:",100,3
+84 ;;D^T+; I $G(OCXTRACE) W !,"%%%%",?20," Execution trace DATA: ",$G(DATA)," TERM: ",$G(TERM)
+85 ;;R^"860.8:",100,4
+86 ;;D^ ; N OCXF,OCXL
+87 ;;R^"860.8:",100,5
+88 ;;D^ ; ;
+89 ;;R^"860.8:",100,6
+90 ;;D^ ; S OCXL="",OCXF=$$TERMLKUP(TERM,.OCXL)
+91 ;;R^"860.8:",100,7
+92 ;;D^T-; Q:'OCXF 0
+93 ;;R^"860.8:",100,8
+94 ;;D^T+; I 'OCXF W:$G(OCXTRACE) !,"%%%%",?20," Term '",TERM,"' not in Order Check National Term File" Q 0
+95 ;;R^"860.8:",100,9
+96 ;;D^T+; I '$O(OCXL(0)) W:$G(OCXTRACE) !,"%%%%",?20," There are no local terms listed for the National Term '",TERM,"'." Q 0
+97 ;;R^"860.8:",100,10
+98 ;;D^T+; I ($D(OCXL(DATA))!$D(OCXL("B",DATA))) W:$G(OCXTRACE) !,"%%%%",?20," Data equals Term" Q 1
+99 ;;R^"860.8:",100,11
+100 ;;D^T-; I ($D(OCXL(DATA))!$D(OCXL("B",DATA))) Q 1
+101 ;;R^"860.8:",100,12
+102 ;;D^T-; Q 0
+103 ;;R^"860.8:",100,13
+104 ;;D^T+; W:$G(OCXTRACE) !,"%%%%",?20," Data does not equal Term" Q 0
+105 ;;R^"860.8:",100,14
+106 ;;D^ ; ;
+107 ;;EOR^
+108 ;;KEY^860.8:^RECENT CREATININE LAB PROCEDURE
+109 ;;R^"860.8:",.01,"E"
+110 ;;D^RECENT CREATININE LAB PROCEDURE
+111 ;;R^"860.8:",.02,"E"
+112 ;;D^RECCREAT
+113 ;;R^"860.8:",100,1
+114 ;;D^ ;RECCREAT(ORDFN,ORDAYS) ;extrinsic function to return most recent
+115 ;;R^"860.8:",100,2
+116 ;;D^ ; ;SERUM CREATININE within <ORDAYS> in format:
+117 ;;R^"860.8:",100,3
+118 ;;D^ ; ; test id^result units flag ref range collection d/t
+119 ;;R^"860.8:",100,4
+120 ;;D^ ; N BDT,CDT,ORY,ORX,ORZ,X,TEST,ORI,ORJ,CREARSLT,LABFILE,SPECFILE
+121 ;;R^"860.8:",100,5
+122 ;;D^ ; Q:'$L($G(ORDFN)) "0^"
+123 ;;R^"860.8:",100,6
+124 ;;D^ ; Q:'$L($G(ORDAYS)) "0^"
+125 ;;R^"860.8:",100,7
+126 ;;D^ ; D NOW^%DTC
+127 ;;R^"860.8:",100,8
+128 ;;D^ ; S BDT=$$FMADD^XLFDT(%,"-"_ORDAYS,"","","")
+129 ;;R^"860.8:",100,9
+130 ;;D^ ; K %
+131 ;;R^"860.8:",100,10
+132 ;;D^ ; Q:'$L($G(BDT)) "0^"
+133 ;;R^"860.8:",100,11
+134 ;;D^ ; S LABFILE=$$TERMLKUP^ORB31(.ORY,"SERUM CREATININE")
+135 ;;R^"860.8:",100,12
+136 ;;D^ ; Q:$G(LABFILE)'=60 "0^"
+137 ;;R^"860.8:",100,13
+138 ;;D^ ; S SPECFILE=$$TERMLKUP^ORB31(.ORX,"SERUM SPECIMEN")
+139 ;;R^"860.8:",100,14
+140 ;;D^ ; Q:$G(SPECFILE)'=61 "0^"
+141 ;;R^"860.8:",100,15
+142 ;;D^ ; F ORI=1:1:ORY I +$G(CREARSLT)<1 D
+143 ;;R^"860.8:",100,16
+144 ;;D^ ; .S TEST=$P(ORY(ORI),U)
+145 ;;R^"860.8:",100,17
+146 ;;D^ ; .Q:+$G(TEST)<1
+147 ;;R^"860.8:",100,18
+148 ;;D^ ; .F ORJ=1:1:ORX I +$G(CREARSLT)<1 D
+149 ;;R^"860.8:",100,19
+150 ;;D^ ; ..S SPECIMEN=$P(ORX(ORJ),U)
+151 ;;R^"860.8:",100,20
+152 ;;D^ ; ..Q:+$G(SPECIMEN)<1
+153 ;;R^"860.8:",100,21
+154 ;;D^ ; ..S ORZ=$$LOCL^ORQQLR1(ORDFN,TEST,SPECIMEN)
+155 ;;R^"860.8:",100,22
+156 ;;D^ ; ..Q:'$L($G(ORZ))
+157 ;;R^"860.8:",100,23
+158 ;;D^ ; ..S CDT=$P(ORZ,U,7)
+159 ;1;
+160 ;