SD53441A ;ALB/MRY - PRE/POST INSTALL ROUTINE;6/20/2005
;;5.3;Scheduling;**441,1015**;Aug 13, 1993;Build 21
;
;The bulk of this routine was copied from routine SD53142
;
POST ;Main entry point of post-install
N X,ZTRTN,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTSK,OLDNAME,NEWNAME
;Make ERROR CODE DESCRIPTION (field #11) an identifier of the
; TRANSMITTED OUTPATIENT ENCOUNTER ERROR CODE file (#409.76)
; (this was removed by the pre init routine)
I ('$D(^DD(409.76,0,"ID",11))) D
.N TMP
.S X(1)=" "
.S X(2)="Restoring ERROR CODE DESCRIPTION (field #11) as an identifier"
.S X(3)="of the TRANSMITTED OUTPATIENT ENCOUNTER ERROR CODE file"
.S X(4)="(#409.76) as it was removed by the pre init."
.S X(5)=" "
.D MES^XPDUTL(.X) K X
.S ^DD(409.76,0,"ID",11)="D EN^DDIOL($P(^(1),U,1))"
.S TMP=$P(^SD(409.76,0),U,2)
.S TMP=$TR(TMP,"I","")
.S $P(^SD(409.76,0),U,2)=TMP_"I"
;Change HL7 application name
S OLDNAME="AMBCARE-DH325"
S NEWNAME="AMBCARE-DH441"
;Patch already installed - skip rest of post-init
I $$PATCH^XPDUTL("SD*5.3*441") D Q
.K X
.S X(1)=" "
.S X(2)="This patch was previously installed. Because of this, changing the"
.S X(3)="HL7 Application name from "_OLDNAME_" to "_NEWNAME_" and changing"
.S X(4)="the status of unacked AmbCare messages to SUCCESSFULLY COMPLETED is"
.S X(5)="not required."
.S X(6)=" "
.D MES^XPDUTL(.X) K X
D HLAPP(OLDNAME,NEWNAME)
;Queue changing of HL7 message statuses
S ZTRTN="QHLM^SD53441A"
S ZTDESC="Change status of unacked AmbCare messages to SUCCESSFULLY COMPLETED"
S ZTIO=""
S ZTDTH=$H
D ^%ZTLOAD
K X
S X(1)=" "
S X(2)="Updating status of AmbCare messages that have not been acknowledged"
S X(3)="queued as task number "_$G(ZTSK)
S X(4)=" "
I '$G(ZTSK) D
.S X(1)=" "
.S X(2)="***** Updating status of AmbCare messages that have not been"
.S X(3)="***** acknowledged was not queued. This process must be done"
.S X(4)="***** in order for these messages to be properly purged."
.S X(5)="***** Use entry point QHLM^SD53441A to do this process."
.S X(6)=" "
D MES^XPDUTL(.X) K X
Q
;
HLAPP(OLDNAME,NEWNAME) ;Change HL7 application name
;Input : OLDNAME - Name of HL7 application to change
; NEWNAME - New name for HL7 application
;Output : None
;Notes : Call designed to be used as a KIDS pre/post init
S OLDNAME=$G(OLDNAME) Q:OLDNAME=""
S NEWNAME=$G(NEWNAME) Q:NEWNAME=""
N DIE,DIC,DA,DR,X,Y,PTCH
D BMES^XPDUTL("Changing HL7 Application name from "_OLDNAME_" to "_NEWNAME)
S DIC="^HL(771,"
S DIC(0)="X"
S X=OLDNAME
D ^DIC
I (Y<0) D Q
.D BMES^XPDUTL(" *** "_OLDNAME_" application not found ***")
S DIE=DIC
S DA=+Y
S DR=".01///^S X=NEWNAME"
D ^DIE
D MES^XPDUTL("HL7 application name successfully changed to "_NEWNAME)
Q
;
QHLM ;Entry point for queued changing of HL7 messages
D HLM("AMBCARE-DH441")
Q
HLM(APPNAME) ;Change status of HL7 messages to '3' (SUCCESSFULLY COMPLETED)
; to enable purging of message
;Input : APPNAME - Name of application generating message
;Output : None
;Notes : Call must be used within KIDS (updates progress bar)
S APPNAME=$G(APPNAME) Q:APPNAME=""
N DA,DIC,DIE,DR,X,Y,SDAPP,HLMID,XPDIDTOT,HLPTR,COUNT,TEXT
N XMDUZ,XMSUB,XMTEXT,XMY,XMZ,SBSCRPT
S SBSCRPT="SD "_APPNAME
K ^TMP(SBSCRPT,$J)
S X=$$NOW^XLFDT()
S Y=$$FMTE^XLFDT(X)
S TEXT="Updating of HL7 Message Text file (#772) began on "
S TEXT=TEXT_$P(Y,"@",1)_" @ "_$P(Y,"@",2)
S ^TMP(SBSCRPT,$J,1,0)=TEXT
S DIC="^HL(771,"
S DIC(0)="M"
S X=APPNAME
D ^DIC
I (Y<0) D G HLMQ
.S ^TMP(SBSCRPT,$J,2,0)=" *** "_APPNAME_" application not found"
.S ^TMP(SBSCRPT,$J,3,0)=" *** Process aborted"
S SDAPP=+Y
S HLMID=""
S COUNT=0
F S HLMID=$O(^HL(772,"AH",SDAPP,HLMID)) Q:(HLMID="") D
.S HLPTR=0
.F S HLPTR=+$O(^HL(772,"AH",SDAPP,HLMID,HLPTR)) Q:('HLPTR) D
..S DIE="^HL(772,"
..S DA=HLPTR
..S DR="20////3"
..D ^DIE
..S COUNT=COUNT+1
S X=$$NOW^XLFDT()
S Y=$$FMTE^XLFDT(X)
S TEXT="Updating of HL7 Message Text file completed on "
S TEXT=TEXT_$P(Y,"@",1)_" @ "_$P(Y,"@",2)
S ^TMP(SBSCRPT,$J,2,0)=TEXT
S ^TMP(SBSCRPT,$J,3,0)=COUNT_" entries were updated"
HLMQ S XMDUZ="Patch SD*5.3*441"
S XMSUB="Updating of HL7 Message Text file"
S XMTEXT="^TMP("""_SBSCRPT_""",$J,"
S XMY(DUZ)=""
D ^XMD
S ZTREQ="@"
Q
SD53441A ;ALB/MRY - PRE/POST INSTALL ROUTINE;6/20/2005
+1 ;;5.3;Scheduling;**441,1015**;Aug 13, 1993;Build 21
+2 ;
+3 ;The bulk of this routine was copied from routine SD53142
+4 ;
POST ;Main entry point of post-install
+1 NEW X,ZTRTN,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTSK,OLDNAME,NEWNAME
+2 ;Make ERROR CODE DESCRIPTION (field #11) an identifier of the
+3 ; TRANSMITTED OUTPATIENT ENCOUNTER ERROR CODE file (#409.76)
+4 ; (this was removed by the pre init routine)
+5 IF ('$DATA(^DD(409.76,0,"ID",11)))
Begin DoDot:1
+6 NEW TMP
+7 SET X(1)=" "
+8 SET X(2)="Restoring ERROR CODE DESCRIPTION (field #11) as an identifier"
+9 SET X(3)="of the TRANSMITTED OUTPATIENT ENCOUNTER ERROR CODE file"
+10 SET X(4)="(#409.76) as it was removed by the pre init."
+11 SET X(5)=" "
+12 DO MES^XPDUTL(.X)
KILL X
+13 SET ^DD(409.76,0,"ID",11)="D EN^DDIOL($P(^(1),U,1))"
+14 SET TMP=$PIECE(^SD(409.76,0),U,2)
+15 SET TMP=$TRANSLATE(TMP,"I","")
+16 SET $PIECE(^SD(409.76,0),U,2)=TMP_"I"
End DoDot:1
+17 ;Change HL7 application name
+18 SET OLDNAME="AMBCARE-DH325"
+19 SET NEWNAME="AMBCARE-DH441"
+20 ;Patch already installed - skip rest of post-init
+21 IF $$PATCH^XPDUTL("SD*5.3*441")
Begin DoDot:1
+22 KILL X
+23 SET X(1)=" "
+24 SET X(2)="This patch was previously installed. Because of this, changing the"
+25 SET X(3)="HL7 Application name from "_OLDNAME_" to "_NEWNAME_" and changing"
+26 SET X(4)="the status of unacked AmbCare messages to SUCCESSFULLY COMPLETED is"
+27 SET X(5)="not required."
+28 SET X(6)=" "
+29 DO MES^XPDUTL(.X)
KILL X
End DoDot:1
QUIT
+30 DO HLAPP(OLDNAME,NEWNAME)
+31 ;Queue changing of HL7 message statuses
+32 SET ZTRTN="QHLM^SD53441A"
+33 SET ZTDESC="Change status of unacked AmbCare messages to SUCCESSFULLY COMPLETED"
+34 SET ZTIO=""
+35 SET ZTDTH=$HOROLOG
+36 DO ^%ZTLOAD
+37 KILL X
+38 SET X(1)=" "
+39 SET X(2)="Updating status of AmbCare messages that have not been acknowledged"
+40 SET X(3)="queued as task number "_$GET(ZTSK)
+41 SET X(4)=" "
+42 IF '$GET(ZTSK)
Begin DoDot:1
+43 SET X(1)=" "
+44 SET X(2)="***** Updating status of AmbCare messages that have not been"
+45 SET X(3)="***** acknowledged was not queued. This process must be done"
+46 SET X(4)="***** in order for these messages to be properly purged."
+47 SET X(5)="***** Use entry point QHLM^SD53441A to do this process."
+48 SET X(6)=" "
End DoDot:1
+49 DO MES^XPDUTL(.X)
KILL X
+50 QUIT
+51 ;
HLAPP(OLDNAME,NEWNAME) ;Change HL7 application name
+1 ;Input : OLDNAME - Name of HL7 application to change
+2 ; NEWNAME - New name for HL7 application
+3 ;Output : None
+4 ;Notes : Call designed to be used as a KIDS pre/post init
+5 SET OLDNAME=$GET(OLDNAME)
IF OLDNAME=""
QUIT
+6 SET NEWNAME=$GET(NEWNAME)
IF NEWNAME=""
QUIT
+7 NEW DIE,DIC,DA,DR,X,Y,PTCH
+8 DO BMES^XPDUTL("Changing HL7 Application name from "_OLDNAME_" to "_NEWNAME)
+9 SET DIC="^HL(771,"
+10 SET DIC(0)="X"
+11 SET X=OLDNAME
+12 DO ^DIC
+13 IF (Y<0)
Begin DoDot:1
+14 DO BMES^XPDUTL(" *** "_OLDNAME_" application not found ***")
End DoDot:1
QUIT
+15 SET DIE=DIC
+16 SET DA=+Y
+17 SET DR=".01///^S X=NEWNAME"
+18 DO ^DIE
+19 DO MES^XPDUTL("HL7 application name successfully changed to "_NEWNAME)
+20 QUIT
+21 ;
QHLM ;Entry point for queued changing of HL7 messages
+1 DO HLM("AMBCARE-DH441")
+2 QUIT
HLM(APPNAME) ;Change status of HL7 messages to '3' (SUCCESSFULLY COMPLETED)
+1 ; to enable purging of message
+2 ;Input : APPNAME - Name of application generating message
+3 ;Output : None
+4 ;Notes : Call must be used within KIDS (updates progress bar)
+5 SET APPNAME=$GET(APPNAME)
IF APPNAME=""
QUIT
+6 NEW DA,DIC,DIE,DR,X,Y,SDAPP,HLMID,XPDIDTOT,HLPTR,COUNT,TEXT
+7 NEW XMDUZ,XMSUB,XMTEXT,XMY,XMZ,SBSCRPT
+8 SET SBSCRPT="SD "_APPNAME
+9 KILL ^TMP(SBSCRPT,$JOB)
+10 SET X=$$NOW^XLFDT()
+11 SET Y=$$FMTE^XLFDT(X)
+12 SET TEXT="Updating of HL7 Message Text file (#772) began on "
+13 SET TEXT=TEXT_$PIECE(Y,"@",1)_" @ "_$PIECE(Y,"@",2)
+14 SET ^TMP(SBSCRPT,$JOB,1,0)=TEXT
+15 SET DIC="^HL(771,"
+16 SET DIC(0)="M"
+17 SET X=APPNAME
+18 DO ^DIC
+19 IF (Y<0)
Begin DoDot:1
+20 SET ^TMP(SBSCRPT,$JOB,2,0)=" *** "_APPNAME_" application not found"
+21 SET ^TMP(SBSCRPT,$JOB,3,0)=" *** Process aborted"
End DoDot:1
GOTO HLMQ
+22 SET SDAPP=+Y
+23 SET HLMID=""
+24 SET COUNT=0
+25 FOR
SET HLMID=$ORDER(^HL(772,"AH",SDAPP,HLMID))
IF (HLMID="")
QUIT
Begin DoDot:1
+26 SET HLPTR=0
+27 FOR
SET HLPTR=+$ORDER(^HL(772,"AH",SDAPP,HLMID,HLPTR))
IF ('HLPTR)
QUIT
Begin DoDot:2
+28 SET DIE="^HL(772,"
+29 SET DA=HLPTR
+30 SET DR="20////3"
+31 DO ^DIE
+32 SET COUNT=COUNT+1
End DoDot:2
End DoDot:1
+33 SET X=$$NOW^XLFDT()
+34 SET Y=$$FMTE^XLFDT(X)
+35 SET TEXT="Updating of HL7 Message Text file completed on "
+36 SET TEXT=TEXT_$PIECE(Y,"@",1)_" @ "_$PIECE(Y,"@",2)
+37 SET ^TMP(SBSCRPT,$JOB,2,0)=TEXT
+38 SET ^TMP(SBSCRPT,$JOB,3,0)=COUNT_" entries were updated"
HLMQ SET XMDUZ="Patch SD*5.3*441"
+1 SET XMSUB="Updating of HL7 Message Text file"
+2 SET XMTEXT="^TMP("""_SBSCRPT_""",$J,"
+3 SET XMY(DUZ)=""
+4 DO ^XMD
+5 SET ZTREQ="@"
+6 QUIT