ABMMCDCU ; IHS/SD/SDR - Medicaid Eligible file cleanup for TPB ; 02/19/2015
;;99.1;IHS DICTIONARIES (PATIENT);**24**;MAR 9, 1999;Build 1
;
;For CR4215 - This routine is called by AUPNMCDF to clean up TPB claims and bills based
; on Medicaid Eligible records that are cleaned up in the AUPNMCDF routine. It will
; use one patient/Medicaid DFN and look for all claims associated with that entry, changing
; .07 MEDICAID MULTIPLE in the Insurer multiple.
;
;
Q
; *********************************************************************
EN(A,B,C,D) ;
; ABM("PDFN")=PATIENT
; ABM("MDFN")=Medicaid Eligible IEN
; ABMOLD - original value; what we are looking for
; ABMNEW - new value; what we are replacing old value with
;
S ABM("PDFN")=A
S ABM("MDFN")=B
S ABMOLD=C
S ABMNEW=D
;
S ABMHOLD=DUZ(2)
S DUZ(2)=0
;
F S DUZ(2)=$O(^ABMDCLM(DUZ(2))) Q:'DUZ(2) D
.S ABM("CDFN")=0
.F S ABM("CDFN")=$O(^ABMDCLM(DUZ(2),"B",ABM("PDFN"),ABM("CDFN"))) Q:'ABM("CDFN") D
..S ABM("MIEN")=0
..F S ABM("MIEN")=$O(^ABMDCLM(DUZ(2),ABM("CDFN"),13,ABM("MIEN"))) Q:'ABM("MIEN") D
...I $P($G(^ABMDCLM(DUZ(2),ABM("CDFN"),13,ABM("MIEN"),0)),U,6)'=ABM("MDFN") Q ;not the Medicaid entry we are looking for
...S ABM("OLD")=$P($G(^ABMDCLM(DUZ(2),ABM("CDFN"),13,ABM("MIEN"),0)),U,7)
...I ABM("OLD")'=ABMOLD Q ;not the Medicaid eligibility entry we are looking for
...S DA(1)=ABM("CDFN")
...S DA=ABM("MIEN")
...S DIE="^ABMDCLM(DUZ(2),"_DA(1)_",13,"
...S DR=".07////"_ABMNEW
...D ^DIE
...D LOG^AUPNMCDF(9002274.3,ABM("MIEN")_",13,"_ABM("CDFN")_","_DUZ(2),"9002274.3013"_","_".07",ABM("OLD"))
...D BILLS
S DUZ(2)=ABMHOLD
Q
BILLS ;EP
S ABM("BILL")=ABM("CDFN")_" " ;the space makes it act like a string
F S ABM("BILL")=$O(^ABMDBILL(DUZ(2),"B",ABM("BILL"))) Q:(ABM("BILL")'[ABM("CDFN")) D
.S ABM("BDFN")=0
.F S ABM("BDFN")=$O(^ABMDBILL(DUZ(2),"B",ABM("BILL"),ABM("BDFN"))) Q:'ABM("BDFN") D
..S ABM("BMIEN")=0
..F S ABM("BMIEN")=$O(^ABMDBILL(DUZ(2),ABM("BDFN"),13,ABM("BMIEN"))) Q:'ABM("BMIEN") D
...I $P($G(^ABMDBILL(DUZ(2),ABM("BDFN"),13,ABM("BMIEN"),0)),U,6)'=ABM("MDFN") Q ;not the Medicaid entry we are looking for
...S ABM("OLD")=$P($G(^ABMDBILL(DUZ(2),ABM("BDFN"),13,ABM("BMIEN"),0)),U,7)
...I ABM("OLD")'=ABMOLD Q ;not the Medicaid eligibility entry we are looking for
...S DA(1)=ABM("BDFN")
...S DA=ABM("BMIEN")
...S DIE="^ABMDBILL(DUZ(2),"_DA(1)_",13,"
...S DR=".07////"_ABMNEW
...D ^DIE
...D LOG^AUPNMCDF(9002274.4,ABM("MIEN")_",13,"_ABM("BDFN")_","_DUZ(2),"9002274.4013"_","_".07",ABM("OLD"))
Q
ABMMCDCU ; IHS/SD/SDR - Medicaid Eligible file cleanup for TPB ; 02/19/2015
+1 ;;99.1;IHS DICTIONARIES (PATIENT);**24**;MAR 9, 1999;Build 1
+2 ;
+3 ;For CR4215 - This routine is called by AUPNMCDF to clean up TPB claims and bills based
+4 ; on Medicaid Eligible records that are cleaned up in the AUPNMCDF routine. It will
+5 ; use one patient/Medicaid DFN and look for all claims associated with that entry, changing
+6 ; .07 MEDICAID MULTIPLE in the Insurer multiple.
+7 ;
+8 ;
+9 QUIT
+10 ; *********************************************************************
EN(A,B,C,D) ;
+1 ; ABM("PDFN")=PATIENT
+2 ; ABM("MDFN")=Medicaid Eligible IEN
+3 ; ABMOLD - original value; what we are looking for
+4 ; ABMNEW - new value; what we are replacing old value with
+5 ;
+6 SET ABM("PDFN")=A
+7 SET ABM("MDFN")=B
+8 SET ABMOLD=C
+9 SET ABMNEW=D
+10 ;
+11 SET ABMHOLD=DUZ(2)
+12 SET DUZ(2)=0
+13 ;
+14 FOR
SET DUZ(2)=$ORDER(^ABMDCLM(DUZ(2)))
IF 'DUZ(2)
QUIT
Begin DoDot:1
+15 SET ABM("CDFN")=0
+16 FOR
SET ABM("CDFN")=$ORDER(^ABMDCLM(DUZ(2),"B",ABM("PDFN"),ABM("CDFN")))
IF 'ABM("CDFN")
QUIT
Begin DoDot:2
+17 SET ABM("MIEN")=0
+18 FOR
SET ABM("MIEN")=$ORDER(^ABMDCLM(DUZ(2),ABM("CDFN"),13,ABM("MIEN")))
IF 'ABM("MIEN")
QUIT
Begin DoDot:3
+19 ;not the Medicaid entry we are looking for
IF $PIECE($GET(^ABMDCLM(DUZ(2),ABM("CDFN"),13,ABM("MIEN"),0)),U,6)'=ABM("MDFN")
QUIT
+20 SET ABM("OLD")=$PIECE($GET(^ABMDCLM(DUZ(2),ABM("CDFN"),13,ABM("MIEN"),0)),U,7)
+21 ;not the Medicaid eligibility entry we are looking for
IF ABM("OLD")'=ABMOLD
QUIT
+22 SET DA(1)=ABM("CDFN")
+23 SET DA=ABM("MIEN")
+24 SET DIE="^ABMDCLM(DUZ(2),"_DA(1)_",13,"
+25 SET DR=".07////"_ABMNEW
+26 DO ^DIE
+27 DO LOG^AUPNMCDF(9002274.3,ABM("MIEN")_",13,"_ABM("CDFN")_","_DUZ(2),"9002274.3013"_","_".07",ABM("OLD"))
+28 DO BILLS
End DoDot:3
End DoDot:2
End DoDot:1
+29 SET DUZ(2)=ABMHOLD
+30 QUIT
BILLS ;EP
+1 ;the space makes it act like a string
SET ABM("BILL")=ABM("CDFN")_" "
+2 FOR
SET ABM("BILL")=$ORDER(^ABMDBILL(DUZ(2),"B",ABM("BILL")))
IF (ABM("BILL")'[ABM("CDFN"))
QUIT
Begin DoDot:1
+3 SET ABM("BDFN")=0
+4 FOR
SET ABM("BDFN")=$ORDER(^ABMDBILL(DUZ(2),"B",ABM("BILL"),ABM("BDFN")))
IF 'ABM("BDFN")
QUIT
Begin DoDot:2
+5 SET ABM("BMIEN")=0
+6 FOR
SET ABM("BMIEN")=$ORDER(^ABMDBILL(DUZ(2),ABM("BDFN"),13,ABM("BMIEN")))
IF 'ABM("BMIEN")
QUIT
Begin DoDot:3
+7 ;not the Medicaid entry we are looking for
IF $PIECE($GET(^ABMDBILL(DUZ(2),ABM("BDFN"),13,ABM("BMIEN"),0)),U,6)'=ABM("MDFN")
QUIT
+8 SET ABM("OLD")=$PIECE($GET(^ABMDBILL(DUZ(2),ABM("BDFN"),13,ABM("BMIEN"),0)),U,7)
+9 ;not the Medicaid eligibility entry we are looking for
IF ABM("OLD")'=ABMOLD
QUIT
+10 SET DA(1)=ABM("BDFN")
+11 SET DA=ABM("BMIEN")
+12 SET DIE="^ABMDBILL(DUZ(2),"_DA(1)_",13,"
+13 SET DR=".07////"_ABMNEW
+14 DO ^DIE
+15 DO LOG^AUPNMCDF(9002274.4,ABM("MIEN")_",13,"_ABM("BDFN")_","_DUZ(2),"9002274.4013"_","_".07",ABM("OLD"))
End DoDot:3
End DoDot:2
End DoDot:1
+16 QUIT