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

APCLAUD7.m

Go to the documentation of this file.
APCLAUD7 ; IHS/CMI/LAB - CODE RANGES IN TABLE ;
 ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
 ;
 I 'APCLSUB D ADD I 1
 E  D DEL
 D EOJ
 Q
 ;
ADD ; SECTION FOR ADDING CODES TO TABLE
 I '$D(APCLTABL) S APCLTABL(APCL("LOW"))=APCL("HI")_U_APCLSYS G X1
 S APCLDONE=0
 S APCLVAL="" F  S APCLVAL=$O(APCLTABL(APCLVAL)) Q:APCLVAL=""   I $P(APCLTABL(APCLVAL),U,2)=APCLSYS D GETCASE,ADDPROC Q:APCLDONE
 D:'APCLDONE SETRANGE
 K APCLDONE,APCLVAL,APCLCASE
X1 Q
 ;
ADDPROC ; CASE SPECIFIC ADD PROCESSING
 G @("ADD"_APCLCASE)
ADD2 ;;
ADD3 ;;
ADD4 ;;
 S APCLTABL(APCL("LOW"))=APCLTABL(APCLVAL)
 K APCLTABL(APCLVAL)
ADD6 ;;
ADD7 ;;
ADD9 ;;
ADD10 ;;
 S APCLDONE=1
 Q
ADD11 ;;
ADD12 ;;
 S APCL("LOW")=APCLVAL
ADD5 ;;
ADD8 ;;
 K APCLTABL(APCLVAL)
 Q
ADD1 ;;
 I $O(^ICD9("BA",APCL("HI")))=APCLVAL,$E(APCLVAL)=$E(APCL("HI"))!(APCLVAL&APCL("HI")) S APCLTABL(APCL("LOW"))=APCLTABL(APCLVAL) K APCLTABL(APCLVAL) S APCLDONE=1
 Q
ADD13 ;;
 I $O(^ICD9("BA",APCLTABL(APCLVAL)))=APCL("LOW"),$E(APCLVAL)=$E(APCL("LOW"))!(APCLVAL&APCL("LOW")) S APCL("LOW")=APCLVAL K APCLTABL(APCLVAL)
 ; continue
 Q
 ;
SETRANGE ;
 ;;
SET1 ;;
SET5 ;;
SET8 ;;
SET11 ;;
SET12 ;;
SET13 ;;
 S APCLTABL(APCL("LOW"))=APCL("HI")_U_APCLSYS
 Q
 ;
DEL ; SECTION FOR DELETING CODES FROM TABLE
 I '$D(APCLTABL) G X2
 S APCLDONE=0
 S APCLVAL="" F  S APCLVAL=$O(APCLTABL(APCLVAL)) Q:APCLVAL=""  I $P(APCLTABL(APCLVAL),U,2)=APCLSYS D GETCASE,DELPROC Q:APCLDONE
X2 Q
 ;
DELPROC ;CASE SPECIFIC DEL PROCESSING
 G @("DEL"_APCLCASE)
DEL2 ;;
 I APCL("HI")=APCLTABL(APCLVAL) K APCLTABL(APCLVAL)
 E  S APCLTABL($O(^ICD9("BA",APCL("HI"))))=APCLTABL(APCLVAL)_U_APCLSYS K APCLTABL(APCLVAL)
 S APCLDONE=1
 Q
 ;
DEL3 ;;
DEL6 ;;
 S APCLTABL($O(^ICD9("BA",APCL("HI"))))=APCLTABL(APCLVAL)_U_APCLSYS K APCLTABL(APCLVAL)
 S APCLDONE=1
 Q
 ;
DEL4 ;;
DEL5 ;;
DEL7 ;;
DEL8 ;;
 K APCLTABL(APCLVAL)
 I APCLCASE'=8,APCLCASE'=5 S APCLDONE=1
 Q
 ;
DEL10 ;;
DEL11 ;;
DEL12 ;;
 D @$S($E(APCLTABL(APCLVAL))?1N:"NUMBER",1:"LETTER")
 S APCLTABL(APCLVAL)=APCL("NEWHI")_U_APCLSYS
 I APCLCASE=10 S APCLDONE=1
 Q
 ;
DEL9 ;;
 D @$S($E(APCLTABL(APCLVAL))?1N:"NUMBER",1:"LETTER")
 S APCLTABL($O(^ICD9("BA",APCL("HI"))))=APCLTABL(APCLVAL)_U_APCLSYS
 S APCLTABL(APCLVAL)=APCL("NEWHI")_U_APCLSYS
 S APCLDONE=1
 Q
 ;
DEL1 ;;
DEL13 ;;
 Q
 ;
GETCASE ; SUBROUTINE TO DETERMINE APCLCASE # FROM INPUT CODE RANGE
 S APCL("TLOW")=APCLVAL,APCL("THI")=$P(APCLTABL(APCLVAL),U,1)  ;_U_APCLSYS
 D CASEA:APCL("TLOW")]APCL("LOW"),CASEB:APCL("LOW")=APCL("TLOW"),CASEC:APCL("LOW")]APCL("TLOW")
 K APCL("TLOW"),APCL("THI")
 Q
 ;
CASEA ;
 I APCL("HI")]APCL("TLOW") S APCLCASE=$S(APCL("THI")]APCL("HI"):3,APCL("HI")=APCL("THI"):4,1:5)
 E  S APCLCASE=$S(APCL("TLOW")]APCL("HI"):1,1:2)
 Q
 ;
CASEB ;
 S APCLCASE=$S(APCL("THI")]APCL("HI"):6,APCL("HI")=APCL("THI"):7,1:8)
 Q
 ;
CASEC ;
 I APCL("THI")]APCL("LOW") S APCLCASE=$S(APCL("THI")]APCL("HI"):9,APCL("HI")=APCL("THI"):10,1:11)
 E  S APCLCASE=$S(APCL("LOW")=APCL("THI"):12,1:13)
 Q
 ;
NUMBER ;
 S APCL("CODE")=APCL("LOW")-5 F  Q:APCL("LOW")]$O(^ICD9("BA",APCL("CODE")_" "))  S APCL("CODE")=APCL("CODE")-5
 S APCL("CODE")=$O(^ICD9("BA",APCL("CODE")_" ")) F  S APCL("NEWHI")=APCL("CODE"),APCL("CODE")=$O(^ICD9("BA",APCL("CODE"))) Q:APCL("CODE")=APCL("LOW")
 Q
 ;
LETTER ;
 S APCL("LET")=$E(APCL("LOW"))_" " F  S APCL("NEWHI")=$S($L(APCL("LET"))>2:APCL("LET"),1:APCL("LOW")),APCL("LET")=$O(^ICD9("BA",APCL("LET"))) Q:APCL("LET")=APCL("LOW")
 Q
EOJ ;
 K APCLCASE,APCLDONE,APCLNEXT,APCLONE,APCLVAL
 Q
 ;