- DVB4P66I ;ALB/MJB/RC - DISABILITY FILE UPDATE ; 11/16/10 3:57pm
- ;;4.0;HINQ;**66**;03/25/92;Build 14
- ;
- ;This routine will delete ICD DIAGNOSIS mappings for DISABILITY
- ;CONDITIONS in the DISABILITY CONDITION (#31) file.
- ;
- Q ;no direct entry
- ;
- POST(DVBTMP,DVBTOT) ;post-install driver for updating the (#31) file
- ;This procedure will call a series of routines that contain the data
- ;element values that will be used to delete requested VBA-ICD9 mapping.
- ;
- ; Input:
- ; DVBTMP - Closed Root global reference for error reporting
- ; DVBTOT - Total number of ICD9 codes filed
- ;
- ; Output:
- ; DVBTMP - Temp file of error messages (if any)
- ; DVBTOT - Total number of ICD9 codes filed
- ;
- N DVBCNT
- S DVBTMP=$G(DVBTMP)
- S DVBTOT=$G(DVBTOT) I DVBTOT']"" S DVBTOT=0
- I DVBTMP']"" S DVBTMP=$NA(^TMP("DVB4P66",$J,"DELICD")) K @DVBTMP
- D BLDXRF(DVBTMP,.DVBTOT)
- ;
- BLDXRF(DVBTMP,DVBTOT) ;call delete VBA/ICD9 codes
- ;
- ; Input:
- ; DVBRTN - Post Install routine to process VBA/ICD9 codes
- ; DVBTMP - Closed Root global reference for error reporting
- ; DVBTOT - Total number of ICD9 codes filed
- ;
- ; Output:
- ; DVBTOT - Total number of ICD9 codes filed
- ;
- N DVBLINE ;$TEXT code line
- N DVBLN ;line counter incrementer
- N DVBTAG ;line tag of routine to process
- N DVBVBA ;VBA DX code (external value)
- N DVBVB ;DX CODE
- ;
- S (DVBLN,DVBVBA)=0
- ;
- F DVBLN=1:1 S DVBTAG="DELCODE+"_DVBLN,DVBLINE=$T(@DVBTAG) S DVBVB=$P(DVBLINE,";",3,999) Q:DVBLINE["EXIT" D
- .;get VBA DX CODE var setup
- .S DVBVBA=$P(DVBVB,"^",1)
- .I '$O(^DIC(31,"C",DVBVBA,"")) D
- ..S @DVBTMP@("ERROR",DVBVBA)="DX CODE not found in (#31) file"
- ..S DVBVBA=0
- ..;
- .;quit back to loop if no VBA code ien found (just in case)
- .I 'DVBVBA Q
- .;
- .D BLDVBA(DVBVBA,DVBLINE,.DVBTOT)
- Q
- ; ;
- BLDVBA(DVBVBA,DVBLINE,DVBTOT) ;extract ICD9 codes from text line
- ;
- ; Input:
- ; DVBVBA - VBA DX code (external value)
- ; DVBLINE - $TEXT code line of ICD9's
- ; DVBTOT - Total number of ICD9 codes filed
- ;
- ; Output:
- ; DVBTOT - Total number of ICD9 codes filed
- ;
- Q:'$G(DVBVBA)
- Q:$G(DVBLINE)'[";"
- ;
- N DVBDATA,DVBI,DVBICD,DVBICDEN,DVBIEN,DVBMATCH,DVBX
- ;
- ;loop in case there are multiple VBA iens setup
- I DVBVBA'="" S DVBIEN=0
- F S DVBIEN=$O(^DIC(31,"C",DVBVBA,DVBIEN)) Q:DVBIEN="" D
- . S DVBX=$P(DVBVB,"^",1)
- . S (DVBI,DVBICD)=0
- . F DVBI=1:1 S DVBDATA=$P(DVBX,"^",DVBI) Q:DVBDATA="" D
- . . Q:DVBDATA[";"
- . . S DVBICD=$P(DVBVB,"^",2),DVBMATCH=+$P(DVBVB,"^",3)
- . . ; - get ICD9 pointer from ICD DIAGNOSIS (#80) file
- . . S DVBICDEN=+$$ICDDX^ICDCODE(DVBICD,DT)
- . . I 'DVBICDEN!(DVBICDEN<0)!(DVBICD=DVBICDEN) D Q
- . . . S @DVBTMP@("ERROR",DVBVBA,DVBIEN,DVBICD)="not found in ICD DIAGNOSIS (#80) file"
- . . ;
- . . Q:'$D(^DIC(31,DVBIEN,"ICD","B",DVBICDEN)) ;
- . . ;
- . . I '$$FILEICD(DVBIEN,DVBICDEN,DVBMATCH) D Q
- . . . S @DVBTMP@("ERROR",DVBVBA,DVBIEN,DVBICD)="error filing to (#31) file"
- . . S DVBTOT=DVBTOT+1
- Q
- ;
- ;
- FILEICD(DVBIEN,DVBICDEN,DVBMATCH) ;file code mapping to delete icds from (#31) file
- ;
- ; Input:
- ; DVBIEN - ien of VBA DX CODE in file (#31)
- ; DVBICDEN - ien of ICD9 code in file (#80)
- ; DVBMATCH - match code (1 or 0)
- ;
- ; Output:
- ; Function result - 1 on success, 0 on failure
- ;
- ; Fields :
- ; (#20) RELATED ICD9 CODES - ICD;0 POINTER Multiple (#31.01)
- ; (#31.01) -- RELATED ICD9 CODES SUB-FILE
- ; Field(s):
- ; .01 RELATED ICD9 CODES - 0;1 POINTER TO ICD DIAGNOSIS FILE (#80)
- ; .02 ICD9 MATCH - 0;2 SET ('0' FOR PARTIAL MATCH; '1' FOR MATCH;)
- ;
- N DVBERR,DVBFDA,DVBRSLT,DIK
- S DVBRSLT=0
- ;
- I $G(DVBIEN),$G(DVBICDEN),$G(DVBMATCH)]"" D
- .S DA(1)=DVBIEN
- .S DA=$O(^DIC(31,DA(1),"ICD","B",DVBICDEN,0)) Q:DA'>0 D
- ..W !!,"DELETING FROM DISABILITY CODE "_DVBVBA_""
- ..W !!,"DELETING ICD CODE "_DVBICD_" FROM MAPPING"
- ..;I DA'>0 D Q:DA'>0
- ..S DIK="^DIC(31,"_DA(1)_",""ICD""," D ^DIK K DA
- .S:'$D(DVBERR) DVBRSLT=1
- Q DVBRSLT
- ;
- ;
- ;codes to be deleted
- DELCODE ;DISABILITY CODE^ICDCODE
- ;;7705^287.4
- ;;7332^787.6
- ;;EXIT
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVB4P66I 4125 printed Feb 18, 2025@23:24:14 Page 2
- DVB4P66I ;ALB/MJB/RC - DISABILITY FILE UPDATE ; 11/16/10 3:57pm
- +1 ;;4.0;HINQ;**66**;03/25/92;Build 14
- +2 ;
- +3 ;This routine will delete ICD DIAGNOSIS mappings for DISABILITY
- +4 ;CONDITIONS in the DISABILITY CONDITION (#31) file.
- +5 ;
- +6 ;no direct entry
- QUIT
- +7 ;
- POST(DVBTMP,DVBTOT) ;post-install driver for updating the (#31) file
- +1 ;This procedure will call a series of routines that contain the data
- +2 ;element values that will be used to delete requested VBA-ICD9 mapping.
- +3 ;
- +4 ; Input:
- +5 ; DVBTMP - Closed Root global reference for error reporting
- +6 ; DVBTOT - Total number of ICD9 codes filed
- +7 ;
- +8 ; Output:
- +9 ; DVBTMP - Temp file of error messages (if any)
- +10 ; DVBTOT - Total number of ICD9 codes filed
- +11 ;
- +12 NEW DVBCNT
- +13 SET DVBTMP=$GET(DVBTMP)
- +14 SET DVBTOT=$GET(DVBTOT)
- IF DVBTOT']""
- SET DVBTOT=0
- +15 IF DVBTMP']""
- SET DVBTMP=$NAME(^TMP("DVB4P66",$JOB,"DELICD"))
- KILL @DVBTMP
- +16 DO BLDXRF(DVBTMP,.DVBTOT)
- +17 ;
- BLDXRF(DVBTMP,DVBTOT) ;call delete VBA/ICD9 codes
- +1 ;
- +2 ; Input:
- +3 ; DVBRTN - Post Install routine to process VBA/ICD9 codes
- +4 ; DVBTMP - Closed Root global reference for error reporting
- +5 ; DVBTOT - Total number of ICD9 codes filed
- +6 ;
- +7 ; Output:
- +8 ; DVBTOT - Total number of ICD9 codes filed
- +9 ;
- +10 ;$TEXT code line
- NEW DVBLINE
- +11 ;line counter incrementer
- NEW DVBLN
- +12 ;line tag of routine to process
- NEW DVBTAG
- +13 ;VBA DX code (external value)
- NEW DVBVBA
- +14 ;DX CODE
- NEW DVBVB
- +15 ;
- +16 SET (DVBLN,DVBVBA)=0
- +17 ;
- +18 FOR DVBLN=1:1
- SET DVBTAG="DELCODE+"_DVBLN
- SET DVBLINE=$TEXT(@DVBTAG)
- SET DVBVB=$PIECE(DVBLINE,";",3,999)
- if DVBLINE["EXIT"
- QUIT
- Begin DoDot:1
- +19 ;get VBA DX CODE var setup
- +20 SET DVBVBA=$PIECE(DVBVB,"^",1)
- +21 IF '$ORDER(^DIC(31,"C",DVBVBA,""))
- Begin DoDot:2
- +22 SET @DVBTMP@("ERROR",DVBVBA)="DX CODE not found in (#31) file"
- +23 SET DVBVBA=0
- +24 ;
- End DoDot:2
- +25 ;quit back to loop if no VBA code ien found (just in case)
- +26 IF 'DVBVBA
- QUIT
- +27 ;
- +28 DO BLDVBA(DVBVBA,DVBLINE,.DVBTOT)
- End DoDot:1
- +29 QUIT
- +30 ; ;
- BLDVBA(DVBVBA,DVBLINE,DVBTOT) ;extract ICD9 codes from text line
- +1 ;
- +2 ; Input:
- +3 ; DVBVBA - VBA DX code (external value)
- +4 ; DVBLINE - $TEXT code line of ICD9's
- +5 ; DVBTOT - Total number of ICD9 codes filed
- +6 ;
- +7 ; Output:
- +8 ; DVBTOT - Total number of ICD9 codes filed
- +9 ;
- +10 if '$GET(DVBVBA)
- QUIT
- +11 if $GET(DVBLINE)'[";"
- QUIT
- +12 ;
- +13 NEW DVBDATA,DVBI,DVBICD,DVBICDEN,DVBIEN,DVBMATCH,DVBX
- +14 ;
- +15 ;loop in case there are multiple VBA iens setup
- +16 IF DVBVBA'=""
- SET DVBIEN=0
- +17 FOR
- SET DVBIEN=$ORDER(^DIC(31,"C",DVBVBA,DVBIEN))
- if DVBIEN=""
- QUIT
- Begin DoDot:1
- +18 SET DVBX=$PIECE(DVBVB,"^",1)
- +19 SET (DVBI,DVBICD)=0
- +20 FOR DVBI=1:1
- SET DVBDATA=$PIECE(DVBX,"^",DVBI)
- if DVBDATA=""
- QUIT
- Begin DoDot:2
- +21 if DVBDATA[";"
- QUIT
- +22 SET DVBICD=$PIECE(DVBVB,"^",2)
- SET DVBMATCH=+$PIECE(DVBVB,"^",3)
- +23 ; - get ICD9 pointer from ICD DIAGNOSIS (#80) file
- +24 SET DVBICDEN=+$$ICDDX^ICDCODE(DVBICD,DT)
- +25 IF 'DVBICDEN!(DVBICDEN<0)!(DVBICD=DVBICDEN)
- Begin DoDot:3
- +26 SET @DVBTMP@("ERROR",DVBVBA,DVBIEN,DVBICD)="not found in ICD DIAGNOSIS (#80) file"
- End DoDot:3
- QUIT
- +27 ;
- +28 ;
- if '$DATA(^DIC(31,DVBIEN,"ICD","B",DVBICDEN))
- QUIT
- +29 ;
- +30 IF '$$FILEICD(DVBIEN,DVBICDEN,DVBMATCH)
- Begin DoDot:3
- +31 SET @DVBTMP@("ERROR",DVBVBA,DVBIEN,DVBICD)="error filing to (#31) file"
- End DoDot:3
- QUIT
- +32 SET DVBTOT=DVBTOT+1
- End DoDot:2
- End DoDot:1
- +33 QUIT
- +34 ;
- +35 ;
- FILEICD(DVBIEN,DVBICDEN,DVBMATCH) ;file code mapping to delete icds from (#31) file
- +1 ;
- +2 ; Input:
- +3 ; DVBIEN - ien of VBA DX CODE in file (#31)
- +4 ; DVBICDEN - ien of ICD9 code in file (#80)
- +5 ; DVBMATCH - match code (1 or 0)
- +6 ;
- +7 ; Output:
- +8 ; Function result - 1 on success, 0 on failure
- +9 ;
- +10 ; Fields :
- +11 ; (#20) RELATED ICD9 CODES - ICD;0 POINTER Multiple (#31.01)
- +12 ; (#31.01) -- RELATED ICD9 CODES SUB-FILE
- +13 ; Field(s):
- +14 ; .01 RELATED ICD9 CODES - 0;1 POINTER TO ICD DIAGNOSIS FILE (#80)
- +15 ; .02 ICD9 MATCH - 0;2 SET ('0' FOR PARTIAL MATCH; '1' FOR MATCH;)
- +16 ;
- +17 NEW DVBERR,DVBFDA,DVBRSLT,DIK
- +18 SET DVBRSLT=0
- +19 ;
- +20 IF $GET(DVBIEN)
- IF $GET(DVBICDEN)
- IF $GET(DVBMATCH)]""
- Begin DoDot:1
- +21 SET DA(1)=DVBIEN
- +22 SET DA=$ORDER(^DIC(31,DA(1),"ICD","B",DVBICDEN,0))
- if DA'>0
- QUIT
- Begin DoDot:2
- +23 WRITE !!,"DELETING FROM DISABILITY CODE "_DVBVBA_""
- +24 WRITE !!,"DELETING ICD CODE "_DVBICD_" FROM MAPPING"
- +25 ;I DA'>0 D Q:DA'>0
- +26 SET DIK="^DIC(31,"_DA(1)_",""ICD"","
- DO ^DIK
- KILL DA
- End DoDot:2
- +27 if '$DATA(DVBERR)
- SET DVBRSLT=1
- End DoDot:1
- +28 QUIT DVBRSLT
- +29 ;
- +30 ;
- +31 ;codes to be deleted
- DELCODE ;DISABILITY CODE^ICDCODE
- +1 ;;7705^287.4
- +2 ;;7332^787.6
- +3 ;;EXIT
- +4 QUIT