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

BPSNPI.m

Go to the documentation of this file.
  1. BPSNPI ;BHAM ISC/DMB - NPI Utilities ;04/19/2006
  1. ;;1.0;E CLAIMS MGMT ENGINE;**2,5**;JUN 2004;Build 45
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. ; Reference to $$NPI^XUSNPI supported by IA4532
  1. ;
  1. ; Must call at an entry point
  1. Q
  1. ;
  1. ; NPIREQ - Extrinsic funtion that will return a flag indicating
  1. ; if the NPI 'drop dead date' has been passed.
  1. ; Input
  1. ; BPSDT - Date to check (internal Fileman format)
  1. ; Output
  1. ; 1 - On or after the May 23, 2008 drop dead date
  1. ; 0 - Prior to the May 23, 2008 drop dead date
  1. NPIREQ(BPSDT) ; Check NPI drop dead date
  1. N BPSCHKDT
  1. S BPSCHKDT=3080523
  1. Q $S(BPSDT<BPSCHKDT:0,1:1)
  1. ;
  1. ; NPI - Get NPI number
  1. ; Input
  1. ; TYPE - Organization_ID, Individual_ID, or Pharmacy_ID
  1. ; IEN - For Organization, IEN from Institution file (#4)
  1. ; - For Individual, IEN from New Person file (#200)
  1. ; - For Pharmacy, IEN from Outpatient Site file (#59)
  1. ; Output - NPI for valid entry
  1. ; - -1^Error Code if unable to get NPI
  1. NPI(TYPE,IEN) ;
  1. N NPI
  1. S TYPE=$G(TYPE)
  1. I TYPE'="Organization_ID",TYPE'="Individual_ID",TYPE'="Pharmacy_ID" Q "-1^Invalid Type"
  1. I '$G(IEN) Q "-1^Invalid IEN"
  1. I TYPE="Pharmacy_ID" D
  1. . K ^TMP($J,"BPS59")
  1. . D PSS^PSO59(IEN,"","BPS59")
  1. . S IEN=$P($G(^TMP($J,"BPS59",IEN,101)),U,1),TYPE="Organization_ID"
  1. . K ^TMP($J,"BPS59")
  1. I 'IEN Q "-1^Unable to determine Institution ID"
  1. S NPI=$$NPI^XUSNPI(TYPE,IEN)
  1. I $P(NPI,U,1)<1 Q "-1^No NPI"
  1. I $P(NPI,U,3)'="Active" Q "-1^Inactive NPI"
  1. Q $P(NPI,U,1)
  1. ;
  1. NPKEY(BPSNCP,BPSNPI,BPSAPI) ;
  1. ; Determine primay key to use in MFE 4.1 for pharm registration.
  1. ; Input
  1. ; BPSNCP - ncpdp number for the pharmacy in file (#9002313.56,.02)
  1. ; BPSNPI - existing NPI for the pharmacy in file (#9002313.56,41.01)
  1. ; BPSAPI - current NPI returned from NPI^BPSNPI
  1. N BPSPKY
  1. S BPSPKY=""
  1. I $G(BPSNPI) S BPSPKY=BPSNPI
  1. E I $G(BPSNCP) S BPSPKY=BPSNCP
  1. E S BPSPKY=$G(BPSAPI)
  1. Q BPSPKY