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

ABMDVCK1.m

Go to the documentation of this file.
  1. ABMDVCK1 ; IHS/ASDST/DMJ - PCC VISIT CHECK - PART 2 ;
  1. ;;2.6;IHS Third Party Billing System;**2**;NOV 12, 2009
  1. ;Original;TMD;
  1. ;
  1. ; IHS/SD/SDR - v2.6 CSV
  1. ; IHS/SD/SDR - abm*2.6*2 - 3PMS10003A - modified to call ABMFEAPI
  1. ;
  1. ; *********************************************************************
  1. ;
  1. VTYP(ABMVDFN,SERVCAT,ABMINS,ABMCLN) ;EP - to get visit type
  1. ;This is an extrinsic function
  1. N VTYP
  1. I 'ABMVDFN Q ""
  1. ;If visit in dental file type=998, other wise 131
  1. ;
  1. VAR ;
  1. S VTYP=$S($D(^AUPNVDEN("AD",ABMVDFN)):998,1:131)
  1. S ABM("LOCK")=0
  1. ;If the visit is in the V hospitalization file set type to 111
  1. I +$O(^AUPNVINP("AD",ABMVDFN,"")),$D(^AUPNVINP($O(^AUPNVINP("AD",ABMVDFN,"")),0)) S VTYP=111
  1. ;Begin mods for inpat lt 30 days
  1. I VTYP=131,SERVCAT="H" S VTYP=111
  1. ;End mods
  1. ;If not in hosp file go thru insurance file
  1. N QUIT
  1. E I SERVCAT'="S" D
  1. .;Note that the visit type must be in the insurer file for this to set
  1. .;the visit type.
  1. .S QUIT=0
  1. .S ABM=0
  1. .F S ABM=$O(^ABMNINS(DUZ(2),ABMINS,1,ABM)) Q:'ABM D Q:QUIT
  1. ..I ABM=131 Q
  1. ..Q:'ABMCLN
  1. ..S D1=0
  1. ..F S D1=$O(^ABMDVTYP(ABM,1,D1)) Q:'D1 D Q:QUIT
  1. ...I +^ABMDVTYP(ABM,1,D1,0)=ABMCLN D
  1. ....S VTYP=ABM
  1. ....S QUIT=1
  1. I SERVCAT="S" S VTYP=831
  1. ;If type is still 131 check to see if it is surgery
  1. I "A"[SERVCAT,VTYP=131 D OPCK
  1. I $P($G(^AUTNINS(+ABMINS,2)),U)="R" D
  1. .S ABMLOC=$P($G(^AUPNVSIT(ABMVDFN,0)),"^",6)
  1. .Q:$P($G(^ABMDPARM(+ABMLOC,1,5)),U)'=1
  1. .S VTYP=999
  1. .K ABMLOC
  1. Q VTYP
  1. ;
  1. ; *********************************************************************
  1. ;This code is only reached if VTYP=131
  1. OPCK ;EP for checking if ambulatory surgery
  1. N C,ASC
  1. D SURGTAB
  1. S ABM=0
  1. F S ABM=$O(^AUPNVPRC("AD",ABMVDFN,ABM)) Q:'ABM D Q:VTYP'=131
  1. .;What we need to find is if from the ICD code we can determine visit
  1. .;type.
  1. .;From the CPT code we should be able to tell if it is surgery
  1. .;If one of the ASC codes from 1 - 8 exists it should be amb surg
  1. .;CPT from 10000-70000 is surgery.
  1. .Q:'$D(^AUPNVPRC(ABM,0))
  1. .S ABM("CPT")=$O(^ICPT("I",+^AUPNVPRC(ABM,0),""))
  1. .Q:'ABM("CPT")
  1. .S ASC=$P($$IHSCPT^ABMCVAPI(ABM("CPT"),ABMP("VDT")),U,6) ;CSV-c
  1. .I ASC>0,ASC<9 D OPSURG
  1. .Q
  1. Q
  1. ;
  1. ; *********************************************************************
  1. OPSURG ;
  1. ;I $D(^ABMNINS(DUZ(2),ABMINS,1,831,0)),+$P(^(0),U,5),'+$P($G(^ABMDFEE($P(^(0),U,5),11,ABM("CPT"),0)),U,2) Q ;abm*2.6*2 3PMS10003A
  1. I $D(^ABMNINS(DUZ(2),ABMINS,1,831,0)),+$P(^(0),U,5),'+$P($$ONE^ABMFEAPI($P(^(0),U,5),11,ABM("CPT"),ABMP("VDT")),U) Q ;abm*2.6*2 3PMS10003A
  1. S VTYP=831
  1. Q
  1. ;
  1. ; *********************************************************************
  1. SURGTAB ;EP - Create CPT table if needed
  1. I '$D(ABMCPTTB("SURGERY")) D
  1. .S ABM=$O(^ABMDCPT("D","SURGERY",""))
  1. .S Y=^ABMDCPT(ABM,0)
  1. .S ABMCPTTB("SURGERY","L")=$P(Y,U,4)
  1. .S ABMCPTTB("SURGERY","H")=$P(Y,U,5)
  1. K Y
  1. Q