AUM15 ;IHS/OIT/NKD - ENVIRONMENT CHECK/PRE/POST-INSTALL FOR ICD 9 CODES FY2015 09/09/14 ;
;;15.0;TABLE MAINTENANCE;;SEP 09,2014;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)_$S($L($P($T(+2),";",5))>4:" Patch "_$P($T(+2),";",5),1:"")_".",IOM),!
;
S:'$$VCHK("XU","8.0","1017") XPDQUIT=2
S:'$$VCHK("XT","7.3","1017") XPDQUIT=2
S:'$$VCHK("DI","22.0","1017") XPDQUIT=2
N AUMAICD S AUMAICD=$$VERSION^XPDUTL("AICD"),XPDQUIT=$S(AUMAICD>3.51:2,1:$G(XPDQUIT))
W !,$$CJ^XLFSTR("Need AICD v3.51.....AICD v"_AUMAICD_" Present"_$S(AUMAICD>3.51:" ***FIX IT***",1:""),IOM)
S:'$$VCHK("AUM","14.0") XPDQUIT=2
S:'$$VCHK("BCSV","1.0","3") XPDQUIT=2
;
NEW DA,DIC
S X="AUM",DIC="^DIC(9.4,",DIC(0)="",D="C"
D IX^DIC
I Y<0,$D(^DIC(9.4,"C","AUM")) D
. W !!,*7,*7,$$CJ^XLFSTR("You Have More Than One Entry In The",IOM),!,$$CJ^XLFSTR("PACKAGE File with an ""AUM"" prefix.",IOM)
. W !,$$CJ^XLFSTR("One entry needs to be deleted.",IOM)
. D SORRY(2)
.Q
;
I $G(XPDQUIT) W !,$$CJ^XLFSTR("FIX IT! Before Proceeding.",IOM),!!,*7,*7,*7 Q
W !!,$$CJ^XLFSTR("ENVIRONMENT OK.",IOM)
I '$$DIR^XBDIR("E","","","","","",1) D SORRY(2)
Q
;
SORRY(X) ;
KILL DIFQ
S XPDQUIT=X
W *7,!,$$CJ^XLFSTR("Sorry....FIX IT!",IOM)
Q
;
VCHK(AUMPRE,AUMVER,AUMPAT) ; Check patch level
N AUMV,AUMP
S AUMV=$$VERSION^XPDUTL(AUMPRE)
I (AUMV<AUMVER) K DIFQ D DISP(AUMPRE,AUMVER,$G(AUMPAT),AUMV,$G(AUMP),0) Q 0
I '$D(AUMPAT) D DISP(AUMPRE,AUMVER,$G(AUMPAT),AUMV,$G(AUMP),1) Q 1
S AUMP=+$$LAST(AUMPRE,AUMVER)
I (AUMP<AUMPAT) K DIFQ D DISP(AUMPRE,AUMVER,$G(AUMPAT),AUMVER,$G(AUMP),0) Q 0
D DISP(AUMPRE,AUMVER,$G(AUMPAT),AUMVER,$G(AUMP),1)
Q 1
DISP(AUMPRE,AUMVER,AUMPAT,AUMV,AUMP,AUMR) ; Display requirement checking results
;
N AUMS
S AUMS="Need at least "_$G(AUMPRE)_" v"_$G(AUMVER)_$S($G(AUMPAT)]"":" p"_$G(AUMPAT),1:"")_"....."
S AUMS=AUMS_$G(AUMPRE)_" v"_$G(AUMV)_$S($G(AUMP)]"":" p"_$G(AUMP),1:"")_" Present"
S AUMS=AUMS_$S('AUMR:" ***FIX IT***",1:"")
W !,$$CJ^XLFSTR(AUMS,IOM)
Q
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
;
PRE ; EP - PRE-INSTALL
N AUMI
; RE-XREF ^ICD9
D RSLT("ICD Diagnosis file cleanup"),^XBFMK W !
F AUMI=$NA(^ICD9("AB")),$NA(^ICD9("BA")) K @AUMI
S DIK="^ICD9(",DIK(1)=".01"
D ENALL^DIK
; RE-XREF ^ICD0
D RSLT("ICD Operation/Procedure file cleanup"),^XBFMK W !
F AUMI=$NA(^ICD0("AB")),$NA(^ICD0("BA")) K @AUMI
S DIK="^ICD0(",DIK(1)=".01"
D ENALL^DIK
; REMOVE PREVIOUS ^AUMDATA
S AUMI=0 F S AUMI=$O(^AUMDATA(AUMI)) Q:'AUMI K ^AUMDATA(AUMI)
F AUMI=3,4 S $P(^AUMDATA(0),"^",AUMI)=0
;
Q
POST ; EP - POST-INSTALL
N AUMDUP
D RSLT($J("",24)_"Resolving duplicate ICD entries",1),RSLT($J("",24)_$$REPEAT^XLFSTR("-",31))
D RSLT("Scan #1"),MAIN^AUM15DU
;
S AUMDUP=+$O(^XTMP("AUM",""),-1),AUMDUP=+$G(^XTMP("AUM",AUMDUP,"COUNT"))
I AUMDUP D RSLT("Scan #2"),MAIN^AUM15DU
;
S AUMDUP=+$O(^XTMP("AUM",""),-1),AUMDUP=+$G(^XTMP("AUM",AUMDUP,"COUNT"))
I AUMDUP D SEARCH^AUM15DU($NA(^TMP("AUM",$J,"SCAN"))) I +$G(^TMP("AUM",$J,"SCAN","COUNT")) D
. D RSLT($$REPEAT^XLFSTR("*",80),1)
. D RSLT($G(^TMP("AUM",$J,"SCAN","COUNT"))_" duplicate ICD entries remain!")
. D RSLT("Contact the OIT Help Desk for assistance")
. D RSLT($$REPEAT^XLFSTR("*",80))
;
D RSLT($J("",24)_"Performing ICD full table update",1),RSLT($J("",24)_$$REPEAT^XLFSTR("-",32))
D MAIN^AUM15U
Q
RSLT(%,LINE) ; EP - INSTALL MESSAGES
I $D(LINE) D BMES^XPDUTL(%)
I '$D(LINE) D MES^XPDUTL(%)
Q
;
AUM15 ;IHS/OIT/NKD - ENVIRONMENT CHECK/PRE/POST-INSTALL FOR ICD 9 CODES FY2015 09/09/14 ;
+1 ;;15.0;TABLE MAINTENANCE;;SEP 09,2014;Build 1
+2 ;
+3 IF '$GET(DUZ)
WRITE !,"DUZ UNDEFINED OR 0."
DO SORRY(2)
QUIT
+4 IF '$LENGTH($GET(DUZ(0)))
WRITE !,"DUZ(0) UNDEFINED OR NULL."
DO SORRY(2)
QUIT
+5 ;
+6 SET X=$PIECE(^VA(200,DUZ,0),U)
+7 WRITE !!,$$CJ^XLFSTR("Hello, "_$PIECE(X,",",2)_" "_$PIECE(X,","),IOM)
+8 WRITE !!,$$CJ^XLFSTR("Checking Environment for "_$PIECE($TEXT(+2),";",4)_" V "_$PIECE($TEXT(+2),";",3)_$SELECT($LENGTH($PIECE($TEXT(+2),";",5))>4:" Patch "_$PIECE($TEXT(+2),";",5),1:"")_".",IOM),!
+9 ;
+10 IF '$$VCHK("XU","8.0","1017")
SET XPDQUIT=2
+11 IF '$$VCHK("XT","7.3","1017")
SET XPDQUIT=2
+12 IF '$$VCHK("DI","22.0","1017")
SET XPDQUIT=2
+13 NEW AUMAICD
SET AUMAICD=$$VERSION^XPDUTL("AICD")
SET XPDQUIT=$SELECT(AUMAICD>3.51:2,1:$GET(XPDQUIT))
+14 WRITE !,$$CJ^XLFSTR("Need AICD v3.51.....AICD v"_AUMAICD_" Present"_$SELECT(AUMAICD>3.51:" ***FIX IT***",1:""),IOM)
+15 IF '$$VCHK("AUM","14.0")
SET XPDQUIT=2
+16 IF '$$VCHK("BCSV","1.0","3")
SET XPDQUIT=2
+17 ;
+18 NEW DA,DIC
+19 SET X="AUM"
SET DIC="^DIC(9.4,"
SET DIC(0)=""
SET D="C"
+20 DO IX^DIC
+21 IF Y<0
IF $DATA(^DIC(9.4,"C","AUM"))
Begin DoDot:1
+22 WRITE !!,*7,*7,$$CJ^XLFSTR("You Have More Than One Entry In The",IOM),!,$$CJ^XLFSTR("PACKAGE File with an ""AUM"" prefix.",IOM)
+23 WRITE !,$$CJ^XLFSTR("One entry needs to be deleted.",IOM)
+24 DO SORRY(2)
+25 QUIT
End DoDot:1
+26 ;
+27 IF $GET(XPDQUIT)
WRITE !,$$CJ^XLFSTR("FIX IT! Before Proceeding.",IOM),!!,*7,*7,*7
QUIT
+28 WRITE !!,$$CJ^XLFSTR("ENVIRONMENT OK.",IOM)
+29 IF '$$DIR^XBDIR("E","","","","","",1)
DO SORRY(2)
+30 QUIT
+31 ;
SORRY(X) ;
+1 KILL DIFQ
+2 SET XPDQUIT=X
+3 WRITE *7,!,$$CJ^XLFSTR("Sorry....FIX IT!",IOM)
+4 QUIT
+5 ;
VCHK(AUMPRE,AUMVER,AUMPAT) ; Check patch level
+1 NEW AUMV,AUMP
+2 SET AUMV=$$VERSION^XPDUTL(AUMPRE)
+3 IF (AUMV<AUMVER)
KILL DIFQ
DO DISP(AUMPRE,AUMVER,$GET(AUMPAT),AUMV,$GET(AUMP),0)
QUIT 0
+4 IF '$DATA(AUMPAT)
DO DISP(AUMPRE,AUMVER,$GET(AUMPAT),AUMV,$GET(AUMP),1)
QUIT 1
+5 SET AUMP=+$$LAST(AUMPRE,AUMVER)
+6 IF (AUMP<AUMPAT)
KILL DIFQ
DO DISP(AUMPRE,AUMVER,$GET(AUMPAT),AUMVER,$GET(AUMP),0)
QUIT 0
+7 DO DISP(AUMPRE,AUMVER,$GET(AUMPAT),AUMVER,$GET(AUMP),1)
+8 QUIT 1
DISP(AUMPRE,AUMVER,AUMPAT,AUMV,AUMP,AUMR) ; Display requirement checking results
+1 ;
+2 NEW AUMS
+3 SET AUMS="Need at least "_$GET(AUMPRE)_" v"_$GET(AUMVER)_$SELECT($GET(AUMPAT)]"":" p"_$GET(AUMPAT),1:"")_"....."
+4 SET AUMS=AUMS_$GET(AUMPRE)_" v"_$GET(AUMV)_$SELECT($GET(AUMP)]"":" p"_$GET(AUMP),1:"")_" Present"
+5 SET AUMS=AUMS_$SELECT('AUMR:" ***FIX IT***",1:"")
+6 WRITE !,$$CJ^XLFSTR(AUMS,IOM)
+7 QUIT
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 ;
PRE ; EP - PRE-INSTALL
+1 NEW AUMI
+2 ; RE-XREF ^ICD9
+3 DO RSLT("ICD Diagnosis file cleanup")
DO ^XBFMK
WRITE !
+4 FOR AUMI=$NAME(^ICD9("AB")),$NAME(^ICD9("BA"))
KILL @AUMI
+5 SET DIK="^ICD9("
SET DIK(1)=".01"
+6 DO ENALL^DIK
+7 ; RE-XREF ^ICD0
+8 DO RSLT("ICD Operation/Procedure file cleanup")
DO ^XBFMK
WRITE !
+9 FOR AUMI=$NAME(^ICD0("AB")),$NAME(^ICD0("BA"))
KILL @AUMI
+10 SET DIK="^ICD0("
SET DIK(1)=".01"
+11 DO ENALL^DIK
+12 ; REMOVE PREVIOUS ^AUMDATA
+13 SET AUMI=0
FOR
SET AUMI=$ORDER(^AUMDATA(AUMI))
IF 'AUMI
QUIT
KILL ^AUMDATA(AUMI)
+14 FOR AUMI=3,4
SET $PIECE(^AUMDATA(0),"^",AUMI)=0
+15 ;
+16 QUIT
POST ; EP - POST-INSTALL
+1 NEW AUMDUP
+2 DO RSLT($JUSTIFY("",24)_"Resolving duplicate ICD entries",1)
DO RSLT($JUSTIFY("",24)_$$REPEAT^XLFSTR("-",31))
+3 DO RSLT("Scan #1")
DO MAIN^AUM15DU
+4 ;
+5 SET AUMDUP=+$ORDER(^XTMP("AUM",""),-1)
SET AUMDUP=+$GET(^XTMP("AUM",AUMDUP,"COUNT"))
+6 IF AUMDUP
DO RSLT("Scan #2")
DO MAIN^AUM15DU
+7 ;
+8 SET AUMDUP=+$ORDER(^XTMP("AUM",""),-1)
SET AUMDUP=+$GET(^XTMP("AUM",AUMDUP,"COUNT"))
+9 IF AUMDUP
DO SEARCH^AUM15DU($NAME(^TMP("AUM",$JOB,"SCAN")))
IF +$GET(^TMP("AUM",$JOB,"SCAN","COUNT"))
Begin DoDot:1
+10 DO RSLT($$REPEAT^XLFSTR("*",80),1)
+11 DO RSLT($GET(^TMP("AUM",$JOB,"SCAN","COUNT"))_" duplicate ICD entries remain!")
+12 DO RSLT("Contact the OIT Help Desk for assistance")
+13 DO RSLT($$REPEAT^XLFSTR("*",80))
End DoDot:1
+14 ;
+15 DO RSLT($JUSTIFY("",24)_"Performing ICD full table update",1)
DO RSLT($JUSTIFY("",24)_$$REPEAT^XLFSTR("-",32))
+16 DO MAIN^AUM15U
+17 QUIT
RSLT(%,LINE) ; EP - INSTALL MESSAGES
+1 IF $DATA(LINE)
DO BMES^XPDUTL(%)
+2 IF '$DATA(LINE)
DO MES^XPDUTL(%)
+3 QUIT
+4 ;