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

ADEAPC1.m

Go to the documentation of this file.
ADEAPC1 ; IHS/HQT/MJL  - DENTAL PCC LINK PART 2 ;  [ 04/02/2014  8:12 AM ]
 ;;6.0;ADE;**2,12,16,27**;March 25,1999;Build 14
 ;;IHS/OIT/GAB 6.4.14 Modified for ICD10 - PATCH 27
 ;;IHS/OIT/GAB 7.2015 Modified for ICD10 Maint. - PATCH 28
 ;------->CREATE NARRATIVE AND POV
 D VPOV
 ;------->V PROVIDER
 D VPRV
 ;------->V DENTAL
 D DENTRY D:$D(ADEW) DENTRY3
 ;------->SEND BULLETIN IF PROBLEMS
 D BULLT:$D(XMB)
 ;------->END
 K APCDALVR,ADEOP,ADEADA,ADEQTY,ADEI,ADEC,ADESER,ADEX,ADEFLG,ADEV,Y,XMB,ADECODE,ADEW,ADEVDFN
 Q
VPOV ;EPFIC
 I $P(^ADEPCD(ADEDFN,0),U,7)]"" S APCDALVR("APCDTNQ")=$P(^(0),U,7)
 E  S:'$D(APCDALVR("APCDTNQ")) APCDALVR("APCDTNQ")="DENTAL/ORAL HEALTH VISIT"
 S APCDALVR("APCDOVRR")=1
 ;/IHS/OIT/GAB 9.4.14 CHANGED BELOW FOR ICD10 PATCH 27
 ;S APCDALVR("APCDTPOV")="V72.2" S APCDALVR("APCDATMP")="[APCDALVR 9000010.07 (ADD)]" D EN^APCDALVR
 S APCDALVR("APCDTPOV")="V72.2"
 ;/IHS/OIT/GAB *** BEGIN PATCH 28 *****
 S VISDT=$P(APCDALVR("APCDDATE"),".")
 S I=$$IMP^ADEAPC1(VISDT)
 I I=30 S APCDALVR("APCDTPOV")="ZZZ.999"
 ;I (APCDALVR("APCDDATE"))>I10DATE S APCDALVR("APCDTPOV")="ZZZ.999"
 ;/IHS/OIT/GAB END ICD10 CHANGES
 S APCDALVR("APCDATMP")="[APCDALVR 9000010.07 (ADD)]" D EN^APCDALVR
 K APCDOVRR,APCDALVR("APCDOVRR")
 I $D(APCDALVR("APCDAFLG")) S XMB(3)="V POV" Q
 S ADEVDFN=APCDALVR("APCDADFN")
 D ADDPCC^ADEAPC2("302///"_ADEVDFN,ADEDFN)
 Q
VPRV ;EP
 ;*IHS/HMW Uncomment next 8 lines and comment 9th line to implement
 ;VA200 changes
 ;N ADEDTPRO
 ;S ADEDTPRO=$P(^ADEPCD(ADEDFN,0),U,4)
 ;I '$D(^DIC(16,ADEDTPRO,"A3")) S XMB(4)="V PROVIDER" Q
 ;S ADEDTPRO=^DIC(16,ADEDTPRO,"A3")
 ;S APCDALVR("APCDTPRO")="`"_ADEDTPRO
 ;S APCDALVR("APCDTPS")="P"
 ;S APCDALVR("APCDATMP")="[APCDALVR 9000010.06 (ADD)]"
 ;D EN^APCDALVR
 ;TUC/DIR/MJL 9/2/99
 S APCDALVR("APCDTPRO")="`"_$S($P(^DD(9000010.06,.01,0),U,2)["P6":$P(^ADEPCD(ADEDFN,0),U,4),1:^DIC(16,$P(^ADEPCD(ADEDFN,0),U,4),"A3"))
 S APCDALVR("APCDTPS")="P",APCDALVR("APCDATMP")="[APCDALVR 9000010.06 (ADD)]" D EN^APCDALVR
 I $D(APCDALVR("APCDAFLG")) S XMB(4)="V PROVIDER" Q
 S ADEVDFN=APCDALVR("APCDADFN")
 D ADDPCC^ADEAPC2("303///"_ADEVDFN,ADEDFN)
 Q
DENTRY ;EP IHS/SET/HMW **16** Added EP to permit external call
 S ADEH=1
 F ADEI=1:1:ADEC D
 . S APCDALVR("APCDTSC")="`"_ADEADA(ADEI)
 . S APCDALVR("APCDTNOU")=ADEQTY(ADEI)
 . S:ADEOP(ADEI)]"" APCDALVR("APCDTOS")="`"_ADEOP(ADEI)
 . S:ADETSUR(ADEI)]"" APCDALVR("APCDTSUR")=ADETSUR(ADEI)
 . S APCDALVR("APCDATMP")="[APCDALVR 9000010.05 (ADD)]"
 . S APCDALVR("APCDTFEE")=$G(ADETFEE(ADEI)) ;IHS/SET/HMW **12** pass fee to PCC
 . D EN^APCDALVR
 . K APCDALVR("APCDTOS")
 . K APCDALVR("APCDTSUR")
 . D DENTRY2
 I '$D(ADEAPC) K ADEH,ADEG Q
 I +ADEAPC(1) D ADDPCC^ADEAPC2("304///"_ADEAPC(1),ADEDFN)
 I $D(ADEAPC(2)) D ADDPCC^ADEAPC2("401///"_ADEAPC(2),ADEDFN)
 I $D(ADEAPC(3)) D ADDPCC^ADEAPC2("501///"_ADEAPC(3),ADEDFN)
 K ADEH,ADEG,ADEQ,ADEAPC Q
DENTRY2 I $D(APCDALVR("APCDAFLG")) S ADEW=ADEI,ADECODE(ADEW)=$P(^AUTTADA(ADEADA(ADEI),0),U,1) Q
 S ADEVDFN=APCDALVR("APCDADFN")
 I $D(ADEAPC(ADEH)) S ADEAPC(ADEH)=ADEAPC(ADEH)_"|"_ADEVDFN S:$L(ADEAPC(ADEH))>180 ADEH=ADEH+1 Q
 S ADEAPC(ADEH)=ADEVDFN
 Q
DENTRY3 ;EP IHS/SET/HMW **16** Added EP to permit external call
 S ADEW="" F ADEL=0:0 S ADEW=$O(ADECODE(ADEW)) Q:ADEW=""  S $P(XMB(5)," ",ADEW)=ADECODE(ADEW)
 Q
BULLT ;EP IHS/SET/HMW **16** Added EP to permit external call
 S Y=$P(^ADEPCD(ADEDFN,0),U,2) X ^DD("DD")
 S XMB(1)=$P(^DPT(ADEPAT,0),U)_"  Patient DFN= "_ADEPAT,XMB(2)=Y,XMB(6)=APCDALVR("APCDVSIT"),XMB="ADEDENTAL" S XMDUZ=.5 S:'ADENEWVS XMB(8)="***THIS DATA FOR A VISIT BEING MODIFIED***"
 D ^XMB
 Q
IMP(D) ;  which coding system should be used
 ;/IHS/OIT/GAB ADDED THIS FUNCTION FOR ICD10 PATCH #28
 ;RETURN IEN of entry in ^ICDS
 ;1 = ICD9
 ;30 = ICD10
 ;
 I $G(D)="" S D=DT
 NEW X,Y,IMPDT
 I '$O(^ICDS("F",80,0)) Q 1
 S Y=""
 S X=0 F  S X=$O(^ICDS("F",80,X)) Q:X'=+X  D
 .I $P(^ICDS(X,0),U,4)="" Q   ;NO IMPLEMENTATION DATE
 .S IMPDT=$P(^ICDS(X,0),U,4)
 ;Compare the visit date to ensure it should use ICD10
 I D>(IMPDT-1) S Y=30
 E  S Y=1
 Q Y