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

APCDEPOV.m

Go to the documentation of this file.
APCDEPOV ; IHS/CMI/LAB - POV LOOKUP ; 01 Apr 2015  3:18 PM
 ;;2.0;IHS PCC SUITE;**11,13,16,20**;MAY 14, 2009;Build 25
 ;
EDIT01 ;EP
 D EN^XBNEW("EDIT011^APCDEPOV","APCDTDA;APCDVSIT;APCDPAT;APCDDATE;DFN;AUPNPAT;AUPNVSIT;APCDTTMP")
 Q
EDIT011 ;
 K DIE,DA,DR
 S APCDOVRR=1
 ;
1 ;EDIT .01 FIELD OF V POV
 W !
 K DIR
 S APCDD=""
 S APCDIAIE=1  ;i am in edit mode
 I $G(APCDVSIT),$D(^AUPNVSIT(APCDVSIT)) D
 .I $P(^AUPNVSIT(APCDVSIT,0),U,7)="H",$$DSCHDATE^APCLV(APCDVSIT)]"" S APCDD=$$DSCHDATE^APCLV(APCDVSIT) Q
 .S APCDD=$P($P(^AUPNVSIT(APCDVSIT,0),U),".")
 I APCDD="" S APCDD=$P($G(APCDDATE),".")
 I APCDD="" S APCDD=DT
 S APCDHDAT=APCDD
 ;
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 S APCDTFIE=".01",APCDTDIA="POV",APCDTDEL="",APCDTNPV=""
 D LEX
 I $G(APCDTDEL) D DELETE
 I $G(APCDTDEL) Q  ;deleted the v pov
 I $G(APCDTSKI) Q  ;"^" OUT
 I $G(APCDTNPV)="" G 2
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR=".01///"_APCDTNPV D ^DIE K DIE,DA,DR
 I $D(Y) W !?5,"??" G 1
2 ;DUAL CODING .24
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 I APCDIMP=1 G 3  ;no dual for icd9 environment
 I '$P($G(^APCDSITE(DUZ(2),0)),U,36) G 3  ;dual coding off
 D K
 S APCDTIN9=1,APCDTDIA="ICD-9 CODE",APCDTDEL="",APCDTNPV="",APCDTFIE=".24",APCDIMP=""
 S APCDD=$$FMADD^XLFDT($$IMP^AUPNVUTL(30),-2),APCDIMP=1
 D LEX
 I $G(APCDTDEL) D DELETE
 I $G(APCDTDEL) G 3
 I $G(APCDTSKI) Q  ;"^" OUT
 I $G(APCDTNPV)="" G 3
 K DIE,DA,DR
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR=".24///"_APCDTNPV  D ^DIE K DA,DR,DIE
 I $D(Y) W !,"??  " G 2
3 ;
 ;W !!,"Please Note:  '^'ing is not allowed with the remainder of this mnemonic."
 ;W !,"You must press enter through each field.",!
 ;PROVIDER NARRATIVE
 D K
 I $P($G(^AUPNVPOV(APCDTDA,11)),U,1)]"" D  G 4
 .W !!?5,"PROVIDER NARRATIVE: ",$$VAL^XBDIQ1(9000010.07,APCDTDA,.04),!!
 I $G(APCDTTMP)="IPV" D  G 4
 .S APCDTNQ=$E($P($$ICDDX^ICDEX($P(^AUPNVPOV(APCDTDA,0),U,1),APCDD,,,"I"),U,4),1,140)_"     ****ICD****"
 .S DA=APCDTDA,DIE="^AUPNVPOV(",DR=".04///"_APCDTNQ,DIE("NO^")=1 D ^DIE K DIE,DA,DR
 .W !!,"PROVIDER NARRATIVE: ",$$VAL^XBDIQ1(9000010.07,APCDTDA,.04)
NA ;
 K DIR S DIR(0)="9000010.07,.04",DIR("A")="PROVIDER NARRATIVE",DIR("B")=$$VAL^XBDIQ1(9000010.07,APCDTDA,.04) KILL DA D ^DIR KILL DIR
 I $D(DIRUT) Q  ;^
 I X["|" D EN^DDIOL("A vertical bar '|' is not allowed in the provider narrative") G NA
 S APCDTNQ=+Y
 S DA=APCDTDA,DIE="^AUPNVPOV(",DR=".04////"_APCDTNQ D ^DIE K DIE,DA,DR
 ;S APCDTOLD=$$VAL^XBDIQ1(9000010.07,APCDTDA,.04)
 ;S APCDTNQ=$$GETNARR^APCDEA3($G(APCDTNQP),APCDTOLD)
 ;I APCDTNQ'=APCDTOLD S DA=APCDTDA,DIE="^AUPNVPOV(",DR=".04///"_APCDTNQ D ^DIE K DIE,DA,DR
4 ;PRESENT ON ADMISSION/PRIMARY/SECONDAY H VISITS ONLY
 D K
 S APCDTIMH=""
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR="[APCD EDIT POV]" D ^DIE K DIE,DA,DR
 I '$G(APCDTIMH) Q
89 ;
 D K
 D 8
 I $G(APCDTUPH) Q
 D 10
 I $G(APCDTUPH) Q
 D 12
 I $G(APCDTUPH) Q
14 ;
 D K
 D POC
 I $G(APCDTUPH) Q
17 ;
 S DA=APCDTDA,DIE="^AUPNVPOV(",DR=".13;.08;1204" D ^DIE K DIE,DA,DR
 Q
K ;
 K DIE,DA,DR,DIR
 K APCDTDEL,APCDTNPV,APCDTFIE,APCDTDIA,APCDIMP,APCDTIN9,APCDTUPH
 Q
8 ;EP -.09 CAUSE 1
 D K
 K DIR
 S APCDD=APCDHDAT
 ;
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 S APCDTFIE=".09",APCDTDIA=$S(APCDIMP=30:"CAUSE (V00-Y99 Code Range)",1:"CAUSE (E-Code)"),APCDTDEL="",APCDTNPV=""
 D CLEX^APCDCPOV
 I $G(APCDTDEL) D DELETE
 I $G(APCDTUPH) Q
 I $G(APCDTNPV)="" G 9
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR=".09///"_APCDTNPV D ^DIE K DIE,DA,DR
 I $D(Y) W !?5,"??" G 8
9 ;DUAL CODE .25
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 I APCDIMP=1 Q  ;no dual for icd9 environment
 I '$P($G(^APCDSITE(DUZ(2),0)),U,36) Q  ;dual coding off
 D K
 S APCDTIN9=1,APCDTDIA="CAUSE (E-code)",APCDTDEL="",APCDTNPV="",APCDTFIE=".25",APCDIMP=""
 K APCDTUPH
 S APCDD=$$FMADD^XLFDT($$IMP^AUPNVUTL(30),-2),APCDIMP=1
 D CLEX^APCDCPOV
 I $G(APCDTDEL) D DELETE
 I $G(APCDTUPH) Q
 I $G(APCDTDEL) Q
 I $G(APCDTNPV)="" Q
 K DIE,DA,DR
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR=".25///"_APCDTNPV  D ^DIE K DA,DR,DIE
 I $D(Y) W !,"??  " G 9
 Q
10 ;.18
 D K
 K DIR
 S APCDD=APCDHDAT
 ;
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 S APCDTFIE=".18",APCDTDIA=$S(APCDIMP=30:"CAUSE (V00-Y99 Code Range) #2",1:"CAUSE (E-Code) #2"),APCDTDEL="",APCDTNPV=""
 K APCDTUPH
 D CLEX^APCDCPOV
 I $G(APCDTDEL) D DELETE
 I $G(APCDTUPH) Q
 I $G(APCDTNPV)="" G 11
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR=".18///"_APCDTNPV D ^DIE K DIE,DA,DR
 I $D(Y) W !?5,"??" G 10
11 ;DUAL CODE .26
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 I APCDIMP=1 Q  ;no dual for icd9 environment
 I '$P($G(^APCDSITE(DUZ(2),0)),U,36) Q  ;dual coding off
 D K
 S APCDTIN9=1,APCDTDIA="CAUSE (E-code) #2",APCDTDEL="",APCDTNPV="",APCDTFIE=".26",APCDIMP=""
 S APCDD=$$FMADD^XLFDT($$IMP^AUPNVUTL(30),-2),APCDIMP=1
 K APCDTUPH
 D CLEX^APCDCPOV
 I $G(APCDTDEL) D DELETE
 I $G(APCDTDEL) Q
 I $G(APCDTUPH) Q
 I $G(APCDTNPV)="" Q
 K DIE,DA,DR
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR=".26///"_APCDTNPV  D ^DIE K DA,DR,DIE
 I $D(Y) W !,"??  " G 11
 Q
12 ;.19
 D K
 K DIR
 S APCDD=APCDHDAT
 ;
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 S APCDTFIE=".19",APCDTDIA=$S(APCDIMP=30:"CAUSE (V00-Y99 Code Range) #3",1:"CAUSE (E-Code) #3"),APCDTDEL="",APCDTNPV=""
 K APCDTUPH
 D CLEX^APCDCPOV
 I $G(APCDTDEL) D DELETE
 I $G(APCDTUPH) Q
 I $G(APCDTNPV)="" G 13
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR=".19///"_APCDTNPV D ^DIE K DIE,DA,DR
 I $D(Y) W !?5,"??" G 12
13 ;DUAL CODE .27
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 I APCDIMP=1 Q  ;no dual for icd9 environment
 I '$P($G(^APCDSITE(DUZ(2),0)),U,36) Q  ;dual coding off
 D K
 S APCDTIN9=1,APCDTDIA="CAUSE (E-code) #3",APCDTDEL="",APCDTNPV="",APCDTFIE=".27",APCDIMP=""
 S APCDD=$$FMADD^XLFDT($$IMP^AUPNVUTL(30),-2),APCDIMP=1
 K APCDTUPH
 D CLEX^APCDCPOV
 I $G(APCDTDEL) D DELETE
 I $G(APCDTDEL) Q
 I $G(APCDTUPH) Q
 I $G(APCDTNPV)="" Q
 K DIE,DA,DR
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR=".26///"_APCDTNPV  D ^DIE K DA,DR,DIE
 I $D(Y) W !,"??  " G 13
 Q
POC ;EP
141 ;RFB
 D K
 K DIR,DIRUT
 S APCDD=APCDHDAT
 ;
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 I APCDIMP=1 G 15  ;NOT IN ICD9
 S APCDTFIE=".23",APCDTDIA="RETAINED FOREIGN BODY (Z18-Z18.9)",APCDTDEL="",APCDTNPV=""
 K APCDTUPH
 D RLEX^APCDBPOV
 I $G(APCDTUPH) Q
 I $G(APCDTDEL) D DELETE
 I $G(APCDTNPV)="" G 15
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR=".23///"_APCDTNPV D ^DIE K DIE,DA,DR
 I $D(Y) W !?5,"??" G 141
15 ;POC .21/.28
 D K
 K DIR
 S APCDD=APCDHDAT
 ;
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 S APCDTFIE=".21",APCDTDIA=$S(APCDIMP=30:"PLACE OF OCCURRENCE (Y92-Y92.9)",1:"PLACE OF OCCURRENCE (E849-E849.9)"),APCDTDEL="",APCDTNPV=""
 K APCDTUPH
 D PLEX^APCDLPOV
 I $G(APCDTUPH) Q
 I $G(APCDTDEL) D DELETE
 I $G(APCDTNPV)="" G 16
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR=".21///"_APCDTNPV D ^DIE K DIE,DA,DR
 I $D(Y) W !?5,"??" G 15
16 ;DUAL CODE .28
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 I APCDIMP=1 Q  ;no dual for icd9 environment
 I '$P($G(^APCDSITE(DUZ(2),0)),U,36) Q  ;dual coding off
 D K
 S APCDTIN9=1,APCDTDIA="PLACE OF OCCURRENCE (E849-E849.9)",APCDTDEL="",APCDTNPV="",APCDTFIE=".28",APCDIMP=""
 S APCDD=$$FMADD^XLFDT($$IMP^AUPNVUTL(30),-2),APCDIMP=1
 K APCDTUPH
 D PLEX^APCDLPOV
 I $G(APCDTUPH) Q
 I $G(APCDTDEL) D DELETE
 I $G(APCDTDEL) Q
 I $G(APCDTNPV)="" Q
 K DIE,DA,DR
 S DIE="^AUPNVPOV(",DA=APCDTDA,DR=".28///"_APCDTNPV  D ^DIE K DA,DR,DIE
 I $D(Y) W !,"??  " G 16
 Q
LEX ;EP - called from input template
 ;reader call to get TEXT for code
 K DIR,APCDTDEL,DIRUT
 K ^TMP("LEXSCH",$J)
 I APCDIMP=1 D CONFIG^LEXSET("ICD","ICD",$P(APCDD,"."))
 I APCDIMP=30 D CONFIG^LEXSET("10D","10D",$P(APCDD,"."))
 S DIR(0)="FO^1:60",DIR("A")=$S($G(APCDTDIA)]"":APCDTDIA,1:"Enter PURPOSE OF VISIT")
 S DIR("?")=$S($G(APCDTIN9):"^D HELP9^AUPNSIC9",1:"^D HELP^AUPNSICH")
 S DIR("??")=$S($G(APCDTIN9):"^D HELP9^AUPNSIC9",1:"^D HELP^AUPNSICH")
 I $$VAL^XBDIQ1(9000010.07,APCDTDA,APCDTFIE)]"" S DIR("B")=$$VAL^XBDIQ1(9000010.07,APCDTDA,APCDTFIE)
 KILL DA D ^DIR KILL DIR
 I X="@" S APCDTDEL=1 G XITL
 I X="" G XITL
 I $D(DIRUT) S APCDTSKI=1 G XITL
 ;I Y="" G XITL
 S APCDUINP=Y
 I APCDUINP=$$VAL^XBDIQ1(9000010.07,APCDTDA,APCDTFIE) G XITL
 S %=""
 I APCDUINP=".9999" S %=+$$ICDDX^ICDEX($S(APCDIMP=1:".9999",1:"ZZZ.999"),,APCDIMP,"E") G LEXN
 I APCDIMP=30,APCDUINP="ZZZ.999" S %=+$$ICDDX^ICDEX($S(APCDIMP=1:".9999",1:"ZZZ.999")) G LEXN
 I APCDIMP=30,$E(APCDUINP,1,4)="ZZZ." S %=+$$ICDDX^ICDEX($S(APCDIMP=1:".9999",1:"ZZZ.999")) G LEXN
 I $E(APCDUINP,1,7)="UNCODED" S %=+$$ICDDX^ICDEX($S(APCDIMP=1:".9999",1:"ZZZ.999")) G LEXN
 I APCDUINP["UNCODED D" S %=+$$ICDDX^ICDEX($S(APCDIMP=1:".9999",1:"ZZZ.999")) G LEXN
 K ^TMP("LEXSCH",$J),^TMP("LEXHIT",$J),LEX,^TMP("LEXFND",$J)
 I APCDIMP=1 D CONFIG^LEXSET("ICD","ICD",$P(APCDD,"."))
 I APCDIMP=30 D CONFIG^LEXSET("10D","10D",$P(APCDD,"."))
 S X=APCDUINP
 I APCDIMP=1 S DIC("S")=$S('$G(APCDTIN9):"I $$ICDONE9^APCDAPOV(+Y,LEXVDT)",1:"I $$ICDONE99^APCDAPOV(+Y,LEXVDT)")
 I APCDIMP=30 S DIC("S")="I $$ICDONE1^APCDAPOV(+Y,LEXVDT)"
 S DIC("A")=$S($G(APCDTDIA)]"":APCDTDIA_": ",1:"Enter PURPOSE OF VISIT: ")
 I APCDIMP=1 D LOOK^LEXA(X,"ICD",999,"ICD",$P(APCDD,"."))
 I APCDIMP=30 D LOOK^LEXA(X,"10D",999,"10D",$P(APCDD,"."))
 I 'LEX D  G:%="" LEX G:% LEXN
 .S X=0 F  S X=$O(LEX("HLP",X)) Q:X'=+X  W !,LEX("HLP",X)
 .;now check fileman V2.0 PATCH 20 CR#554
 .W !!,"now trying secondary fileman lookup..."
 .S %="" S X=APCDUINP,DIC="^ICD9(",DIC(0)="MEQ",DIC("S")="D ^AUPNSICD" D ^DIC K DIC
 .S %="" I $P(Y,U)'=-1 S %=+Y
 ;display all codes and call reader
 S APCDANS=""
 D GETANS^APCDAPOV
 I APCDY="^" W ! D  G:%="" LEX G:% LEXN
 .;now check fileman
 .;W !!,"now trying fileman lookup..."
 .S %="" ;S X=APCDUINP,DIC="^ICD9(",DIC(0)="QME" D ^DIC K DIC
 .;S %="" I $P(Y,U)'=-1 S %=+Y
 I APCDY="" W ! D  G:%="" LEX G:% LEXN
 .;now check fileman
 .;W !!,"now trying fileman lookup..."
 .S %="" ;S X=APCDUINP,DIC="^ICD9(",DIC(0)="MEQ" D ^DIC K DIC
 .;S %="" I $P(Y,U)'=-1 S %=+Y
 I '$G(APCDY) W ! D  G:%="" LEX G:% LEXN
 .;now check fileman
 .;W !!,"now trying fileman lookup..."
 .S %="" ;S X=APCDUINP,DIC="^ICD9(",DIC(0)="MEQ" D ^DIC K DIC
 .;S %="" I $P(Y,U)'=-1 S %=+Y
 I APCDIMP=1 S Y=$$ICDONE^LEXU($P(^TMP("LEXHIT",$J,APCDY),U,1),$P(APCDD,"."))
 I APCDIMP=30 S Y=$$ONE^LEXU($P(^TMP("LEXHIT",$J,APCDY),U,1),$P(APCDD,"."),"10D")
 K DO,^TMP("LEXSCH",$J)
 I $G(Y)="" W !!,"lexicon isn't passing back an ICD code." S APCDTERR=1,APCDTNPV="" G XITL
 S %=$$ICDDX^ICDEX(Y,$P(APCDD,"."),,"E")
 I $P(%,U,1)="-1" W !!,"lexicon isn't passing back an ICD code." S APCDTERR=1,APCDTNPV="" G XITL
LEXN ;
 S APCDTNPV="`"_+%,APCDTNQP=APCDUINP
 W !
XITL K Y,X,DO,D,DD,DIPGM,APCDTPCC
 Q
DELETE ;
 S APCDTDEL=0
 I APCDTFIE=".01" D  Q
 .K DIR
 .S DIR(0)="Y",DIR("A")="   SURE YOU WANT TO DELETE THE ENTIRE V POV" KILL DA D ^DIR KILL DIR
 .I 'Y Q
 .I $D(DIRUT) Q
 .S APCDTDEL=1
 .S DA=APCDTDA,DIK="^AUPNVPOV(" D ^DIK
 K DIR
 S DIR(0)="Y",DIR("A")="   SURE YOU WANT TO DELETE" KILL DA D ^DIR KILL DIR
 I 'Y Q
 I $D(DIRUT) Q
 S DA=APCDTDA,DIE="^AUPNVPOV(",DR=APCDTFIE_"///@" D ^DIE K DIE,DA,DR
 Q
ECOD ;
 ;EP
 D EN^XBNEW("ECOD1^APCDEPOV","APCDTDA;APCDVSIT;APCDPAT;APCDDATE;DFN;AUPNPAT;AUPNVSIT;APCDTTMP")
 Q
ECOD1 ;
 W !
 K DIR
 S APCDD=""
 I $G(APCDVSIT),$D(^AUPNVSIT(APCDVSIT)) D
 .I $P(^AUPNVSIT(APCDVSIT,0),U,7)="H",$$DSCHDATE^APCLV(APCDVSIT)]"" S APCDD=$$DSCHDATE^APCLV(APCDVSIT) Q
 .S APCDD=$P($P(^AUPNVSIT(APCDVSIT,0),U),".")
 I APCDD="" S APCDD=$P($G(APCDDATE),".")
 I APCDD="" S APCDD=DT
 S APCDHDAT=APCDD
 ;
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 D 8
 D POC
 Q
ECO2 ;
 ;EP
 D EN^XBNEW("ECO21^APCDEPOV","APCDTDA;APCDVSIT;APCDPAT;APCDDATE;DFN;AUPNPAT;AUPNVSIT;APCDTTMP")
 Q
ECO21 ;
 W !
 K DIR
 S APCDD=""
 I $G(APCDVSIT),$D(^AUPNVSIT(APCDVSIT)) D
 .I $P(^AUPNVSIT(APCDVSIT,0),U,7)="H",$$DSCHDATE^APCLV(APCDVSIT)]"" S APCDD=$$DSCHDATE^APCLV(APCDVSIT) Q
 .S APCDD=$P($P(^AUPNVSIT(APCDVSIT,0),U),".")
 I APCDD="" S APCDD=$P($G(APCDDATE),".")
 I APCDD="" S APCDD=DT
 S APCDHDAT=APCDD
 ;
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 D 10
 Q
ECO3 ;
 ;EP
 D EN^XBNEW("ECO31^APCDEPOV","APCDTDA;APCDVSIT;APCDPAT;APCDDATE;DFN;AUPNPAT;AUPNVSIT;APCDTTMP")
 Q
ECO31 ;
 W !
 K DIR
 S APCDD=""
 I $G(APCDVSIT),$D(^AUPNVSIT(APCDVSIT)) D
 .I $P(^AUPNVSIT(APCDVSIT,0),U,7)="H",$$DSCHDATE^APCLV(APCDVSIT)]"" S APCDD=$$DSCHDATE^APCLV(APCDVSIT) Q
 .S APCDD=$P($P(^AUPNVSIT(APCDVSIT,0),U),".")
 I APCDD="" S APCDD=$P($G(APCDDATE),".")
 I APCDD="" S APCDD=DT
 S APCDHDAT=APCDD
 ;
 S APCDIMP=$$IMP^AUPNSICD(APCDD)
 D 12
 Q