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

IB20P669.m

Go to the documentation of this file.
  1. IB20P669 ;/Albany - IB*2.0*669 POST INSTALL;03/10/20 2:10pm
  1. ;;2.0;Integrated Billing;**669**;Mar 20, 1995;Build 20
  1. ;Per VA Directive 6402, this routine should not be modified.
  1. Q
  1. ;
  1. POSTINIT ;Post Install for IB*2.0*669
  1. D BMES^XPDUTL(" >> Starting the Post-Initialization routine for IB*2.0*669")
  1. ; Adding AR CATEGORIES and REVENUE SOURCE CODES
  1. D QUEUEINT
  1. ;D INITUCDB ; Load initial data into Visit tracking DB
  1. D NEWCREAS
  1. D CANCLUC
  1. D BMES^XPDUTL(" >> End of the Post-Initialization routine for IB*2.0*669")
  1. Q
  1. ;
  1. QUEUEINT ; Run the UC Visit DB initialization in the background.
  1. ;
  1. N ZTRTN,ZTDTH,ZTDESC,ZTIO,ZTSK
  1. ;
  1. ; Set up the other TaskManager variables
  1. S ZTRTN="INITUCDB^IB20P669"
  1. S ZTDTH=$$NOW^XLFDT
  1. S ZTDESC="IB*2.0*669 Initialize/Update File 351.82 - Urgent Care Visit Tracking DB"
  1. S ZTIO=""
  1. D ^%ZTLOAD ; Call TaskManager
  1. D BMES^XPDUTL(" >> Task "_ZTSK_" started to update the Urgent Care Visit Tracking DB")
  1. Q
  1. ;
  1. INITUCDB ; Loop through the Copay file (350) to find any Urgent Care visits and update the UC database
  1. ;
  1. N LOOP,FDA,FDAIEN,IBUCIEN1,IBUCIEN3,IBUCIEN4,IBQUIT,IBN,IBDATA,IBDFN,IBVST
  1. N IBERR1,IBERR2,IBERR3,IBERR4,IBERR5,IBERR6
  1. N IBVSTIEN,IBSTAT,IBBILL,IBBLST,IBREAS,IBLSDTA,IBSITE,IBCREAS
  1. N X,Y,DIE,DA,DR,DLAYGO,DIC,DINUM
  1. ;
  1. ; Check to see if previously installed. If so, exit with message.
  1. ;I $O(^IBUC(351.82,0))]"" D Q
  1. ;. D BMES^XPDUTL(" >> Urgent Care Visit Tracking Database present. Initialization not tasked.")
  1. ;
  1. ;Looping through initially for adds
  1. S IBUCIEN1=$O(^IBE(350.1,"B","CC URGENT CARE (OPT) NEW",""))
  1. S IBUCIEN3=$O(^IBE(350.1,"B","CC URGENT CARE (OPT) CANCEL",""))
  1. S IBUCIEN4=$O(^IBE(350.1,"B","DG FEE SERVICE (OPT) CANCEL",""))
  1. S IBERR1=$O(^IBE(350.3,"B","UC - ENTERED IN ERROR","")) ;Skip
  1. S IBERR2=$O(^IBE(350.3,"B","UC - DUPLICATE VISIT","")) ;Skip
  1. S IBERR3=$O(^IBE(350.3,"B","ENTERED IN ERROR","")) ;Removed Entered in Error
  1. S IBERR4=$O(^IBE(350.3,"B","CATASTROPHICALLY DISABLED","")) ;Free if <3 MISSION Act otherwise Visit Only No Copay
  1. S IBERR5=$O(^IBE(350.3,"B","COMBAT VETERAN","")) ;Free if <3 MISSION Act otherwise Visit Only No Copay
  1. S IBERR6=$O(^IBE(350.3,"B","PURPLE HEART CONFIRMED","")) ;Free if <3 MISSION Act otherwise Visit Only No Copay
  1. D SITE^IBAUTL ;Defines variable IBSITE
  1. ;
  1. S IBQUIT=0
  1. ;
  1. ;Initialize process tracking array in case initialization stops
  1. N X,X2,X1,DT
  1. S DT=$$DT^XLFDT,X1=DT,X2=30 D C^%DTC
  1. S ^XTMP("IB20P669",0)=X_U_DT_U_"IB*2.0*669 Post install Urgent Care Visit Tracking Initialization"
  1. ;
  1. F LOOP=IBUCIEN1,IBUCIEN3,IBUCIEN4 D Q:IBQUIT
  1. . ;
  1. . S IBN=0
  1. . ;
  1. . ;See if the initialization was halted. If so, restore loop variables to last entry processed.
  1. . I $D(^XTMP("IB20P669",1)) S IBLSDTA=$G(^XTMP("IB20P669",1)),LOOP=$P(IBLSDTA,U),IBN=$P(IBLSDTA,U,2)
  1. . ;
  1. . F S IBN=$O(^IB("AE",LOOP,IBN)) Q:'IBN D
  1. . . S IBDATA=$G(^IB(IBN,0)) ; Get the data
  1. . . Q:IBDATA=""
  1. . . S IBDFN=$P(IBDATA,U,2),IBVST=$P(IBDATA,U,14),IBVSTIEN=0
  1. . . Q:IBVST<3190606 ;Do not count UC visits prior to the start of the UC program on 6/6/2019
  1. . . S IBVSTIEN=$$DBCHK(IBDFN,IBVST)
  1. . . S IBSTAT=4,IBREAS=5,IBBILL="@" ;init variables
  1. . . S IBBLST=$P(IBDATA,U,5) ; Get the bill status
  1. . . I (LOOP=IBUCIEN4),($P(IBDATA,U,7)'=30) Q ;Captures all of the DG FEE CANCEL entries from 6/6/2019 to install of IB*2.0*656
  1. . . S IBCREAS=$P(IBDATA,U,10),IBBLST=$P(IBDATA,U,5)
  1. . . I (IBBLST'=10),(LOOP=IBUCIEN1),+IBVSTIEN Q ;don't process if visit already in DB and adding a new paid visit
  1. . . I IBBLST'=10 D
  1. . . . S IBSTAT=1,IBREAS=""
  1. . . . S IBBILL=$P(IBDATA,U,11) ;Billing Number
  1. . . . I (IBBLST=8),(IBBILL="") S IBBILL="ON HOLD"
  1. . . I IBBLST=10 D
  1. . . . I (IBCREAS=IBERR3) S IBSTAT=3,IBREAS=3 ;Set Visit to Removed/Entered in Error
  1. . . . ; If Cat Disabled, Purple Heart, or Combat Vet Cancel Reason is used, check for free visits. If any free visits available, set the visit to free
  1. . . . I (IBCREAS=IBERR4)!(IBCREAS=IBERR5)!(IBCREAS=IBERR6),$$GETELGP^IBECEA36(IBDFN,IBVST) D
  1. . . . . S IBNOVST=$$GETVST^IBECEA36(IBDFN,IBVST)
  1. . . . . I $P(IBNOVST,U,2)<3 S IBSTAT=1,IBREAS=1 ;Potential Free visits
  1. . . ;Add new entry to the tracking database
  1. . . I (IBVSTIEN=0) D Q
  1. . . . K FDA
  1. . . . ;Store in array for adding to the file (#351.82)
  1. . . . S FDA(351.82,"+1,",.01)=IBDFN ;Patient
  1. . . . S FDA(351.82,"+1,",.02)=IBSITE ;Site
  1. . . . S FDA(351.82,"+1,",.03)=IBVST ;Visit Date
  1. . . . S FDA(351.82,"+1,",.04)=IBSTAT ;Status (2 - Billed or 3- Not Counted)
  1. . . . S FDA(351.82,"+1,",.05)=IBBILL ;Status (2 - Billed or 3- Not Counted)
  1. . . . S FDA(351.82,"+1,",1.01)=1 ;Status (2 - Billed or 3- Not Counted)
  1. . . . S:$G(IBREAS)'="" FDA(351.82,"+1,",.06)=IBREAS ;Reason (Not counted)
  1. . . . S FDA(351.82,"+1,",1.01)=1
  1. . . . ;Add to the file.
  1. . . . D UPDATE^DIE(,"FDA","FDAIEN")
  1. . . . S FDAIEN=FDAIEN(1) K FDAIEN(1)
  1. . . ;
  1. . . ;Otherwise Taking a canceled visit and updating the reason, bill no, and status fields
  1. . . I IBVSTIEN'=0 D
  1. . . . ;S DLAYGO=351.82,DIC="^IBUC(351.82,",DIC(0)="L"
  1. . . . ;I '+$G(IBVSTIEN) D FILE^DICN S LIEN=+IBVSTIEN K DIC,DINUM,DLAYGO
  1. . . . S DR=".04////"_IBSTAT ; Visit Tracking Status
  1. . . . S DR=DR_";.05////"_IBBILL ; Bill Number (should reset to NULL)
  1. . . . S DR=DR_";.06////"_IBREAS ; Reason (should be UC-ENTERED IN ERROR or UC-Duplicate Event)
  1. . . . S DR=DR_";1.01////1" ; Flag for multi-site transmission
  1. . . . ;
  1. . . . S DIE="^IBUC(351.82,",DA=IBVSTIEN
  1. . . . D ^DIE
  1. . . . K DR
  1. . . ;Save the entry just processed
  1. . . S ^XTMP("IB20P669",1)=LOOP_U_IBN
  1. . . I $$S^%ZTLOAD() D Q
  1. . . . ;
  1. . . . N ZTRTN,ZTDTH,ZTDESC,ZTIO
  1. . . . ;
  1. . . . ;requeue for later
  1. . . . S ZTRTN="INITUCDB^IB20P669"
  1. . . . S ZTDTH=$$NOW^XLFDT+.01 ; reschedule for 1 hr after time process stopped
  1. . . . S ZTDESC="IB*2.0*669 Initialize File 351.82 - Urgent Care Visit Tracking DB"
  1. . . . S ZTIO=""
  1. . . . D ^%ZTLOAD ; Call TaskManager
  1. . . . S IBQUIT=1
  1. K DR ;Clear update array before next use
  1. Q
  1. ;
  1. DBCHK(IBDFN,IBVDT) ; Check to see if the visit is already in the DB.
  1. ;
  1. N IBLP,IBQUIT,IBDATA,IBDT
  1. ; Returns IBQUIT - the IEN of the Visit OR 0
  1. ;loop through the patient's visits to see if it has already been recorded.
  1. S IBLP=0,IBQUIT=0
  1. F S IBLP=$O(^IBUC(351.82,"B",IBDFN,IBLP)) Q:'IBLP D Q:IBQUIT
  1. . S IBDATA=$G(^IBUC(351.82,IBLP,0))
  1. . S IBDT=$P(IBDATA,U,3)
  1. . ; quit if there is a visit already stored on that day.
  1. . I IBDT=IBVDT S IBQUIT=IBLP
  1. Q IBQUIT
  1. ;
  1. CANCLUC ; Initialize the new CAN CANCEL URGENT CARE field (.04) in the IB CHARGE REMOVE REASON file (#350.3).
  1. ; Also inactivate UC-ENTERED IN ERROR AND UC-CHANGE IN ELIGIBILITY
  1. ; Also define the type of UC Visit Tracking DB (351.82) update process to follow when using the cancellation
  1. ;
  1. N LOOP,LIEN,IBDATA,IBCCUC,IBINACT,IBNM,IBNOVST,IBUCDB
  1. N X,Y,DIE,DA,DR,DTOUT,DATA
  1. ;
  1. D MES^XPDUTL(" -> Update of the new IB CHARGE REMOVE REASON fields started.")
  1. ; Grab all of the entries to update
  1. F LOOP=1:1:14 D
  1. . ;Extract the new ACTION TYPE to be added.
  1. . S IBDATA=$T(IBDDAT+LOOP)
  1. . S IBDATA=$P(IBDATA,";;",2)
  1. . S IBNM=$P(IBDATA,";",1),IBCCUC=$P(IBDATA,";",2),IBUCDB=$P(IBDATA,";",3),IBINACT=$P(IBDATA,";",4)
  1. . S LIEN=$O(^IBE(350.3,"B",IBNM,"")) ; find CHARGE REMOVE REASON entry
  1. . Q:LIEN=""
  1. . ;
  1. . ; File the update along with inactivate the ACTION TYPE
  1. . S DR=".04///"_IBCCUC
  1. . S DR=DR_";.05///"_IBUCDB
  1. . S:IBINACT'="" DR=DR_";.06///"_IBINACT
  1. . S DIE="^IBE(350.3,",DA=LIEN
  1. . D ^DIE
  1. . K DR ;Clear update array before next use
  1. ;
  1. S DR=""
  1. D MES^XPDUTL(" -> Update of IB CHARGE REMOVE REASON completed.")
  1. Q
  1. ;
  1. IBDDAT ; Cancellation reasons (350.3) to update
  1. ;;ENTERED IN ERROR;Y;1
  1. ;;PATIENT DECEASED;Y;2
  1. ;;CHANGE IN ELIGIBILITY;Y;3
  1. ;;RECD INPATIENT CARE;Y;2
  1. ;;PURPLE HEART CONFIRMED;N;3
  1. ;;BILLED AT HIGHER TIER RATE;Y;2
  1. ;;BILLED LTC CHARGE;Y;2
  1. ;;COMBAT VETERAN;N;3
  1. ;;CATASTROPHICALLY DISABLED;N;3
  1. ;;UC - ENTERED IN ERROR;Y;1;Y
  1. ;;UC - CHANGE IN ELIGIBILITY;Y;3;Y
  1. ;;UC - DUPLICATE VISIT;Y;4
  1. ;;UC - SEQUENCE UPDATE;Y;3
  1. ;;UC - PG6 REVIEWED;Y;3
  1. ;;END
  1. ;
  1. NEWCREAS ; New Cancellation Reasons
  1. N LOOP,LIEN,IBDATA,IBCNNM
  1. N X,Y,DIE,DA,DR,DTOUT,DATA,IBDATAB
  1. ;
  1. N CANIEN,UPDIEN,SVCIEN,CHGIEN
  1. ;
  1. ; Grab all of the entries to update
  1. D MES^XPDUTL(" -> Adding new Cancellation Reason to the IB CHARGE REMOVE REASON file (350.3).")
  1. S Y=-1
  1. F LOOP=1:1 S IBDATA=$T(REASDAT+LOOP) Q:$P(IBDATA,";",3)="END" D
  1. . S DR=""
  1. . ;Extract the new ACTION TYPE to be added.
  1. . ;Store in array for adding to the file (#350.1).
  1. . Q:IBDATA="" ;go to next entry if Category is not to be updated.
  1. . ;
  1. . S IBCNNM=$P(IBDATA,";",3)
  1. . S LIEN=$O(^IBE(350.3,"B",IBCNNM,""))
  1. . ; File the update along with inactivate the ACTION TYPE
  1. . S DLAYGO=350.3,DIC="^IBE(350.3,",DIC(0)="L",X=IBCNNM
  1. . I '+LIEN D FILE^DICN S LIEN=+Y K DIC,DINUM,DLAYGO
  1. . S DR=".02////"_$P(IBDATA,";",4) ; ABBREVIATION
  1. . S DR=DR_";.03////"_$P(IBDATA,";",5) ; LIMIT
  1. . ;
  1. . S DIE="^IBE(350.3,",DA=LIEN
  1. . D ^DIE
  1. . ;<re-index new entry here>
  1. . S DA=LIEN,DIK="^IBE(350.3," D IX^DIK
  1. . K DR
  1. Q
  1. ;
  1. REASDAT ; Fee Service to inactivate
  1. ;;UC - PG6 REVIEWED;UCPG6;3
  1. ;;END
  1. Q