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

IBJDI11.m

Go to the documentation of this file.
  1. IBJDI11 ;ALB/CPM - PERCENTAGE OF COMPLETED REGISTRATIONS (CONT'D) ;16-DEC-96
  1. ;;2.0;INTEGRATED BILLING;**100,118,128,249**;21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. EN ; - Entry point from IBJDI1.
  1. ;
  1. ; - Get patient's most recent registration.
  1. S IBREG=$G(^DPT(DFN,"DIS",+$O(^DPT(DFN,"DIS",0)),0)) I 'IBREG G ENQ
  1. ;
  1. ; - Get division, if necessary.
  1. I 'IBSORT S IBDIV=0
  1. E S IBDIV=+$P(IBREG,U,4) I 'IBDIV S IBDIV=+$$PRIM^VASITE()
  1. I IBSORT,'VAUTD,'$D(VAUTD(IBDIV)) Q ; Not a selected division.
  1. ;
  1. ; - Set 'total registrations' accumulator.
  1. S IB(IBDIV,"TOT")=IB(IBDIV,"TOT")+1
  1. ;
  1. ; - Check if patient is a non-veteran.
  1. D ELIG^VADPT S IBNVET=$S('VAEL(4):1,1:0)
  1. ;
  1. ; - Check if patient is deceased; get DOD.
  1. I +$G(^DPT(DFN,.35)) D
  1. .S IBDOD=$$DAT1^IBOUTL(+^DPT(DFN,.35)\1),IB(IBDIV,"DEC")=IB(IBDIV,"DEC")+1
  1. E S IBDOD=""
  1. ;
  1. ; - Check if patient is/was getting inpatient care.
  1. S IBINPT=""
  1. I $$INPT^IBAMTS1(DFN,IBEDT) S IBINPT="*"
  1. E S IBX=$O(^DGPM("APTT3",DFN,(IBBDT-.01)))\1 I IBX,IBX<IBEDT S IBINPT="*"
  1. ;
  1. ; - Check for 'no billable treatment' dispositions.
  1. I $$NOTR(DFN,IBBDT,IBEDT,0) S IBNOTR="+",IB(IBDIV,"NOTR")=IB(IBDIV,"NOTR")+1
  1. E S IBNOTR="",IB(IBDIV,"TR")=IB(IBDIV,"TR")+1
  1. ;
  1. ; - Set accumulators for the breakdown of the total number.
  1. D INC(DFN,.IBIN)
  1. I IBIN]"" D:IBNOTR="" G EN1
  1. .I IBNVET D
  1. ..S IBIN=+$P(IBREG,U,13)_";"_IBIN,IB(IBDIV,"NVETI")=IB(IBDIV,"NVETI")+1
  1. .E S IB(IBDIV,"VETI")=IB(IBDIV,"VETI")+1
  1. .S IB(IBDIV,"INC")=IB(IBDIV,"INC")+1
  1. I IBNOTR="" D
  1. .S IB(IBDIV,"COM")=IB(IBDIV,"COM")+1
  1. .I IBNVET S IB(IBDIV,"NVETC")=IB(IBDIV,"NVETC")+1
  1. .E S IB(IBDIV,"VETC")=IB(IBDIV,"VETC")+1
  1. ;
  1. EN1 I IBRPT="S"!(IBIN="") G ENQ ; Summary info only/No inconsistencies.
  1. ;
  1. ; - Get patient's type of care.
  1. S X=+$P(IBREG,U,3),IBTOC=$S(X=1:"HOSPITAL",X=2:"DOMICILIARY",X=3:"OPT. MEDICAL",X=4:"OPT. DENTAL",X=5:"N.H. CARE",1:"")
  1. ;
  1. ; - Get next scheduled treatment date.
  1. S IBNEXT=""
  1. I $$GETICN^MPIF001(DFN)>0 S ^TMP("IBDFN",$J,DFN)="" ; for future look up scheduled appts.
  1. S X=0 F S X=$O(^DGS(41.1,"B",DFN,X)) Q:'X D ; Scheduled adm.
  1. .S X1=$G(^DGS(41.1,X,0)),X2=$P(X1,U,2)\1
  1. .I X2<DT Q ; Must be old scheduled admission.
  1. .I $P(X1,U,13) Q ; Scheduled admission is cancelled.
  1. .I $P(X1,U,17) Q ; Patient already admitted.
  1. .I X2>IBNEXT S IBNEXT=X2
  1. ;
  1. ; - Save detail information.
  1. S ^TMP("IBJDI1",$J,IBDIV,IBNVET,$E($P(IBDN,U),1,25)_IBINPT_IBNOTR_"@@"_DFN)=$P(IBDN,U,9)_U_$E($P($G(^DPT(DFN,.13)),U),1,15)_U_IBTOC_U_IBIN_U_$E($P($G(^VA(200,+$P(IBREG,U,9),0)),U),1,20)_U_IBNEXT_U_IBDOD
  1. ;
  1. ENQ K VA,VAEL,VAERR
  1. Q
  1. ;
  1. NOTR(DFN,IBBDT,IBEDT,Z) ; - Check for patient's 'no treatment' dispositions.
  1. ; Input: DFN = Patient IEN
  1. ; IBBDT = Start date for search
  1. ; IBEDT = Ending date for search
  1. ; Z = 1-Look for 'no treatment' dispositions only
  1. ; 0-Also look for C&P/emply/collat/non-ct clinic visits
  1. ; Output: 0 = Patient had no 'no treatment' dispositions or patient
  1. ; had treatment within selected date range
  1. ; 1 = Patient had at least one 'no treatment' disposition or
  1. ; C&P exam/employee/collateral/non-count clinic visit
  1. ;
  1. N IBDIS,VAROOT,VARP,X,X1,X2,Y
  1. S VAROOT="IBDIS",VARP("F")=IBBDT,VARP("T")=IBEDT D REG^VADPT
  1. S Y=1 I '$O(IBDIS(0)) G NTQ
  1. S (X,X1)=0 F S X=$O(IBDIS(X)) Q:X="" D I X1 S Y=0 Q
  1. .S X2=+$P($G(^DPT(DFN,"DIS",9999999-$P(IBDIS(X,"I"),U,6),0)),U,18)
  1. .S X2=$G(^SCE(X2,0))
  1. .I $P(X2,U,8)'=2,"^CANCEL WITHOUT EXAM^NO CARE OR TREATMENT REQUIRED^"[("^"_$P(IBDIS(X,"E"),U,7)_"^") Q
  1. .I 'Z,"^1^4^7^"[("^"_+$P(X2,U,10)_"^") Q ; C&P/collat/emply visit.
  1. .I 'Z,$P($G(^SC(+$P(X2,U,4),0)),U,17)="Y" Q ; Non-count clinic.
  1. .S X1=1 ; Patient had treatment.
  1. ;
  1. NTQ Q Y
  1. ;
  1. INC(DFN,X) ; - Find a patient's registration inconsistencies.
  1. ; Input: DFN = Pointer to the patient in file #2
  1. ; Output: X = Passed by reference - the patient's
  1. ; registration inconsistencies in the form
  1. ;
  1. ; n;n1;n2;n3...
  1. ;
  1. ; where n is a pointer to file #38.6.
  1. N I S X=""
  1. S I=0 F S I=$O(^DGIN(38.5,DFN,"I",I)) Q:'I S X=X_I_";"
  1. I X]"" S X=$E(X,1,$L(X)-1)
  1. Q