AUM13EN ;IHS/OIT/NKD - ENVIRONMENT CHECK/PRE/POST-INSTALL FOR ICD 9 CODES 08/30/12 ;
;;13.0;TABLE MAINTENANCE;;AUG 30,2012;Build 1
;
I '$G(DUZ) W !,"DUZ UNDEFINED OR 0." D SORRY(2) Q
;
I '$L($G(DUZ(0))) W !,"DUZ(0) UNDEFINED OR NULL." D SORRY(2) Q
;
S X=$P(^VA(200,DUZ,0),U)
W !!,$$CJ^XLFSTR("Hello, "_$P(X,",",2)_" "_$P(X,","),IOM)
W !!,$$CJ^XLFSTR("Checking Environment for "_$P($T(+2),";",4)_" V "_$P($T(+2),";",3)_".",IOM)
;
S XPDQUIT=0,AUMQUIT=0
I $$VCHK("XU","8.0",2)
I $$VCHK("DI","22.0",2)
;
I $$VCHK("AUM","12.0",2)
I $$VCHK2("BCSV","1.0.3",2)
;
I XPDQUIT D SORRY(XPDQUIT) Q
;
W !!,$$CJ^XLFSTR("ENVIRONMENT OK.",IOM)
;
Q
;
SORRY(X) ;
KILL DIFQ
S XPDQUIT=X
W:'$D(ZTQUEUED) *7,!,$$CJ^XLFSTR("Sorry....",IOM),$$DIR^XBDIR("E","Press RETURN")
Q
;
VCHK(AUMPRE,AUMVER,AUMQUIT) ; Check versions needed.
;
NEW AUMV
S AUMV=$$VERSION^XPDUTL(AUMPRE)
W !,$$CJ^XLFSTR("Need at least "_AUMPRE_" v "_AUMVER_"....."_AUMPRE_" v "_AUMV_" Present",IOM)
I AUMV<AUMVER S XPDQUIT=AUMQUIT W *7,!,$$CJ^XLFSTR("^^^^**NEEDS FIXED**^^^^",IOM) Q 0
Q 1
;
VCHK2(AUMPRE,AUMVER,AUMQUIT) ; Check patch level
NEW AUMV
S AUMV=$$VERSION^XPDUTL(AUMPRE)
I $L(AUMV)<1 S XPDQUIT=AUMQUIT W !,$$CJ^XLFSTR("Need at least "_AUMPRE_" v "_AUMVER_"....."_AUMPRE_" Not Installed",IOM),*7,!,$$CJ^XLFSTR("^^^^**NEEDS TO BE FIXED**^^^^",IOM) Q 1
S PTCH=+$$LAST(AUMPRE,AUMV) S:PTCH=-1 DPTCH="" S:PTCH'=-1 DPTCH="."_PTCH
W !,$$CJ^XLFSTR("Need at least "_AUMPRE_" v "_AUMVER_"....."_AUMPRE_" v "_AUMV_DPTCH_" Present",IOM)
I (AUMV=$P(AUMVER,".",1,2))&(PTCH<$P(AUMVER,".",3)) KILL DIFQ S XPDQUIT=AUMQUIT W *7,!,$$CJ^XLFSTR("^^^^**NEEDS TO BE FIXED**^^^^",IOM)
Q 1
LAST(PKG,VER) ; EP - returns last patch applied for a Package, PATCH^DATE
; Patch includes Seq # if Released
N PKGIEN,VERIEN,LATEST,PATCH,SUBIEN
I $G(VER)="" S VER=$$VERSION^XPDUTL(PKG) Q:'VER -1
S PKGIEN=$O(^DIC(9.4,"C",PKG,"")) Q:'PKGIEN -1
S VERIEN=$O(^DIC(9.4,PKGIEN,22,"B",VER,"")) Q:'VERIEN -1
S LATEST=-1,PATCH=-1,SUBIEN=0
F S SUBIEN=$O(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN)) Q:SUBIEN'>0 D
. I $P(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)>LATEST S LATEST=$P(^(0),U,2),PATCH=$P(^(0),U)
. I $P(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)=LATEST,$P(^(0),U)>PATCH S PATCH=$P(^(0),U)
Q PATCH_U_LATEST
;
RSLT(%,LINE) ; EP - INSTALL MESSAGES
I $D(LINE) D BMES^XPDUTL(%)
I '$D(LINE) D MES^XPDUTL(%)
Q
;
PRE ; EP - PRE-INSTALL
; RE-XREF ^ICD9
S AUMK="^ICD9(""BA"")"
K @AUMK
S AUMK="^ICD9(""AB"")"
K @AUMK
D ^XBFMK
S DIK="^ICD9("
S DIK(1)=".01"
D ENALL^DIK
; RE-XREF ^ICD0
S AUMK="^ICD0(""BA"")"
K @AUMK
S AUMK="^ICD0(""AB"")"
K @AUMK
D ^XBFMK
S DIK="^ICD0("
S DIK(1)=".01"
D ENALL^DIK
; REMOVE PREVIOUS ^AUMDATA
S CNT=0 F S CNT=$O(^AUMDATA(CNT)) Q:'CNT K ^AUMDATA(CNT,0)
F CNT=3,4 S $P(^AUMDATA(0),"^",CNT)=0
;
Q
POST ; EP - POST-INSTALL
D UPDATE^AUM131
Q
AUM13EN ;IHS/OIT/NKD - ENVIRONMENT CHECK/PRE/POST-INSTALL FOR ICD 9 CODES 08/30/12 ;
+1 ;;13.0;TABLE MAINTENANCE;;AUG 30,2012;Build 1
+2 ;
+3 IF '$GET(DUZ)
WRITE !,"DUZ UNDEFINED OR 0."
DO SORRY(2)
QUIT
+4 ;
+5 IF '$LENGTH($GET(DUZ(0)))
WRITE !,"DUZ(0) UNDEFINED OR NULL."
DO SORRY(2)
QUIT
+6 ;
+7 SET X=$PIECE(^VA(200,DUZ,0),U)
+8 WRITE !!,$$CJ^XLFSTR("Hello, "_$PIECE(X,",",2)_" "_$PIECE(X,","),IOM)
+9 WRITE !!,$$CJ^XLFSTR("Checking Environment for "_$PIECE($TEXT(+2),";",4)_" V "_$PIECE($TEXT(+2),";",3)_".",IOM)
+10 ;
+11 SET XPDQUIT=0
SET AUMQUIT=0
+12 IF $$VCHK("XU","8.0",2)
+13 IF $$VCHK("DI","22.0",2)
+14 ;
+15 IF $$VCHK("AUM","12.0",2)
+16 IF $$VCHK2("BCSV","1.0.3",2)
+17 ;
+18 IF XPDQUIT
DO SORRY(XPDQUIT)
QUIT
+19 ;
+20 WRITE !!,$$CJ^XLFSTR("ENVIRONMENT OK.",IOM)
+21 ;
+22 QUIT
+23 ;
SORRY(X) ;
+1 KILL DIFQ
+2 SET XPDQUIT=X
+3 IF '$DATA(ZTQUEUED)
WRITE *7,!,$$CJ^XLFSTR("Sorry....",IOM),$$DIR^XBDIR("E","Press RETURN")
+4 QUIT
+5 ;
VCHK(AUMPRE,AUMVER,AUMQUIT) ; Check versions needed.
+1 ;
+2 NEW AUMV
+3 SET AUMV=$$VERSION^XPDUTL(AUMPRE)
+4 WRITE !,$$CJ^XLFSTR("Need at least "_AUMPRE_" v "_AUMVER_"....."_AUMPRE_" v "_AUMV_" Present",IOM)
+5 IF AUMV<AUMVER
SET XPDQUIT=AUMQUIT
WRITE *7,!,$$CJ^XLFSTR("^^^^**NEEDS FIXED**^^^^",IOM)
QUIT 0
+6 QUIT 1
+7 ;
VCHK2(AUMPRE,AUMVER,AUMQUIT) ; Check patch level
+1 NEW AUMV
+2 SET AUMV=$$VERSION^XPDUTL(AUMPRE)
+3 IF $LENGTH(AUMV)<1
SET XPDQUIT=AUMQUIT
WRITE !,$$CJ^XLFSTR("Need at least "_AUMPRE_" v "_AUMVER_"....."_AUMPRE_" Not Installed",IOM),*7,!,$$CJ^XLFSTR("^^^^**NEEDS TO BE FIXED**^^^^",IOM)
QUIT 1
+4 SET PTCH=+$$LAST(AUMPRE,AUMV)
IF PTCH=-1
SET DPTCH=""
IF PTCH'=-1
SET DPTCH="."_PTCH
+5 WRITE !,$$CJ^XLFSTR("Need at least "_AUMPRE_" v "_AUMVER_"....."_AUMPRE_" v "_AUMV_DPTCH_" Present",IOM)
+6 IF (AUMV=$PIECE(AUMVER,".",1,2))&(PTCH<$PIECE(AUMVER,".",3))
KILL DIFQ
SET XPDQUIT=AUMQUIT
WRITE *7,!,$$CJ^XLFSTR("^^^^**NEEDS TO BE FIXED**^^^^",IOM)
+7 QUIT 1
LAST(PKG,VER) ; EP - returns last patch applied for a Package, PATCH^DATE
+1 ; Patch includes Seq # if Released
+2 NEW PKGIEN,VERIEN,LATEST,PATCH,SUBIEN
+3 IF $GET(VER)=""
SET VER=$$VERSION^XPDUTL(PKG)
IF 'VER
QUIT -1
+4 SET PKGIEN=$ORDER(^DIC(9.4,"C",PKG,""))
IF 'PKGIEN
QUIT -1
+5 SET VERIEN=$ORDER(^DIC(9.4,PKGIEN,22,"B",VER,""))
IF 'VERIEN
QUIT -1
+6 SET LATEST=-1
SET PATCH=-1
SET SUBIEN=0
+7 FOR
SET SUBIEN=$ORDER(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN))
IF SUBIEN'>0
QUIT
Begin DoDot:1
+8 IF $PIECE(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)>LATEST
SET LATEST=$PIECE(^(0),U,2)
SET PATCH=$PIECE(^(0),U)
+9 IF $PIECE(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)=LATEST
IF $PIECE(^(0),U)>PATCH
SET PATCH=$PIECE(^(0),U)
End DoDot:1
+10 QUIT PATCH_U_LATEST
+11 ;
RSLT(%,LINE) ; EP - INSTALL MESSAGES
+1 IF $DATA(LINE)
DO BMES^XPDUTL(%)
+2 IF '$DATA(LINE)
DO MES^XPDUTL(%)
+3 QUIT
+4 ;
PRE ; EP - PRE-INSTALL
+1 ; RE-XREF ^ICD9
+2 SET AUMK="^ICD9(""BA"")"
+3 KILL @AUMK
+4 SET AUMK="^ICD9(""AB"")"
+5 KILL @AUMK
+6 DO ^XBFMK
+7 SET DIK="^ICD9("
+8 SET DIK(1)=".01"
+9 DO ENALL^DIK
+10 ; RE-XREF ^ICD0
+11 SET AUMK="^ICD0(""BA"")"
+12 KILL @AUMK
+13 SET AUMK="^ICD0(""AB"")"
+14 KILL @AUMK
+15 DO ^XBFMK
+16 SET DIK="^ICD0("
+17 SET DIK(1)=".01"
+18 DO ENALL^DIK
+19 ; REMOVE PREVIOUS ^AUMDATA
+20 SET CNT=0
FOR
SET CNT=$ORDER(^AUMDATA(CNT))
IF 'CNT
QUIT
KILL ^AUMDATA(CNT,0)
+21 FOR CNT=3,4
SET $PIECE(^AUMDATA(0),"^",CNT)=0
+22 ;
+23 QUIT
POST ; EP - POST-INSTALL
+1 DO UPDATE^AUM131
+2 QUIT