| 1 | BPSNPI ;BHAM ISC/DMB - NPI Utilities ;04/19/2006 | 
|---|
| 2 | ;;1.0;E CLAIMS MGMT ENGINE;**2,5**;JUN 2004;Build 45 | 
|---|
| 3 | ;;Per VHA Directive 2004-038, this routine should not be modified. | 
|---|
| 4 | ; | 
|---|
| 5 | ; Reference to $$NPI^XUSNPI supported by IA4532 | 
|---|
| 6 | ; | 
|---|
| 7 | ; Must call at an entry point | 
|---|
| 8 | Q | 
|---|
| 9 | ; | 
|---|
| 10 | ; NPIREQ - Extrinsic funtion that will return a flag indicating | 
|---|
| 11 | ;          if the NPI 'drop dead date' has been passed. | 
|---|
| 12 | ; Input | 
|---|
| 13 | ;    BPSDT - Date to check (internal Fileman format) | 
|---|
| 14 | ; Output | 
|---|
| 15 | ;    1 - On or after the May 23, 2008 drop dead date | 
|---|
| 16 | ;    0 - Prior to the May 23, 2008 drop dead date | 
|---|
| 17 | NPIREQ(BPSDT) ; Check NPI drop dead date | 
|---|
| 18 | N BPSCHKDT | 
|---|
| 19 | S BPSCHKDT=3080523 | 
|---|
| 20 | Q $S(BPSDT<BPSCHKDT:0,1:1) | 
|---|
| 21 | ; | 
|---|
| 22 | ; NPI - Get NPI number | 
|---|
| 23 | ; Input | 
|---|
| 24 | ;   TYPE - Organization_ID, Individual_ID, or Pharmacy_ID | 
|---|
| 25 | ;   IEN  - For Organization, IEN from Institution file (#4) | 
|---|
| 26 | ;        - For Individual, IEN from New Person file (#200) | 
|---|
| 27 | ;        - For Pharmacy, IEN from Outpatient Site file (#59) | 
|---|
| 28 | ; Output - NPI for valid entry | 
|---|
| 29 | ;        -  -1^Error Code if unable to get NPI | 
|---|
| 30 | NPI(TYPE,IEN) ; | 
|---|
| 31 | N NPI | 
|---|
| 32 | S TYPE=$G(TYPE) | 
|---|
| 33 | I TYPE'="Organization_ID",TYPE'="Individual_ID",TYPE'="Pharmacy_ID" Q "-1^Invalid Type" | 
|---|
| 34 | I '$G(IEN) Q "-1^Invalid IEN" | 
|---|
| 35 | I TYPE="Pharmacy_ID" D | 
|---|
| 36 | . K ^TMP($J,"BPS59") | 
|---|
| 37 | . D PSS^PSO59(IEN,"","BPS59") | 
|---|
| 38 | . S IEN=$P($G(^TMP($J,"BPS59",IEN,101)),U,1),TYPE="Organization_ID" | 
|---|
| 39 | . K ^TMP($J,"BPS59") | 
|---|
| 40 | I 'IEN Q "-1^Unable to determine Institution ID" | 
|---|
| 41 | S NPI=$$NPI^XUSNPI(TYPE,IEN) | 
|---|
| 42 | I $P(NPI,U,1)<1 Q "-1^No NPI" | 
|---|
| 43 | I $P(NPI,U,3)'="Active" Q "-1^Inactive NPI" | 
|---|
| 44 | Q $P(NPI,U,1) | 
|---|
| 45 | ; | 
|---|
| 46 | NPKEY(BPSNCP,BPSNPI,BPSAPI) ; | 
|---|
| 47 | ; Determine primay key to use in MFE 4.1 for pharm registration. | 
|---|
| 48 | ; Input | 
|---|
| 49 | ;    BPSNCP  - ncpdp number for the pharmacy in file (#9002313.56,.02) | 
|---|
| 50 | ;    BPSNPI - existing NPI for the pharmacy in file (#9002313.56,41.01) | 
|---|
| 51 | ;    BPSAPI - current NPI returned from NPI^BPSNPI | 
|---|
| 52 | N BPSPKY | 
|---|
| 53 | S BPSPKY="" | 
|---|
| 54 | I $G(BPSNPI) S BPSPKY=BPSNPI | 
|---|
| 55 | E  I $G(BPSNCP) S BPSPKY=BPSNCP | 
|---|
| 56 | E  S BPSPKY=$G(BPSAPI) | 
|---|
| 57 | Q BPSPKY | 
|---|