source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCEP82.m@ 1604

Last change on this file since 1604 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 5.2 KB
Line 
1IBCEP82 ;ALB/CLT, Special cross references and data entry for fields in file 355.93 ; 14 Apr 2006 9:41 AM
2 ;;2.0;INTEGRATED BILLING;**343,374**;21-MAR-94;Build 16
3 ;
4 ; Call at tags only
5 Q
6 ;This routine will ask for the NPI, check for duplicate entries, and check for proper
7 ;format using the double-add-double formula. If the NPI is being deleted it will ask
8 ;the user why it is being deleted.
9 ;If it is being deleted because of an erroneous entry it will be completely deleted.
10 ;If it is a valid NPI being deleted because of possible inappropriate usage it will be
11 ;maintained in the history cross reference to preclude anyone from using this NPI again.
12 ;
13EN ;Routine primary entry point
14 N DTOUT,DUOUT,DIR,DIE,DIC,DR,X,Y
15 N IBIEN,IBNPI,IBCHECK,IBOLDNPI,IBRBNPI,IBRB
16 S IBIEN=DA,IBOLDNPI=""
17EN1 ;
18 K DIR
19 S DIR(0)="FO^10:10",DIR("A")="NPI",DIR("?")="Enter a 10 digit National Provider Identifier"
20 I $G(DA) S:$P($G(^IBA(355.93,DA,0)),U,14)'="" (DIR("B"),IBOLDNPI)=$P($G(^IBA(355.93,DA,0)),U,14)
21 D ^DIR S IBCHECK=0
22 I X="^" W *7,!," EXIT NOT ALLOWED ??" G EN1
23 I $E(X)="^" W *7,!," JUMPING NOT ALLOWED ??" G EN1
24 I X="@" G:IBOLDNPI'="" DEL W *7,"??" G EN1
25 I $G(DUOUT)!$G(DTOUT)!(X="")!(Y=IBOLDNPI) G XIT
26 S IBNPI=Y
27 I '$$CHKDGT^XUSNPI(IBNPI) W !,*7,"Not a valid NPI. Please try again.",! G EN1
28 I $$NPIUSED^IBCEP81(IBNPI) G EN1
29 S IBCHECK=1
30 I IBOLDNPI="" D ACTI
31 I IBOLDNPI'="" D:IBNPI'=IBOLDNPI INACT
32 S $P(^IBA(355.93,IBIEN,0),U,14)=IBNPI,^IBA(355.93,"NPI",IBNPI,IBIEN)="",^IBA(355.93,"NPIHISTORY",IBNPI,IBIEN)=""
33 G XIT
34 ;
35ACTI ;CREATE AN ACTIVATED ENTRY IN MULTIPLE NPISTATUS FIELD
36 S DA(1)=IBIEN,DIC="^IBA(355.93,"_DA(1)_",""NPISTATUS"",",DIC(0)="L",X=$$NOW^XLFDT()
37 S DIC("DR")=".02////^S X=1;.03////^S X=IBNPI;.04////^S X=DUZ"
38 D FILE^DICN
39 S $P(^IBA(355.93,IBIEN,0),U,14)=IBNPI
40 Q
41 ;
42DEL ;NPI HAS BEEN DELETED
43 ;If the user deletes the NPI this subroutine will determine why it was deleted and if it was because it was found
44 ;in a false identity situation will mark it in history to never be used again.
45 S IBNPI=DIR("B")
46 K DIR
47 S DIR(0)="Y"
48 S DIR("A")="Are you sure you wish to delete this NPI"
49 S DIR("?")="You have indicated you wish to delete the NPI. This is a second chance check."
50 D ^DIR
51 G:Y(0)="NO" XIT
52 S DIR(0)="S^E:ERROR;V:VALID",DIR("A")="Was this a Valid NPI or an NPI entered in Error"
53 S DIR("?",1)="An example of an NPI entered in error is if the entry person transposed numbers,"
54 S DIR("?",2)="or if the NPI for one provider is accidentally assigned to a different provider."
55 S DIR("?")="Enter an 'E' for Error or a 'V' for Valid."
56 D ^DIR
57 I Y="E" D COMP W !,"The NPI has been deleted.",!
58 I Y="V" S IBCHECK=2 D INACT W !,"The NPI is now inactive.",!
59 Q
60 ;
61COMP ;COMPLETELY DELETE THE NPI
62 ;This subroutine will delete the NPI from the file 355.93.
63 S OIEN=$O(^IBA(355.93,IBIEN,"NPISTATUS","C",IBOLDNPI,"A"),-1)
64 D DELNPI(IBIEN,OIEN)
65 K ^IBA(355.93,"NPI",IBOLDNPI,DA),^IBA(355.93,"NPIHISTORY",IBOLDNPI,DA)
66 S IBRB=0
67 D ; Find the most recent status '0' (inactive) NPI entry in the list.
68 . N IBRBLST,IBRBTMP
69 . ; Don't want to roll back to the same number you are deleting.
70 . S IBRBLST(IBOLDNPI)=""
71 . S IBRBTMP="A"
72 . ; Go through each entry in reverse order
73 . F S IBRBTMP=$O(^IBA(355.93,IBIEN,"NPISTATUS",IBRBTMP),-1) Q:'IBRBTMP D Q:IBRB'=0
74 .. S IBRBLST=^IBA(355.93,IBIEN,"NPISTATUS",IBRBTMP,0)
75 .. ; If this is an 'active' entry then ignore it.
76 .. I $P(IBRBLST,U,2)=1 Q
77 .. ; If this entry does not have an NPI then ignore it.
78 .. I $P(IBRBLST,U,3)="" Q
79 .. ;If this is an inactive entry then report it.
80 .. I $P(IBRBLST,U,2)=0 S IBRB=IBRBTMP Q
81 .. Q
82 . Q
83 I IBRB>0 D ROLLBACK
84 Q
85 ;
86DELNPI(IEN,OIEN) ;DELETE-INVALID removes NPI from file.
87 NEW DIE,DIK,DIC,DA,DR,D,D0,DI,DIC,DQ,X
88 NEW DP,DM,DK,DL,DIEL
89 S DIE="^IBA(355.93,",DA=IEN,DR="41.01////@"
90 D ^DIE
91 S DA(1)=IEN,DIK="^IBA(355.93,"_DA(1)_",""NPISTATUS"",",DA=OIEN
92 D ^DIK
93 Q
94 ;
95INACT ;INACTIVATE AN ENTRY
96 ;This subroutine makes two entries in the NPI multiple field.
97 ;One for the deactivation of the old NPI and the second
98 ;for the activation of a new NPI.
99 S DA(1)=IBIEN,DIC="^IBA(355.93,"_DA(1)_",""NPISTATUS"",",DIC(0)="L",X=$$NOW^XLFDT()
100 S DIC("DR")=".02////^S X=0;.03////^S X=IBOLDNPI;.04////^S X=DUZ"
101 D FILE^DICN
102 S ^IBA(355.93,"NPIHISTORY",IBOLDNPI,DA(1))=""
103 K ^IBA(355.93,"NPI",IBOLDNPI,DA(1))
104 S $P(^IBA(355.93,IBIEN,0),U,14)=""
105 I $G(IBCHECK)<2 D ACTI
106 S ^IBA(355.93,"NPIHISTORY",IBNPI,DA(1))=""
107 Q
108 ;
109ROLLBACK ;Rollback or delete NPI
110 S IBRBNPI=$P(^IBA(355.93,IBIEN,"NPISTATUS",IBRB,0),U,3)
111 NEW DIE,DIK,DIC,DA,DR,D,D0,DI,DIC,DQ,X
112 NEW DP,DM,DK,DL,DIEL
113 S DA(1)=IBIEN,DIK="^IBA(355.93,"_DA(1)_",""NPISTATUS"",",DA=IBRB
114 D ^DIK
115 S $P(^IBA(355.93,IBIEN,0),U,14)=IBRBNPI,^IBA(355.93,"NPI",IBRBNPI,IBIEN)=""
116 Q
117 ;
118XIT ;CLEAN AND EXIT
119 Q
120 ;
121XR ;Set the primary taxonomy code cross reference for field 42
122 N ATAX S ATAX=""
123 I $D(^IBA(355.93,DA(1),"TAXONOMY","D")) D:X=1
124 . F S ATAX=$O(^IBA(355.93,DA(1),"TAXONOMY","D",1,ATAX)) Q:ATAX="" D
125 .. K ^IBA(355.93,DA(1),"TAXONOMY","D",1,ATAX)
126 .. 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)=""
127 S ^IBA(355.93,DA(1),"TAXONOMY","D",X,DA)=""
128 Q
129 ;
130KXR ;Kill primary taxonomy code cross reference for field 42
131 N K
132 F K=0,1 K ^IBA(355.93,DA(1),"TAXONOMY","D",K,DA)
133 Q
Note: See TracBrowser for help on using the repository browser.