AZAXBILL ;IHS/PHXAO/AEF - FIND 3P BILLS AND CHANGE FROM HCFA-1500 TO UB-92
;;1.0;ANNE'S SPECIAL ROUTINES;;MAR 2, 2004
;
DESC ;ROUTINE DESCRIPTION
;;
;;This routine finds all bills that have been transmitted during the
;;1/1/04 to 3/31/04 date range which meet the following criteria and
;;changes the CPT code from 00099 to 99211 and the mode of export from
;;HCFA-1500-E to UB-92-E V4.
;;
;;Export Date = between 1/4/04-3/31/04
;;Mode of Export = HCFA-1500-E
;;Insurer = Arizona Medicaid
;;Bill Type = 131
;;Bill Status = Billed
;;
;;$$END
;;
EN ;EP -- MAIN ENTRY POINT
; LOOPS THROUGH THE 3P TX STATUS FILE TO FIND THE EXPORTS
; DURING THE TIME FRAME AND THEN FINDS ALL THE BILLS UNDER
; THAT EXPORT
;
N BCNT,DATE,DIR,EXPIEN,FAC,NOW,TCNT,X,Y
;
D TXT
;
S DIR(0)="E"
D ^DIR
Q:'Y
;
S NOW=$$NOW
D ADDREC(NOW)
;
S TCNT=0
S BCNT=0
S FAC=0
F S FAC=$O(^ABMDTXST(FAC)) Q:'FAC D
. S DATE=3031231.9999
. F S DATE=$O(^ABMDTXST(FAC,"B",DATE)) Q:'DATE Q:DATE>3040331 D
. . S EXPIEN=0
. . F S EXPIEN=$O(^ABMDTXST(FAC,"B",DATE,EXPIEN)) Q:'EXPIEN D
. . . D 1BAT(FAC,EXPIEN,.BCNT)
. . . S TCNT=TCNT+BCNT
;
W !!?5,"TOTAL BILLS PROCESSED: "_TCNT
;
Q
1BAT(FAC,EXPIEN,BCNT) ;
;----- PROCESS ONE BATCH
;
N BILLIEN,DATA
;
Q:'FAC
Q:'EXPIEN
S DATA=$G(^ABMDTXST(FAC,EXPIEN,0))
Q:$$MODE($P(DATA,U,2))'="HCFA-1500-E"
Q:$$INSURER($P(DATA,U,4))'="ARIZONA MEDICAID"
;
W !!?5,"PROCESSING BATCH #"_FAC_"-"_EXPIEN_" "_$$DATE($P(DATA,U))
;
S BCNT=0
S BILLIEN=0
F S BILLIEN=$O(^ABMDTXST(FAC,EXPIEN,2,BILLIEN)) Q:'BILLIEN D
. D 1BILL(FAC,BILLIEN,.BCNT)
W !?5,"NUMBER OF BILLS PROCESSED: "_BCNT
Q
1BILL(FAC,BILLIEN,BCNT) ;
;----- PROCESS ONE BILL
; EDITS THE EXPORT MODE AND CPT CODES FOR ONE BILL
;
N CODE,CODEIEN,DA,DATA,DIE,DR,MODE,X,Y
;
Q:'FAC
Q:'BILLIEN
Q:'$D(^ABMDBILL(FAC,BILLIEN,0))
S DATA=$G(^ABMDBILL(FAC,BILLIEN,0))
Q:$P(DATA,U,2)'=131 ;BILL TYPE MUST BE 131
Q:$P(DATA,U,4)'="B" ;BILL STATUS MUST BE "BILLED"
Q:$$MODE($P(DATA,U,6))'="HCFA-1500-E"
Q:$$INSURER($P(DATA,U,8))'="ARIZONA MEDICAID"
;
S BCNT=$G(BCNT)+1
;
;----- CHANGE THE EXPORT MODE
;
S MODE="UB-92-E V4"
S DA=BILLIEN
S DIE="^ABMDBILL("_FAC_","
S DR=".06///^S X=MODE"
;D ^DIE ;*** TESTING - AEF *** COMMENT OUT FOR TESTING
;
;----- NOW FIND ALL THE 00099 CPT CODES UNDER THE Medical Procedures
; MULTIPLE AND CHANGE THEM TO 99211
;
S CODEIEN=0
F S CODEIEN=$O(^ABMDBILL(FAC,BILLIEN,27,CODEIEN)) Q:'CODEIEN D
. S CODE=$P($G(^ABMDBILL(FAC,BILLIEN,27,CODEIEN,0)),U)
. Q:+CODE'=99
. S DA(1)=BILLIEN
. S DA=CODEIEN
. S DIE="^ABMDBILL("_FAC_","_DA(1)_",27,"
. S DR=".01///^S X=99211"
. ;D ^DIE ;*** TESTING - AEF *** COMMENT OUT FOR TESTING
;
;----- NOW ADD THE BILL TO THE AZAX BILL FILE
;
D ADDBIL(NOW,FAC,BIL)
;
Q
ADDREC(X) ;
;----- ADD RECORD TO THE AZAX BILL FILE
;
; X = NOW
;
N DD,DIC,DO,Y
;
S DINUM=X
S DIC="^AZAXBILL("
S DIC(0)=""
D FILE^DICN
Q
ADDBIL(NOW,FAC,BIL) ;
;----- ADD BILL TO THE AZAX BILL FILE
;
N DA,DD,DIC,DO,Y
;
S X=FAC_"-"_BIL
S DA(1)=NOW
S DIC="^AZAXBILL("_DA(1)_","
S DIC(0)=""
S DIC("P")=$P(^DD(1991226,1,0),U,2)
D FILE^DICN
Q
TXT ;----- PRINT OPTION TEXT
;
N I,X
F I=1:1 S X=$P($T(DESC+I),";",3) Q:X["$$END" W !,X
Q
MODE(X)
;----- RESOLVE EXPORT MODE POINTER
;
N Y
S Y=""
I X S Y=$P($G(^ABMDEXP(X,0)),U)
Q Y
INSURER(X)
;----- RESOLVE INSURER POINTER
;
N Y
S Y=""
I X S Y=$P($G(^AUTNINS(X,0)),U)
Q Y
DATE(X) ;
;----- DATE CONVERSION TO EXTERNAL DATE
;
; X = DATE IN INTERNAL FM FORMAT
;
N Y
S Y=""
I X D
. S Y=X
. D DD^%DT
Q Y
NOW() ;
;----- RETURNS CURRENT DATE/TIME
;
N %,%H,%I,X
D NOW^%DTC
Q %