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

ACHSEOB4.m

Go to the documentation of this file.
ACHSEOB4 ; IHS/ITSC/TPF/PMF - PROCESS EOBRS (5/6) - UPDATE DOCUMENT(2/2) ;  
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**18,22,23**;JUN 11, 2001;Build 43
 ;
 ;
ICD ;EP.
 ;ACHS*3.1*22 ADDED FOR ICD LENGTH OF 3, TO FX ISSUE OF CSV LOOK UP BY IEN
 ;F ACHS=12:1:16 S ACHSX=$P(ACHSEOBR("E",ACHS)," ") I ACHSX]"" D:$L(ACHSX)<3 ICNV1 D:$L(ACHSX)>3 ICNV D I1
 ;F ACHS=12:1:16 S ACHSX=$P(ACHSEOBR("E",ACHS)," ") I ACHSX]"" D:$L(ACHSX)<3 ICNV1 D:$L(ACHSX)>3 ICNV S:$L(ACHSX)=3 ACHSX=ACHSX_"." D I1 ;ACHS*3.1*22
 ;ACHS*3.1*23 CHANGED END OF FOR LOOP TO TST FOR DATA "E" TO ACHSREJ AND FI SENDS . IN NEW FORMAT
 I $$PARM^ACHS(0,17)?1N.N,DT>($$PARM^ACHS(0,17)-1) F ACHS=12:1 Q:'$D(ACHSEOBR(ACHSREJ,ACHS))  D
 .S ACHSX=$P(ACHSEOBR(ACHSREJ,ACHS)," ") I ACHSX]"" D I1
 I ($$PARM^ACHS(0,17)'?1N.N)!(DT<$$PARM^ACHS(0,17)) F ACHS=12:1 Q:'$D(ACHSEOBR(ACHSREJ,ACHS))  D
 .S ACHSX=$P(ACHSEOBR(ACHSREJ,ACHS)," ")
 .I ACHSX]"" D:$L(ACHSX)<3 ICNV1 D:$L(ACHSX)>3 ICNV S:$L(ACHSX)=3 ACHSX=ACHSX_"." D I1
 Q
 ;
I1 ; Check DX codes first
 ;ACHS*3.1*18 IHS.OIT.FCJ MODIFIED FOR CSV
 ;S DIC(0)="M",X=$G(^DD(80,0,"DIC"))
 ;I X]"" X ^%ZOSF("TEST") E  S DIC(0)="IM"
 ;S DIC="^ICD9(",D="AB",X=ACHSX
 ;D IX^DIC
 ;I Y<1 D ICDLK Q:$G(ACHSERRE)
 ;ACHS*3.1*23 IHS.OIT.MOD FOR ICD-10
 ;S Y=$P($$ICDDX^ICDCODE(ACHSX),U,1,2)
 S Y=$P($$ICDDX^ICDEX(ACHSX,,,"E"),U,1,2)
 I Y<0 D ERR Q
 ;ACHS*3.1*18 END OF CHANGES
 I '$D(^ACHSF(DUZ(2),"D",ACHSDIEN,9)) S $P(^ACHSF(DUZ(2),"D",ACHSDIEN,9,0),U,2)=$P($G(^DD(9002080.01,95,0)),U,2)
 N ACHSTMP S ACHSTMP=0
 ;IF DUP DX OR PROC CODES SET WARNING
 F  S ACHSTMP=$O(^ACHSF(DUZ(2),"D",ACHSDIEN,9,ACHSTMP)) Q:ACHSTMP=""  D
 .Q:'$D(^ACHSF(DUZ(2),"D",ACHSDIEN,9,ACHSTMP,0))
 .;ACHS*3.1*23 CHG NXT LN ACHSEDAT=Y TO ACHSEDAT=$P(Y,U,2)
 .I $P($G(^ACHSF(DUZ(2),"D",ACHSDIEN,9,ACHSTMP,0)),U)=+Y S ACHSERRE=23,ACHSEDAT=$P(Y,U,2) D ^ACHSEOBG Q
 S X=+Y
 S DIC(0)="M",DIC="^ACHSF(DUZ(2),""D"",ACHSDIEN,9,"
 S DIC("DR")="1////^S X=ACHSTDA"
 S DA(2)=DUZ(2)
 S DA(1)=ACHSDIEN
 K DO,DD D FILE^DICN
 I Y<1 S ACHSERRE=16,ACHSEDAT=X D ^ACHSEOBG
 Q
 ;
ICNV ; Convert E and vee codes and place decimal.
 I $E(ACHSX,1)'="E" S ACHSX=$E(ACHSX,1,3)_"."_$E(ACHSX,4,5) Q
 S ACHSX=$E(ACHSX,1,4)_"."_$E(ACHSX,5)
 I $E(ACHSX,6)="" S ACHSX=$E(ACHSX,1,5) Q
 Q
 ;
ICNV1 ;
 S X="000",X=$E(X,1,3-$L(ACHSX)),ACHSX=X_ACHSX
 Q
 ;
PROC ;EP
 ;ACHS*3.1*23 ADDED 2 MORE PROC CHANGE 10 TO 12 IN NXT LINE
 F ACHS=8:1:12 I $D(ACHSEOBR("G",ACHS)) S ACHSX=$P(ACHSEOBR("G",ACHS)," ") Q:ACHSX=""  D PROC1
 Q
 ;
PROC1 ;
 ;ACHS*3.1*18 IHS.OIT.FCJ MODIFIED FOR CSV
 ;S DIC(0)="M"
 ;S X=$G(^DD(80.1,0,"DIC"))
 ;I X]"" X ^%ZOSF("TEST") E  S DIC(0)="IM"
 ;ACHS*3.1*23 ICD-10 PROCEDURE CODE ARE 7 DIGITS
 G:$L(ACHSX)=7 PROC2
 S ACHSX=$P(ACHSX,".")_$P(ACHSX,".",2)
 S ACHSX=$E(ACHSX,1,2)_"."_$E(ACHSX,3,$L(ACHSX))
 ;S DIC="^ICD0(",D="AB",X=ACHSX
 ;D IX^DIC
PROC2 ;
 ;S Y=$P($$ICDOP^ICDCODE(ACHSX),U,1,2)  ;ACHS*3.1*23
 S Y=$P($$ICDOP^ICDEX(ACHSX),U,1,2)     ;ACHS*3.1*23
 ;ACHS*3.1*18 END OF CHANGES
 I Y<1 S ACHSERRE=17,ACHSEDAT=ACHSX D ^ACHSEOBG Q
 I '$D(^ACHSF(DUZ(2),"D",ACHSDIEN,10)) S $P(^ACHSF(DUZ(2),"D",ACHSDIEN,10,0),U,2)=$P(^DD(9002080.01,96,0),U,2)
 ; Add procedure date to next line for duplicate verification,
 ; after FI begins sending that data.
 ;ACHS*3.1*23 CHG NXT LN ACHSEDAT=Y TO ACHSEDAT=$P(Y,U,2)
 I $D(^ACHSF(DUZ(2),"D",ACHSDIEN,10,+Y)) S ACHSERRE=43,ACHSEDAT=$P(Y,U,2) D ^ACHSEOBG
 S X=+Y
 S DIC(0)="M",DIC="^ACHSF(DUZ(2),""D"",ACHSDIEN,10,"
 S DIC("DR")="2////^S X=ACHSTDA"
 S DA(2)=DUZ(2)
 S DA(1)=ACHSDIEN
 K DO,DD D FILE^DICN
 I Y<1 S ACHSERRE=17,ACHSEDAT=X D ^ACHSEOBG
 Q
 ;
CPTREV ;EP - Process EOBR CPT / REVENUE / ADA codes.
SHUNT D CPTREV^ACHSEOBZ Q  ; MRS:1/3/2000
 S ACHS=0
C1 ;
 S ACHS=$O(^TMP("ACHSEOB",$J,"F",ACHS))
 Q:'ACHS
 S ACHSMRCA="" ; NO WARNING MESSAGE FOR REV/CPT/ADA YET
 ;S ACHSEOBR("F")=^TMP("ACHSEOB",$J,"F",ACHS),ACHSX=$E(ACHSEOBR("F"),35,39),ACHSX=$$STRIP^XLFSTR(ACHSX," ")
 S ACHSEOBR("F")=^TMP("ACHSEOB",$J,"F",ACHS),ACHSX=$E(ACHSEOBR("F"),39,43),ACHSX=$$STRIP^XLFSTR(ACHSX," ")
 ;
 S X=$S($L(ACHSX)=5:81,$L(ACHSX)=4:9999999.31,$L(ACHSX)=3:9999999.72,1:""),DIC(0)="M"
 I X]"" S X=$G(^DD(X,0,"DIC"))
 I X]"" X ^%ZOSF("TEST") E  S DIC(0)="IM"
 S DIC=$S($L(ACHSX)=5:"^ICPT(",$L(ACHSX)=4:"^AUTTADA(",1:"^AUTTREVN("),X=ACHSX
 D ^DIC
 I +Y>0 G DOCUMENT
 G REV:$L(ACHSX)=3,ADA:$L(ACHSX)=4,CPT
 ;
REV ; Add missing Revenue Code.
 S ACHSERRE=19,ACHSEDAT=ACHSX D ^ACHSEOBG
 S X="PT CONVENCE/OTH" D ^DIC
 S ACHSMRCA="WARNING: REV["_ACHSEDAT_"] FAILED, USING["_X_"]"
 G DOCUMENT
 ;
ADA ; Add missing ADA code.
 S ACHSERRE=33,ACHSEDAT=ACHSX D ^ACHSEOBG
 S X="UNSPECIFIED TREATMENT" D ^DIC
 S ACHSMRCA="WARNING: ADA["_ACHSEDAT_"] FAILED, USING["_X_"]"
 G DOCUMENT
 ;
CPT ; Add missing CPT code.
 S ACHSERRE=18,ACHSEDAT=ACHSX D ^ACHSEOBG
 S X="UNCODED",DIC(0)="MI" D ^DIC S DIC(0)="M"
 S ACHSMRCA="WARNING: CPT["_ACHSEDAT_"] FAILED, USING["_X_"]"
 G DOCUMENT
 ;
DOCUMENT ; Add EOBR info to CPT/REV/ADA multiple in DOCUMENT multiple.
 ;
 I '$D(^ACHSF(DUZ(2),"D",ACHSDIEN,11)) S ^ACHSF(DUZ(2),"D",ACHSDIEN,11,0)=$$ZEROTH^ACHS(9002080.01,97)
 S X=+Y_";"_$P($P(DIC,"("),U,2)_"(",DIC="^ACHSF(DUZ(2),""D"",ACHSDIEN,11,",DA(2)=DUZ(2),DA(1)=ACHSDIEN
 K DO,DD D FILE^DICN
 I Y<1 S ACHSERRE=$S(+ACHSX>999:18,1:19),ACHSEDAT=ACHSX D ^ACHSEOBG G C1
 S Y=+Y,$P(^ACHSF(DA(2),"D",DA(1),11,Y,0),U,2)=ACHSEOBR("F",8)-17000000,$P(^(0),U,3)=ACHSEOBR("F",9)-17000000
 S $P(^ACHSF(DA(2),"D",DA(1),11,Y,0),U,4)=ACHSEOBR("F",11)
 S $P(^ACHSF(DA(2),"D",DA(1),11,Y,0),U,5)=+$E(ACHSEOBR("F",12),1,7)_"."_$E(ACHSEOBR("F",12),8,9),$P(^(0),U,6)=+$E(ACHSEOBR("F",13),1,7)_"."_$E(ACHSEOBR("F",13),8,9)
 S (ACHSMSG,X)=$P(ACHSEOBR("F",14)," ")
 I X]"" S $P(^ACHSF(DA(2),"D",DA(1),11,Y,0),U,7)=X
 S X=$P(ACHSEOBR("F",15)," ")
 I X]"" S $P(^ACHSF(DA(2),"D",DA(1),11,Y,0),U,8)=X
 S X=$P(ACHSEOBR("F",16)," ")
 I X]"" S $P(^ACHSF(DA(2),"D",DA(1),11,Y,0),U,9)=X
 S $P(^ACHSF(DA(2),"D",DA(1),11,Y,0),U,10)=ACHSTDA
 G C1:ACHSMSG=""&(ACHSMRCA="")
G ;
 S ACHSDA=0
 F ACHSX=1:2 Q:'$D(^TMP("ACHSEOB",$J,"G",ACHSX))  D
 . I ACHSMSG=$E(^TMP("ACHSEOB",$J,"G",ACHSX),1,4) S ACHSDA=ACHSDA+1,^ACHSF(DA(2),"D",DA(1),11,Y,1,ACHSDA,0)=ACHSMSG_" -"_$E(^TMP("ACHSEOB",$J,"G",ACHSX),5,99)_$E(^TMP("ACHSEOB",$J,"G",ACHSX+1),5,99)
 .Q
 I ACHSMRCA]"" D
 . S ACHSDA=ACHSDA+1
 . S ^ACHSF(DA(2),"D",DA(1),11,Y,1,ACHSDA,0)=ACHSMRCA
 S ^ACHSF(DA(2),"D",DA(1),11,Y,1,0)=U_U_ACHSDA_U_ACHSDA_U_DT
 G C1
 ;
ICDLK ; ACHS*3.1*23;NO LONGER USED
 I $L(X)=3 S X=X_"."
 I $L($P(X,".",2))>2 S ACHSX=$E(X,1,6) G ERR
 S DIC="^ICD9(",DIC(0)="X",D="AB",X=X_"0"
 D IX^DIC
 Q:Y>0
 G ICDLK
 ;
ERR ;
 S ACHSERRE=16,ACHSEDAT=ACHSX
 D ^ACHSEOBG
 Q
 ;
SENDMSG(DIC,DA) ;
 K ^TMP("ACHSEOB4",$J)
 N ACHSCTR,ACHSFLD,X,XMSUB,XMDUZ,XMTEXT,XMY
 S (ACHSCTR,ACHSFLD)=0
 F ACHSCTR=1:1 S X=$P($T(TXT+ACHSCTR),";;",2) Q:X="###"  S ^TMP("ACHSEOB4",$J,ACHSCTR)=X
 S %=^DIC(DIC,0,"GL")_"0)",^TMP("ACHSEOB4",$J,ACHSCTR)="New entry # "_DA_" in the "_$P(@%,U)_" file is the following:"
 S ACHSCTR=ACHSCTR+1,^TMP("ACHSEOB4",$J,ACHSCTR)="  "
 F  S ACHSFLD=$O(^DD(DIC,ACHSFLD)) Q:'ACHSFLD  S ACHSCTR=ACHSCTR+1 S X=$J($P(^(ACHSFLD,0),U),20)_" = "_$$VAL^XBDIQ1(DIC,DA,ACHSFLD),^TMP("ACHSEOB4",$J,ACHSCTR)=X
 S XMB="ACHS EOBR PROCESSING"
 S XMDUZ="CHS EOBR Automatic Processing",XMSUB="Add of CPT/ADA/REV code."
 S XMTEXT="^TMP(""ACHSEOB4"",$J,"
 S XMY(1)=""
 D ^XMB,KILL^XM
 K ^TMP("ACHSEOB4",$J)
 Q
 ;
TXT ;
 ;;The following information has been added to the indicated file,
 ;;based on information received thru automatic EOBR processing of
 ;;a CHS EOBR file.  Please follow up on the entry to ensure more
 ;;complete and accurate data has been entered.  Thank you.
 ;;  
 ;;###
 ;