GMRAY19 ;SLC/DAN Post-install for patch 19 ;5/4/04 10:24
;;4.0;Adverse Reaction Tracking;**19**;Mar 29, 1996
;DBIA SECTION
;10063 - %ZTLOAD
; 3744 - $$TESTPAT^VADPT
;10018 - DIE
;10103 - XLFDT
;10070 - XMD
;10141 - XPDUTL
;
Q ;Entry point to queue process during install
N ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK
S ZTRTN="DQ^GMRAY19",ZTDESC="GMRA*4*19 POST INSTALL ROUTINE",ZTIO="",ZTDTH=$H
D ^%ZTLOAD I '$G(ZTSK) D BMES^XPDUTL("POST INSTALL NOT QUEUED - RUN DQ^GMRA19 AFTER INSTALL FINISHES") Q
D BMES^XPDUTL("Post-install queued as task # "_$G(ZTSK))
Q
;
DQ ;Dequeue
N TCNT,VCNT
D POST,MAIL
Q
;
POST ;Post-install for patch 19
N IEN,GMRA0,GMRAV,DIE,DA,DR,VER,DFN
S (IEN,TCNT,VCNT)=0 F S IEN=$O(^GMR(120.8,IEN)) Q:'+IEN D
.S GMRA0=$G(^GMR(120.8,IEN,0)) ;Set GMRA0 to zero node
.Q:GMRA0="" ;Quit if no zero node
.Q:$P(GMRA0,U,16)'="" ;Quit if verified field set
.Q:+$G(^GMR(120.8,IEN,"ER")) ;Quit if entered in error
.S DFN=$P(GMRA0,U) Q:'+DFN ;Quit if no patient identifier
.Q:$$TESTPAT^VADPT(DFN) ;Quit if test patient
.Q:$$DECEASED^GMRAFX(DFN) ;Quit if patient is deceased
.S TCNT=TCNT+1
.S GMRAV="",GMRAV(0)=GMRA0
.S VER=$$VFY^GMRASIGN(.GMRAV)
.S DIE=120.8,DA=IEN,DR="19///"_VER S:VER DR=DR_";20///"_$$NOW^XLFDT D ^DIE
.I VER S VCNT=VCNT+1 D ADCOM^GMRAFX(IEN,"V","Auto-verified by patch 19 post-install")
Q
;
MAIL ;Send message indicating post install is finished
N XMSUB,XMTEXT,XMDUZ,XMY,XMZ,GMRATXT
S XMDUZ="PATCH GMRA*4*19 POST-INSTALL",XMY(.5)="" S:$G(DUZ) XMY(DUZ)=""
S GMRATXT(1)="The post-install routine for patch GMRA*4*19"
S GMRATXT(2)="finished on "_$$FMTE^XLFDT($$NOW^XLFDT)_"."
S GMRATXT(3)=""
I TCNT=0 D
.S GMRATXT(4)="The post-install did not find any entries that were missing the"
.S GMRATXT(5)="verified field. No further action is required."
I TCNT>0 D
.S GMRATXT(4)="The post-install found "_TCNT_$S(TCNT=1:" entry",1:" entries")_" that were missing"
.S GMRATXT(5)="the verified field. "_$S(TCNT=VCNT:"All",VCNT=0:"None",1:VCNT)_" of these were auto-verified."
.S:TCNT'=VCNT GMRATXT(6)="The remaining reactants are now available for verification",GMRATXT(7)="using allergy package options."
S XMTEXT="GMRATXT(",XMSUB="PATCH GMRA*4*19 Post Install COMPLETED"
D ^XMD
Q
GMRAY19 ;SLC/DAN Post-install for patch 19 ;5/4/04 10:24
+1 ;;4.0;Adverse Reaction Tracking;**19**;Mar 29, 1996
+2 ;DBIA SECTION
+3 ;10063 - %ZTLOAD
+4 ; 3744 - $$TESTPAT^VADPT
+5 ;10018 - DIE
+6 ;10103 - XLFDT
+7 ;10070 - XMD
+8 ;10141 - XPDUTL
+9 ;
Q ;Entry point to queue process during install
+1 NEW ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK
+2 SET ZTRTN="DQ^GMRAY19"
SET ZTDESC="GMRA*4*19 POST INSTALL ROUTINE"
SET ZTIO=""
SET ZTDTH=$HOROLOG
+3 DO ^%ZTLOAD
IF '$GET(ZTSK)
DO BMES^XPDUTL("POST INSTALL NOT QUEUED - RUN DQ^GMRA19 AFTER INSTALL FINISHES")
QUIT
+4 DO BMES^XPDUTL("Post-install queued as task # "_$GET(ZTSK))
+5 QUIT
+6 ;
DQ ;Dequeue
+1 NEW TCNT,VCNT
+2 DO POST
DO MAIL
+3 QUIT
+4 ;
POST ;Post-install for patch 19
+1 NEW IEN,GMRA0,GMRAV,DIE,DA,DR,VER,DFN
+2 SET (IEN,TCNT,VCNT)=0
FOR
SET IEN=$ORDER(^GMR(120.8,IEN))
IF '+IEN
QUIT
Begin DoDot:1
+3 ;Set GMRA0 to zero node
SET GMRA0=$GET(^GMR(120.8,IEN,0))
+4 ;Quit if no zero node
IF GMRA0=""
QUIT
+5 ;Quit if verified field set
IF $PIECE(GMRA0,U,16)'=""
QUIT
+6 ;Quit if entered in error
IF +$GET(^GMR(120.8,IEN,"ER"))
QUIT
+7 ;Quit if no patient identifier
SET DFN=$PIECE(GMRA0,U)
IF '+DFN
QUIT
+8 ;Quit if test patient
IF $$TESTPAT^VADPT(DFN)
QUIT
+9 ;Quit if patient is deceased
IF $$DECEASED^GMRAFX(DFN)
QUIT
+10 SET TCNT=TCNT+1
+11 SET GMRAV=""
SET GMRAV(0)=GMRA0
+12 SET VER=$$VFY^GMRASIGN(.GMRAV)
+13 SET DIE=120.8
SET DA=IEN
SET DR="19///"_VER
IF VER
SET DR=DR_";20///"_$$NOW^XLFDT
DO ^DIE
+14 IF VER
SET VCNT=VCNT+1
DO ADCOM^GMRAFX(IEN,"V","Auto-verified by patch 19 post-install")
End DoDot:1
+15 QUIT
+16 ;
MAIL ;Send message indicating post install is finished
+1 NEW XMSUB,XMTEXT,XMDUZ,XMY,XMZ,GMRATXT
+2 SET XMDUZ="PATCH GMRA*4*19 POST-INSTALL"
SET XMY(.5)=""
IF $GET(DUZ)
SET XMY(DUZ)=""
+3 SET GMRATXT(1)="The post-install routine for patch GMRA*4*19"
+4 SET GMRATXT(2)="finished on "_$$FMTE^XLFDT($$NOW^XLFDT)_"."
+5 SET GMRATXT(3)=""
+6 IF TCNT=0
Begin DoDot:1
+7 SET GMRATXT(4)="The post-install did not find any entries that were missing the"
+8 SET GMRATXT(5)="verified field. No further action is required."
End DoDot:1
+9 IF TCNT>0
Begin DoDot:1
+10 SET GMRATXT(4)="The post-install found "_TCNT_$SELECT(TCNT=1:" entry",1:" entries")_" that were missing"
+11 SET GMRATXT(5)="the verified field. "_$SELECT(TCNT=VCNT:"All",VCNT=0:"None",1:VCNT)_" of these were auto-verified."
+12 IF TCNT'=VCNT
SET GMRATXT(6)="The remaining reactants are now available for verification"
SET GMRATXT(7)="using allergy package options."
End DoDot:1
+13 SET XMTEXT="GMRATXT("
SET XMSUB="PATCH GMRA*4*19 Post Install COMPLETED"
+14 DO ^XMD
+15 QUIT