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

ABMVRQUE.m

Go to the documentation of this file.
  1. ABMVRQUE ;IHS/SD/SDR - Routine to regenerate claims for Riverside ;
  1. ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
  1. ;
  1. ;Routine will loop through claims generated under Riverside
  1. ;putting the visits back into the ABILL cross reference and
  1. ;removing the .04 field (THIRD PARTY BILLED) from the visit
  1. ;file so they will regenerate.
  1. ;
  1. ;ASK for locations to get claims from; this will be used
  1. ;for the DUZ(2) of the 3P Claim global root
  1. SITE K ABML
  1. K ^TMP($J)
  1. K DIC,DIE,DA,DR,X,Y
  1. F D Q:$D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT)!($D(ABML)&(Y<0))
  1. .S DIC="^AUTTLOC("
  1. .S DIC(0)="AEMQZ"
  1. .I $D(ABML) S DIC("A")="Select another site: "
  1. .E S DIC("A")="Select site to requeue visits from: "
  1. .D ^DIC
  1. .Q:$D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT)
  1. .Q:Y<0
  1. .I +Y>0 S ABML(+Y)=""
  1. W !
  1. ;
  1. ;ASK for date range; just as a safety precaution; it could
  1. ;be that the site had claims generating at the satellite at
  1. ;one point but doesn't anymore
  1. FROMDT ;
  1. K DIR,DIC,DIE,DA,X,Y
  1. S DIR("A")="Enter Encounter FROM date"
  1. S DIR(0)="D"
  1. D ^DIR
  1. Q:'Y
  1. Q:$D(DIRUT)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
  1. S ABMFROM=+Y
  1. TODT ;
  1. K DIR,DIC,DIE,DA,X,Y
  1. S DIR("A")="Enter Encounter TO date"
  1. S DIR(0)="D"
  1. D ^DIR
  1. Q:'Y
  1. G:$D(DIRUT)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT) FROMDT
  1. S ABMTO=+Y
  1. I ABMTO<ABMFROM W !!,"TO DATE CAN'T BE AFTER FROM DATE",! G FROMDT
  1. W !
  1. ;
  1. DISP ; display selection made
  1. W !,"Ok, I will requeue visits for: "
  1. S ABMI=0
  1. F S ABMI=$O(ABML(ABMI)) Q:+ABMI=0 D
  1. .W !,?5,$P($G(^AUTTLOC(ABMI,0)),U,2)
  1. W !,"for date range ",$$SDT^ABMDUTL(ABMFROM)," thru ",$$SDT^ABMDUTL(ABMTO)
  1. ;
  1. PAUSE ;
  1. W !!,"I am now going to loop through and requeue the requested visits"
  1. W !,"and dump the visit info to the screen."
  1. W !!,"PLEASE turn on screen capture to record the visit info."
  1. K DIR,DIC,DIE,X,Y,DA
  1. W ! S DIR(0)="E",DIR("A")="Enter RETURN to Continue" D ^DIR K DIR
  1. ;
  1. LOOP ;loop thru claims and requeue
  1. W !,"VISIT IEN",?13,"HRN",?20,"S.CAT",?28,"ADMIT DT/TM",?45,"CLN",?65,"LOC",?74,"REVW'D"
  1. S ABMI=0
  1. K ABMALST
  1. F S ABMI=$O(ABML(ABMI)) Q:+ABMI=0 D
  1. .S ABMFDT=ABMFROM-.5
  1. .F S ABMFDT=$O(^ABMDCLM(ABMI,"AD",ABMFDT)) Q:+ABMFDT=0!(ABMFDT>ABMTO) D
  1. ..S ABMP("CDFN")=0
  1. ..F S ABMP("CDFN")=$O(^ABMDCLM(ABMI,"AD",ABMFDT,ABMP("CDFN"))) Q:+ABMP("CDFN")=0 D
  1. ...S ABMP("VDFN")=0
  1. ...F S ABMP("VDFN")=$O(^ABMDCLM(ABMI,ABMP("CDFN"),11,ABMP("VDFN"))) Q:+ABMP("VDFN")=0 D
  1. ....Q:$D(^TMP($J,ABMP("VDFN"))) ;visit already requeued
  1. ....;
  1. ....I $D(^ABMDCLM(DUZ(2),ABMP("CDFN"),65)) D
  1. .....S D1=0
  1. .....F S D1=$O(^ABMDCLM(DUZ(2),ABMP("CDFN"),65,D1)) Q:'D1 D
  1. ......I +^ABMDCLM(DUZ(2),ABMP("CDFN"),65,D1,0) S ABMALST(ABMP("CDFN"))=""
  1. .....K D1
  1. ....Q:$D(ABMALST(ABMP("CDFN"))) ;an active bill was found; don't cancel
  1. ....I '$D(ABMALST(ABMP("CDFN"))) D ENT
  1. ....;
  1. ....;remove THIRD PARTY BILLED from Visit
  1. ....K DIC,DIE,DA,DR,X,Y
  1. ....S DIE="^AUPNVSIT("
  1. ....S DA=ABMP("VDFN")
  1. ....S DR=".04////@"
  1. ....D ^DIE
  1. ....S ABMDTC=$P($G(^AUPNVSIT(ABMP("VDFN"),0)),U,2)
  1. ....S ^AUPNVSIT("ABILL",ABMDTC,ABMP("VDFN"))="" ;Set ABILL X-ref
  1. ....S ABMP("PDFN")=$P($G(^AUPNVSIT(ABMP("VDFN"),0)),U,5)
  1. ....S ABMSCAT=$P($G(^AUPNVSIT(ABMP("VDFN"),0)),U,7)
  1. ....S ABMADTTM=$P($G(^AUPNVSIT(ABMP("VDFN"),0)),U)
  1. ....S ABMPCLN=$P($G(^AUPNVSIT(ABMP("VDFN"),0)),U,8)
  1. ....S ABMCSTAT=$P($G(^AUPNVSIT(ABMP("VDFN"),11)),U,11)
  1. ....S ABMP("LDFN")=$P($G(^AUPNVSIT(ABMP("VDFN"),0)),U,6)
  1. ....W !,ABMP("VDFN"),?13,$$HRN^ABMUTL8(ABMP("PDFN")),?22,ABMSCAT
  1. ....W ?26,$$CDT^ABMDUTL(ABMADTTM)
  1. ....W:+ABMPCLN'=0 ?43,$E($P($G(^DIC(40.7,ABMPCLN,0)),U),1,17)
  1. ....W ?62,$E($P($G(^AUTTLOC(ABMP("LDFN"),0)),U,2),1,11)
  1. ....W ?77,ABMCSTAT
  1. ....S ^TMP($J,ABMP("VDFN"))=""
  1. Q:'$D(ABMALST) ;no active bills were found
  1. W !!,"ACTIVE BILLS WERE FOUND FOR THE FOLLOWING CLAIMS SO THEY WERE NOT REQUEUED"
  1. S ABMI=0
  1. F S ABMI=$O(ABMALST(ABMI)) Q:+ABMI=0 D
  1. .W !,ABMI
  1. XIT ;
  1. Q
  1. ;
  1. ENT ;EP - to Cancel a Claim
  1. W !
  1. S DIE="^ABMCCLMS(DUZ(2),"
  1. S DA=ABMP("CDFN")
  1. S DIE("NO^")="OUTOK"
  1. S DR=".04////X;.114////"_DUZ_";.115///NOW;.118////11" ;put OTHER for cancel reason
  1. D ^DIE
  1. I $P($G(^ABMCCLMS(DUZ(2),ABMP("CDFN"),1)),U,8)="" D Q ;cancellation reason
  1. .S DIK="^ABMCCLMS(DUZ(2),"
  1. .S DA=ABMP("CDFN")
  1. .D ^DIK
  1. M ^ABMCCLMS(DUZ(2),ABMP("CDFN"),0)=^ABMDCLM(DUZ(2),ABMP("CDFN"),0)
  1. M ^ABMCCLMS(DUZ(2),ABMP("CDFN"),11)=^ABMDCLM(DUZ(2),ABMP("CDFN"),11) ;PCC Visits
  1. M ^ABMCCLMS(DUZ(2),ABMP("CDFN"),41)=^ABMDCLM(DUZ(2),ABMP("CDFN"),41) ;Providers
  1. S DIK="^ABMCCLMS(DUZ(2),"
  1. S DA=ABMP("CDFN")
  1. D IX^DIK ;merged entries don't x-ref
  1. S DR=".04///1" D KCLM
  1. S ^ABMDTMP("KCLM",DT,ABMP("CDFN"))=DUZ
  1. K ^TMP($J)
  1. Q
  1. ;
  1. KCLM ;EP for Deleting Claim
  1. S DIK="^ABMDCLM(DUZ(2),"
  1. S DA=ABMP("CDFN")
  1. D ^ABMDEDIK
  1. Q