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

APCLAUD5.m

Go to the documentation of this file.
APCLAUD5 ; IHS/CMI/LAB - USER INTERFACE TO SELECT ICD CODES ;
 ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
 ;
 ;cmi/anch/maw 9/10/2007 code set versioning in DISPLAY
BEGIN ;
 W !
 S APCL("NO DISPLAY")=0
 D ASK1
 I Y="^" S APCLSTP=1 G X
 I $D(APCLTABL) D CHECK I Y'=1 G @$S(Y=0:"BEGIN",1:"X")
X I $D(APCLTABL) D SETUTIL
 D EOJ
 Q
 ;
ASK1 ;
 ;WHAT CODING SYSTEM?
 S APCLSYS="",APCLA=0
 W !,"You must enter the coding system from which you want to enter a code,",!,"or range of codes.",!
 S DIC="^ICDS(",DIC("S")="I $P(^(0),U,3)=80",DIC(0)="AEMQ" D ^DIC K DIC
 I Y=-1 G X1
 S APCLSYS=+Y
 K APCL("LOW"),APCL("HI")
 S DIR("A")=$S('$D(APCLTABL):"Enter Diagnosis (or range of DX codes)",1:"Enter Another Diagnosis (or range of DX codes)") D SETDIR^APCLAUD6,^DIR K DIR
 I "^"[Y G X1
 D PROCESS
 I $D(APCLTABL),'APCL("NO DISPLAY") D RANGES
 S APCL("NO DISPLAY")=0
 G ASK1
X1 Q
 ;
PROCESS ;EVALUATE USER RESPONSE
 S (APCLSUB,APCLONE)=0 ;APCLSUB=0 => NO DELETE OF CODE(S),APCLONE=0 => RANGE OF CODES ENTERED
 I $E(X,1,2)="-[" W $C(7),"  ?? Not allowed" S APCL("NO DISPLAY")=1 G X2
 I $E(X,$L(X))="*" D STAR G X2
 I X'["-" S APCLTYP="LOW",APCLONE=1 D LOOK^APCLAUD6 G X2
 I $E(X)="-",'$D(APCLTABL) W $C(7),"  ??  No previous codes entered!" G X2
 I $L(X,"-")>3 W $C(7),"  ??"  S APCLA=1 S APCL("NO DISPLAY")=1 G X2
 I $L(X,"-")=3,$E(X,$L(X))="-" W $C(7),"  ??" S APCLA=1 S APCL("NO DISPLAY")=1 G X2
 I $L(X,"-")=3,$P(X,"-")]"" W $C(7),"  ??" S APCLA=1 S APCL("NO DISPLAY")=1 G X2
 I $E(X)="-" S APCLSUB=1 D  I 1
 . S APCLSAVE("X")=X
 . I $L(X,"-")=3 S X=$P(APCLSAVE("X"),"-",2),APCLTYP="LOW" D LOOK^APCLAUD6 I 'APCLA S X=$P(APCLSAVE("X"),"-",3),APCLTYP="HI" W ! D LOOK^APCLAUD6 Q
 . I $L(APCLSAVE("X"),"-")=2 S X=$E(X,2,99),APCLTYP="LOW",APCLONE=1 D LOOK^APCLAUD6
 E  S APCLSAVE("X")=X S APCLTYP="LOW",X=$P(APCLSAVE("X"),"-") D LOOK^APCLAUD6 I 'APCLA S APCLTYP="HI",X=$P(APCLSAVE("X"),"-",2) W ! D LOOK^APCLAUD6
X2 Q
 ;
DISPLAY ;EP - SHOW CODES IN RANGE SELECTED
 W:$D(IOF) @IOF
 NEW APCLX,APCLQ,APCLARR,X
 ;W !!,"ICD codes in this range =>",!! W $P(APCL("LOW")," ") S APCLDFN=$O(^ICD9("BA",APCL("LOW"),"")) W ?9,$P(^ICD9(APCLDFN,0),U,3)  ;cmi/anch/maw 9/10/2007 orig line
 W !!,"ICD codes in this range =>",!!
 ;call new API to get all codes back in APCLARR
 D LST^ATXAPI(APCLSYS,80,$$STRIP^XLFSTR(APCL("LOW"))_"-"_$$STRIP^XLFSTR(APCL("HI")),"CODE","APCLARR")
 S APCLX="",APCLQ=0 F  S APCLX=$O(APCLARR(APCLX)) Q:APCLX=""!($G(APCLQ))  D
 .I $Y>(IOSL-2) D EOP Q:APCLQ
 .I $P(APCLARR(APCLX),U,2)=1 W !,APCLX,?12,$E($P($$ICDDX^ICDEX($P(APCLARR(APCLX),U,1)),U,4),1,40),?60,$P(APCLARR(APCLX),U,4) I 1
 .E  W !,APCLX,?12,$E($P($$ICDDX^ICDEX($P(APCLARR(APCLX),U,1)),U,4),1,40),?60,$P(APCLARR(APCLX),U,4)
 NEW DIR
 S DIR(0)="E",DIR("A")="Press Enter to Continue <>" D ^DIR
 Q
EOP ;
 S APCLQ=0
 NEW DIR
 K DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
 S DIR(0)="E" D ^DIR K DIR
 I $D(DUOUT) S APCLQ=1 Q
 W:$D(IOF) @IOF
 Q
 ;
SETUTIL ;SET UP UTILITY NODES TO STORE CODES
 NEW APCLX,APCLQ,APCLARR
 S APCLIRNG=0,APCL("LOW")="" F  S APCL("LOW")=$O(APCLTABL(APCL("LOW"))) Q:APCL("LOW")=""  S APCL("HI")=$P(APCLTABL(APCL("LOW")),U,1) D
 .S APCLIRNG=APCLIRNG+1
 .KILL APCLX,APCLQ,APCLARR
 .D LST^ATXAPI(APCLSYS,80,$$STRIP^XLFSTR(APCL("LOW"))_"-"_$$STRIP^XLFSTR(APCL("HI")),"CODE","APCLARR")
 .S ^XTMP("APCLAUD",APCLJOB,APCLBT,APCLIRNG,"ICDB")=APCL("LOW")
 .S ^XTMP("APCLAUD",APCLJOB,APCLBT,APCLIRNG,"ICDE")=APCL("HI")
 .;S APCLDFN=$$CODEN^ICDEX(APCL("LOW")),^XTMP("APCLAUD",APCLJOB,APCLBT,"ICDDFN",APCLDFN,APCLIRNG)=""
 .S X="" F  S X=$O(APCLARR(X)) Q:X=""  D
 ..S ^XTMP("APCLAUD",APCLJOB,APCLBT,"ICDDFN",$P(APCLARR(X),U,1),APCLIRNG)=""
 .Q
 Q
RANGES ;DISPLAY TABLE OF ALL RANGES
 W:$D(IOF) @IOF
 W !!,"ICD Code Range(s) Selected So Far =>",!
 S (APCL("NUM"),APCL)=0 F  S APCL=$O(APCLTABL(APCL)) Q:APCL=""  S APCL("NUM")=APCL("NUM")+1 W !,APCL("NUM"),")  ",APCL,$S(APCL'=$P(APCLTABL(APCL),U,1):"- "_$P(APCLTABL(APCL),U,1),1:"")
 I '$D(APCL("BANG")) W !
 Q
 ;
SHOW ; ENTRY POINT - ALLOW USER TO SELECT FROM RANGES TO DISPLAY CODES
 D RANGES
A W !,"Enter an Item Number from the table above to display code(s): " R APCL("N"):300 W:"^"[APCL("N") ! Q:"^"[APCL("N")  I APCL("N")'?1N!(APCL("N")>APCL("NUM")) W "  ??",$C(7) G A
 F APCLI=1:1:APCL("N") S APCL=$O(APCLTABL(APCL)) I APCLI=APCL("N") S APCL("LOW")=APCL,APCL("HI")=$P(APCLTABL(APCL),U,1) D DISPLAY Q
 S APCL("BANG")="" D RANGES K APCL("BANG")
 Q
 ;
 ;
CHECK ;ASKS USER IF SATISFIED WITH ENTERED RANGES
 NEW DIR
 W ! S DIR(0)="Y",DIR("B")="Y",DIR("A")="Are all of the ICD ranges okay" D ^DIR K DIR
 W !
 Q
 ;
EOJ ;ENTRY POINT
 I $D(APCL("NOT TAX")) K APCLSTP,APCLX
 K APCLSUB,APCLTYP,APCLDFN,DIR,APCLSAVE,APCLA,APCLCNT,APCL,APCLR,APCLI,APCLONE,APCLFLG
 Q
 ;
STAR ;
 I $E(X)="-" S APCLSUB=1
 NEW APCLTEMP
 D LST^ATXAPI(APCLSYS,80,$S($E(X)="-":$E(X,2,999),1:X),"CODE","APCLTEMP")
 I '$D(APCLTEMP) W "  ?? There are no codes in that range!" S APCL("NO DISPLAY")=1 Q
 S APCL("LOW")=$O(APCLTEMP(0))
 NEW Z,C
 S (Z,C)="" F  S Z=$O(APCLTEMP(Z)) Q:Z=""  S C=Z
 S APCL("HI")=C
 D DISPLAY
 D ^APCLAUD7
 Q