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

IBOUNP2.m

Go to the documentation of this file.
  1. IBOUNP2 ;ALB/CJM - OUTPATIENT INSURANCE REPORT ;JAN 25,1992
  1. ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
  1. ; IBOTIME appointment time
  1. ; IBODIV division
  1. ; IBOCLNC clinic
  1. ; IBOCTG category vet is in (no=noinsurance,expired,unknow)
  1. ; IBOEND2 end of the date range + 30 days
  1. ; IBOINS =1 in there is insurance data
  1. ; IBORPTD =1 if appt should appear on report
  1. LOOPCLNC ; loops through selected clinics
  1. N IBOCLNC,IBOTIME,IBOEND2,IBOCTG,IBOINS,IBORPTD,IBONAME S IBOCLNC=""
  1. S X1=IBOEND,X2=30 D C^%DTC S IBOEND2=X
  1. I VAUTC=1 F S IBOCLNC=$O(^SC("AC","C",IBOCLNC)) Q:'IBOCLNC D LOOPAPPT
  1. I VAUTC'=1 F S IBOCLNC=$O(VAUTC(IBOCLNC)) Q:'IBOCLNC D LOOPAPPT
  1. Q
  1. LOOPAPPT ; loops through appointments for a selected clinic
  1. N J,R,IBOCLN,IBODIV I $D(^SC(IBOCLNC,0)) D
  1. .S IBODIV=$P($G(^SC(IBOCLNC,0)),"^",15) S:IBODIV IBODIV=$P($G(^DG(40.8,IBODIV,0)),"^",1) S:IBODIV="" IBODIV="UNKNOWN"
  1. .N IBOCLN S IBOCLN=$P($G(^SC(IBOCLNC,0)),"^",1) I IBOCLN="" S IBOCLN="NOT KNOWN"
  1. .F IBOTIME=IBOBEG-.0001:0 S IBOTIME=$O(^SC(IBOCLNC,"S",IBOTIME)) Q:'IBOTIME!(IBOTIME>(IBOEND+.99)) F J=0:0 S J=$O(^SC(IBOCLNC,"S",IBOTIME,1,J)) Q:J<1 I $D(^SC(IBOCLNC,"S",IBOTIME,1,J,0)) D
  1. .. S R=^(0),DFN=+R
  1. .. I $P(R,"^",9)'="C",$D(^DPT(DFN,"S",IBOTIME,0)),$P(^(0),"^",2)']"" S IBOQUIT=0 D DONE,VET:'IBOQUIT,STATUS:'IBOQUIT Q:IBOQUIT S IBORPTD=0 D UNK:IBOUK,EXP:'IBORPTD&IBOEXP,UNI:'IBORPTD&IBOUI,INDEX:IBORPTD
  1. Q
  1. VET ; checks if patient is a vet
  1. S IBOQUIT=1 D ELIG^VADPT Q:VAERR S:VAEL(4) IBOQUIT=0
  1. Q
  1. DONE ; checks if patient already on report
  1. S:$D(^TMP($J,"PATIENTS",DFN)) IBOQUIT=1
  1. Q
  1. STATUS ; checks if appt status="",otherwise should not be on report
  1. S:($P($G(^DPT(DFN,"S",IBOTIME,0)),"^",2)]"") IBOQUIT=1
  1. Q
  1. INDEX ; indexes appointment,also indexs vet so he won't be reported
  1. S IBONAME=$P($G(^DPT(DFN,0)),"^",1) Q:IBONAME'[""
  1. S ^TMP($J,IBOCTG,IBODIV,IBOCLN,IBONAME,DFN)=IBOTIME
  1. S ^TMP($J,"PATIENTS",DFN)=""
  1. Q
  1. UNK ; goes in 'unknown' category if the field COVERED BY HEALTH INSURANCE
  1. ; was not answered, was answered unknown, and there is no insurance data
  1. S IBORPTD=0 N T S T=$P($G(^DPT(DFN,.31)),"^",11) I T="U"!(T="") D CKINS I 'IBOINS S IBOCTG="UNKNOWN",IBORPTD=1 Q
  1. Q
  1. EXP ; goes in expired category only if there is insurance and
  1. ; all of it expired before end of specified period + 30 days
  1. S IBORPTD=0 N T,E D CKINS Q:'IBOINS
  1. S IBORPTD=1,IBOCTG="EXPIRED" F T=0:0 S T=$O(^DPT(DFN,.312,T)) Q:T'>0 S E=$P($G(^(T,0)),"^",4) I E=""!(E>IBOEND2) S IBORPTD=0 Q
  1. Q
  1. UNI ; goes in unisured category if there is no insurance data and
  1. ; the field COVERED BY HEALTH INSURANCE was answered YES or NO
  1. S IBORPTD=0 N T S T=$P($G(^DPT(DFN,.31)),"^",11) I T="N"!(T="Y") D CKINS I 'IBOINS S IBOCTG="NO",IBORPTD=1
  1. Q
  1. CKINS ; checks if any insurance in insurance multiple of patient record
  1. S IBOINS=0 I $O(^DPT(DFN,.312,0)) S IBOINS=1
  1. Q