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

AQAOCOD1.m

Go to the documentation of this file.
AQAOCOD1 ; IHS/ORDC/LJF - MAINTAIN CODE RANGES IN TABLE ;
 ;;1.01;QAI MANAGEMENT;;OCT 05, 1995
 ;IHS/ORDC/LJF; copy 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
 ;            put DEL subrtn into rtn ^AQAOCOD9
 ;
 I 'AQAOSUB D ADD I 1
 E  D DEL^AQAOCOD9
 D EOJ
 Q
ADD ; SECTION FOR ADDING CODES TO TABLE
 I '$D(AQAOTBL) S AQAOTBL(AQAO("LOW"))=AQAO("HI") G X1
 S AQAODONE=0
 S AQAOVAL="" F  S AQAOVAL=$O(AQAOTBL(AQAOVAL)) Q:AQAOVAL=""  D GETCASE,ADDPROC Q:AQAODONE
 D:'AQAODONE SETRANGE
 K AQAODONE,AQAOVAL,AQAOCASE
X1 Q
ADDPROC ; CASE SPECIFIC ADD PROCESSING
 G @("ADD"_AQAOCASE)
ADD2 ;;
ADD3 ;;
ADD4 ;;
 S AQAOTBL(AQAO("LOW"))=AQAOTBL(AQAOVAL)
 K AQAOTBL(AQAOVAL)
ADD6 ;;
ADD7 ;;
ADD9 ;;
ADD10 ;;
 S AQAODONE=1
 Q
ADD11 ;;
ADD12 ;;
 S AQAO("LOW")=AQAOVAL
ADD5 ;;
ADD8 ;;
 K AQAOTBL(AQAOVAL)
 Q
ADD1 ;;
 I AQAOICD=9 I $O(^ICD9("BA",AQAO("HI")))=AQAOVAL,$E(AQAOVAL)=$E(AQAO("HI"))!(AQAOVAL&AQAO("HI")) S AQAOTBL(AQAO("LOW"))=AQAOTBL(AQAOVAL) K AQAOTBL(AQAOVAL) S AQAODONE=1
 I AQAOICD=0 I $O(^ICD0("BA",AQAO("HI")))=AQAOVAL,$E(AQAOVAL)=$E(AQAO("HI"))!(AQAOVAL&AQAO("HI")) S AQAOTBL(AQAO("LOW"))=AQAOTBL(AQAOVAL) K AQAOTBL(AQAOVAL) S AQAODONE=1 ;IHS/ORDC/LJF code for ICD0
 Q
ADD13 ;;
 I AQAOICD=9 I $O(^ICD9("BA",AQAOTBL(AQAOVAL)))=AQAO("LOW"),$E(AQAOVAL)=$E(AQAO("LOW"))!(AQAOVAL&AQAO("LOW")) S AQAO("LOW")=AQAOVAL K AQAOTBL(AQAOVAL)
 I AQAOICD=0 I $O(^ICD0("BA",AQAOTBL(AQAOVAL)))=AQAO("LOW"),$E(AQAOVAL)=$E(AQAO("LOW"))!(AQAOVAL&AQAO("LOW")) S AQAO("LOW")=AQAOVAL K AQAOTBL(AQAOVAL) ;IHS/ORDC/LJF code for ICD0
 ; continue
 Q
SETRANGE ;
 ;;
SET1 ;;
SET5 ;;
SET8 ;;
SET11 ;;
SET12 ;;
SET13 ;;
 S AQAOTBL(AQAO("LOW"))=AQAO("HI")
 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
EOJ ;
 K AQAOCASE,AQAODONE,AQAONEXT,AQAONE,AQAOVAL
 Q