ORY216 ;SLC/MKB - Clean-up existing Allergy orders ;3/16/04 14:28
;;3.0;ORDER ENTRY/RESULTS REPORTING;**216**;Dec 17, 1997
;
POST ; -- postinit
N ORDG,ORX S ORDG=+$O(^ORD(100.98,"B","ALG",0)) Q:ORDG'>0
S $P(^ORD(100.98,ORDG,0),U,4)="" ;clear Default Dialog
S ORX("GMRAOR ALLERGY ENTER/EDIT")="" D EN^ORYDLG(216,.ORX)
D TASK
Q
;
TASK ; -- queue job to complete ART orders
Q:$G(^XTMP("ORGMRA","PAT"))<0 ;already done
N ZTDESC,ZTRTN,ZTIO,ZTSAVE,ZTDTH,ZTSK,ORMSG
S ORMSG(1)="A background job has been queued to complete any currently active"
S ORMSG(2)="Allergy/Adverse Reaction orders." D MES^XPDUTL(.ORMSG)
S ZTDESC="Mark ART orders as complete",ZTRTN="EN^ORY216"
S ZTIO="",ZTDTH=$H,ZTSAVE("DUZ")="" D ^%ZTLOAD K ORMSG
S ORMSG="Task "_$S($G(ZTSK):"#"_ZTSK,1:"not")_" started."
D MES^XPDUTL(ORMSG)
I '$G(ZTSK) D BMES^XPDUTL("Use TASK^ORY216 to queue this job to complete ART orders as soon as possible!")
Q
;
EN ; -- main loop to complete ART orders on:
; ^OR(100,"ACT",ORVP,invORLOG,ORDG,ORIFN)
;
N ORDG,ORNOW,ORVP,ORLOG,ORIFN
S ORDG=+$O(^ORD(100.98,"B","ALG",0)) Q:ORDG'>0
S ORNOW=+$E($$NOW^XLFDT,1,12),ORVP=$G(^XTMP("ORGMRA","PAT")) I '$D(^(0)) D
. S ^XTMP("ORGMRA",0)=$$FMADD^XLFDT(ORNOW,90)_U_ORNOW_"^ART orders completion"
F S ORVP=$O(^OR(100,"ACT",ORVP)) Q:ORVP="" D Q:$G(ZTSTOP)
. S ORLOG=0 F S ORLOG=$O(^OR(100,"ACT",ORVP,ORLOG)) Q:ORLOG'>0 D
.. S ORIFN=0 F S ORIFN=+$O(^OR(100,"ACT",ORVP,ORLOG,ORDG,ORIFN)) Q:ORIFN'>0 D
... Q:$P($G(^OR(100,ORIFN,3)),U,3)=2 ;already completed
... D STATUS^ORCSAVE2(ORIFN,2) S $P(^OR(100,ORIFN,6),U,6)=ORNOW
. S ^XTMP("ORGMRA","PAT")=ORVP
. I $D(ZTQUEUED) S:$$S^%ZTLOAD ZTSTOP=1 Q:$G(ZTSTOP)
I '$G(ZTSTOP) S ^XTMP("ORGMRA","PAT")=-1 D MAIL ;done
Q
;
MAIL ; -- Send completion message to user who initiated conversion
N XMSUB,XMTEXT,XMDUZ,XMY,XMZ,XMMG,ORTXT,DIFROM
S XMDUZ="PATCH OR*3*216 ART ORDERS COMPLETION",XMY(.5)="" S:$G(DUZ) XMY(DUZ)=""
S ORTXT(1)="The task triggered by patch OR*3*216"_$S($G(ZTSK):" (Task #"_ZTSK_")",1:"")_" to complete ART orders"
S ORTXT(2)="finished at "_$$FMTE^XLFDT($$NOW^XLFDT)_"."
S XMTEXT="ORTXT(",XMSUB="PATCH OR*3*216 ART ORDERS COMPLETED"
D ^XMD
Q
ORY216 ;SLC/MKB - Clean-up existing Allergy orders ;3/16/04 14:28
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**216**;Dec 17, 1997
+2 ;
POST ; -- postinit
+1 NEW ORDG,ORX
SET ORDG=+$ORDER(^ORD(100.98,"B","ALG",0))
IF ORDG'>0
QUIT
+2 ;clear Default Dialog
SET $PIECE(^ORD(100.98,ORDG,0),U,4)=""
+3 SET ORX("GMRAOR ALLERGY ENTER/EDIT")=""
DO EN^ORYDLG(216,.ORX)
+4 DO TASK
+5 QUIT
+6 ;
TASK ; -- queue job to complete ART orders
+1 ;already done
IF $GET(^XTMP("ORGMRA","PAT"))<0
QUIT
+2 NEW ZTDESC,ZTRTN,ZTIO,ZTSAVE,ZTDTH,ZTSK,ORMSG
+3 SET ORMSG(1)="A background job has been queued to complete any currently active"
+4 SET ORMSG(2)="Allergy/Adverse Reaction orders."
DO MES^XPDUTL(.ORMSG)
+5 SET ZTDESC="Mark ART orders as complete"
SET ZTRTN="EN^ORY216"
+6 SET ZTIO=""
SET ZTDTH=$HOROLOG
SET ZTSAVE("DUZ")=""
DO ^%ZTLOAD
KILL ORMSG
+7 SET ORMSG="Task "_$SELECT($GET(ZTSK):"#"_ZTSK,1:"not")_" started."
+8 DO MES^XPDUTL(ORMSG)
+9 IF '$GET(ZTSK)
DO BMES^XPDUTL("Use TASK^ORY216 to queue this job to complete ART orders as soon as possible!")
+10 QUIT
+11 ;
EN ; -- main loop to complete ART orders on:
+1 ; ^OR(100,"ACT",ORVP,invORLOG,ORDG,ORIFN)
+2 ;
+3 NEW ORDG,ORNOW,ORVP,ORLOG,ORIFN
+4 SET ORDG=+$ORDER(^ORD(100.98,"B","ALG",0))
IF ORDG'>0
QUIT
+5 SET ORNOW=+$EXTRACT($$NOW^XLFDT,1,12)
SET ORVP=$GET(^XTMP("ORGMRA","PAT"))
IF '$DATA(^(0))
Begin DoDot:1
+6 SET ^XTMP("ORGMRA",0)=$$FMADD^XLFDT(ORNOW,90)_U_ORNOW_"^ART orders completion"
End DoDot:1
+7 FOR
SET ORVP=$ORDER(^OR(100,"ACT",ORVP))
IF ORVP=""
QUIT
Begin DoDot:1
+8 SET ORLOG=0
FOR
SET ORLOG=$ORDER(^OR(100,"ACT",ORVP,ORLOG))
IF ORLOG'>0
QUIT
Begin DoDot:2
+9 SET ORIFN=0
FOR
SET ORIFN=+$ORDER(^OR(100,"ACT",ORVP,ORLOG,ORDG,ORIFN))
IF ORIFN'>0
QUIT
Begin DoDot:3
+10 ;already completed
IF $PIECE($GET(^OR(100,ORIFN,3)),U,3)=2
QUIT
+11 DO STATUS^ORCSAVE2(ORIFN,2)
SET $PIECE(^OR(100,ORIFN,6),U,6)=ORNOW
End DoDot:3
End DoDot:2
+12 SET ^XTMP("ORGMRA","PAT")=ORVP
+13 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET ZTSTOP=1
IF $GET(ZTSTOP)
QUIT
End DoDot:1
IF $GET(ZTSTOP)
QUIT
+14 ;done
IF '$GET(ZTSTOP)
SET ^XTMP("ORGMRA","PAT")=-1
DO MAIL
+15 QUIT
+16 ;
MAIL ; -- Send completion message to user who initiated conversion
+1 NEW XMSUB,XMTEXT,XMDUZ,XMY,XMZ,XMMG,ORTXT,DIFROM
+2 SET XMDUZ="PATCH OR*3*216 ART ORDERS COMPLETION"
SET XMY(.5)=""
IF $GET(DUZ)
SET XMY(DUZ)=""
+3 SET ORTXT(1)="The task triggered by patch OR*3*216"_$SELECT($GET(ZTSK):" (Task #"_ZTSK_")",1:"")_" to complete ART orders"
+4 SET ORTXT(2)="finished at "_$$FMTE^XLFDT($$NOW^XLFDT)_"."
+5 SET XMTEXT="ORTXT("
SET XMSUB="PATCH OR*3*216 ART ORDERS COMPLETED"
+6 DO ^XMD
+7 QUIT