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

AQAOCOD9.m

Go to the documentation of this file.
AQAOCOD9 ; IHS/ORDC/LJF - MAINTAIN CODE RANGES IN TABLE ;
 ;;1.01;QAI MANAGEMENT;;OCT 05, 1995
 ;IHS/ORDC/LJF; copy of DEL subrtn of rtn ^ATXCODE1
 ;            ;4.2;Taxonomy;;MAR 19, 1991
 ;  changes:  changed namespacing from ATX to AQA
 ;            added check of AQAOICD to determin if using ICD9 or ICD0
 ;
DEL ;ENTRY POINT - SECTION FOR DELETING CODES FROM TABLE
 I '$D(AQAOTBL) G X2
 S AQAODONE=0
 S AQAOVAL="" F  S AQAOVAL=$O(AQAOTBL(AQAOVAL)) Q:AQAOVAL=""  D GETCASE,DELPROC Q:AQAODONE
X2 Q
DELPROC ;CASE SPECIFIC DEL PROCESSING
 G @("DEL"_AQAOCASE)
DEL2 ;;
 I AQAOICD=0 G DEL2A ;IHS/ORDC/LJF code for ICD0
 I AQAO("HI")=AQAOTBL(AQAOVAL) K AQAOTBL(AQAOVAL)
 E  S AQAOTBL($O(^ICD9("BA",AQAO("HI"))))=AQAOTBL(AQAOVAL) K AQAOTBL(AQAOVAL)
 S AQAODONE=1
 Q
DEL2A ;; for procedures   
 I AQAO("HI")=AQAOTBL(AQAOVAL) K AQAOTBL(AQAOVAL)
 E  S AQAOTBL($O(^ICD0("BA",AQAO("HI"))))=AQAOTBL(AQAOVAL) K AQAOTBL(AQAOVAL)
 S AQAODONE=1
 Q
DEL3 ;;
DEL6 ;;
 I AQAOICD=9 S AQAOTBL($O(^ICD9("BA",AQAO("HI"))))=AQAOTBL(AQAOVAL) K AQAOTBL(AQAOVAL)
 I AQAOICD=0 S AQAOTBL($O(^ICD0("BA",AQAO("HI"))))=AQAOTBL(AQAOVAL) K AQAOTBL(AQAOVAL) ;IHS/ORDC/LJF code for ICD0
 S AQAODONE=1
 Q
DEL4 ;;
DEL5 ;;
DEL7 ;;
DEL8 ;;
 K AQAOTBL(AQAOVAL)
 I AQAOCASE'=8,AQAOCASE'=5 S AQAODONE=1
 Q
DEL10 ;;
DEL11 ;;
DEL12 ;;
 D @$S($E(AQAOTBL(AQAOVAL))?1N:"NUMBER",1:"LETTER")
 S AQAOTBL(AQAOVAL)=AQAO("NEWHI")
 I AQAOCASE=10 S AQAODONE=1
 Q
DEL9 ;;
 D @$S($E(AQAOTBL(AQAOVAL))?1N:"NUMBER",1:"LETTER")
 I AQAOICD=9 S AQAOTBL($O(^ICD9("BA",AQAO("HI"))))=AQAOTBL(AQAOVAL)
 I AQAOICD=0 S AQAOTBL($O(^ICD0("BA",AQAO("HI"))))=AQAOTBL(AQAOVAL)
 S AQAOTBL(AQAOVAL)=AQAO("NEWHI")
 S AQAODONE=1
 Q
DEL1 ;;
DEL13 ;;
 Q
 ;
 ;
GETCASE ; SUBROUTINE TO DETERMINE AQAOCASE # FROM INPUT CODE RANGE
 S AQAO("TLOW")=AQAOVAL,AQAO("THI")=AQAOTBL(AQAOVAL)
 D CASEA:AQAO("TLOW")]AQAO("LOW"),CASEB:AQAO("LOW")=AQAO("TLOW"),CASEC:AQAO("LOW")]AQAO("TLOW")
 K AQAO("TLOW"),AQAO("THI")
 Q
 ;
 ;
CASEA ;
 I AQAO("HI")]AQAO("TLOW") S AQAOCASE=$S(AQAO("THI")]AQAO("HI"):3,AQAO("HI")=AQAO("THI"):4,1:5)
 E  S AQAOCASE=$S(AQAO("TLOW")]AQAO("HI"):1,1:2)
 Q
CASEB ;
 S AQAOCASE=$S(AQAO("THI")]AQAO("HI"):6,AQAO("HI")=AQAO("THI"):7,1:8)
 Q
CASEC ;
 I AQAO("THI")]AQAO("LOW") S AQAOCASE=$S(AQAO("THI")]AQAO("HI"):9,AQAO("HI")=AQAO("THI"):10,1:11)
 E  S AQAOCASE=$S(AQAO("LOW")=AQAO("THI"):12,1:13)
 Q
NUMBER ;
 I AQAOICD=0 G NUMBER2 ;IHS/ORDC/LJF code for procedures
 S AQAO("CODE")=AQAO("LOW")-5 F  Q:AQAO("LOW")]$O(^ICD9("BA",AQAO("CODE")_" "))  S AQAO("CODE")=AQAO("CODE")-5
 S AQAO("CODE")=$O(^ICD9("BA",AQAO("CODE")_" ")) F  S AQAO("NEWHI")=AQAO("CODE"),AQAO("CODE")=$O(^ICD9("BA",AQAO("CODE"))) Q:AQAO("CODE")=AQAO("LOW")
 Q
NUMBER2 ; CODE FOR PROCEDURES
 S AQAO("CODE")=AQAO("LOW")-5 F  Q:AQAO("LOW")]$O(^ICD0("BA",AQAO("CODE")_" "))  S AQAO("CODE")=AQAO("CODE")-5 ;IHS/ORDC/LJF code for ICD0
 S AQAO("CODE")=$O(^ICD0("BA",AQAO("CODE")_" ")) F  S AQAO("NEWHI")=AQAO("CODE"),AQAO("CODE")=$O(^ICD0("BA",AQAO("CODE"))) Q:AQAO("CODE")=AQAO("LOW")  ;IHS/ORDC/LJF code for ICD0
 Q
LETTER ;
 I AQAOICD=9 S AQAO("LET")=$E(AQAO("LOW"))_" " F  S AQAO("NEWHI")=$S($L(AQAO("LET"))>2:AQAO("LET"),1:AQAO("LOW")),AQAO("LET")=$O(^ICD9("BA",AQAO("LET"))) Q:AQAO("LET")=AQAO("LOW")
 I AQAOICD=0 S AQAO("LET")=$E(AQAO("LOW"))_" " F  S AQAO("NEWHI")=$S($L(AQAO("LET"))>2:AQAO("LET"),1:AQAO("LOW")),AQAO("LET")=$O(^ICD0("BA",AQAO("LET"))) Q:AQAO("LET")=AQAO("LOW")  ;IHS/ORDC/LJF code for ICD0
 S AQAO("LET")=$E(AQAO("LOW"))_" " F  S AQAO("NEWHI")=$S($L(AQAO("LET"))>2:AQAO("LET"),1:AQAO("LOW")),AQAO("LET")=$O(@(AQAOFL_"(""BA"","_AQAO("LET")_")")) Q:AQAO("LET")=AQAO("LOW")
 Q