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

ABMRSPIN.m

Go to the documentation of this file.
  1. ABMRSPIN ; IHS/SD/SDR - Claims Identified as Potential Split Billing Report;
  1. ;;2.6;IHS 3P BILLING SYSTEM;**22**;NOV 12, 2009;Build 418
  1. ;IHS/SD/SDR 2.6*22 HEAT335246 - New routine
  1. ;
  1. Q
  1. START ;
  1. S ABMP("RTN")="ABMRSPIN" ;Routine used to get data
  1. S ABMMENU="Claims ID'd as Potential Split Billing Report"
  1. K ^TMP("ABM-SPIN",$J),^TMP("ABM-SPIN-DATA",$J),^TMP("ABM-SPIN-CNT",$J)
  1. SEL ;
  1. K ABMY,ABM
  1. K DTOUT,DIRUT,DUOUT,DIROUT
  1. I $D(ABMY("RTYP")) S ABM("HD",0)=ABMY("RTYP","NM")_" "_ABMMENU
  1. E S ABM("HD",0)=ABMMENU
  1. W !!,"This report will look through claims/bills based on the selection criteria"
  1. W !,"chosen and report any claims that match. This report is meant as a tool for the"
  1. W !,"user to identify potential bills that can be split for further billing due to"
  1. W !,"multiple entries in V-files."
  1. W !!,"NOTE: all prompts are required"
  1. W !
  1. D INS ;select insurer(s)
  1. I '$D(ABMY("INS")) Q ;no insurer was selected
  1. Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
  1. D DT ;select visit or approval date range
  1. I '$D(ABMY("DT",1)) Q ;no dates were entered
  1. D CLMSTAT ;What claim status (Open, complete, or both)
  1. I '$D(ABMY("STA")) Q ;no claim status was selected
  1. Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
  1. D PGS ;what pages do you want to split (8D, 8E, 8F, 8H, 8Z)
  1. I '$D(ABMY("PGS")) Q ;no pages were selected
  1. Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
  1. D RTYP ;brief or statistical
  1. I '$D(ABMY("RTYP")) Q ;no format was selected
  1. ;
  1. W !!,"You selected: "
  1. W !?3,"Insurers: "
  1. S ABMI=0
  1. F S ABMI=$O(ABMY("INS",ABMI)) Q:'ABMI W !?6,$P($G(^AUTNINS(ABMI,0)),U)
  1. W !?3,$S(ABMY("DT")="V":"Visit",1:"Approval")_" Dates: ",$$SDT^ABMDUTL(ABMY("DT",1))_" to "_$$SDT^ABMDUTL(ABMY("DT",2))
  1. W !?3,"Claim Status: "
  1. F ABMI=1:1:$L(ABMY("STA","NM"),",") W !?6,$$TRIM^ABMUTLP($P(ABMY("STA","NM"),",",ABMI),"L")
  1. W !?3,"Check pages: "_$E($TR(ABMY("PGS"),"^",","),2,($L(ABMY("PGS"))-1))
  1. W !?3,"Report Type: "_$S(ABMY("RTYP")=2:"Statistical Summary Only",1:"Brief Listing"),!!
  1. S DIR(0)="Y",DIR("A")="Do you wish to continue" D ^DIR K DIR
  1. Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
  1. I 'Y G SEL ;start over if they say NO
  1. ;
  1. S %ZIS="QM"
  1. D ^%ZIS Q:POP
  1. I $D(IO("Q")) D Q
  1. .S ZTRTN="PRINT^ABMRSPIN",ZTDESC=XQY0
  1. .S ZTSAVE("ABM*")=""
  1. .D ^%ZTLOAD
  1. .I $D(ZTSK)[0 W !!?5,"Report Cancelled!"
  1. .E W !!?5,"Report queued to run on ",ZTSK," #"
  1. .D HOME^%ZIS
  1. .K IO("Q")
  1. U IO
  1. D COMPUTE
  1. D PRINT
  1. D ^%ZISC
  1. D HOME^%ZIS
  1. Q
  1. PRINT ;
  1. S ABM("HD",1)="with "_$S(ABMY("DT")="V":"Visit",1:"Approval")_" Dates from "_$$SDT^ABMDUTL(ABMY("DT",1))_" to "_$$SDT^ABMDUTL(ABMY("DT",2))
  1. S ABM("HD",1)=ABM("HD",1)_" AND for page"_$S(($L(ABMY("PGS"),"^")>3):"s",1:"")_" "_$E($TR($G(ABMY("PGS")),"^",","),2,$L(ABMY("PGS"))-1)
  1. S ABM("HD",2)="for insurer"_$S((+$G(ABMY("INS"))>1):"s",1:"")_" "
  1. S ABMI=0
  1. S ABMJ=0
  1. F S ABMI=$O(ABMY("INS",ABMI)) Q:'ABMI S ABM("HD",2)=ABM("HD",2)_$S(ABMJ=1:", ",1:"")_$P($G(^AUTNINS(ABMI,0)),U) S ABMJ=1
  1. S ABM("PG")=0
  1. ;
  1. I ABMY("RTYP")'=1 D SUMMARY Q ;summary, not detail
  1. D HDB
  1. S ABMP("VLOC")=""
  1. S (ABM("CNT"),ABM("SUBCNT"))=0,(ABM("L"),ABM("V"))=""
  1. F S ABMP("VLOC")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"))) Q:($G(ABMP("VLOC"))="") D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
  1. .Q:ABMP("VLOC")="VLST" ;other data in same array; don't print it
  1. .Q:ABMP("VLOC")="VSTS" ;other data in array
  1. .D LOC
  1. .I $Y>(IOSL-5) D HD Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT) D LOC W " (cont)"
  1. .S ABMP("VTYP")=""
  1. .F S ABMP("VTYP")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP"))) Q:($G(ABMP("VTYP"))="") D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
  1. ..D VTYP
  1. ..I $Y>(IOSL-5) D HD Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT) D VTYP W " (cont)"
  1. ..S ABMP("SDT")=0
  1. ..F S ABMP("SDT")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP"),ABMP("SDT"))) Q:'ABMP("SDT") D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
  1. ...S ABMP("CDFN")=0
  1. ...F S ABMP("CDFN")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP"),ABMP("SDT"),ABMP("CDFN"))) Q:'ABMP("CDFN") D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
  1. ....S ABMPREC=$G(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP"),ABMP("SDT"),ABMP("CDFN")))
  1. ....W !,$P(ABMPREC,U) ;claim/bill status
  1. ....S ABMSSTAT=$P(ABMPREC,U,2)
  1. ....W ?4,$S(ABMSSTAT="O":"Orig",ABMSSTAT="S":"Splt",ABMSSTAT="A":"Auto",1:"N/A")
  1. ....W ?9,$E($P(ABMPREC,U,3),1,10) ;patient name
  1. ....W ?21,$P(ABMPREC,U,4) ;HRN
  1. ....W ?28,$E($P(ABMPREC,U,5),1,12) ;active insurer
  1. ....W ?41,$P(ABMPREC,U,6)
  1. ....W ?53,$$SDTO^ABMDUTL(ABMP("SDT")) ;visit date
  1. ....W ?63,$P(ABMPREC,U,8) ;8D
  1. ....W ?67,$P(ABMPREC,U,9) ;8E
  1. ....W ?71,$P(ABMPREC,U,10) ;8F
  1. ....W ?75,$P(ABMPREC,U,11) ;8H
  1. ....S ABM("SUBCNT")=+$G(ABM("SUBCNT"))+1
  1. ....S ABM("CNT")=+$G(ABM("CNT"))+1
  1. ....I $Y>(IOSL-5) D HD Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT) D LOC,VTYP W " (cont)"
  1. ..D SUB
  1. W !?44,"======"
  1. W !?35,"Total:",?45,$FN(ABM("CNT"),",",0)
  1. D ^%ZISC
  1. D PAZ^ABMDRUTL
  1. Q
  1. SUMMARY ;
  1. D HDB
  1. S ABMP("VLOC")=""
  1. S (ABM("CNT"),ABM("SUBCNT"))=0,(ABM("L"),ABM("V"))=""
  1. F S ABMP("VLOC")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"))) Q:($G(ABMP("VLOC"))="") D
  1. .Q:ABMP("VLOC")="VLST" ;other data in same array; don't print it
  1. .Q:ABMP("VLOC")="VSTS" ;other data in array
  1. .W !?4,ABMP("VLOC")
  1. .I $Y>(IOSL-5) D HD Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT) D LOC W " (cont)"
  1. .S ABMP("VTYP")=""
  1. .F S ABMP("VTYP")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP"))) Q:($G(ABMP("VTYP"))="") D
  1. ..W !?40,ABMP("VTYP")
  1. ..W ?65,$G(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP")))
  1. ..S ABM("CNT")=+$G(ABM("CNT"))+$G(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP")))
  1. W !?65,"======"
  1. W !?58,"Total:",?65,$FN(ABM("CNT"),",",0)
  1. D ^%ZISC
  1. Q
  1. HD ;
  1. D PAZ^ABMDRUTL Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
  1. HDB ;
  1. S ABM("PG")=ABM("PG")+1 D WHD^ABMDRHD
  1. I ABMY("RTYP")=1 W !?63," - - PAGE - - ",!,"ST",?4,"O/S",?9,"Patient",?21,"HRN",?28,"Active Insurer",?41,"Claim#",?53,"Visit Dt",?63,"D",?67,"E",?71,"F",?75,"H",!
  1. E W !,"Location",?40,"Visit Type",?65,"# Claims",!
  1. F I=1:1:80 W "-"
  1. Q
  1. LOC ;
  1. W !?3,"Visit Location: ",ABMP("VLOC")
  1. Q
  1. VTYP ;
  1. W !?5,"Visit Type: ",ABMP("VTYP")
  1. Q
  1. SUB ;
  1. Q:'ABM("SUBCNT")
  1. W !?46,"------"
  1. W !?37,"Subtotal:",?50,$FN(ABM("SUBCNT"),",",0)
  1. S ABM("SUBCNT")=0
  1. Q
  1. COMPUTE ;
  1. ;search by visit date range
  1. K ^TMP("ABM-SPIN-DATA",$J)
  1. K ^TMP("ABM-SPIN",$J,"VLST") ;this will be a list of counters
  1. I ABMY("DT")="V" D VISIT^ABMRSPI1 Q
  1. ;search by approval date range
  1. I ABMY("DT")="A" D APPROVAL^ABMRSPI1
  1. Q
  1. INS ;EP
  1. K ABMY("INS")
  1. W !!,"Insurers selected here MUST be the active insurer in order for claims/bills"
  1. W !,"to display on the report!",!
  1. F D Q:(+Y<0&(X=""))!$D(DUOUT)!$D(DTOUT)!$D(DIROUT)!$D(DIRUT)
  1. .D ^XBFMK
  1. .S DIC="^AUTNINS("
  1. .S DIC(0)="QEAMZ"
  1. .D ^DIC
  1. .Q:$D(DUOUT)!$D(DTOUT)!$D(DIROUT)!$D(DIRUT)
  1. .Q:+Y<0
  1. .;check if the insurer they selected is merged
  1. .I $$GET1^DIQ(9999999.18,+Y,".27","E")'="" D Q:(+Y<1)!$D(DUOUT)!$D(DTOUT)!$D(DIROUT)!$D(DIRUT)
  1. ..W !!!,"The insurer you selected has been merged into insurer "_$$GET1^DIQ(9999999.18,+Y,".27","E")
  1. ..S ABMITMP=+Y
  1. ..D ^XBFMK
  1. ..S DIR(0)="Y",DIR("A")="Do you wish to continue" D ^DIR K DIR
  1. ..Q:+Y<1
  1. ..S Y=ABMITMP
  1. .S ABMY("INS",+Y)=""
  1. .S ABMY("INS")=+$G(ABMY("INS"))+1
  1. Q
  1. DT ;EP
  1. D ^XBFMK
  1. K ABMY("DT")
  1. I $G(ABM("DT"))="C" S Y=4 G DTYP
  1. I $D(ABM("STA")),($G(ABM("STA"))'="M") S Y=2 G DTYP
  1. S DIR(0)="S^1:Approval Date;2:Visit Date"
  1. G DDIR:$G(ABMP("TYP"))=2
  1. I $G(ABM("STA"))="M" G DTYP2
  1. ;
  1. DDIR ;
  1. S DIR("A")="Select TYPE of DATE Desired"
  1. D ^DIR
  1. Q:$D(DIROUT)!$D(DIRUT)
  1. I Y=3 S Y=$S(DIR(0)["Pay":5,1:3)
  1. ;
  1. DTYP ;
  1. Q:$D(DIRUT)
  1. S ABMY("DT")=$S(Y=1:"A",1:"V")
  1. S Y=$S(Y=1:"APPROVAL",1:"VISIT")_" DATE"
  1. W !!," ============ Entry of ",Y," Range =============",!
  1. S DIR("A")="Enter STARTING "_Y
  1. S DIR(0)="DO^::EP"
  1. D ^DIR
  1. G DT:$D(DIRUT)
  1. S ABMY("DT",1)=Y
  1. W !
  1. S DIR("A")="Enter ENDING DATE"
  1. D ^DIR
  1. K DIR
  1. G DT:$D(DIRUT)
  1. S ABMY("DT",2)=Y
  1. I ABMY("DT",1)>ABMY("DT",2) W !!,*7,"INPUT ERROR: Start Date is Greater than than the End Date, TRY AGAIN!",!! G DT
  1. Q
  1. CLMSTAT ;
  1. D ^XBFMK
  1. I ABMY("DT")="V" D
  1. .S DIR(0)="SO^F:Flagged as Billable;E:In Edit Mode;O:ROLLED-In Edit Mode;P:Pending;C:Completed;U:Uneditable (Billed);X:Closed"
  1. .S DIR("A")="Select TYPE of CLAIM STATUS to Display"
  1. I ABMY("DT")="A" D
  1. .S DIR(0)="SO^A:Approved;B:Billed;C:Completed;X:Cancelled"
  1. .S DIR("A")="Select TYPE of BILL STATUS to Display"
  1. F D Q:$D(DIRUT)!$D(DIROUT)
  1. .D ^DIR
  1. .Q:$D(DIRUT)!$D(DIROUT)
  1. .Q:$G(ABMY("STA"))[Y ;they already selected this status; don't save it again
  1. .S ABMY("STA")=$G(ABMY("STA"))_"^"_Y
  1. .S ABMY("STA","NM")=$G(ABMY("STA","NM"))_$S($G(ABMY("STA","NM"))'="":", ",1:"")_Y(0)
  1. K DIR
  1. Q
  1. PGS ;
  1. S ABMSTRG=""
  1. S DIR(0)="SO^8D:MEDICATIONS;8E:LABORATORY;8F:RADIOLOGY;8H:HCPCS;8Z:ALL"
  1. S DIR("A")="Move Which Section(s)? "
  1. F D Q:(('Y)!(Y["8Z"))
  1. .D ^DIR
  1. .Q:'Y
  1. .Q:$G(ABMY("PGS"))[Y ;quit if they already selected this page
  1. .S ABMY("PGS")=$S($G(ABMY("PGS"))="":"^"_Y,1:ABMY("PGS")_"^"_Y)
  1. S:$G(ABMY("PGS"))'="" ABMY("PGS")=ABMY("PGS")_"^"
  1. Q
  1. RTYP ;EP
  1. K DIR
  1. S DIR(0)="SO^1:BRIEF LISTING (80 Width);2:STATISTICAL SUMMARY ONLY"
  1. S DIR("A")="Select TYPE of LISTING to Display"
  1. S DIR("B")=1
  1. D ^DIR
  1. K DIR
  1. Q:$D(DIRUT)
  1. S ABMY("RTYP")=Y
  1. S ABM("RTYP","NM")=Y(0)
  1. Q