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

ABMRSTIN.m

Go to the documentation of this file.
  1. ABMRSTIN ; IHS/SD/SDR - Split Claim Billing;
  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")="ABMRSTIN" ;Routine used to get data
  1. S ABMMENU="Split Claim Billing Report"
  1. K ^TMP("ABM-SPIN",$J) ;this is from routine ABMRSPIN to gather data before splitting
  1. K ^TMP("ABM-SPIN-DATA",$J) ;detail from ABMRSPIN
  1. K ^TMP("ABM-SPIN-CNT",$J)
  1. K ^TMP("ABM-STIN",$J)
  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 menu option is going to take one claim and split it as many times as"
  1. W !,"necessary to get either 1) one claim with one claim editor page of line items"
  1. W !,"OR 2) one claim with 1 line item charge. The user will be prompted if they"
  1. W !,"want the system to automatically find the claims, or if they would rather do"
  1. W !,"it manually, one claim at a time. Either way, the user will get messages"
  1. W !,"to the screen telling them the new claim numbers that generated based on"
  1. W !,"their selection."
  1. W !!,"This option should be used VERY CAUTIOUSLY since it could generate a LOT of"
  1. W !,"claims based on how the prompts are answered."
  1. ;
  1. MANORAUT ;
  1. D ^XBFMK
  1. S DIR(0)="SO^A:Automatically find and split claims;M:Manually select claims one at a time to split"
  1. S DIR("A")="Select"
  1. D ^DIR
  1. Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. S ABMY("SPLIT")=Y
  1. I ABMY("SPLIT")="M" D MANUAL Q ;prompt user to split one claim one at a time
  1. I ABMY("SPLIT")="A" D AUTO Q ;split multiple claims/bills based on selection criteria
  1. Q
  1. MANUAL ;EP
  1. K ABMP
  1. MANUAL2 ;EP
  1. D ^ABMDEDIC ;prompt for bill/claim number
  1. Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. S ABMY("PGS")="^8Z^" ;make it capture everything
  1. S ABMVSTCK=0 ;flag for if visit contains H or I visit
  1. D DATA2^ABMRSPI1 ;get list of files
  1. W !!
  1. W !,"ST",?4,"SelectedClm#",?17,"HRN",?24,"Active Insurer",?40,"Visit Date",?51,"VTYP",?56,"Clinic",?65,"ServCat (VST)",!
  1. F I=1:1:80 W "-"
  1. S ABMCS=$P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,4)
  1. W !,$S(ABMCS="F":"FAB",ABMCS="E":"EDT",ABMCS="O":"ROL",ABMCS="C":"COM",ABMCS="P":"PEN",ABMCS="U":"UNB",ABMCS="X":"CLO",1:"")
  1. W ?4,ABMP("CDFN")
  1. W ?17,$P($G(^AUPNPAT($P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U),41,$P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,3),0)),U,2) ;HRN
  1. W ?24,$E($P($G(^AUTNINS($P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,8),0)),U),1,15) ;active insurer
  1. W ?40,$$SDTO^ABMDUTL($P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,2)) ;visit date
  1. W ?51,$P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,7) ;visit type
  1. W ?56,$E($P($G(^DIC(40.7,$P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,6),0)),U),1,8) ;clinic
  1. S ABMV=0
  1. F S ABMV=$O(^TMP("ABM-SPIN",$J,"VSTS",ABMV)) Q:'ABMV W ?65,$G(^TMP("ABM-SPIN",$J,"VSTS",ABMV))_" ("_ABMV_")",!
  1. D VSTDISP^ABMRSTI1 ;display visit info
  1. ;
  1. K ABMCK
  1. I $P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,22)'="" D SPLTCHK^ABMRSTI1 ;check if any portion of claim has already been split
  1. I $D(ABMCK) D CLMDISP^ABMRSTI1 ;if there are orig/split claims, display them
  1. ;
  1. I +$G(ABMVSTCK)=1 D G MANUAL2
  1. .W !!?5,"At least one visit on this claim has a Service Category of"
  1. .W !?5,"Hospitalization (H) or In Hospital (I) and is therefore unsplittable",!!
  1. .H 2
  1. ;
  1. ;ask if they wish to continue since claim has already been split at least once
  1. I $D(ABMCK) D G:Y<1 MANUAL
  1. .D ^XBFMK
  1. .S DIR(0)="Y",DIR("A")="This claim has already been split at least once. Do you wish to continue" D ^DIR K DIR
  1. K ABMY("PGS") ;reset because it was set to 8Z to pull everything for display first
  1. D PGS ;have user select pages; will be in ABMY("PGS") variable
  1. I +$D(ABMY("PGS"))=0 Q ;don't ask anything more if they didn't pick pages
  1. D SPLITHOW ;do they want one claim per charge or one claim per category picked?
  1. I +$G(ABMY("SPLITHOW"))=0 Q
  1. D ASKDEL ;ask if they want to delete sections after new claims are generated
  1. ;I +$G(ABMDLT)=0 Q
  1. Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. K ^TMP("ABM-STIN",$J,"NEWCLMLST")
  1. D INSSTMP^ABMRSTI4 ;abm*2.6*22 IHS/SD/SDR CR9700
  1. D SPLITCLM^ABMRSTI2 ;creates the new claims and deletes from original
  1. S ABMCDFN=ABMP("CDFN")
  1. W $$EN^ABMVDF("IOF"),!
  1. W "Split complete.",!
  1. D PRINT2^ABMRSTI3 ;print claim summary with split info
  1. D PAZ^ABMDRUTL
  1. D ^XBFMK
  1. K ^TMP("ABM-SPIN",$J) ;this is from routine ABMRSPIN to gather data before splitting
  1. K ^TMP("ABM-SPIN-DATA",$J) ;detail from ABMRSPIN
  1. K ^TMP("ABM-SPIN-CNT",$J)
  1. K ^TMP("ABM-STIN",$J)
  1. K ABMY,ABM
  1. G MANUAL2
  1. Q
  1. PGS ;
  1. S ABMSTRG=""
  1. S ABMPG=""
  1. S ABMPCNT=0
  1. S DIR(0)="SO^"
  1. F S ABMPG=$O(^TMP("ABM-SPIN",$J,"VLST",ABMP("CDFN"),ABMPG)) Q:$G(ABMPG)="" D
  1. .S DIR(0)=DIR(0)_ABMPG_":"_$S(ABMPG["D":"MEDICATIONS",ABMPG["E":"LABORATORY",ABMPG["F":"RADIOLOGY",1:"HCPCS")_";"
  1. .S ABMPCNT=+$G(ABMPCNT)+1 ;total pages to choose from
  1. S:$L(DIR(0),":")>2 DIR(0)=DIR(0)_"8Z:ALL"
  1. S DIR("A")="Move Which Section(s)? "
  1. S ABMTPCNT=0
  1. F D Q:(('Y)!(Y["8Z"))!(ABMTPCNT=ABMPCNT)
  1. .D ^DIR
  1. .Q:'Y
  1. .S ABMY("PGS")=$S($G(ABMY("PGS"))="":"^"_Y,1:ABMY("PGS")_"^"_Y)
  1. .S ABMTPCNT=+$G(ABMTPCNT)+1
  1. I $G(ABMY("PGS"))["8Z" D
  1. .K ABMY("PGS")
  1. .S ABMPG=""
  1. .F S ABMPG=$O(^TMP("ABM-SPIN",$J,"VLST",ABMP("CDFN"),ABMPG)) Q:$G(ABMPG)="" D
  1. ..S ABMY("PGS")=$G(ABMY("PGS"))_"^"_ABMPG
  1. S:$G(ABMY("PGS"))'="" ABMY("PGS")=ABMY("PGS")_"^"
  1. Q
  1. SPLITHOW ;EP
  1. D ^XBFMK
  1. S DIR(0)="SO^C:1 Claim for each CHARGE;P:1 Claim for each PAGE"
  1. S DIR("A")="Split it how? "
  1. D ^DIR
  1. I $G(Y)=""!$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT) Q ;exit option if they '^'
  1. S ABMY("SPLITHOW")=$S(Y="C":1,1:2)
  1. Q
  1. ASKDEL ;EP
  1. I ABMY("PGS")'["8Z" D Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. .S DIR(0)="Y",DIR("A")="Delete sections from original claim after split"
  1. .S DIR("B")="NO"
  1. .D ^DIR K DIR
  1. .Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. .S:Y=1 ABMDLT=1
  1. Q
  1. AUTO ;
  1. S ABMY("RTYP")=1
  1. D INS^ABMRSPIN ;select insurer(s)
  1. I '$D(ABMY("INS")) Q ;no insurer was selected
  1. Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. D DT^ABMRSPIN ;select visit or approval date range
  1. I '$D(ABMY("DT",1)) Q ;no dates were entered
  1. Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. D CLMSTAT^ABMRSPIN ;What claim status (Open, complete, or both)
  1. I '$D(ABMY("STA")) Q ;no claim status was selected
  1. Q:$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. D PGS^ABMRSPIN ;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(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. I ABMY("PGS")["8Z" S ABMY("PGS")="^8D^8E^8F^8H^"
  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(DUOUT)!$D(DTOUT)!$D(DIROUT)!$D(DIRUT)
  1. ;
  1. I Y S ABMANS="A" ;they user said they want to continue, act like 'A'
  1. I 'Y D
  1. .K DIR,DIC,DIE,X,Y,DA,DR
  1. .S DIR(0)="S^E:Exit Report;R:Reselect Parameters;A:Accept selection and continue"
  1. .D ^DIR
  1. S ABMANS=Y
  1. K DIR
  1. I ABMANS="E" Q ;exit report
  1. I ABMANS="R" G AUTO ;reselect criteria
  1. ;note - ABMANS="A" should just continue on through code
  1. ;
  1. W !!,"Now searching for claims that meet the selected criteria . . ."
  1. K ^TMP("ABM-SPIN",$J,"VLST") ;this will be a list of counters
  1. D COMPUTE^ABMRSPIN
  1. D SPLIT
  1. D ^XBFMK
  1. K ^TMP("ABM-SPIN",$J) ;this is from routine ABMRSPIN to gather data before splitting
  1. K ^TMP("ABM-SPIN-DATA",$J) ;detail from ABMRSPIN
  1. K ^TMP("ABM-SPIN-CNT",$J)
  1. K ^TMP("ABM-STIN",$J)
  1. K ABMY,ABM
  1. Q
  1. SPLIT ;EP
  1. W !!,"OK, "_+$G(^TMP("ABM-SPIN-CNT",$J))_" claims were found to split."
  1. W !!
  1. I +$G(^TMP("ABM-SPIN-CNT",$J))=0 W "Exiting option since no claims were found matching selected criteria." D PAZ^ABMDRUTL Q
  1. D ^XBFMK
  1. S DIR(0)="Y",DIR("A")="Do you wish to continue" D ^DIR K DIR
  1. Q:+Y<1
  1. Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. D SPLITHOW ;do they want one claim per charge or one claim per category picked?
  1. Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. D ASKDEL ;ask if they want to delete sections after new claims are generated
  1. Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
  1. D INSSTMP^ABMRSTI4 ;stamp insurer with run info ;abm*2.6*22 IHS/SD/SDR CR9700
  1. W !!,"Splitting claims..."
  1. ;loop thru claims and split them
  1. K ^TMP("ABM-STIN",$J,"NEWCLMLST")
  1. S ABMVLOC=""
  1. F S ABMVLOC=$O(^TMP("ABM-SPIN",$J,ABMVLOC)) Q:$G(ABMVLOC)="" D
  1. .S ABMVTYP=""
  1. .F S ABMVTYP=$O(^TMP("ABM-SPIN",$J,ABMVLOC,ABMVTYP)) Q:$G(ABMVTYP)="" D
  1. ..S ABMVDT=0
  1. ..F S ABMVDT=$O(^TMP("ABM-SPIN",$J,ABMVLOC,ABMVTYP,ABMVDT)) Q:'ABMVDT D
  1. ...S ABMP("CDFN")=0
  1. ...F S ABMP("CDFN")=$O(^TMP("ABM-SPIN",$J,ABMVLOC,ABMVTYP,ABMVDT,ABMP("CDFN"))) Q:'ABMP("CDFN") D
  1. ....K ABMP("VDETAIL")
  1. ....D SPLITCLM^ABMRSTI2
  1. D PRINT ;output report of original and split claims
  1. Q
  1. PRINT ;EP
  1. S DIR(0)="Y"
  1. S DIR("A","1")="Would you like a listing of the original claims and the new"
  1. S DIR("A")="associated claim numbers"
  1. D ^DIR K DIR
  1. Q:Y<1
  1. S %ZIS="QM"
  1. D ^%ZIS Q:POP
  1. I $D(IO("Q")) D Q
  1. .S ZTRTN="PRINT^ABMRSTI3",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. D PRINT^ABMRSTI3
  1. D PAZ^ABMDRUTL
  1. Q