source: FOIAVistA/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPRPIX1.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 6.1 KB
Line 
1RMPRPIX1 ;HINCIO/ODJ - PIP HCPCS ITEM FILE 661.11 APIs ;3/8/01
2 ;;3.0;PROSTHETICS;**61**;Feb 09, 1996
3 Q
4 ;
5 ;***** IEN - get the ien for a HCPCS item
6 ;
7 ; Inputs:
8 ; RMPR("STATION") - Station ien
9 ; RMPR("HCPCS") - HCPCS code
10 ; RMPR("ITEM") - HCPCS Item
11 ;
12 ; Outputs:
13 ; RMPR("IEN") - ien for HCPCS Item rec.
14 ; RMPRERR - exit code returned by function
15 ; 0 - no problems
16 ; 1,2,3 - null inputs
17IEN(RMPR) ;
18 N RMPRIEN,RMPRERR
19 S RMPRERR=0
20 I $G(RMPR("STATION"))="" S RMPRERR=1 G IENX
21 I $G(RMPR("HCPCS"))="" S RMPRERR=2 G IENX
22 I $G(RMPR("ITEM"))="" S RMPRERR=3 G IENX
23 S RMPRIEN=$O(^RMPR(661.11,"ASHI",RMPR("STATION"),RMPR("HCPCS"),RMPR("ITEM"),""))
24 S RMPR("IEN")=RMPRIEN
25IENX Q RMPRERR
26 ;
27 ;***** CRE - Create a new HCPCS Item (661.11) record
28 ;
29 ; Inputs
30CRE(RMPR) ;
31 N RMPRCRE,RMPRFDA,RMPRFME,RMPRIEN,X,Y,DA
32 S RMPRCRE=0
33 L +^RMPR(661.11)
34 ;
35 ; Get new seq. number for Item
36 I $G(RMPR("ITEM"))="" D
37 . S RMPR("ITEM")=1+$O(^RMPR(661.11,"ASHI",RMPR("STATION"),RMPR("HCPCS"),""),-1)
38 . Q
39 ;
40 ; Update 661.11
41 S RMPRFDA(661.11,"+1,",.01)=RMPR("HCPCS")
42 S RMPRFDA(661.11,"+1,",1)=RMPR("ITEM")
43 S RMPRFDA(661.11,"+1,",2)=RMPR("DESCRIPTION")
44 S RMPRFDA(661.11,"+1,",3)=RMPR("STATION")
45 S RMPRFDA(661.11,"+1,",4)=RMPR("SOURCE")
46 S RMPRFDA(661.11,"+1,",5)=$G(RMPR("UNIT"))
47 S RMPRFDA(661.11,"+1,",6)=RMPR("HCPCS")_"-"_RMPR("ITEM")
48 S RMPRFDA(661.11,"+1,",7)=RMPR("ITEM MASTER IEN")
49 D UPDATE^DIE("","RMPRFDA","RMPRIEN","RMPRFME")
50 L -^RMPR(661.11)
51 I $D(RMPRFME) S RMPRCRE=1 G CREX
52 S RMPR("IEN")=RMPRIEN(1)
53 ;
54 ; Update Inventory Flag
55 K RMPRFDA,RMPRFME
56 S RMPRIEN=$O(^RMPR(661.1,"B",RMPR("HCPCS"),""))_","
57 S RMPRFDA(661.1,RMPRIEN,10)=1
58 D FILE^DIE("","RMPRFDA","RMPRFME")
59CREX Q RMPRCRE
60 ;
61 ;***** UPD - Update HCPCS Item record (661.11)
62UPD(RMPR11) ;
63 N RMPRFDA,RMPRFME,X,Y,DA,RMPRIEN,RMPRERR
64 S RMPRERR=0
65 S RMPRIEN=RMPR11("IEN")_","
66 I $D(RMPR11("HCPCS")) D
67 . S RMPRFDA(661.11,RMPRIEN,.01)=RMPR11("HCPCS")
68 . Q
69 I $D(RMPR11("ITEM")) D
70 . S RMPRFDA(661.11,RMPRIEN,1)=RMPR11("ITEM")
71 . Q
72 S:$D(RMPR11("DESCRIPTION")) RMPRFDA(661.11,RMPRIEN,2)=RMPR11("DESCRIPTION")
73 S:$D(RMPR11("SOURCE")) RMPRFDA(661.11,RMPRIEN,4)=RMPR11("SOURCE")
74 S:$D(RMPR11("UNIT")) RMPRFDA(661.11,RMPRIEN,5)=RMPR11("UNIT")
75 S:$D(RMPR11("HCPCS-ITEM")) RMPRFDA(661.11,RMPRIEN,6)=RMPR11("HCPCS-ITEM")
76 S:$D(RMPR11("ITEM MASTER IEN")) RMPRFDA(661.11,RMPRIEN,7)=RMPR11("ITEM MASTER IEN")
77 D:$D(RMPRFDA) FILE^DIE("","RMPRFDA","RMPRFME")
78 I $D(RMPRFME) S RMPRERR=1 G UPDX
79UPDX Q RMPRERR
80 ;
81 ;***** DUP - Check that a HCPCS Item does not have a different
82 ; source on the same code
83DUP(RMPR,RMPRDUP) ;
84 N RMPRS,RMPRERR,RMPR1,RMPR1I
85 S RMPRERR=0,RMPRDUP=0
86 S RMPRERR=$$IEN(.RMPR) G:RMPRERR DUPX
87 I RMPR("IEN")="" G DUPX
88 S RMPR1("IEN")=RMPR("IEN")
89 S RMPRERR=$$GET(.RMPR1) G:RMPRERR DUPX
90 S RMPRERR=$$ETOI(.RMPR1,.RMPR1I) G:RMPRERR DUPX
91 I RMPR1I("SOURCE")=RMPR("SOURCE") D
92 . S RMPRDUP=0
93 . Q
94 E D
95 . S RMPRDUP=1
96 . Q
97DUPX Q RMPRERR
98 ;
99 ;***** GET - read HCPCS Item 661.11 record
100GET(RMPR) ;
101 N RMPRCRE,RMPRFME,RMPROUP,RMPRIEN
102 S RMPRCRE=0
103 I $G(RMPR("IEN"))="" D
104 . S RMPRCRE=$$IEN(.RMPR)
105 . Q
106 I RMPRCRE G GETX
107 S RMPRIEN=RMPR("IEN")_","
108 D GETS^DIQ(661.11,RMPRIEN,"*","","RMPROUP","RMPRFME")
109 I $D(RMPRFME) S RMPRCRE=1 G GETX
110 S RMPR("HCPCS")=RMPROUP(661.11,RMPRIEN,.01)
111 S RMPR("ITEM")=RMPROUP(661.11,RMPRIEN,1)
112 S RMPR("DESCRIPTION")=RMPROUP(661.11,RMPRIEN,2)
113 S RMPR("STATION")=RMPROUP(661.11,RMPRIEN,3)
114 S RMPR("SOURCE")=RMPROUP(661.11,RMPRIEN,4)
115 S RMPR("UNIT")=RMPROUP(661.11,RMPRIEN,5)
116 S RMPR("HCPCS-ITEM")=RMPROUP(661.11,RMPRIEN,6)
117 S RMPR("ITEM MASTER")=RMPROUP(661.11,RMPRIEN,7)
118 S RMPR("STATUS")=RMPROUP(661.11,RMPRIEN,8)
119GETX Q RMPRCRE
120 ;
121 ; Given HCPCS code get 1st active HCPCS record in 661.1 file
122 ; If none are active then use 1st ien (should never occur)
123HPACT(RMPR) ;
124 N RMPRCRE,RMPRFME,RMPROUP,RMPRIEN,RMPRE,RMPRI
125 S RMPRCRE=0
126 I $G(RMPR("HCPCS"))="" S RMPRCRE=1 G HPACTX
127 S RMPRI=""
128 F S RMPRI=$O(^RMPR(661.1,"B",RMPR("HCPCS"),RMPRI)) Q:RMPRI="" D Q:RMPRE("STATUS")="ACTIVE"
129 . K RMPRE S RMPRE("IEN")=RMPRI
130 . S RMPRCRE=$$HPGET(.RMPRE)
131 . Q
132 I $G(RMPRE("IEN"))'="" M RMPR=RMPRE
133HPACTX Q RMPRCRE
134 ;
135 ;***** HPGET - Get a HCPCS record
136HPGET(RMPR) ;
137 N RMPRCRE,RMPRFME,RMPROUP,RMPRIEN
138 S RMPRCRE=0
139 I $G(RMPR("IEN"))="" S RMPRCRE=1 G HPGETX
140 S RMPRIEN=RMPR("IEN")_","
141 D GETS^DIQ(661.1,RMPRIEN,"*","","RMPROUP","RMPRFME")
142 I $D(RMPRFME) S RMPRCRE=2 G HPGETX
143 S RMPR("HCPCS")=RMPROUP(661.1,RMPRIEN,.01)
144 S RMPR("SHORT DESC")=RMPROUP(661.1,RMPRIEN,.02)
145 S RMPR("NEW HCPC IEN")=RMPROUP(661.1,RMPRIEN,1)
146 S RMPR("CPT CODE")=RMPROUP(661.1,RMPRIEN,2)
147 S RMPR("STATUS")=RMPROUP(661.1,RMPRIEN,3)
148 S RMPR("NPPD REPAIR CODE")=RMPROUP(661.1,RMPRIEN,5)
149 S RMPR("NPPD NEW CODE")=RMPROUP(661.1,RMPRIEN,6)
150 S RMPR("CALC FLAG")=RMPROUP(661.1,RMPRIEN,9)
151 S RMPR("INV FLAG")=RMPROUP(661.1,RMPRIEN,10)
152 S RMPR("LAB TIME")=RMPROUP(661.1,RMPRIEN,11)
153HPGETX Q RMPRCRE
154 ;
155 ;***** HPETOI - Convert external to internal form for HCPCS rec.
156HPETOI(RMPRE,RMPRI) ;
157 N RMPRFDA,RMPRIEN,RMPRFDI,RMPRFME,RMPRERR
158 S RMPRERR=0
159 S RMPRIEN=RMPRE("IEN")_","
160 D GETS^DIQ(661.1,RMPRIEN,"*","I","RMPRFDI","RMPRFME")
161 I $D(RMPRFME) S RMPRERR=1 G HPETOIX
162 S RMPRI("IEN")=RMPRE("IEN")
163 S RMPRI("NEW HCPC IEN")=RMPRFDI(661.1,RMPRIEN,1,"I")
164 S RMPRI("CPT CODE")=RMPRFDI(661.1,RMPRIEN,2,"I")
165 S RMPRI("STATUS")=RMPRFDI(661.1,RMPRIEN,3,"I")
166 S RMPRI("NPPD REPAIR CODE")=RMPRFDI(661.1,RMPRIEN,5,"I")
167 S RMPRI("NPPD NEW CODE")=RMPRFDI(661.1,RMPRIEN,6,"I")
168 S RMPRI("CALC FLAG")=RMPRFDI(661.1,RMPRIEN,9,"I")
169 S RMPRI("INV FLAG")=RMPRFDI(661.1,RMPRIEN,10,"I")
170 S RMPRI("LAB TIME")=RMPRFDI(661.1,RMPRIEN,11,"I")
171HPETOIX Q RMPRERR
172 ;
173 ;***** ETOI - Convert external to internal form
174ETOI(RMPRE,RMPRI) ;
175 N RMPRFDA,RMPRIEN,RMPRFDI,RMPRFME,RMPRERR
176 S RMPRERR=0
177 S RMPRIEN=RMPRE("IEN")_","
178 D GETS^DIQ(661.11,RMPRIEN,"*","I","RMPRFDI","RMPRFME")
179 I $D(RMPRFME) S RMPRERR=1 G ETOIX
180 S RMPRI("IEN")=RMPRE("IEN")
181 S RMPRI("HCPCS")=RMPRFDI(661.11,RMPRIEN,.01,"I")
182 S RMPRI("ITEM")=RMPRFDI(661.11,RMPRIEN,1,"I")
183 S RMPRI("DESCRIPTION")=RMPRFDI(661.11,RMPRIEN,2,"I")
184 S RMPRI("STATION")=RMPRFDI(661.11,RMPRIEN,3,"I")
185 S RMPRI("SOURCE")=RMPRFDI(661.11,RMPRIEN,4,"I")
186 S RMPRI("UNIT")=RMPRFDI(661.11,RMPRIEN,5,"I")
187 S RMPRI("ITEM MASTER IEN")=RMPRFDI(661.11,RMPRIEN,7,"I")
188ETOIX Q RMPRERR
Note: See TracBrowser for help on using the repository browser.