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

IBCEP82.m

Go to the documentation of this file.
  1. IBCEP82 ;ALB/CLT - Special cross references and data entry for fields in file 355.93 ;18 Apr 2008 3:46 PM
  1. ;;2.0;INTEGRATED BILLING;**343,374,377,391,516**;21-MAR-94;Build 123
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ; Call at tags only
  1. Q
  1. ;This routine will ask for the NPI, check for duplicate entries, and check for proper
  1. ;format using the double-add-double formula. If the NPI is being deleted it will ask
  1. ;the user why it is being deleted.
  1. ;If it is being deleted because of an erroneous entry it will be completely deleted.
  1. ;If it is a valid NPI being deleted because of possible inappropriate usage it will be
  1. ;maintained in the history cross reference to preclude anyone from using this NPI again.
  1. ;
  1. EN(IBNPRV) ;Routine primary entry point
  1. N DTOUT,DUOUT,DA,DIR,DIE,DIC,DR,X,Y,IBKEY
  1. N IBIEN,IBNPI,IBCHECK,IBOLDNPI,IBRBNPI,IBRB
  1. S IBOLDNPI="",IBNPI="",IBKEY="XUSNPIMTL"
  1. EN1 ;
  1. S (DA,IBIEN)=IBNPRV
  1. K DIR
  1. S DIR(0)="FO^10:10",DIR("A")="NPI",DIR("?")="Enter a 10 digit National Provider Identifier"
  1. I $G(DA) S:$P($G(^IBA(355.93,DA,0)),U,14)'="" (DIR("B"),IBOLDNPI,IBNPI)=$P($G(^IBA(355.93,DA,0)),U,14)
  1. ;Sole Proprietor IB*2*516
  1. I $P($G(^IBA(355.93,DA,0)),U,17)="Y" D
  1. . N IBA35593
  1. . S IBA35593=$P($G(^IBA(355.93,DA,0)),U,18)
  1. . I IBA35593,$P($G(^IBA(355.93,IBA35593,0)),U,14)]"" S DIR("B")=$P(^(0),U,14)
  1. D ^DIR S IBCHECK=$S(Y=IBOLDNPI:2,1:0)
  1. I X="^" W *7,!," EXIT NOT ALLOWED ??" G EN1
  1. I $E(X)="^" W *7,!," JUMPING NOT ALLOWED ??" G EN1
  1. I X="@" G:IBOLDNPI'="" DEL W *7,"??" G EN1
  1. I $G(DUOUT)!$G(DTOUT) G XIT
  1. I $G(IBOLDNPI)="",$G(X)="" G XIT
  1. S IBNPI=$S(X="":$G(IBOLDNPI),1:X)
  1. I '$$PROC(IBNPI,IBOLDNPI,IBIEN) G EN1
  1. G XIT
  1. ;
  1. EN2(IBNPRV,INDENT) ; entry point from input templates IB SCREEN82 and IB SCREEN8H
  1. N DTOUT,DUOUT,DA,DIR,DIE,DIC,DR,X,Y,IBKEY
  1. N IBIEN,IBNPI,IBCHECK,IBOLDNPI,IBRBNPI,IBRB,SPACES
  1. S IBNPI="",IBKEY="XUSNPIMTL",IBOLDNPI="",SPACES=" "
  1. EN21 ;
  1. S (DA,IBIEN)=IBNPRV
  1. K DIR
  1. S DIR(0)="FO^10:10",DIR("A")=$E(SPACES,1,INDENT)_"NPI",DIR("?")=$E(SPACES,1,INDENT)_"Enter a 10 digit National Provider Identifier"
  1. I $G(DA) S:$P($G(^IBA(355.93,DA,0)),U,14)'="" (DIR("B"),IBOLDNPI,IBNPI)=$P($G(^IBA(355.93,DA,0)),U,14)
  1. D ^DIR S IBCHECK=$S(Y=IBOLDNPI:2,1:0)
  1. I X="@" G:IBOLDNPI'="" DEL W *7,"??" G EN21
  1. I $G(DUOUT)!$G(DTOUT) G XIT
  1. I $G(IBOLDNPI)="",$G(X)="" G XIT
  1. S IBNPI=$S(X="":$G(IBOLDNPI),1:X)
  1. I '$$PROC(IBNPI,IBOLDNPI,IBIEN) G EN21
  1. G XIT
  1. ;
  1. PROC(IBNPI,IBOLDNPI,IBIEN) ; process new NPI
  1. I '$$CHKDGT^XUSNPI(IBNPI) W !,*7,$E($G(SPACES),1,+$G(INDENT))_"Not a valid NPI. Please try again.",! Q 0
  1. I $$NPIUSED^IBCEP81(IBNPI,IBOLDNPI,IBIEN,IBCHECK,IBKEY)=1 Q 0
  1. S IBCHECK=1
  1. I IBOLDNPI="" D ACTI
  1. I IBOLDNPI'="" D:IBNPI'=IBOLDNPI INACT
  1. S $P(^IBA(355.93,IBIEN,0),U,14)=IBNPI,^IBA(355.93,"NPI",IBNPI,IBIEN)="",^IBA(355.93,"NPIHISTORY",IBNPI,IBIEN)=""
  1. Q 1
  1. ;
  1. ACTI ;CREATE AN ACTIVATED ENTRY IN MULTIPLE NPISTATUS FIELD
  1. S DA(1)=IBIEN,DIC="^IBA(355.93,"_DA(1)_",""NPISTATUS"",",DIC(0)="L",X=$$NOW^XLFDT()
  1. S DIC("DR")=".02////^S X=1;.03////^S X=IBNPI;.04////^S X=DUZ"
  1. D FILE^DICN
  1. S $P(^IBA(355.93,IBIEN,0),U,14)=IBNPI
  1. Q
  1. ;
  1. DEL ;NPI HAS BEEN DELETED
  1. ;If the user deletes the NPI this subroutine will determine why it was deleted and, if it was because it was found
  1. ;in a false identity situation, will mark it in history to never be used again.
  1. S IBNPI=$G(DIR("B"))
  1. K DIR
  1. S DIR(0)="Y"
  1. S DIR("A")="Are you sure you wish to delete this NPI"
  1. S DIR("?")="You have indicated you wish to delete the NPI. This is a second chance check."
  1. D ^DIR
  1. G:Y(0)="NO" XIT
  1. ;S DIR(0)="S^E:ERROR;V:VALID",DIR("A")="Was this a Valid NPI or an NPI entered in Error"
  1. ;S DIR("?",1)="An example of an NPI entered in error is if the entry person transposed numbers,"
  1. ;S DIR("?",2)="or if the NPI for one provider is accidentally assigned to a different provider."
  1. ;S DIR("?")="Enter an 'E' for Error or a 'V' for Valid."
  1. ;D ^DIR
  1. D COMP W !,"This NPI will be designated as Entered in Error.",!
  1. ;I Y="V" S IBCHECK=2 D INACT W !,"The NPI is now inactive.",!
  1. ;Q:$D(DTOUT)!($D(DUOUT))
  1. S IBOLDNPI=IBNPI D WARND(IBIEN,IBOLDNPI,IBKEY)
  1. Q
  1. ;
  1. COMP ;COMPLETELY DELETE THE NPI
  1. ;This subroutine will delete the NPI from the file 355.93.
  1. S OIEN=$O(^IBA(355.93,IBIEN,"NPISTATUS","C",IBOLDNPI,"A"),-1)
  1. D DELNPI(IBIEN,OIEN)
  1. K ^IBA(355.93,"NPI",IBOLDNPI,DA),^IBA(355.93,"NPIHISTORY",IBOLDNPI,DA)
  1. S IBRB=0
  1. D ; Find the most recent status '0' (inactive) NPI entry in the list.
  1. . N IBRBLST,IBRBTMP
  1. . ; Don't want to roll back to the same number you are deleting.
  1. . S IBRBLST(IBOLDNPI)=""
  1. . S IBRBTMP="A"
  1. . ; Go through each entry in reverse order
  1. . F S IBRBTMP=$O(^IBA(355.93,IBIEN,"NPISTATUS",IBRBTMP),-1) Q:'IBRBTMP D Q:IBRB'=0
  1. .. S IBRBLST=^IBA(355.93,IBIEN,"NPISTATUS",IBRBTMP,0)
  1. .. ; If this is an 'active' entry then ignore it.
  1. .. I $P(IBRBLST,U,2)=1 Q
  1. .. ; If this entry does not have an NPI then ignore it.
  1. .. I $P(IBRBLST,U,3)="" Q
  1. .. ;If this is an inactive entry then report it.
  1. .. I $P(IBRBLST,U,2)=0 S IBRB=IBRBTMP Q
  1. .. Q
  1. . Q
  1. I IBRB>0 D ROLLBACK
  1. Q
  1. ;
  1. DELNPI(IEN,OIEN) ;DELETE-INVALID removes NPI from file.
  1. NEW DIE,DIK,DIC,DA,DR,D,D0,DI,DIC,DQ,X
  1. NEW DP,DM,DK,DL,DIEL
  1. S DIE="^IBA(355.93,",DA=IEN,DR="41.01////@"
  1. D ^DIE
  1. S DA(1)=IEN,DIK="^IBA(355.93,"_DA(1)_",""NPISTATUS"",",DA=OIEN
  1. D ^DIK
  1. Q
  1. ;
  1. INACT ;INACTIVATE AN ENTRY
  1. ;This subroutine makes two entries in the NPI multiple field:
  1. ;one for the deactivation of the old NPI and the second
  1. ;for the activation of a new NPI.
  1. S DA(1)=IBIEN,DIC="^IBA(355.93,"_DA(1)_",""NPISTATUS"",",DIC(0)="L",X=$$NOW^XLFDT()
  1. S DIC("DR")=".02////^S X=0;.03////^S X=IBOLDNPI;.04////^S X=DUZ"
  1. D FILE^DICN
  1. S ^IBA(355.93,"NPIHISTORY",IBOLDNPI,DA(1))=""
  1. K ^IBA(355.93,"NPI",IBOLDNPI,DA(1))
  1. S $P(^IBA(355.93,IBIEN,0),U,14)=""
  1. I $G(IBCHECK)<2 D
  1. .D ACTI
  1. .S ^IBA(355.93,"NPIHISTORY",IBNPI,DA(1))=""
  1. .D WARNR(IBIEN,IBOLDNPI,IBKEY)
  1. Q
  1. ;
  1. ROLLBACK ;Rollback or delete NPI
  1. S IBRBNPI=$P(^IBA(355.93,IBIEN,"NPISTATUS",IBRB,0),U,3)
  1. NEW DIE,DIK,DIC,DA,DR,D,D0,DI,DIC,DQ,X
  1. NEW DP,DM,DK,DL,DIEL
  1. S DA(1)=IBIEN,DIK="^IBA(355.93,"_DA(1)_",""NPISTATUS"",",DA=IBRB
  1. D ^DIK
  1. S $P(^IBA(355.93,IBIEN,0),U,14)=IBRBNPI,^IBA(355.93,"NPI",IBRBNPI,IBIEN)=""
  1. Q
  1. ;
  1. XIT ;CLEAN AND EXIT
  1. Q
  1. ;
  1. XR ;Set the primary taxonomy code cross reference for field 42
  1. N ATAX S ATAX=""
  1. I $D(^IBA(355.93,DA(1),"TAXONOMY","D")) D:X=1
  1. . F S ATAX=$O(^IBA(355.93,DA(1),"TAXONOMY","D",1,ATAX)) Q:ATAX="" D
  1. .. K ^IBA(355.93,DA(1),"TAXONOMY","D",1,ATAX)
  1. .. I ATAX'=DA S $P(^IBA(355.93,DA(1),"TAXONOMY",ATAX,0),U,2)=0,^IBA(355.93,DA(1),"TAXONOMY","D",0,ATAX)=""
  1. S ^IBA(355.93,DA(1),"TAXONOMY","D",X,DA)=""
  1. Q
  1. ;
  1. KXR ;Kill primary taxonomy code cross reference for field 42
  1. N K
  1. F K=0,1 K ^IBA(355.93,DA(1),"TAXONOMY","D",K,DA)
  1. Q
  1. ;
  1. WARNR(IBIEN,IBOLDNPI,IBKEY) ;Warn user that the old NPI that was replaced is currently used by an entry in the New Person file (#200)
  1. N IBIEN200
  1. Q:$G(IBOLDNPI)=""
  1. S IBIEN200=$O(^VA(200,"ANPI",IBOLDNPI,""))
  1. Q:IBIEN200=""
  1. W !!,"WARNING: NPI ",IBOLDNPI," is also associated with Provider ",$$GET1^DIQ(200,IBIEN200,.01),".",!
  1. I $O(^XUSEC(IBKEY,""))="" W !!,"There are no holders of the ",IBKEY," security key on the VistA system. Contact your IRM department for further direction." Q
  1. W !,"A MailMan message has been sent to holders of the "_""""_IBKEY_""""_" security key."
  1. D MAILR(IBIEN,IBKEY,IBIEN200,IBOLDNPI)
  1. Q
  1. ;
  1. WARND(IBIEN,IBOLDNPI,IBKEY) ;Warn user that the old NPI that was deleted is currently used by an entry in the New Person file (#200)
  1. N IBIEN200
  1. Q:$G(IBOLDNPI)=""
  1. S IBIEN200=$O(^VA(200,"ANPI",IBOLDNPI,""))
  1. Q:IBIEN200=""
  1. W !!,"WARNING: NPI ",IBOLDNPI," is also associated with VA Provider ",$$GET1^DIQ(200,IBIEN200,.01),".",!
  1. I $O(^XUSEC(IBKEY,""))="" W !!,"There are no holders of the ",IBKEY," security key on the VistA system. Contact your IRM department for further direction." Q
  1. W !,"A MailMan message has been sent to holders of the "_""""_IBKEY_""""_" security key."
  1. D MAILD(IBIEN,IBKEY,IBIEN200,IBOLDNPI)
  1. Q
  1. ;
  1. MAILR(IBIEN,IBKEY,IBIEN200,IBOLDNPI) ;Send mailman message for replacement of NPI
  1. ;This subroutine is supported by IA# 10070
  1. ;Lookups in NEW PERSON file (#200) are supported by IA#10076
  1. N IBIEN2,XMDUZ,XMSUB,XMTEXT,XMY,IBMSG,XMZ,XMMG
  1. S IBIEN2=0 F S IBIEN2=$O(^XUSEC(IBKEY,IBIEN2)) Q:IBIEN2="" S XMY(IBIEN2)=""
  1. S XMDUZ=$S($G(DUZ):DUZ,1:.5),XMSUB="NPI Replacement"
  1. S IBMSG(1)="The NPI "_IBOLDNPI_" was changed to "_IBNPI_" for"
  1. S IBMSG(2)=$$GET1^DIQ(355.93,IBIEN,.01)_" in the IB NON/OTHER VA BILLING PROVIDER"
  1. S IBMSG(3)="file. The NPI "_IBOLDNPI_" is also associated with"
  1. S IBMSG(4)=$$GET1^DIQ(200,IBIEN200,.01)_" in the NEW PERSON file."
  1. S IBMSG(5)=""
  1. S IBMSG(6)="The same change may need to be made to the NEW PERSON file using the"
  1. S IBMSG(7)="Add/Edit NPI values for Providers option."
  1. S XMTEXT="IBMSG(" D ^XMD
  1. Q
  1. ;
  1. MAILD(IBIEN,IBKEY,IBIEN200,IBOLDNPI) ;Send mailman message for deletion of an NPI
  1. ;This subroutine is supported by IA# 10070
  1. ;Lookups in NEW PERSON file (#200) are supported by IA#10076
  1. N IBIEN2,XMDUZ,XMSUB,XMTEXT,XMY,IBMSG,XMZ,XMMG
  1. S IBIEN2=0 F S IBIEN2=$O(^XUSEC(IBKEY,IBIEN2)) Q:IBIEN2="" S XMY(IBIEN2)=""
  1. S XMDUZ=$S($G(DUZ):DUZ,1:.5),XMSUB="NPI Deletion"
  1. S IBMSG(1)="The NPI "_IBOLDNPI_" was deleted for "_$$GET1^DIQ(355.93,IBIEN,.01)
  1. S IBMSG(2)="in the IB NON/OTHER VA BILLING PROVIDER file. The NPI "_IBOLDNPI_" is also"
  1. S IBMSG(3)="associated with "_$$GET1^DIQ(200,IBIEN200,.01)_" in the NEW PERSON file."
  1. S IBMSG(4)=""
  1. S IBMSG(5)="The same change may need to be made to the NEW PERSON file using the"
  1. S IBMSG(6)="Add/Edit NPI values for Providers option."
  1. S XMTEXT="IBMSG(" D ^XMD
  1. Q