Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: OCXOCMPD

OCXOCMPD.m

Go to the documentation of this file.
  1. OCXOCMPD ;SLC/RJS,CLA - ORDER CHECK CODE COMPILER (Sort Code Segments cont...) ;3/22/01 09:38
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,105**;Dec 17,1997
  1. ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
  1. ;
  1. EN() ;
  1. ;
  1. N OCXELE,OCXD0,OCXD1,OCXD2
  1. ;
  1. S OCXD0=0 F S OCXD0=$O(^TMP("OCXCMP",$J,"RULE",OCXD0)) Q:'OCXD0 D Q:OCXWARN
  1. .N OCXR M OCXR=^OCXS(860.2,OCXD0)
  1. .S OCXD1=0 F S OCXD1=$O(^TMP("OCXCMP",$J,"RULE",OCXD0,OCXD1)) Q:'OCXD1 S OCXCODE=$G(^(OCXD1)) I $L(OCXCODE) D
  1. ..N OCXNMSG,OCXCMSG,OCXNTF,OCXNOD0,OCXL,OCXD2,OCXCNT,OCXVAR,OCXCODE,OCXMCOD
  1. ..S OCXLA="R"_OCXD0_"R"_OCXD1_"A",OCXLB="R"_OCXD0_"R"_OCXD1_"B"
  1. ..S OCXCODE=" D ||LINE:"_$$LINE^OCXOCMP4(OCXLA)_"||"
  1. ..;
  1. ..S OCXD2=0 F OCXCNT=0:1 S OCXD2=$O(^TMP("OCXCMP",$J,"RULE",OCXD0,OCXD1,OCXD2)) Q:'OCXD2 D
  1. ...I '$D(OCXELE(OCXD2)) D
  1. ....I $G(OCXTRACE) D IN^OCXOCMP4("EL"_OCXD2," W:$G(OCXTRACE) !,||LNTAG||,?27,""Element Check for: ("_OCXD2_") '"_$P(^OCXS(860.3,OCXD2,0),U,1)_"'""")
  1. ....I $G(OCXTRACE) D IN^OCXOCMP4("EL"_OCXD2," ;")
  1. ....S OCXELE(OCXD2)=""
  1. ...D IN^OCXOCMP4("EL"_OCXD2,OCXCODE_" ; Check Relation #"_(+OCXD1)_" in Rule #"_(+OCXD0)_" '"_$P(OCXR(0),U,1)_"'")
  1. ..;
  1. ..D IN^OCXOCMP4(OCXLA," Q:$G(^OCXS(860.2,"_OCXD0_",""INACT""))")
  1. ..D IN^OCXOCMP4(OCXLA," ;")
  1. ..S OCXD2=0 F S OCXD2=$O(^TMP("OCXCMP",$J,"RULE",OCXD0,OCXD1,"CODE",OCXD2)) Q:'OCXD2 S OCXCODE=$G(^(OCXD2)) D
  1. ...F Q:'(OCXCODE["@@@@") S OCXCODE=$P(OCXCODE,"@@@@",1)_"||LINE:"_$$LINE^OCXOCMP4(OCXLB)_"||"_$P(OCXCODE,"@@@@",2,999)
  1. ...D IN^OCXOCMP4(OCXLA," "_OCXCODE)
  1. ..;
  1. ..S OCXNOD0=$G(OCXR("R",OCXD1,0))
  1. ..S OCXNMSG=$G(OCXR("R",OCXD1,"MSG")) S:'$P(OCXNOD0,U,3) OCXNMSG=""
  1. ..S OCXCMSG=$G(OCXR("R",OCXD1,"OCMSG")) S:'$P(OCXNOD0,U,2) OCXCMSG=""
  1. ..S OCXMCOD=$G(OCXR("R",OCXD1,"MCODE"))
  1. ..;
  1. ..I $G(OCXTRACE) D IN^OCXOCMP4(OCXLB," I $G(OCXTRACE),$D(OCXRULE("""_OCXLB_""")) W !,||LNTAG||,?27,""Rule '"_$P($G(OCXR(0)),U,1)_"' already triggered !!""")
  1. ..D IN^OCXOCMP4(OCXLB," Q:$D(OCXRULE("""_OCXLB_"""))")
  1. ..D IN^OCXOCMP4(OCXLB," ;")
  1. ..;
  1. ..I '$G(OCXAUTO) W:($X>60) ! W "."
  1. ..;
  1. ..I '($L(OCXCMSG)+$L(OCXNMSG)),'$L($G(OCXR("R",OCXD1,"RULE"))),'$L(OCXMCOD) D Q
  1. ...D IN^OCXOCMP4(OCXLB," ; Notification and order checking disabled for this")
  1. ...D IN^OCXOCMP4(OCXLB," ; rule due to no Order Check or Notification message,")
  1. ...D IN^OCXOCMP4(OCXLB," ; or execute code found in the Order Check Rule File (860.2)")
  1. ..;
  1. ..I $L($G(OCXR("R",OCXD1,"RULE"))) D
  1. ...N OCXSCH,OCXTIME
  1. ...S OCXSCH=$P(OCXR("R",OCXD1,"RULE"),U,1)
  1. ...S OCXTIME=$P(OCXR("R",OCXD1,"RULE"),U,2)
  1. ...;
  1. ...D IN^OCXOCMP4(OCXLB," ;")
  1. ...I ((OCXSCH="START")!(OCXSCH="CONTINUE")) D Q
  1. ....I '$L(OCXTIME) D Q
  1. .....D IN^OCXOCMP4(OCXLB," ; No code generated for '"_OCXSCH_"' rule schedule.")
  1. .....D IN^OCXOCMP4(OCXLB," ; Time period not defined.")
  1. .....D IN^OCXOCMP4(OCXLB," ;")
  1. ....I '$L($$TIME^OCXOCMPQ(OCXTIME,OCXD0,OCXD1)) D Q
  1. .....D IN^OCXOCMP4(OCXLB," ; No code generated for '"_OCXSCH_"' rule schedule.")
  1. .....D IN^OCXOCMP4(OCXLB," ; Invalid time period definition. -> "_OCXTIME)
  1. .....D IN^OCXOCMP4(OCXLB," ;")
  1. ....S OCXTIME=$$TIME^OCXOCMPQ(OCXTIME,OCXD0,OCXD1)
  1. ....D IN^OCXOCMP4(OCXLB," ; Add '"_$P($G(^OCXS(860.2,OCXD0,0)),U,1)_"' rule to")
  1. ....D IN^OCXOCMP4(OCXLB," ; Time Based Order Check Schedule for patient defined by 'DFN'.")
  1. ....D IN^OCXOCMP4(OCXLB," ;")
  1. ....D IN^OCXOCMP4(OCXLB," N OCXSDATE")
  1. ....D IN^OCXOCMP4(OCXLB," S OCXSDATE=$$ADD2DATE("_OCXTIME_")")
  1. ....D IN^OCXOCMP4(OCXLB," S ^OCXD(860.1,DFN,0)=DFN")
  1. ....D IN^OCXOCMP4(OCXLB," S ^OCXD(860.1,DFN,2,0)=""^860.12D^""_OCXSDATE")
  1. ....D IN^OCXOCMP4(OCXLB," S ^OCXD(860.1,DFN,2,OCXSDATE,1,0)=""^860.121P^"_OCXD0_"""")
  1. ....D IN^OCXOCMP4(OCXLB," S ^OCXD(860.1,DFN,2,OCXSDATE,1,"_OCXD0_",0)="_OCXD0)
  1. ....D IN^OCXOCMP4(OCXLB," S ^OCXD(860.1,""TIME"","_OCXD0_",DFN,OCXSDATE,"_OCXD0_")=""""")
  1. ...;
  1. ...I (OCXSCH="STOP") D
  1. ....D IN^OCXOCMP4(OCXLB," ; Delete all entries for rule '"_$P($G(^OCXS(860.2,OCXD0,0)),U,1)_"' from")
  1. ....D IN^OCXOCMP4(OCXLB," ; Time Based Order Check Schedule for patient defined by 'DFN'.")
  1. ....D IN^OCXOCMP4(OCXLB," ; ")
  1. ....D IN^OCXOCMP4(OCXLB," N OCXSDATE S OCXSDATE=0 F S OCXSDATE=$O(^OCXD(860.1,DFN,2,OCXSDATE)) Q:'OCXSDATE D")
  1. ....D IN^OCXOCMP4(OCXLB," .Q:'$D(^OCXD(860.1,DFN,2,OCXSDATE,1,"_OCXD0_"))")
  1. ....D IN^OCXOCMP4(OCXLB," .K ^OCXD(860.1,DFN,2,OCXSDATE,1,"_OCXD0_")")
  1. ....D IN^OCXOCMP4(OCXLB," .K ^OCXD(860.1,DFN,2,OCXSDATE,1,""B"","_OCXD0_","_OCXD0_")")
  1. ....D IN^OCXOCMP4(OCXLB," .K ^OCXD(860.1,""TIME"","_OCXD0_",DFN,OCXSDATE,"_OCXD0_")")
  1. ..;
  1. ..I '($L(OCXCMSG)+$L(OCXNMSG)+$L(OCXMCOD)) Q
  1. ..;
  1. ..D IN^OCXOCMP4(OCXLB," N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD")
  1. ..;
  1. ..I $L(OCXCMSG) D I 1
  1. ...S OCXCMSG=$TR(OCXCMSG,"""","""""")
  1. ...S OCXCMSG=$$XLATE^OCXOCMPQ(OCXCMSG,OCXD0,OCXD1)
  1. ...D IN^OCXOCMP4(OCXLB," I ($G(OCXOSRC)=""CPRS ORDER PRESCAN"") S OCXCMSG=(+OCXPSD)_""^"_(+$P(OCXNOD0,U,2))_"^^"_$S(($E(OCXCMSG,1)=""""):$E(OCXCMSG,2,$L(OCXCMSG)),1:"""_"_OCXCMSG)_" I 1")
  1. ...D IN^OCXOCMP4(OCXLB," E S OCXCMSG="_OCXCMSG)
  1. ..E D IN^OCXOCMP4(OCXLB," S OCXCMSG=""""")
  1. ..;
  1. ..S OCXNMSG=$$XLATE^OCXOCMPQ(OCXNMSG,OCXD0,OCXD1)
  1. ..S OCXMCOD=$$XLATE^OCXOCMPQ(OCXMCOD,OCXD0,OCXD1,1)
  1. ..D IN^OCXOCMP4(OCXLB," S OCXNMSG="_OCXNMSG)
  1. ..;
  1. ..S OCXWARN=$$EN^OCXOCMPG(OCXLB,OCXCNT)
  1. ..;
  1. ..M OCXVAR("CODE")=^TMP("OCXCMP",$J,"C CODE",$$LINE^OCXOCMP4(OCXLA))
  1. ..S OCXD2=0 F S OCXD2=$O(OCXVAR("CODE",OCXD2)) Q:'OCXD2 D
  1. ...N OCXD3
  1. ...F OCXD3=1:1:$L(OCXVAR("CODE",OCXD2,0),"OCXLD") I +$P(OCXVAR("CODE",OCXD2,0),"OCXLD",OCXD3+1) S OCXVAR("VAR","OCXLD"_(+$P(OCXVAR("CODE",OCXD2),"OCXLD",OCXD3+1)))=""
  1. ...F OCXD3=1:1:$L(OCXVAR("CODE",OCXD2,0),"OCXLV") I +$P(OCXVAR("CODE",OCXD2,0),"OCXLV",OCXD3+1) S OCXVAR("VAR","OCXLV"_(+$P(OCXVAR("CODE",OCXD2),"OCXLV",OCXD3+1)))=""
  1. ...F OCXD3=1:1:$L(OCXVAR("CODE",OCXD2,0),"OCXLC") I +$P(OCXVAR("CODE",OCXD2,0),"OCXLC",OCXD3+1) S OCXVAR("VAR","OCXLC"_(+$P(OCXVAR("CODE",OCXD2),"OCXLC",OCXD3+1)))=""
  1. ..S (OCXD2,OCXCODE)="" F S OCXD2=$O(OCXVAR("VAR",OCXD2)) Q:'$L(OCXD2) S:$L(OCXCODE) OCXCODE=OCXCODE_"," S OCXCODE=OCXCODE_OCXD2
  1. ..I $L(OCXCODE) D IN^OCXOCMP4(OCXLA," N "_OCXCODE,"",11000),IN^OCXOCMP4(OCXLA," ;","",11000)
  1. ..K OCXVAR("CODE") M OCXVAR("CODE")=^TMP("OCXCMP",$J,"C CODE",$$LINE^OCXOCMP4(OCXLA),0)
  1. ;
  1. Q OCXWARN
  1. ;