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

APCDFHD.m

Go to the documentation of this file.
APCDFHD ; IHS/CMI/LAB - POV ICDUP ;
 ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
 ;
START ;
 D EN^XBNEW("START1^APCDFHD","APCDTSKI;APCDICD;APCDTERR;APCDPAT;APCDDATE")
 Q
START1 ;EP
 S APCDTPCC="",APCDINPE=1
 ;FOR NOW IF ICD9 CALL LEX, AFTER VA SENDS OUT ICD10 LEX JUST D LEX Q
 NEW APCDCSI
 S (APCDIMP,APCDCSI)=$$IMP^AUPNSICD($S($G(APCDDATE):$P(APCDDATE,"."),1:DT))
 ;
LEX ;EP - called from input template
 K DIR
 K ^TMP("LEXSCH",$J)
 I APCDIMP=1 D CONFIG^LEXSET("ICD","ICD",$P(APCDDATE,"."))
 I APCDIMP=30 D CONFIG^LEXSET("10D","10D",$S(APCDDATE>3141001:APCDDATE,1:3141001))
 S DIR(0)="FO^1:60",DIR("A")="Family History Condition"
 S DIR("?")="^D HELPFH^AUPNSICD"
 S DIR("??")="^D HELPFH^AUPNSICD"
 KILL DA D ^DIR KILL DIR
 I $D(DIRUT) S APCDTSKI=1,APCDLOOK="" G XITL
 I Y="" S APCDTSKI=1,APCDLOOK="" G XITL
 S APCDUINP=Y
 K ^TMP("LEXSCH",$J),LEX,^TMP("LEXHIT",$J),^TMP("LEXFND",$J)
 I APCDIMP=1 D CONFIG^LEXSET("ICD","ICD",$P(APCDDATE,"."))
 I APCDIMP=30 D CONFIG^LEXSET("10D","10D",$S(APCDDATE>3141001:APCDDATE,1:3141001))
 S X=APCDUINP
 I APCDIMP=1 S DIC("S")="I $$ICDONE9^APCDFHD(+Y,LEXVDT)"
 I APCDIMP=30 S DIC("S")="I $$ICDONE1^APCDFHD(+Y,LEXVDT)"
 I APCDIMP=1 D LOOK^LEXA(X,"ICD",999,"ICD",$P(APCDDATE,".",1))
 I APCDIMP=30 D LOOK^LEXA(X,"10D",999,"10D",$S(APCDDATE>3141001:APCDDATE,1:3141001))
 I 'LEX D  G LEX
 .S X=0 F  S X=$O(LEX("HLP",X)) Q:X'=+X  W !,LEX("HLP",X)
 ;display all codes and call reader
 S APCDANS=""
 D GETANS^APCDAPOV
 I APCDY="^" W ! G LEX
 I APCDY="" W ! G LEX
 I '$G(APCDY) W ! G LEX
 I APCDIMP=1 S Y=$$ICDONE^LEXU($P(^TMP("LEXHIT",$J,APCDY),U,1),$P(APCDDATE,"."))
 I APCDIMP=30 S Y=$$ONE^LEXU($P(^TMP("LEXHIT",$J,APCDY),U,1),$S($P(APCDDATE,".")>3141001:$P(APCDDATE,"."),1:3141001),"10D")
 K DO,^TMP("LEXSCH",$J)
 I $G(Y)="" W !!,"lexicon isn't passing back an ICD code." S APCDTERR=1,APCDTCLK="" G XITL
 S %=$$ICDDX^ICDEX(Y,$P(APCDDATE,"."),APCDIMP,"E")
 I $P(%,U,1)="-1" W !!,"lexicon isn't passing back an ICD code." S APCDTERR=1,APCDTCLK="" G XITL
 S APCDICD=$P(%,U,1)
XITL K Y,X,DO,D,DD,DIPGM,APCDTPCC
 Q
ICDONE9(ALEX,ALEXVDT) ;EP - Return one ICD code for an expression
 ;    LEX      IEN of file 757.01
 ;    LEXVDT   Date to use for screening by codes
 N ALEXICD
 S ALEXVDT=$S(+$G(ALEXVDT)>0:ALEXVDT,1:$$DT^XLFDT)
 S ALEX=$$ICDONE^LEXU(ALEX,ALEXVDT) Q:ALEX="" ""
 S ALEXICD=$$ICDDX^ICDEX(ALEX,ALEXVDT,1,"E")
 Q:$P(ALEXICD,"^",2)="INVALID CODE" ""
 Q:'$$CHKFH^AUPNSICD($P(ALEXICD,U,1)) ""
 Q 1
ICDONE1(ALEX,ALEXVDT) ;EP - Return one ICD code for an expression
 ;    LEX      IEN of file 757.01
 ;    LEXVDT   Date to use for screening by codes
 N ALEXICD
 ;S ALEXVDT=$S(+$G(ALEXVDT)>0:ALEXVDT,1:$$DT^XLFDT)
 S ALEX=$$ONE^LEXU(ALEX,ALEXVDT,"10D") Q:ALEX="" ""
 S ALEXICD=$$ICDDX^ICDEX(ALEX,ALEXVDT)
 Q:$P(ALEXICD,"^",2)="INVALID CODE" ""
 Q:'$$CHKFH^AUPNSICD($P(ALEXICD,U,1)) ""
 Q 1