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

APCDFQA3.m

Go to the documentation of this file.
APCDFQA3 ; IHS/CMI/LAB - USER INTERFACE TO SELECT ICD CODES ;
 ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
BEGIN ;
 W !
 S APCD("NO DISPLAY")=0
 D ASK1
 I Y="^" S APCDSTP=1 G X
 I $D(APCDTABL) D CHECK I Y'=1 G @$S(Y=0:"BEGIN",1:"X")
X I $D(APCDTABL) D SETUTIL
 D EOJ
 Q
 ;
ASK1 ;
 S APCDA=0
 ;WHAT CODING SYSTEM?
 S APCDSYS=""
 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 APCDSYS=+Y
 K APCD("LOW"),APCD("HI")
 S DIR("A")=$S('$D(APCDTABL):"Enter Diagnosis (or range of DX codes)",1:"Enter another Diagnosis (or range of DX codes)") D SETDIR^APCDFQA4,^DIR K DIR
 I "^"[Y G X1
 D PROCESS
 I $D(APCDTABL),'APCD("NO DISPLAY") D RANGES
 S APCD("NO DISPLAY")=0
 G ASK1
X1 Q
 ;
PROCESS ;EVALUATE USER RESPONSE
 S (APCDSUB,APCDONE)=0 ;APCDSUB=0 => NO DELETE OF CODE(S),APCDONE=0 => RANGE OF CODES ENTERED
 I $E(X,1,2)="-[" W $C(7),"  ?? Not allowed" S APCD("NO DISPLAY")=1 G X2
 I $E(X,$L(X))="*" D STAR G X2
 I X'["-" S APCDTYP="LOW",APCDONE=1 D LOOK^APCDFQA4 G X2
 I $E(X)="-",'$D(APCDTABL) W $C(7),"  ??  No previous codes entered!" G X2
 I $L(X,"-")>3 W $C(7),"  ??"  S APCDA=1 S APCD("NO DISPLAY")=1 G X2
 I $L(X,"-")=3,$E(X,$L(X))="-" W $C(7),"  ??" S APCDA=1 S APCD("NO DISPLAY")=1 G X2
 I $L(X,"-")=3,$P(X,"-")]"" W $C(7),"  ??" S APCDA=1 S APCD("NO DISPLAY")=1 G X2
 I $E(X)="-" S APCDSUB=1 D  I 1
 . S APCDSAVE("X")=X
 . I $L(X,"-")=3 S X=$P(APCDSAVE("X"),"-",2),APCDTYP="LOW" D LOOK^APCDFQA4 I 'APCDA S X=$P(APCDSAVE("X"),"-",3),APCDTYP="HI" W ! D LOOK^APCDFQA4 Q
 . I $L(APCDSAVE("X"),"-")=2 S X=$E(X,2,99),APCDTYP="LOW",APCDONE=1 D LOOK^APCDFQA4
 E  S APCDSAVE("X")=X S APCDTYP="LOW",X=$P(APCDSAVE("X"),"-") D LOOK^APCDFQA4 I 'APCDA S APCDTYP="HI",X=$P(APCDSAVE("X"),"-",2) W ! D LOOK^APCDFQA4
X2 Q
 ;
DISPLAY ;EP - SHOW CODES IN RANGE SELECTED
 W:$D(IOF) @IOF
 NEW APCDX,APCDQ,APCDARR,X
 ;W !!,"ICD codes in this range =>",!! W $P(APCD("LOW")," ") S APCDDFN=$O(^ICD9("BA",APCD("LOW"),"")) W ?9,$P(^ICD9(APCDDFN,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 APCDARR
 D LST^ATXAPI(APCDSYS,80,$$STRIP^XLFSTR(APCD("LOW"))_"-"_$$STRIP^XLFSTR(APCD("HI")),"CODE","APCDARR")
 S APCDX="",APCDQ=0 F  S APCDX=$O(APCDARR(APCDX)) Q:APCDX=""!($G(APCDQ))  D
 .I $Y>(IOSL-2) D EOP Q:APCDQ
 .I $P(APCDARR(APCDX),U,2)=1 W !,APCDX,?12,$E($P($$ICDDX^ICDEX($P(APCDARR(APCDX),U,1)),U,4),1,40),?60,$P(APCDARR(APCDX),U,4) I 1
 .E  W !,APCDX,?12,$E($P($$ICDDX^ICDEX($P(APCDARR(APCDX),U,1)),U,4),1,40),?60,$P(APCDARR(APCDX),U,4)
 NEW DIR
 S DIR(0)="E",DIR("A")="Press Enter to Continue <>" D ^DIR
 Q
EOP ;
 S APCDQ=0
 NEW DIR
 K DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
 S DIR(0)="E" D ^DIR K DIR
 I $D(DUOUT) S APCDQ=1 Q
 W:$D(IOF) @IOF
 Q
STAR ;
 I $E(X)="-" S APCDSUB=1
 NEW APCDTEMP
 D LST^ATXAPI(APCDSYS,80,$S($E(X)="-":$E(X,2,999),1:X),"CODE","APCDTEMP")
 I '$D(APCDTEMP) W "  ?? There are no codes in that range!" S APCD("NO DISPLAY")=1 Q
 S APCD("LOW")=$O(APCDTEMP(0))
 NEW Z,C
 S (Z,C)="" F  S Z=$O(APCDTEMP(Z)) Q:Z=""  S C=Z
 S APCD("HI")=C
 D DISPLAY
 D ^APCDFQA5
 ;S APCDSAVE("X")=X S APCDTYP="LOW",X=APCD("LOW") D LOOK^APCDFQA4 I 'APCDA S APCDTYP="HI",X=APCD("HI") W ! D LOOK^APCDFQA4
 Q
 ;
SETUTIL ;SET UP TMP NODES TO STORE CODES
 NEW APCDX,APCDQ,APCDARR
 S APCDIRNG=0,APCD("LOW")="" F  S APCD("LOW")=$O(APCDTABL(APCD("LOW"))) Q:APCD("LOW")=""  S APCD("HI")=$P(APCDTABL(APCD("LOW")),U,1) D
 .S APCDIRNG=APCDIRNG+1
 .KILL APCDX,APCDQ,APCDARR
 .D LST^ATXAPI(APCDSYS,80,$$STRIP^XLFSTR(APCD("LOW"))_"-"_$$STRIP^XLFSTR(APCD("HI")),"CODE","APCDARR")
 .S ^XTMP("APCDFQA",APCDJOB,APCDBT,APCDIRNG,"ICDB")=APCD("LOW")
 .S ^XTMP("APCDFQA",APCDJOB,APCDBT,APCDIRNG,"ICDE")=APCD("HI")
 .S X="" F  S X=$O(APCDARR(X)) Q:X=""  D
 ..S ^XTMP("APCDFQA",APCDJOB,APCDBT,"DEPOV","ICDDFN",$P(APCDARR(X),U,1),APCDIRNG)=""
 .Q
 Q
RANGES ;DISPLAY TABLE OF ALL RANGES
 W:$D(IOF) @IOF
 W !!,"ICD Code Range(s) Selected So Far =>",!
 S (APCD("NUM"),APCD)=0 F  S APCD=$O(APCDTABL(APCD)) Q:APCD=""  S APCD("NUM")=APCD("NUM")+1 W !,APCD("NUM"),")  ",APCD,$S(APCD'=$P(APCDTABL(APCD),U,1):"- "_$P(APCDTABL(APCD),U,1),1:"")
 I '$D(APCD("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 APCD("N"):300 W:"^"[APCD("N") ! Q:"^"[APCD("N")  I APCD("N")'?1N!(APCD("N")>APCD("NUM")) W "  ??",$C(7) G A
 F APCDI=1:1:APCD("N") S APCD=$O(APCDTABL(APCD)) I APCDI=APCD("N") S APCD("LOW")=APCD,APCD("HI")=$P(APCDTABL(APCD),U,1) D DISPLAY Q
 S APCD("BANG")="" D RANGES K APCD("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 ;
 I $D(APCD("NOT TAX")) K APCDSTP,APCDX
 K APCDSUB,APCDTYP,APCDDFN,DIR,APCDSAVE,APCDA,APCDCNT,APCD,APCDR,APCDI,APCDONE,APCDFLG
 Q
 ;