Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: AICDPOST

AICDPOST.m

Go to the documentation of this file.
AICDPOST ; IHS/OIT/FBD&NKD - ICD-10 LOAD POST-INIT ;   
 ;;4.0;AICD;;DEC 12, 2014;Build 7
 ;
 ;
 D:'$D(IOM) HOME^%ZIS
 ;
 ; LOAD ICD-10 GLOBAL VALUES
 D MES^XPDUTL($$LJ^XLFSTR("Loading ICD-10 codes into ICD globals...",IOM))
 ;
 ; DOUBLE-CHECK EXISTENCE OF UPDATE GLOBALS (IN CASE OF RESTART)
 S AICDERR=0
 S:'$$GCHK^AICDENV("^AICDICD9","ICD DIAGNOSIS update global") AICDERR=2            ; FILE 80
 S:'$$GCHK^AICDENV("^AICDICD0","ICD OPERATION/PROCEDURE update global") AICDERR=2  ; FILE 80.1
 S:'$$GCHK^AICDENV("^AICDICDS","ICD CODING SYSTEMS update global") AICDERR=2       ; FILE 80.4
 I +AICDERR D SORRY(AICDERR) Q
 ;
 I $D(^ICD9(500001)) D  ; CLEANUP FOR RE-INSTALLATIONS - FLUSH PREVIOUS ICD-10 LOADS
 . N AICDIEN
 . S AICDIEN=499998
 . F  S AICDIEN=$O(^ICD9(AICDIEN)) Q:+AICDIEN'=AICDIEN  K ^ICD9(AICDIEN)  ; CLEANING ^ICD9 GLOBAL (FILE 80)
 . S AICDIEN=499998
 . F  S AICDIEN=$O(^ICD0(AICDIEN)) Q:+AICDIEN'=AICDIEN  K ^ICD0(AICDIEN)  ; CLEANING ^ICD0 GLOBAL (FILE 80.1)
 ;
 M ^ICD9=^AICDICD9  ; FILE 80
 M ^ICD0=^AICDICD0  ; FILE 80.1
 M ^ICDS=^AICDICDS  ; FILE 80.4
 K ^AICDALL(0)      ; RESET OVERRIDE
 D MES^XPDUTL($$LJ^XLFSTR("ICD-10 global load complete.",IOM))
 ;
 ; LAST STEP - REINDEX UPDATED FILES
 N XREF
 D MES^XPDUTL($$LJ^XLFSTR("Re-indexing modified files...",IOM))
 ;
 ; 1) WHOLE-FILE X-REF KILLS
 S XREF="@"                              ; STARTER SEED VALUE FOR FILE 80 XREF SCAN
 F  S XREF=$O(^ICD9(XREF)) Q:XREF=""  D  ; SCAN AND FLUSH ALL XREFS FOR FILE 80
 . K ^ICD9(XREF)
 S XREF="@"                              ; STARTER SEED VALUE FOR FILE 80.1 XREF SCAN
 F  S XREF=$O(^ICD0(XREF)) Q:XREF=""  D  ; SCAN AND FLUSH ALL XREFS FOR FILE 80.1
 . K ^ICD0(XREF)
 S XREF="@"                              ; STARTER SEED VALUE FOR FILE 80.4 XREF SCAN
 F  S XREF=$O(^ICDS(XREF)) Q:XREF=""  D  ; SCAN AND FLUSH ALL XREFS FOR FILE 80.4
 . K ^ICDS(XREF)
 ;
 ; 2) SUB-FILE X-REF KILLS
 F DIK="^ICD9(","^ICD0(","^ICDS(" D IXALL2^DIK  ; KILL LOGIC (TO REMOVE SUBFILE XREFS)
 ;
 ; 3) COMPLETE RE-INDEX (SET LOGIC)
 D MES^XPDUTL($$LJ^XLFSTR(" - File 80 ",IOM))
 S DIK="^ICD9(" D IXALL^DIK
 D MES^XPDUTL($$LJ^XLFSTR(" - File 80.1 ",IOM))
 S DIK="^ICD0(" D IXALL^DIK
 D MES^XPDUTL($$LJ^XLFSTR(" - File 80.4 ",IOM))
 S DIK="^ICDS(" D IXALL^DIK
 ;
 ; ENABLE ICD9 UNCODED DX/PX ENTRIES
 D UNCODED
 ;
 ; END OF POST-INIT RUN LOGIC
 D MES^XPDUTL($$LJ^XLFSTR("IHS ICD-10 LOOKUP install complete.",IOM))
 Q
 ;
UNCODED ; ADD/UPDATE ICD9 UNCODED ENTRIES
 N AICDC,AICDS,AICDI,AICDF,AICDR,AICDDT
 D MES^XPDUTL("Enabling IHS ICD9 Uncoded entries...")
 S AICDC=".9999",AICDDT=3141001
 F AICDS=1,2 S AICDF=$$FILE^ICDEX(AICDS),AICDR=$$ROOT^ICDEX(AICDS),AICDI=+$$CODEABA^ICDEX(AICDC,,AICDS) D
 . N FDA,NEWIEN
 . I AICDI<1 D
 . . S FDA(AICDF,"+1,",.01)=AICDC,FDA(AICDF,"+1,",1.1)=AICDS
 . . F AICDI=499999:-1:0 Q:'$D(@(AICDR_AICDI_")"))
 . . Q:'AICDI  Q:$D(@(AICDR_AICDI_")"))
 . . S NEWIEN(1)=AICDI
 . . D UPDATE^DIE(,"FDA","NEWIEN")
 . . S AICDI=$G(NEWIEN(1))
 . I 'AICDI D MES^XPDUTL("Could not add uncoded "_$$SNAM^ICDEX(AICDS)) Q
 . K FDA
 . S FDA(AICDF+.066,"?+2,"_AICDI_",",.01)=AICDDT
 . S FDA(AICDF+.066,"?+2,"_AICDI_",",.02)=1
 . S FDA(AICDF+.067,"?+3,"_AICDI_",",.01)=AICDDT
 . S FDA(AICDF+.067,"?+3,"_AICDI_",",1)="UNCODED "_$S(AICDS=2:"OPERATION / PROCEDURE",1:"DIAGNOSIS")
 . S FDA(AICDF+.068,"?+4,"_AICDI_",",.01)=AICDDT
 . S FDA(AICDF+.068,"?+4,"_AICDI_",",1)="UNCODED "_$S(AICDS=2:"OPERATION / PROCEDURE",1:"DIAGNOSIS")
 . D UPDATE^DIE(,"FDA")
 D MES^XPDUTL("Done")
 ;
 Q
SORRY(X) ;
 KILL DIFQ
 S XPDQUIT=X
 D MES^XPDUTL($$LJ^XLFSTR("Aborting post-init process.",IOM))
 Q