source: FOIAVistA/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUSNPIE2.m@ 1635

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

initial load of FOIAVistA 6/30/08 version

File size: 8.3 KB
Line 
1XUSNPIE2 ;FO-OAKLAND/JLI - DATA ENTRY FOR INITIAL NPI VALUES ;06/06/07
2 ;;8.0;KERNEL;**410,435,454,462**;Jul 10, 1995;Build 3
3 Q
4 ;
5PRINTOPT ;
6 N DIR,%ZIS,ION,OPTION,PRNTFRMT,XUSDIV,XUSSORT,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
7 K IO("Q")
8 W !,"Select one of the following:",!!,?11,"1",?21,"All providers",!,?11,"2",?21,"All providers without NPI numbers",!
9 S DIR(0)="N^1:2",DIR("A")="Select a report option",DIR("B")="1" D ^DIR K DIR Q:Y'>0 S OPTION=+Y
10 S DIR(0)="Y",DIR("B")="NO",DIR("A")="Sort by DIVISION" D ^DIR K DIR Q:Y="^" S XUSDIV=+Y
11 S PRNTFRMT=1
12 I XUSDIV S DIR(0)="N^1:2",DIR("A")="Output type (1=Printed text or 2=^-delimited)" D ^DIR K DIR Q:Y'>0 S PRNTFRMT=Y
13 S DIR(0)="Y",DIR("B")="YES",DIR("A")="Sort by SERVICE/SECTION"_$S(XUSDIV>0:" (as well)",1:"") D ^DIR K DIR Q:Y="^" S XUSSORT=+Y
14 W !!,">>> Report processing time is approximately 10 minutes."
15 W !," Recommend text output be queued to a network printer."
16 W !
17 S %ZIS="MQ" D ^%ZIS Q:POP
18 I $D(IO("Q")) S ZTSAVE("OPTION")="",ZTSAVE("XUSSORT")="",ZTSAVE("XUSDIV")="",ZTSAVE("PRNTFRMT")="",ZTIO=ION,ZTRTN="DQ^XUSNPIE2",ZTDESC="NPI PRINT JOB FOR OPTION "_OPTION D ^%ZTLOAD W:$D(ZTSK) !,"Queued as Task "_ZTSK D HOME^%ZIS Q
19 ;
20DQ ; entry point for queued print job
21 U IO D PRNTPROV(OPTION,XUSSORT,XUSDIV,PRNTFRMT)
22 U IO D ^%ZISC
23 Q
24 ;
25PRNTPROV(OPTION,XUSSORT,XUSDIV,PRNTFRMT) ;
26 ; PRINT PROVIDER INFO
27 ;
28 ; OPTION SPECIFIES TYPE OF PRINT - 1=ALL PROVIDERS, 2=NEEDS NPI ONLY
29 ; XUSSORT INDICATES WHETHER SORTED BY SERVICE/SECTION
30 ; XUSDIV INDICATES WHETHER SORTED BY DIVISION
31 ; PRNTFRMT INDICATES TYPE OF OUTPUT, PRINTED OR ^-DELIMITED
32 ;
33 ; ZEXCEPT: IOSL - KERNEL VARIABLE
34 N PAGENUM,LINENUM,PROVNAME,TAXDESCR,TAXONOMY,SERVSECT,DIRUT,DTOUT
35 N GLOBLOC,IEN,NPI,DATETIME,GLOBVALU,NCOUNT,GLOBLOC1,XUSDIVNM,CNTTOTAL,CNTNONE,CNTEXMPT,CNTDONE,MULTDIV,MULTDIVC
36 S CNTTOTAL=0,CNTNONE=0,CNTEXMPT=0,CNTDONE=0
37 S PAGENUM=0,LINENUM=0
38 S DATETIME=$$NOW^XLFDT()
39 S GLOBLOC1=$$GETDATA(OPTION,XUSSORT,XUSDIV)
40 I PRNTFRMT'=1 W !,"PROVIDER_NAME^LAST4^IEN^NPI^TAXONOMY_CODE^TAXONOMY DESCRIPTION"_$S(XUSDIV:"^DIVISION",1:"")_$S(XUSSORT:"^SERVICE/SECTION",1:"")
41 S GLOBLOC=GLOBLOC1,XUSDIVNM="" F S XUSDIVNM=$O(@GLOBLOC1@(XUSDIVNM)) Q:XUSDIVNM="" D Q:$D(DIRUT)!$D(DTOUT)
42 . S SERVSECT="" F S SERVSECT=$O(@GLOBLOC1@(XUSDIVNM,SERVSECT)) Q:SERVSECT="" S GLOBLOC=$NA(@GLOBLOC1@(XUSDIVNM,SERVSECT)) D Q:$D(DIRUT)!$D(DTOUT)
43 . . I PRNTFRMT=1 D HEADER(OPTION,DATETIME,.PAGENUM,.LINENUM,XUSDIV,XUSDIVNM,XUSSORT,SERVSECT) Q:$D(DIRUT)!$D(DTOUT)
44 . . S PROVNAME="" F S PROVNAME=$O(@GLOBLOC@(PROVNAME)) Q:PROVNAME="" Q:$D(DIRUT)!$D(DTOUT) S IEN=0 F S IEN=$O(@GLOBLOC@(PROVNAME,IEN)) Q:IEN'>0 D Q:$D(DIRUT)!$D(DTOUT)
45 . . . S NCOUNT=0
46 . . . S TAXDESCR="" F S TAXDESCR=$O(@GLOBLOC@(PROVNAME,IEN,TAXDESCR)) Q:TAXDESCR="" S GLOBVALU=@GLOBLOC@(PROVNAME,IEN,TAXDESCR) D
47 . . . . S NPI=$P(GLOBVALU,U,3),TAXONOMY=$P(GLOBVALU,U,4) I PRNTFRMT=1 S NCOUNT=NCOUNT+1 W:NCOUNT=1 !,PROVNAME,?33,$$ALIGNRGT(IEN,11),?49,NPI W !,?6,TAXONOMY," ",TAXDESCR
48 . . . . I PRNTFRMT'=1 W !,PROVNAME_U_$E($$GET1^DIQ(200,IEN_",",9),6,9)_U_IEN_U_NPI_U_TAXONOMY_U_TAXDESCR_$S(XUSDIV:U_XUSDIVNM,1:"")_$S(XUSSORT:U_SERVSECT,1:"")
49 . . . . Q
50 . . . I PRNTFRMT=1 S LINENUM=LINENUM+NCOUNT+1 I LINENUM>(IOSL-4) D HEADER(OPTION,DATETIME,.PAGENUM,.LINENUM,XUSDIV,XUSDIVNM,XUSSORT,SERVSECT) Q:$D(DIRUT)!$D(DTOUT)
51 . . . Q
52 . . Q
53 . Q
54 I '($D(DIRUT)!$D(DTOUT)),PRNTFRMT=1 D
55 . S PROVNAME="" I $O(@GLOBLOC@(PROVNAME))="" W !,?20,"* * * N O D A T A F O U N D * * *",!! I 1
56 . E D
57 . . W !!,"Total Billable Providers:",?43,CNTTOTAL,!,"Billable Providers with an NPI:",?43,CNTDONE,!,"EXEMPT Billable Providers:",?43,CNTEXMPT,!,"Billable Providers Still Needing an NPI:",?43,CNTNONE
58 . . I $G(MULTDIV)>0 W !!,MULTDIV," Providers were repeated a total of ",MULTDIVC," times",!," due to listing under multiple divisions"
59 . . Q
60 . W !!,?27,"*** End of Report ***"
61 . Q
62 Q
63 ;
64HEADER(OPTION,DATETIME,PAGNOREF,LINNOREF,XUSDIV,XUSDIVNM,XUSSORT,SERVSECT) ;
65 ; ZEXCEPT: IOF,IOST KERNEL IO VARIABLES
66 ; ZEXCEPT: DIRUT,DTOUT NEWED IN CALLING PRNTPROV - INDICATE QUIT TO PRNTPROV
67 N TEMPVAL,DIR,X,Y
68 S PAGNOREF=PAGNOREF+1
69 ; Don't page feed on the first page
70 IF PAGNOREF>1 I $E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR I 'Y S DIRUT=1 Q
71 IF PAGNOREF>1 W @IOF
72 W:$E(IOST,1,2)'="C-" ! W "Active Provider Report",?48,$$FMTE^XLFDT(DATETIME)," Page: ",PAGNOREF
73 W !," Report Option: Provider List Active Providers",$S(OPTION=2:" Without NPI Numbers",1:"")
74 W !!,"Provider Name",?39,"IEN",?49,$S(OPTION'=2:"NPI",1:"")
75 W !," Taxonomy"
76 W !,"--------------------------------------------------------------------------------"
77 S LINNOREF=6
78 I XUSDIV W !,"DIVISION: ",XUSDIVNM," " S LINNOREF=LINNOREF+1
79 I XUSSORT W:'XUSDIV ! W "SERVICE/SECTION: ",SERVSECT S:'XUSDIV LINNOREF=LINNOREF+1
80 Q
81 ;
82GETDATA(OPTION,XUSSORT,XUSDIV) ; get data for reports for providers
83 N NPI,PROVNAME,TAXDESCR,TAXONOMY,XUSDEFLT,XUSDIVCN,XUSDIVN,XUSDIVNM,XUSGLOB
84 N XUSIEN,XUSSERVC,XUSVAL,CNTCLEAN
85 ; ZEXCEPT: CNTTOTAL,CNTNONE,CNTEXMPT,CNTDONE - NEWed and initialized in PRNTPROV or killed based on CNTCLEAN
86 S CNTCLEAN=0 I '$D(CNTTOTAL) S CNTCLEAN=1
87 S XUSGLOB=$NA(^TMP($J,"XUSNPIPRNT")) K @XUSGLOB
88 I 'XUSDIV S XUSDIVNM(1)=" ",XUSDEFLT=" "
89 I XUSDIV S XUSDEFLT=$$NS^XUAF4($$KSP^XUPARAM("INST")),XUSDEFLT=$P(XUSDEFLT,U)
90 I 'XUSSORT S XUSSERVC=" "
91 F XUSIEN=0:0 S XUSIEN=$O(^VA(200,XUSIEN)) Q:XUSIEN'>0 I ($$ACTIVE^XUSER(XUSIEN)'=""),($P($$ACTIVE^XUSER(XUSIEN),"^",2)'="TERMINATED") S XUSVAL=$$CHEKNPI^XUSNPIED(XUSIEN),XUSVAL=$$NPISTATS^XUSNPIED(XUSIEN) I XUSVAL'="" D
92 . S PROVNAME=$$GET1^DIQ(200,XUSIEN_",",.01),NPI=$$GETNPI^XUSNPIED(XUSIEN),TAXONOMY=$$GETTAXON^XUSNPIED(XUSIEN,.TAXDESCR) I TAXONOMY=-1 S TAXONOMY=" ",TAXDESCR=" "
93 . I NPI="",$$EXMPTNPI^XUSNPIED(XUSIEN) S NPI="EXEMPTED "
94 . S CNTTOTAL=$G(CNTTOTAL)+1 S:NPI="" CNTNONE=$G(CNTNONE)+1 S:NPI="EXEMPTED " CNTEXMPT=$G(CNTEXMPT)+1 S:NPI?10N CNTDONE=$G(CNTDONE)+1
95 . I '((XUSVAL="N")!(OPTION'=2)) Q
96 . I XUSSORT S XUSSERVC=$$GET1^DIQ(200,XUSIEN_",",29) I XUSSERVC="" S XUSSERVC=" "
97 . I XUSDIV D
98 . . K XUSDIVNM S XUSDIVCN=0,XUSDIVNM(1)=XUSDEFLT
99 . . F XUSDIVN=0:0 S XUSDIVN=$O(^VA(200,XUSIEN,2,XUSDIVN)) Q:XUSDIVN'>0 S XUSDIVCN=XUSDIVCN+1,XUSDIVNM(XUSDIVCN)=$$GET1^DIQ(200.02,XUSDIVN_","_XUSIEN_",",.01)
100 . . I XUSDIVCN>1 S MULTDIV=$G(MULTDIV)+1,MULTDIVC=$G(MULTDIVC)+XUSDIVCN-1
101 . . Q
102 . F XUSDIVN=0:0 S XUSDIVN=$O(XUSDIVNM(XUSDIVN)) Q:XUSDIVN'>0 S @XUSGLOB@(XUSDIVNM(XUSDIVN),XUSSERVC,PROVNAME,XUSIEN,TAXDESCR)=PROVNAME_U_XUSIEN_U_NPI_U_TAXONOMY_U_TAXDESCR
103 . Q
104 I CNTCLEAN K CNTTOTAL,CNTNONE,CNTEXMPT,CNTDONE
105 Q XUSGLOB
106 ;
107ALIGNRGT(TEXT,WIDTH) ; align text right in a specified width
108 N RESULT
109 S $P(RESULT," ",WIDTH)=" ",RESULT=RESULT_TEXT,RESULT=$E(RESULT,$L(RESULT)-WIDTH+1,$L(RESULT))
110 Q RESULT
111 ;
112CHKOLD1(IEN) ; check for earlier value, and activate if present
113 N IEN1,STATUS,NPI,DATE,XUFDA
114 S IEN1=$O(^VA(200,IEN,"NPISTATUS"," "),-1) I IEN1>0 D I STATUS=0 D CHKOLD1(IEN)
115 . S STATUS=^VA(200,IEN,"NPISTATUS",IEN1,0),NPI=$P(STATUS,U,3),DATE=$P(STATUS,U),STATUS=$P(STATUS,U,2)
116 . I STATUS=0 D DELETNPI(IEN,IEN1,DATE) Q ; entry making it INACTIVE - remove it
117 . I STATUS=1 D SET^XUSNPIE1(IEN,NPI)
118 . Q
119 Q
120 ;
121DELETNPI(IEN,OIEN,ODATEVAL) ;
122 N XUFDA
123 I $D(ODATEVAL) S XUFDA(200.042,OIEN_","_IEN_",",.01)="@"
124 S XUFDA(200,IEN_",",41.99)="@",XUFDA(200,IEN_",",41.98)="@"
125 D FILE^DIE("","XUFDA")
126 Q
127 ;
128CLERXMPT ; edit entry indicating whether a provider is exempt from needing an NPI
129 N DIC,DIR,FDA,IEN,Y
130 W ! S DIC="^VA(200,",DIC(0)="AEQ" S DIC("A")="select Provider: " D ^DIC Q:Y'>0 S IEN=+Y
131 I $$HASNPI^XUSNPIED(IEN) W !,"This Provider already has an NPI value. Nothing to do." Q
132 I '$$CHEKNPI^XUSNPIED(IEN),'$$EXMPTNPI^XUSNPIED(IEN) W !,"This Provider does not appear to need an NPI or Exemption." Q
133 I $$EXMPTNPI^XUSNPIED(IEN) D Q ; currently marked as Exempt
134 . S DIR(0)="Y",DIR("A")="Provider is currently EXEMPT from needing an NPI, set to NEEDS an NPI (Y/N)" D ^DIR I 'Y Q
135 . S FDA(200,IEN_",",41.98)="N" D FILE^DIE("","FDA")
136 . W !,$S($$NEEDSNPI^XUSNPIED(IEN):"File updated",1:"Ecountered a problem updating file, status NOT set to NEEDS an NPI")
137 . Q
138 ; check to make sure provider should be exempt
139 S DIR(0)="Y",DIR("A")="Confirm that Provider should be Exempt from needing an NPI (Y/N)" D ^DIR I 'Y Q
140 ; and update file to show as exempt
141 S FDA(200,IEN_",",41.98)="E" D FILE^DIE("","FDA")
142 W !,$S($$EXMPTNPI^XUSNPIED(IEN):"File updated",1:"Ecountered a problem updating file, status NOT set to EXEMPT")
143 Q
Note: See TracBrowser for help on using the repository browser.