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

AZAXBILL.m

Go to the documentation of this file.
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 Arizona Medicaid bills that have been 
 ;;transmitted during the 1/1/04 to 3/31/04 date range and changes 
 ;;the CPT code from 00099 to 99211, the Mode of Export from 
 ;;HCFA-1500-E to UB-92-E V4 and the Bill Type to 131.
 ;;
 ;;$$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 ^XBKVAR
 D HOME^%ZIS
 ;
 D TXT
 ;
 S DIR(0)="E"
 D ^DIR
 Q:'Y
 ;
 S NOW=$$NOW
 ;D ADDREC(NOW)
 ;
 S TCNT=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
 . . . S BCNT=0
 . . . D 1BAT(FAC,EXPIEN,.BCNT,NOW)
 . . . S TCNT=TCNT+BCNT
 ;
 W !!?5,"TOTAL BILLS PROCESSED:  "_TCNT
 ;
 Q
1BAT(FAC,EXPIEN,BCNT,NOW) ;
 ;----- PROCESS ONE BATCH
 ;
 N BILLIEN,DATA
 ;
 Q:'FAC
 Q:'EXPIEN
 Q:'NOW
 ;
 ;I '$D(^AZAXBILL("B",NOW)) D ADDREC(NOW)
 ;
 S DATA=$G(^ABMDTXST(FAC,EXPIEN,0))
 Q:$$MODE($P(DATA,U,2))[837   ;DO ALL BATCHES EXCEPT FOR 837 BATCHES
 Q:$$INSURER($P(DATA,U,4))'="ARIZONA MEDICAID"
 ;
 W !!?5,"PROCESSING BATCH #"_FAC_"-"_EXPIEN_"  "_$$DATE($P(DATA,U)) 
 ;
 D CHMOD(FAC,EXPIEN)
 ;
 S BILLIEN=0
 F  S BILLIEN=$O(^ABMDTXST(FAC,EXPIEN,2,BILLIEN)) Q:'BILLIEN  D
 . D 1BILL(FAC,BILLIEN,.BCNT,NOW)
 W !?5,"NUMBER OF BILLS PROCESSED: "_BCNT
 Q
1BILL(FAC,BILLIEN,BCNT,NOW) ;
 ;----- 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:'NOW
 ;
 ;I '$D(^AZAXBILL("B",NOW)) D ADDREC(NOW)
 ;
 Q:'$D(^ABMDBILL(FAC,BILLIEN,0))
 S DATA=$G(^ABMDBILL(FAC,BILLIEN,0))
 ;Q:$P(DATA,U,2)'=131   ;BILL TYPE MUST BE 131 ; DO ALL BILLS
 ;Q:$P(DATA,U,4)'="B"   ;BILL STATUS MUST BE "BILLED"
 Q:$$MODE($P(DATA,U,6))[837   ;DO ALL BILLS EXCEPT 837s
 Q:$$INSURER($P(DATA,U,8))'="ARIZONA MEDICAID"
 ;
 D EXP(FAC,BILLIEN)
 D CPT(FAC,BILLIEN)
 ;D ADDBIL(NOW,FAC,BILLIEN)
 ;
 S BCNT=$G(BCNT)+1
 Q
CHMOD(FAC,EXPIEN) ;
 ;----- CHANGE EXPORT MODE IN BATCH
 ;
 N DA,DIE,DR,MODE,X,Y
 ;
 S MODE="UB-92-E V4"
 S DA=EXPIEN
 S DIE="^ABMDTXST("_FAC_","
 S DR=".02///^S X=MODE"
 D ^DIE
 Q
EXP(FAC,BILLIEN) ;
 ;----- CHANGE EXPORT MODE AND BILL TYPE IN BILL
 ;
 N DA,DIE,DR,MODE,TYPE,X,Y
 ;
 S TYPE=131
 S MODE="UB-92-E V4"
 S DA=BILLIEN
 S DIE="^ABMDBILL("_FAC_","
 S DR=".02///^S X=TYPE;.06///^S X=MODE"
 D ^DIE   ;*** TESTING - AEF *** COMMENT OUT FOR TESTING
 Q
CPT(FAC,BILLIEN) ;
 ;----- NOW FIND ALL THE 00099 CPT CODES UNDER THE Medical Procedures
 ;      MULTIPLE AND CHANGE THEM TO 99211 AND STUFF REVENUE CODE 510
 ;
 N DA,DIE,DR,CODE,CODEIEN,REVCOD,X,Y
 ;
 S REVCODE=510
 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;.02///^S X=REVCOD"
 . D ^DIE   ;*** TESTING - AEF *** COMMENT OUT FOR TESTING
 Q
ADDREC(X) ;
 ;----- ADD RECORD TO THE AZAX BILL FILE
 ;
 ;      X  =  NOW
 ; 
 Q     
 N DA,DD,DIC,DINUM,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
 ;
 Q
 N DA,DD,DIADD,DIC,DO,X,Y
 ;
 S X=FAC_"-"_BIL
 S DA(1)=NOW
 S DIC="^AZAXBILL("_DA(1)_",1,"
 S DIC(0)=""
 S DIC("P")=$P(^DD(1991226,1,0),U,2)
 S DIADD=1
 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 %