Produced by Araxis Merge on 11/9/2018 12:33:56 AM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | CPEE_Build9_Sprint27.zip\HAC_CPE_CH | CHMIMCC.m | Mon Nov 5 16:43:08 2018 UTC |
2 | CPEE_Build9_Sprint27.zip\HAC_CPE_CH | CHMIMCC.m | Mon Nov 5 17:48:18 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 1898 |
Changed | 1 | 6 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | CHMIMCC ;H AC/AJM; SU BMIT CLAIM S TO CLAIM CHECK | |
2 | ;;1.0;CHA MPVA SYSTE M;;JULY 4, 1990;Buil d 10 | |
3 | ; Claim C heck mods (DEV000105 ) | |
4 | ; devel opers: AJM | |
5 | ; SKD | |
6 | ; | |
7 | ; MTN0024 55-01 06-0 5-07 ajm; fix http t imeout err ors on Cla imCheck ca ll | |
8 | ; MTN0024 54-01 06-0 5-07 ajm; limit char acters sen t in Claim Check emai l msgs < 2 54 | |
9 | ; MTN0024 83-01 06-0 6-07 ajm; capture xm l input on soap erro rs. | |
10 | ; DEV0025 32-01 07-2 3-07 ajm; claim chec k unable t o handle l ine number s greater than three digits | |
11 | ; DEV0024 57-01 07-2 3-07 ajm; tmp sequen tial dir n eeds wide open permi ssions for all users . | |
12 | ; MTN0120 62-01 04-0 6-11 jeh; added HAC PST mailgr oup. | |
13 | ; DEV0078 20 09-0 2-11 ew; a dded check for UCI o f DEVSLA | |
14 | ; MTN0161 94-01 09-2 0-12 jeh; Update "Cl aim Check Processing Error" di stribution list | |
15 | ; | |
16 | ; The ent ry point i s ENT func tion. This routine t akes the c laim | |
17 | ; informa tion from the ^%ZSTA T global a nd calls t he Claim C heck | |
18 | ; web ser vice. | |
19 | ; ------- ---------- ---------- ---------- ---------- ---------- ----- | |
20 | ; The rou tine uses claim inpu t data sto red in the ^%ZSTAT g lobal. | |
21 | ; The for mat of thi s data is discribed below: | |
22 | ; ^%ZS TAT("CC",u ci,claimIE N)=P1^P2^P 3^... | |
23 | ; P1 = CLAIM NUMB ER | |
24 | ; P2 = PAY FILE ( e.g. "CHMP AY(" ) | |
25 | ; P3 = DATE OF SE RVICE / ST MT FROM DA TE | |
26 | ; P4 = SEX | |
27 | ; P5 = DATE OF BI RTH | |
28 | ; P6 = VENDOR ID | |
29 | ; P7 = OUTPATIENT DIAGNOSIS | |
30 | ; P8 = OUTPATIENT DIAGNOSIS | |
31 | ; P9 = OUTPATIENT DIAGNOSIS | |
32 | ; P10 = OUTPATIENT DIAGNOSIS | |
33 | ; P11 = PROCEDURE COUNT | |
34 | ; | |
35 | ; | |
36 | ; ^%ZS TAT("CC",U CI,CLAIMIE N,"PX",I)= P1^P2^... | |
37 | ; P1 = PROCEDURE CODE | |
38 | ; P2 = CHARGE FOR SERVICE | |
39 | ; P3 = PROCEDURE MODIFIER | |
40 | ; | |
41 | ; | |
42 | ; ------- ---------- ---------- ---------- ---------- ---------- ----- | |
43 | ; The Fo rmat of th e return g lobal is d iscribed b elow: | |
44 | ; | |
45 | ; ^T MP($J,"CC- RETURN", c laimIEN, l inenumber, procedure Code, "CC- AGE-CONFLI CT") = single code age conflict. | |
46 | ; ^T MP($J,"CC- RETURN", l inenumber, procedure Code, "CC- ASST-SURG" ) = indica tes whethe r proceedu re may not require a n assistan t. | |
47 | ; ^T MP($J,"CC- RETURN", l inenumber, procedure Code, "CC- COSMETIC/U NLISTED") = indi cates cosm etic and u nlisted pr oceedures. | |
48 | ; ^T MP($J,"CC- RETURN", l inenumber, procedure Code, "CC- EXPERIMENT AL-PROC") = indi cates if t he proceed ure is exp erimental | |
49 | ; ^T MP($J,"CC- RETURN", l inenumber, procedure Code, "CC- LINE-ORIG" ) = indica tes the or igin of th e proceedu re | |
50 | ; ^T MP($J,"CC- RETURN", l inenumber, procedure Code, "CC- LINE-SURV- PROC-CODE" ) = proced ure code f rom the cl aim line t hat caused the audit that was reported f or this cl aim line. | |
51 | ; ^T MP($J,"CC- RETURN", l inenumber, procedure Code, "CC- OUTPUT-MES SAGE") = contai ns the CPT or HCPCS code that caused the multi-cod e ClaimChe ck audit f ailure. | |
52 | ; ^T MP($J,"CC- RETURN", l inenumber, procedure Code, "CC- RESULT") = result o f audit | |
53 | ; ^T MP($J,"CC- RETURN", l inenumber, procedure Code, "CC- SEX-CONFLI CT") = report s single-c ode sex co nflicts | |
54 | ; ^T MP($J,"CC- RETURN", l inenumber, procedure Code, "CC- LINE-CHARG E-AMOUNT") = charge for servi ce | |
55 | ; ^T MP($J,"CC- RETURN", l inenumber, procedure Code, "CC- LINE-ERROR -CODE") = Code v alue indic ating that a coding error was detected o n this cla im line | |
56 | ; ^T MP($J,"CC- RETURN", c laimIEN, l inenumber, procedure Code, "MOD ") = proc edure modi fier | |
57 | ; | |
58 | ; ------- ---------- ---------- ---------- ---------- ---------- ---- | |
59 | ; | |
60 | ; See the "HAC-Clai mCheck8.5 Mim Specif ication.do c" for an explanatio n | |
61 | ; of o f the opti ons and va lues sent to the MIM and the v alues retu rned by th e | |
62 | ; MIM. | |
63 | ; | |
64 | ; ------- ---------- ---------- ---------- ---------- ---------- ---- | |
65 | ; Note: a ll functio ns are pub lic in ord er to aid in debuggi ng. Other wise the | |
66 | ; l ocation of the code is not sho wn when st epping thr ough the c ode or | |
67 | ; w hen readin g a stack trace. | |
68 | ; | |
69 | /// This is the Ent ry Point f or calling Claim Che ck. The p rocedure | |
70 | /// reads the claim data from the ^%ZST AT array, performs p reprocessi ng | |
71 | /// of th e claim da ta, calls the MIM we b service, does some post proc essing | |
72 | /// of th e Claim Ch eck result s, and ret urns the r esults. | |
73 | /// | |
74 | /// | |
75 | /// Param eters: | |
76 | /// CL IEN - The cl aim's Inte rnal Entry Number | |
77 | /// UC I - The User Class Ide ntifier | |
78 | /// | |
79 | /// Retur n: | |
80 | /// pl aces the r esult of c laim check processin g in ^TMP( $J,"CC-RET URN") | |
81 | /// | |
82 | /// Note if the MIM returns a n CLAIM-AB END-CODE o r a CLAIM- ERROR code | |
83 | /// oth er than no rmal opera tion then a null ret urn array is returne d | |
84 | /// and the error is logged and for a bnormal CL AIM-ABEND- CODEs an | |
85 | /// err or email i s returned . | |
86 | /// | |
87 | ENT(CLIEN, UCI) PUBL IC { | |
88 | SET $Z ERROR="" | |
89 | SET $Z TRAP="MYER R" | |
90 | QUIT:' $DATA(^%ZS TAT("CC",U CI,CLIEN)) ; bai l if the d ata can't be found | |
91 | ; copy the conte nts of the %ZSTAT gl obal into a working tmp global | |
92 | ; this array wil l also act as a temp orary plac e holder | |
93 | ; for Claim Chec k pre and post proce ssing | |
94 | MERGE ^TMP($J, " CC-WORKSPA CE") = ^%Z STAT("CC", UCI,CLIEN) | |
95 | SET ^T MP($J, "CC -WORKSPACE ", "clien" ) = CLIEN | |
96 | ; deci de which l ine items to send to Claim Che ck (i.e., mark which lines | |
97 | ; to f ilter out) | |
98 | DO Tag ProcsToFil ter() | |
99 | ; get a MIMUITYP E object p opulated w ith data t o send to Claim Chec k | |
100 | SET Mi m=$$Create CCinput() | |
101 | ; Clai mCheck can 't handle line numbe rs contain ing greate r than 3 d igits; | |
102 | ; it w ill trunca te a 4 dig it number to three, returning an incorre ct | |
103 | ; line number. If we have claims wi th line nu mbers grea ter than 4 digits | |
104 | ; don' t send the m to claim check (DE V002532 aj m 07-23-07 ) | |
105 | IF $$L ineNumGT(M im, 999) { | |
106 | KILL ^TMP($J,"C C-WORKSPAC E") | |
107 | QUIT | |
108 | } | |
109 | IF (Mi m.LINEGROU P.LINEDATA .Count() = 0) { | |
110 | DO CreateRes ultsNoItem sToSend( C LIEN ) | |
111 | } ELSE { | |
112 | ; s end the da ta to Clai m Check an d get the results in | |
113 | ; a MIMUITYPE object | |
114 | SET ccresult= $$GetClaim CheckResul ts( Mim ) | |
115 | ; A BEND CODE other than "NO" sign als seriou s error in claim che ck | |
116 | ; p rocessing. Other Cla ims will n ot get pro cessed als o; send em ail of err or | |
117 | SET AbendCode = ccresul t.CLAIMGRO UP.CLAIMRE SULT.CLAIM ABENDCODE | |
118 | IF (AbendCode '="NO") { | |
119 | SET xaddr(1) = 274577 | |
120 | SET xsub = "C laimCheck ABEND Erro r" | |
121 | ;li mit the si ze of the message so that Mail Man's limi t of 254 i s not exce eded | |
122 | SET xtext(0) = $EXTRACT (ccresult. CLAIMGROUP .CLAIMRESU LT.CLAIMAB ENDMESSAGE ,1,80) | |
123 | DO SendErrorN otificatio n(.xaddr, xsub, .xte xt) | |
124 | SET $ECODE=", U"_xtext(0 )_"," | |
125 | } | |
126 | ; C laim Error indicates an error with a par ticular cl aim; not a s serious | |
127 | ; a s an ABEND error; ot her claims may still process t hrough. | |
128 | SET clmErrorC ode = ccre sult.CLAIM GROUP.CLAI MRESULT.CL AIMERRORCO DE | |
129 | If (clmErrorC ode'="00") { | |
130 | SET ERRORTYPE = "CLAIM CHECK ALER T" | |
131 | SET $ECODE=", U"_ccresul t.CLAIMGRO UP.CLAIMRE SULT.CLAIM ERRORMESSA GE_"," | |
132 | } | |
133 | ; T ake the MI MUITYPE wi th the res ults retur n from Cla im Check | |
134 | ; a nd return them in a more usabl e form in the Return array | |
135 | DO CollateRes ults( ccre sult ) | |
136 | DO AdjustChar gedAmounts () | |
137 | } | |
138 | //TODO : uncommen t out if n eeded for future deb ugging or reporting | |
139 | ;DO cc result.%Sa ve() | |
140 | KILL ^ TMP($J,"CC -WORKSPACE ") | |
141 | QUIT | |
142 | MYERR | |
143 | KILL ^TMP ($J,"CC-WO RKSPACE") ; on error kill part ial result s if any | |
144 | KILL ^TMP ($J,"CC-RE TURN") ; o n error ki ll partial results i f any | |
145 | SET $ZTRA P="" ; preven t infinite loops if RecordErro r errors o ut | |
146 | // DON'T LOG ERROR 462, PROVI DER REQUIR ED; TAKEN CARE OF BY VISTA | |
147 | IF ('($EC ODE["E462 ")) { ;AJ M 06-04-07 | |
148 | SE T:'$D(ERRO RTYPE) ERR ORTYPE="CL AIM CHECK ERROR" | |
149 | DO RecordErr or(ERRORTY PE) | |
150 | } | |
151 | } | |
152 | /// Takes the claim data in t he TmpStat array and returns a | |
153 | /// MIMUI TYPE objec t with all the data needed by Claim Chec k | |
154 | /// to pr ocess the claim. | |
155 | /// | |
156 | /// Retur ns: | |
157 | /// A Mim object populated with the claim data | |
158 | CreateCCin put( ) PUB LIC { | |
159 | SET Mi m = ##clas s(ccaudit2 .MIMUITYPE ).%New() | |
160 | DO Add SystemData (.Mim) | |
161 | DO Add ClaimData( .Mim) | |
162 | DO Add DiagGroupD ata(.Mim) ; must cal l before A ddLineGrou pData (nee ds Diagnos is to be s et) | |
163 | DO Add LineGroupD ata(.Mim) | |
164 | QUIT M im | |
165 | } | |
166 | /// Popul ates the M IMUITYPE o bject with the Claim Check rel ated | |
167 | /// Syste m data nee ded by Cla im Check t o process claims. | |
168 | /// | |
169 | /// Param eters: | |
170 | /// Mi m - passed in by ref erence, In tegration module dat a structur e. | |
171 | /// | |
172 | AddSystemD ata(Mim) P UBLIC { | |
173 | SET Mim.S YSTEMDATA = ##class( ccaudit2.S YSTEMDATAT YPE).%New( ) | |
174 | ;adding M IMOPTIONS | |
175 | SET Mim.S YSTEMDATA. MIMOPTIONS = ##class (ccaudit2. MIMOPTIONS TYPE).%New () | |
176 | SET Mim.S YSTEMDATA. MIMOPTIONS .DEFINITIO NNAME = "M IM" | |
177 | SET Mim.S YSTEMDATA. MIMOPTIONS .MODEXPPOS TOPT = "1" | |
178 | SET Mim.S YSTEMDATA. MIMOPTIONS .MODEXPPRE OPT = "1" | |
179 | SET Mim.S YSTEMDATA. MIMOPTIONS .UNITEXPPO STOPT = "2 " | |
180 | SET Mim.S YSTEMDATA. MIMOPTIONS .UNITEXPPR EOPT = "0" | |
181 | SET Mim.S YSTEMDATA. MIMOPTIONS .EXPPAYPCT IND = "N" | |
182 | ;adding P RODUCTOPTI ONS | |
183 | SET Produ ctOption = ##class(c caudit2.PR ODUCTOPTIO NSTYPE).%N ew() | |
184 | SET Produ ctOption.A GEREPLACEI ND = "N" | |
185 | SET Produ ctOption.C ALLSEQUENC E = "0" | |
186 | SET Produ ctOption.I OSREPLACEI ND = "N" | |
187 | SET Produ ctOption.C LAIMCHECKA CCOUNT = " HAC" | |
188 | SET Produ ctOption.M 51PROCESSI NGIND = "0 " | |
189 | SET Produ ctOption.N VFREPLACEI ND = "N" | |
190 | SET Produ ctOption.P RODUCTNAME = "ClaimC heck" | |
191 | SET Produ ctOption.R ETURNCLAIM CHECKRESUL TS = "Y" | |
192 | SET Produ ctOption.S EXREPLACEI ND = "N" | |
193 | SET Produ ctOption.S UMUPOPTION = "0" | |
194 | DO Mim.SY STEMDATA.P RODUCTOPTI ONS.Insert ( ProductO ption ) | |
195 | } | |
196 | /// Popul ates the M IMUITYPE o bject with the claim level dat a needed | |
197 | /// by Cl aim Check to process the claim . | |
198 | /// | |
199 | /// Param eters: | |
200 | /// Mi m - is pas sed by ref erence and is modifi ed by this procedure | |
201 | /// | |
202 | AddClaimDa ta(Mim) PU BLIC { | |
203 | SET Mi m.CLAIMGRO UP = ##cla ss(ccaudit 2.CLAIMGRO UPTYPE).%N ew() | |
204 | SET Mi m.CLAIMGRO UP.CLAIMDA TA = ##cla ss(ccaudit 2.CLAIMDAT ATYPE).%Ne w() | |
205 | SET Mi m.CLAIMGRO UP.CLAIMDA TA.CLAIMID = ^TMP($J ,"CC-WORKS PACE","cli en") | |
206 | ; The Date of Bi rth format that Clai m Checks a ccepts is yyyymmdd | |
207 | ; the dat es in ^%ZS TAT are in mmddyyyy format so we must re format it | |
208 | SET Dob = $PIECE(^T MP($J,"CC- WORKSPACE" ), "^", 5) | |
209 | SET Dob = $EXTRACT( Dob,5,8)_$ EXTRACT(Do b,1,4) | |
210 | SET Mi m.CLAIMGRO UP.CLAIMDA TA.MEMBERD OB = Dob | |
211 | SET Mi m.CLAIMGRO UP.CLAIMDA TA.MEMBERG ENDER = $P IECE(^TMP( $J,"CC-WOR KSPACE")," ^",4) | |
212 | SET Mi m.CLAIMGRO UP.CLAIMDA TA.SERVICE PROVIDERID = $PIECE( ^TMP($J,"C C-WORKSPAC E"),"^",6) | |
213 | SET Mi m.CLAIMGRO UP.CLAIMDA TA.CLAIMPR OCEDURECOU NT = $PIE CE(^TMP($J ,"CC-WORKS PACE"),"^" ,11) | |
214 | ; retu rn the las t line ite m number f or the cla im. Any Cl aim Check | |
215 | ; adde d lines wi ll come af ter this o ne | |
216 | SET id x = "" | |
217 | SET id x = $ORDER (^TMP($J," CC-WORKSPA CE","PX",i dx), -1) | |
218 | SET Mi m.CLAIMGRO UP.CLAIMDA TA.CLAIMLA STLINE = i dx | |
219 | QUIT M im | |
220 | } | |
221 | /// Popul ates the M IMUITYPE o bject with the claim diagnosis data need ed | |
222 | /// by Cl aim Check to process the claim . | |
223 | /// | |
224 | /// Param eters: | |
225 | /// Mi m - is pas sed by ref erence and is modifi ed by this procedure | |
226 | /// | |
227 | AddDiagGro upData(Mim ) PUBLIC { | |
228 | SET Mim.D IAGGROUP = ##class(c caudit2.DI AGGROUPTYP E).%New() | |
229 | ;the DX c odes are f ound in pi eces 7,8,9 , and 10 o f the reco rd | |
230 | ;so we of fset idx b y 6 to poi nt to the DX codes | |
231 | FOR Index =1:1:4 { | |
232 | SE T diagcode = $PIECE( ^TMP($J,"C C-WORKSPAC E"), "^", Index+6) | |
233 | SE T diagcode = $ZSTRIP ( diagcode , "*W" ) ; some empt y codes ar e entered as spaces, remove th em | |
234 | ||
235 | ;; Commented out DX sen ding since Claimchec k doesn't like ICD10 DX until go-live da te - YG | |
236 | ;; DX cod es are not needed an yway, they dont affe ct what cl aimcheck d oes - YG | |
237 | ||
238 | // If (diagco de'="") { | |
239 | // SET Tmp = ##cl ass(ccaudi t2.DIAGENT RYTYPE).%N ew() | |
240 | // SET Tmp.DIAGSE QNO = Inde x | |
241 | // SET Tmp.DIAGCO DE = $PIEC E(^TMP($J, "CC-WORKSP ACE"), "^" , Index+6) | |
242 | // DO M im.DIAGGRO UP.DIAGENT RY.Insert( Tmp) | |
243 | // } | |
244 | ||
245 | } | |
246 | } | |
247 | /// Popul ates the M IMUITYPE o bject with the claim line item data | |
248 | /// neede d by Claim Check to process th e claim. | |
249 | /// | |
250 | /// Param eters: | |
251 | /// Mi m - is pas sed by ref erence and is modifi ed by this procedure | |
252 | /// | |
253 | AddLineGro upData(Mim ) PUBLIC { | |
254 | SET Mim.L INEGROUP = ##class(c caudit2.LI NEGROUPTYP E).%New() | |
255 | SET Claim HdrRec = ^ TMP($J,"CC -WORKSPACE ") | |
256 | ; There i s a presen t limit of 100 curre nt line-da ta entries | |
257 | SET MaxLi neItems = 100 | |
258 | SET Index = "" | |
259 | SET Count = 1 | |
260 | WHILE (1) { | |
261 | SE T Index=$O RDER(^TMP( $J,"CC-WOR KSPACE","P X", Index) ) | |
262 | ; Claim Chec k will han dle only o ne hundred current p rocedures per | |
263 | ; claim subm ission. An y procedur es over th e 100 limi t will not | |
264 | ; be sent to Claim Che ck. | |
265 | QU IT:(Index = "")||(Co unt > MaxL ineItems) | |
266 | SE T PxRec = ^TMP($J,"C C-WORKSPAC E","PX", I ndex) | |
267 | SE T procCode = $PIECE( PxRec, "^" , 1) | |
268 | ; send if no t tagged t o be filte red or are line item s that hav e | |
269 | ; been expan ded and on ly the fir st occuran ce is to b e sent sen d to CC | |
270 | SE T send = ' $D(^TMP($J ,"CC-WORKS PACE","PX" , Index, " F")) && '( $D(^TMP($J ,"CC-WORKS PACE","PX" , Index, " EF")) && $ D(sent(pro cCode))) | |
271 | IF (send) { | |
272 | SET Line Data = ##c lass(ccaud it2.LINEDA TATYPE).%N ew() | |
273 | SET Line Data.UNITE XPLINEIND = "N" | |
274 | SET Line Data.LINEP ROCEDURECO DE = procC ode | |
275 | SET Line Data.LINEC HARGEAMOUN T = $PIECE (PxRec, "^ ", 2) | |
276 | ; The Da te of Serv ice format that Clai m Check ac cepts is y yyymmdd | |
277 | ; the da tes in ^%Z STAT are i n mmddyyyy format so the date must be | |
278 | ; reform atted | |
279 | SET Dos = $PIECE(C laimHdrRec , "^", 3) | |
280 | SET Dos = $EXTRACT (Dos,5,8)_ $EXTRACT(D os,1,4) | |
281 | SET Line Data.LINET HRUDOS = D os | |
282 | SET Line Data.LINEF ROMDOS = D os | |
283 | SET Line Data.LINEP ROCEDURECO DEMODIFIER 1 = $PIECE (PxRec, "^ ", 3) | |
284 | SET Line Data.LINEC LAIMID = $ PIECE(Clai mHdrRec, " ^", 1) | |
285 | SET Line Data.LINEP ROVIDERID = $PIECE(C laimHdrRec , "^", 6) | |
286 | SET Line Data.LINEN UMBER = In dex | |
287 | SET Num = Mim.DIAG GROUP.DIAG ENTRY.Coun t() | |
288 | FOR i=1: 1:Num { | |
289 | SET TmpDia gEntry = M im.DIAGGRO UP.DIAGENT RY.GetAt(i ) | |
290 | If (i=1) { | |
291 | SE T LineData .LINEDIAG = TmpDiagE ntry.DIAGC ODE | |
292 | } ELSEIF ( i=2) { | |
293 | Se t LineData .LINEDIAGP TR1 = TmpD iagEntry.D IAGSEQNO | |
294 | } ELSEIF ( i=3) { | |
295 | SE T LineData .LINEDIAGP TR2 = TmpD iagEntry.D IAGSEQNO | |
296 | } ELSEIF ( i=4) { | |
297 | SE T LineData .LINEDIAGP TR3 = TmpD iagEntry.D IAGSEQNO | |
298 | } | |
299 | } | |
300 | DO Mim.L INEGROUP.L INEDATA.In sert(LineD ata) | |
301 | SET Coun t = Count + 1 | |
302 | SET sent (procCode) ="" | |
303 | } | |
304 | } | |
305 | ; tag tho se line it ems we did not send due to max item limi t reached | |
306 | IF ((Coun t > MaxLin eItems) && (Index '= "")) { | |
307 | WH ILE (1) { | |
308 | ; if not alrea dy tagged as filtere d or expan ded, tag a s not | |
309 | ; se nt. | |
310 | IF ('$D( ^TMP($J,"C C-WORKSPAC E","PX", I ndex, "F") ) && '($D( ^TMP($J,"C C-WORKSPAC E","PX", I ndex, "EF" )))){ | |
311 | S ET ^TMP($J ,"CC-WORKS PACE","PX" , Index, " NS") = "" | |
312 | } | |
313 | SET Inde x = $ORDER ( ^TMP($J, "CC-WORKSP ACE","PX", Index) ) | |
314 | QUIT:Ind ex="" | |
315 | } | |
316 | } | |
317 | } | |
318 | /// This procedure takes the data from the MIMUIT YPE object , converts | |
319 | /// that data to an xml strin g, sends t he data to the MIM / Claim Che ck, | |
320 | /// and r eturns the result in a MIMUITY PE object. | |
321 | /// | |
322 | /// Param eters: | |
323 | /// mi m - a MIMU ITYPE obje ct contain ing the cl aim data t o send | |
324 | /// to claim che ck | |
325 | /// Retur ns: | |
326 | /// a MIMUITYPE object con taing the results re turned by Claim Chec k. | |
327 | /// | |
328 | GetClaimCh eckResults ( mim ) [Y ] PUBLIC { | |
329 | N Y | |
330 | ; get the UCI fo r the envi ronment we re running in | |
331 | X ^%ZOSF( "UCI") S U CI=$P(Y,", ",1) | |
332 | ; select the appror iate tmp d irectory f or the env we're run ning in | |
333 | ; Syncing the UCI l ist with D EV list - YG | |
334 | ; S tmpD ir = $SELE CT(UCI="DE V":"HAC_HF S$:[ARC.CC _DEV]",UCI ="DEVSLA": "HAC_ARCZ$ : | |
335 | ; [CC_DE V]",UCI="T ST":"HAC_H FS$:[ARC.C C_TST]",UC I="TRN":"H AC_HFS$:[A RC.CC_DEV] ",UCI="CTS T": | |
336 | ; "HAC_HF S$:[ARC.CC _DEV]",UCI ="HAC":"HA C_HFS$:[AR C.CC_UCI]" ) ;DEV0078 20 EW | |
337 | S tmpDir = $SELECT( UCI="DEVHR ":"HAC_HFS $:[ARC.CC_ DEV]",UCI= "DEV":"HAC _HFS$:[ARC .CC_DEV]", UCI="TST": "HAC_HFS$: [ARC.CC_TS T]",UCI="T RN":"HAC_H FS$:[ARC.C C_TST]",UC I="CTST":" HAC_HFS$:[ ARC.CC_DEV ]",UCI="HA C":"HAC_HF S$:[ARC.CC _UCI]",1:" HAC_HFS$:[ ARC.CC_DEV ]") | |
338 | ; change seq file d ir and sav e old dir | |
339 | S rtnEntr yDir=$zu(1 68,tmpDir) | |
340 | S inst rm = ##cla ss(%Librar y.GlobalCh aracterStr eam).%New( ) | |
341 | S err = m im.XMLExpo rtToStream (instrm) | |
342 | ;SET INPU T = mim.XM LExportToS tring(.str g) ;Turn on to see the MIM in put (mimin .xml) | |
343 | ;write !, strg ;Tu rn on to s ee the MIM input | |
344 | If $syste m.Status.I sError(err ) { | |
345 | Do Decompose Status^%ap iOBJ(%objl asterror,. Err) ; e xtract the error mes sage | |
346 | SE T $ZERROR= "" | |
347 | SE T $ECODE=" ,U"_Err(Er r)_"," ; f orce an er ror 1 | |
348 | } | |
349 | ; Catc h errors in communi cating wit h | |
350 | ; the WS (eg. ne twork erro rs, or the WS being down). set the error handler | |
351 | ; to h andle thos e types of errors. | |
352 | SET $Z ERROR="" | |
353 | SET $ZTRA P="ERRORSE ND" | |
354 | ; make th e web serv ice call | |
355 | SET claim CheckWS = ##class(CC App.ClaimS oap).%New( ) | |
356 | SET claim CheckWS.Ti meout = 30 ;Time all owed for t he Web ser vice to re spond in s ecs | |
357 | SET claim ResultStrm = claimCh eckWS.Audi t(instrm) | |
358 | IF ('$ D(claimRes ultStrm)) { | |
359 | SET $ ZERROR="" | |
360 | SET $ ZTRAP="" | |
361 | SET $ ECODE=",UC laimCheckT imeout," | |
362 | } | |
363 | ; Any Err ors from n ow on are due to par sing of th e Claim Ch eck return | |
364 | ; values. We'll ju st reset t he ZTRAP e rror handl er, force an error, | |
365 | ; and let the calli ng procedu re handle it. | |
366 | SET $ZTRA P="" | |
367 | ; read in the claim check res ult xml in preparati on for MIM UI object | |
368 | ; creatio n. | |
369 | SET reade r = ##clas s(%XML.Rea der).%New( ) | |
370 | SET err = reader.Op enStream(c laimResult Strm) | |
371 | If $syste m.Status.I sError(err ) { | |
372 | Do Decompose Status^%ap iOBJ(%objl asterror,. Err) ; e xtract the error mes sage | |
373 | SE T $ZERROR= "" | |
374 | SE T $ECODE=" ,U"_Err(Er r)_"," ; f orce an er ror 2 | |
375 | } | |
376 | ; parse t he result xml string into a MI MUITYPE ob ject | |
377 | DO rea der.Correl ate( "MIM- UI", "ccau dit2.MIMUI TYPE" ) | |
378 | ; we only expect to get one M IM element back from ClaimChec k | |
379 | DO reader .Next(.res ult, .sc) | |
380 | If $syste m.Status.I sError(sc) { | |
381 | Do Decompose Status^%ap iOBJ(%objl asterror,. Err) ; ex tract the error mess age | |
382 | SE T $ZERROR= "" | |
383 | SE T $ECODE=" ,U"_Err(Er r)_"," ; fo rce an err or 3 | |
384 | } | |
385 | ;DO re sult.XMLEx portToStri ng(.outstr ) ;Turn o n to see t he MIM out put (mimou t.xml) | |
386 | ;write !, outstr ;Turn on t o see the MIM output | |
387 | //restore original tmp direct ory | |
388 | I $D(rtnE ntryDir) { | |
389 | I $zu(1 68,rtnEntr yDir) | |
390 | } | |
391 | QUIT resu lt | |
392 | ERRORSEND | |
393 | SET $Z ERROR="" | |
394 | SET $ZTRA P="" ; preven ts infinte loops in case we er ror out in handler | |
395 | //restore original tmp direct ory | |
396 | I $D(rtnE ntryDir) { | |
397 | I $zu(1 68,rtnEntr yDir) | |
398 | } | |
399 | Do Decomp oseStatus^ %apiOBJ(%o bjlasterro r,.Err) | |
400 | ; Emai l Notifica tion of er ror | |
401 | ; TODO : uncommen t out emai ls when co de is move d to produ ction. | |
402 | ;SET xaddr (0)= " PII " | |
403 | SET xaddr( 1)= " PII " ; MTN01619 4-01 09-20 -12 jeh | |
404 | SET xaddr( 2)= "
|
|
405 | SET xsub= "Claim Che ck Process ing Error" | |
406 | SET xtext (0)=$EXTRA CT(Err(Err ),1,80) ; limit the size of th e message so that MM limit of 254 is not exceeded | |
407 | DO SendEr rorNotific ation(.xad dr, xsub, .xtext) | |
408 | SET $ECOD E=",U"_Err (Err)_"," ; force a n error to be handle d by calli ng proc | |
409 | } | |
410 | ///This f unction re turns true (1) if a line numbe r found in the mim | |
411 | ///object is greate r that the maximum l imit. | |
412 | /// | |
413 | /// param eters: | |
414 | /// mi m - the mi m containi ng the inp ut data | |
415 | /// ma x - the ma ximum line number th at ClaimCh eck can ha ndle | |
416 | /// (curre ntly this is 999) | |
417 | /// | |
418 | /// retur ns true (1 ) if a lin e number i s greater than max, false (0) | |
419 | /// otherwise. | |
420 | /// | |
421 | LineNumGT( mim, max) PUBLIC { | |
422 | SET maxli nenum = 1 | |
423 | SET co unt = mim. LINEGROUP. LINEDATA.C ount() | |
424 | FOR i=1:1 :count { | |
425 | SE T curlinen um = mim.L INEGROUP.L INEDATA.Ge tAt(i).LIN ENUMBER | |
426 | IF (curlinen um > maxli nenum) { | |
427 | Set maxlinenum = curline num | |
428 | } | |
429 | } | |
430 | QUIT (max linenum >= max) ;ret urn 1 if t he max lin e number i s greater than a pre set limit 0 otherwis e | |
431 | } | |
432 | /// Sends an Email notificati on of the error. | |
433 | /// | |
434 | /// Param eters: | |
435 | /// Addre ssees - an array of addressees (may be t he user's DUZ or Ema il | |
436 | /// ad dress (Req uired) | |
437 | /// Subje ctline - T he Subject line is th e string y ou want to use as th e mail | |
438 | /// m essage's subject (R equired) | |
439 | /// Text - An array of string s that wil l make up the body o f the mail | |
440 | /// message (Required) | |
441 | /// | |
442 | SendErrorN otificatio n(Addresse es, Subjec tline, Tex t) [XMSUB, XMTEXT, X MY, XMDUZ, DUZ] PUBL IC { | |
443 | NEW XMDUZ , XMSUB, X MTEXT, XMY | |
444 | ; check f or require d input | |
445 | QUIT:'$DA TA(Address ees)||'$DA TA(Subject line)||'$D ATA(Text) | |
446 | ; check t o see if a notificat ion has al ready been sent | |
447 | ; Don't s end, if on e has alre ady been s ent today | |
448 | SET Curre ntDate = $ $CurrentFM Date() | |
449 | QUIT:$DAT A(^XTMP("C C-ERR",Cur rentDate)) | |
450 | SET MSGDT M = $$HTE^ XLFDT( $H ) ; C urrent Dat e/Time | |
451 | SET XMDUZ =.5 ; i ndicate po stmaster a s the send er | |
452 | IF '$DATA (DUZ) NEW DUZ SET DU Z=.5 ; i f DUZ is n ot set def ault to po stmaster's DUZ | |
453 | SET XMSUB =Subjectli ne | |
454 | KILL ^TMP ("CC-ERROR ",$J) ; r emove prev ious email msgs (if present) | |
455 | ; create the messag e body | |
456 | DO MsgAdd ( "" ) | |
457 | DO MsgAdd ( MSGDTM ) | |
458 | DO MsgAdd ( "" ) | |
459 | SET lineN um="" | |
460 | WHILE(1) { | |
461 | SE T lineNum= $ORDER(Tex t(lineNum) ) | |
462 | QU IT:lineNum ="" | |
463 | DO MsgAdd( T ext(lineNu m) ) | |
464 | } | |
465 | DO MsgAdd ( "" ) | |
466 | DO Msg Add( "Plea se Kill th e ^XTMP("" CC-ERR"") node ") | |
467 | DO MsgAdd ( "when th e problem has been f ixed") | |
468 | DO MsgAdd ( "in orde r to recei ve further problem n otificatio ns.") | |
469 | SET XMTEX T="^TMP("" CC-ERROR"" ,$J," | |
470 | ;set the email reci pients | |
471 | SET index ="" | |
472 | WHILE( 1) { | |
473 | SE T index=$O RDER(Addre ssees(inde x)) | |
474 | QU IT:index=" " | |
475 | SE T XMY(Addr essees(ind ex))="" | |
476 | } | |
477 | DO ^XMD ; send t he mailman message | |
478 | KILL ^TMP ("CC-ERROR ", $J) | |
479 | DO MsgSen tIndicator () ; mark e mail as al ready sent | |
480 | } | |
481 | /// This procedure creates an error msg sent mark er in the | |
482 | /// ^XTMP global. This marke r is place d in the g lobal and | |
483 | /// is us ed by the error msg sending pr ocedure to prevent t he | |
484 | /// syste m from sen ding more than one C laim Check error msg | |
485 | /// per d ay. | |
486 | /// | |
487 | /// NOTE: If there is an erro r with Cla im Check t hat causes email not ifications to | |
488 | /// be sent; and Claim Check is l ater resto red, the ^ XTMP("CC-E RR") node must | |
489 | /// be killed | |
490 | /// | |
491 | MsgSentInd icator() [ X, X1, X2] PUBLIC { | |
492 | NEW X, X1 , X2, %H, %T, % | |
493 | SET CurrD ate = $$Cu rrentFMDat e() | |
494 | ; create the purge date for t he ^XTMP r ecord (tod ay +30 da ys) | |
495 | SET X1=Cu rrDate ; record is create d today | |
496 | SET X2=30 ; when t o purge (d ays from t oday) | |
497 | DO C^%DTC | |
498 | ; set up 0 node of ^XTMP to a llow the s ystem to p urge after 30 days | |
499 | ; the 0 n ode is req ured to be in ^XTMP and is to be in the form | |
500 | ; purgeda te^created ate^descri ption | |
501 | SET ^XTMP ("CC-ERR", 0)=X_"^"_ CurrDate_" ^"_"Claim Check Erro r, Email N otificatio n Sent, Ma rker" | |
502 | SET ^XTMP ("CC-ERR", CurrDate) ="" | |
503 | QUIT | |
504 | } | |
505 | /// Attac hes each l ine to the email mes sage text | |
506 | /// | |
507 | /// Param eters: | |
508 | /// XL INE - The text to at tach to th e email me ssage body | |
509 | /// | |
510 | MsgAdd(XLI NE) PUBLIC { | |
511 | SET MSGLI NE=$ORDER( ^TMP("CC-E RROR", $J, ""), -1)+ 1 ;next l ine number | |
512 | SET ^TMP( "CC-ERROR" , $J, MSGL INE)=$GET( XLINE) | |
513 | } | |
514 | /// Retur ns the cur rent date in Fileman format | |
515 | /// | |
516 | CurrentFMD ate() [X] PUBLIC { | |
517 | NEW %, %H , %I, X | |
518 | DO NOW^%D TC | |
519 | QUIT X | |
520 | } | |
521 | /// Retur ns the cur rent time in ODBC ti mestamp fo rmat (YYYY -MM-DD HH: MM:SS) | |
522 | /// | |
523 | CurrentTim eStamp() [ X] PUBLIC { | |
524 | NEW %, %H , %I, X | |
525 | DO NOW^%D TC | |
526 | QUIT ##cl ass(%Libra ry.Fileman TimeStamp) .LogicalTo Odbc(%) | |
527 | } | |
528 | /// logs the error in the sys tem error trap | |
529 | /// | |
530 | RecordErro r(ERRORTYP E) [X] PUB LIC { | |
531 | NEW X | |
532 | SET X="" | |
533 | SET $ZE=E RRORTYPE_" : "_$ECODE | |
534 | SET @^%ZO SF("TRAP") | |
535 | DO ^%ZTER ; c all Kernel error tra p | |
536 | } | |
537 | /// creat e the arra y of resul t values. The array is in a f orm that | |
538 | /// is ea sier for t he calling M code to use (see routine hd r comments | |
539 | /// for f ormat). | |
540 | /// | |
541 | /// Param eter: | |
542 | /// Mi m - the MI MUITYPE ob ject popul ated with the result s from | |
543 | /// Cl aim Check | |
544 | /// Re sultArray - the resu lts from C laim Check in an arr ay format | |
545 | /// | |
546 | CollateRes ults( Mim ) PUBLIC { | |
547 | QUIT:'$DA TA(Mim) | |
548 | SET claim IEN = Mim. CLAIMGROUP .CLAIMDATA .CLAIMID | |
549 | ; create a line seq uence numb er to line number ma p | |
550 | ; the lin e sequence number is just a se quential n umber assi gned | |
551 | ; to the procedures sent to C laim Check the line number is the | |
552 | ; procedu re line nu mber in th e M system | |
553 | ; NOTE: s ince we're not addin g history claims at this stage | |
554 | ; all result poi nters poin t back to the line D ata in | |
555 | ; the line group . If hist ory is add ed then th at won't | |
556 | ; be t he case an d the mapp ing will n eed to tak e that int o | |
557 | ; acco unt. | |
558 | SET lineN umMap = "" | |
559 | SET count = Mim.LIN EGROUP.LIN EDATA.Coun t() | |
560 | FOR i=1:1 :count { | |
561 | SE T lineNumM ap(Mim.LIN EGROUP.LIN EDATA.GetA t(i).LINES EQNO) = Mi m.LINEGROU P.LINEDATA .GetAt(i). LINENUMBER | |
562 | } | |
563 | FOR i=1:1 :count { | |
564 | SE T linenum = +Mim.LIN EGROUP.LIN EDATA.GetA t(i).LINEN UMBER ;+ c onverts to num & rem oves leadi ng 0s | |
565 | SE T code = M im.LINEGRO UP.LINEDAT A.GetAt(i) .LINEPROCE DURECODE | |
566 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "CC -LINE-CHAR GE-AMOUNT" ) = Mim.LI NEGROUP.LI NEDATA.Get At(i).LINE CHARGEAMOU NT | |
567 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "MO D") = Mim. LINEGROUP. LINEDATA.G etAt(i).LI NEPROCEDUR ECODEMODIF IER1 | |
568 | ; this will help out i n filling in values for expand ed lines | |
569 | ; that were not sent t o claim ch eck | |
570 | IF ($D(^TMP( $J,"CC-WOR KSPACE","P X",linenum ,"EF"))) { | |
571 | SET ExpE xclResultM ap($PIECE( ^TMP($J,"C C-WORKSPAC E","PX",li nenum),"^" ,1)) = lin enum | |
572 | } | |
573 | } | |
574 | SET count = Mim.LIN EGROUP.LIN ERESULT.Co unt() | |
575 | FOR i=1:1 :count { | |
576 | SE T linenum = +lineNum Map(Mim.LI NEGROUP.LI NERESULT.G etAt(i).RE SULTLINEPT R) ;+ conv erts to nu m & remove s leading 0s | |
577 | SE T code = M im.LINEGRO UP.LINEDAT A.GetAt(i) .LINEPROCE DURECODE | |
578 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "CC -RESULT") = Mim.LINE GROUP.LINE RESULT.Get At(i).LINE CUSAUDITRE SULTCODE | |
579 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "CC -LINE-ORIG ") = Mim.L INEGROUP.L INERESULT. GetAt(i).L INEORIGINA TION | |
580 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "CC -LINE-SURV -PROC-CODE ") = Mim.L INEGROUP.L INERESULT. GetAt(i).L INESURVIVO RPROCEDURE CODE | |
581 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "CC -LINE-ERRO R-CODE") = Mim.LINEG ROUP.LINER ESULT.GetA t(i).LINEE RRORCODE | |
582 | } | |
583 | SET count = Mim.CLA IMCHECKGRO UP.CCLINER ESULT.Coun t() | |
584 | FOR i=1:1 :count { | |
585 | SE T linenum = +lineNum Map(Mim.CL AIMCHECKGR OUP.CCLINE RESULT.Get At(i).CCRE SULTLINEPT R) ;+ conv erts to nu m & remove s leading 0s | |
586 | SE T code = M im.LINEGRO UP.LINEDAT A.GetAt(i) .LINEPROCE DURECODE | |
587 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "CC -SEX-CONFL ICT") = Mi m.CLAIMCHE CKGROUP.CC LINERESULT .GetAt(i). CCSCEERROR 1 | |
588 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "CC -COSMETIC/ UNLISTED") = Mim.CLA IMCHECKGRO UP.CCLINER ESULT.GetA t(i).CCSCE ERROR2 | |
589 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "CC -AGE-CONFL ICT") = Mi m.CLAIMCHE CKGROUP.CC LINERESULT .GetAt(i). CCSCEAGEST ATUS | |
590 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "CC -EXPERIMEN TAL-PROC") = Mim.CLA IMCHECKGRO UP.CCLINER ESULT.GetA t(i).CCSCE EXPERIMENT AL | |
591 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "CC -ASST-SURG ") = Mim.C LAIMCHECKG ROUP.CCLIN ERESULT.Ge tAt(i).CCS CEASSTSURG STATUS | |
592 | SE T ^TMP($J, "CC-RETURN ",claimIEN , linenum, code, "CC -OUTPUT-ME SSAGE") = $ZSTRIP( M im.CLAIMCH ECKGROUP.C CLINERESUL T.GetAt(i) .CCMESSAGE CODE, "<>W ") ;leadin g and trai ling space s | |
593 | } | |
594 | ; Fill in results f or line it ems not se nt or expa nded | |
595 | ; i.e., n ot sent du e to being expanded or filtere d or not s ent due to | |
596 | ; max line items being exc eeded | |
597 | ; Line it ems not se nt due to being filt ered or be cause max line items exceeded | |
598 | ; will ha ve all CC return val ues filled in with " ". | |
599 | ; Line it ems not se nt due to being expa nded will be filled in with | |
600 | ; the sam e values t hat the on e line ite ms that wa s sent to ClaimCheck | |
601 | ; got. | |
602 | SET idx = "" | |
603 | WHILE (1) { | |
604 | SE T idx = $O RDER(^TMP( $J,"CC-WOR KSPACE","P X",idx)) | |
605 | QU IT:idx="" | |
606 | SE T procCode = $PIECE( ^TMP($J,"C C-WORKSPAC E","PX",id x),"^",1) | |
607 | SE T notSent = $D(^TMP( $J,"CC-WOR KSPACE","P X",idx,"F" )) || $D(^ TMP($J,"CC -WORKSPACE ","PX",idx ,"NS")) | |
608 | SE T expanded AndNotSent = $D(^TMP ($J,"CC-WO RKSPACE"," PX",idx,"E F")) && '$ D(ExpExclR esultMap(p rocCode)) | |
609 | SE T expanded AndSent = $D(^TMP($J ,"CC-WORKS PACE","PX" ,idx,"EF") ) && $D(Ex pExclResul tMap(procC ode)) | |
610 | IF (notSent || expande dAndNotSen t) { | |
611 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-CHARGE -AMOUNT") = "" | |
612 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "MOD" ) = $P(^TM P($J,"CC-W ORKSPACE", "PX",idx), "^",3) | |
613 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-R ESULT") = "" | |
614 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-ORIG") = "" | |
615 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-SURV-P ROC-CODE") = "" | |
616 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-ERROR- CODE") = " " | |
617 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-S EX-CONFLIC T") = "" | |
618 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-C OSMETIC/UN LISTED") = "" | |
619 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-A GE-CONFLIC T") = "" | |
620 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-E XPERIMENTA L-PROC") = "" | |
621 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-A SST-SURG") = "" | |
622 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-O UTPUT-MESS AGE") = "" | |
623 | } ELSEIF (ex pandedAndS ent) { | |
624 | SET filledin = ExpExclRe sultMap(pr ocCode) | |
625 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-CHARGE -AMOUNT") = ^TMP($J, "CC-RETURN ",claimIEN , filledin , procCode , "CC-LINE -CHARGE-AM OUNT") | |
626 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "MOD" ) = $P(^TM P($J,"CC-W ORKSPACE", "PX",idx), "^",3) | |
627 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-R ESULT") = ^TMP($J,"C C-RETURN", claimIEN, filledin, procCode, "CC-RESULT ") | |
628 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-ORIG") = ^TMP($J ,"CC-RETUR N",claimIE N, filledi n, procCod e, "CC-LIN E-ORIG") | |
629 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-SURV-P ROC-CODE") = ^TMP($J ,"CC-RETUR N",claimIE N, filledi n, procCod e, "CC-LIN E-SURV-PRO C-CODE") | |
630 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-ERROR- CODE") = ^ TMP($J,"CC -RETURN",c laimIEN, f illedin, p rocCode, " CC-LINE-ER ROR-CODE") | |
631 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-S EX-CONFLIC T") = ^TMP ($J,"CC-RE TURN",clai mIEN, fill edin, proc Code, "CC- SEX-CONFLI CT") | |
632 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-C OSMETIC/UN LISTED") = ^TMP($J," CC-RETURN" ,claimIEN, filledin, procCode, "CC-COSME TIC/UNLIST ED") | |
633 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-A GE-CONFLIC T") = ^TMP ($J,"CC-RE TURN",clai mIEN, fill edin, proc Code, "CC- AGE-CONFLI CT") | |
634 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-E XPERIMENTA L-PROC") = ^TMP($J," CC-RETURN" ,claimIEN, filledin, procCode, "CC-EXPER IMENTAL-PR OC") | |
635 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-A SST-SURG") = ^TMP($J ,"CC-RETUR N",claimIE N, filledi n, procCod e, "CC-ASS T-SURG") | |
636 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-O UTPUT-MESS AGE") = ^T MP($J,"CC- RETURN",cl aimIEN, fi lledin, pr ocCode, "C C-OUTPUT-M ESSAGE") | |
637 | } | |
638 | } | |
639 | } | |
640 | ///There are certai n cases wh ere filter ing will r esult in a condition | |
641 | ///where no service lines are to be sen t to claim check. T his | |
642 | ///functi on will cr eate the c orrect res ults when that is th e case. | |
643 | /// | |
644 | /// Param eter: | |
645 | /// cl aimIEN - t he claim's i value | |
646 | CreateResu ltsNoItems ToSend(cla imIEN) PUB LIC { | |
647 | SET idx = "" | |
648 | WHILE(1) { | |
649 | SE T idx = $O RDER(^TMP( $J,"CC-WOR KSPACE","P X",idx)) | |
650 | QU IT:idx="" | |
651 | SE T procCode = $PIECE( ^TMP($J,"C C-WORKSPAC E","PX",id x),"^",1) | |
652 | SE T notSent = $D(^TMP( $J,"CC-WOR KSPACE","P X",idx,"F" )) | |
653 | IF (notSent) { | |
654 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-CHARGE -AMOUNT") = "" | |
655 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "MOD" ) = $P(^TM P($J,"CC-W ORKSPACE", "PX",idx), "^",3) | |
656 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-R ESULT") = "" | |
657 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-ORIG") = "" | |
658 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-SURV-P ROC-CODE") = "" | |
659 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-L INE-ERROR- CODE") = " " | |
660 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-S EX-CONFLIC T") = "" | |
661 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-C OSMETIC/UN LISTED") = "" | |
662 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-A GE-CONFLIC T") = "" | |
663 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-E XPERIMENTA L-PROC") = "" | |
664 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-A SST-SURG") = "" | |
665 | SET ^TMP($J,"C C-RETURN", claimIEN, idx, procC ode, "CC-O UTPUT-MESS AGE") = "" | |
666 | } | |
667 | } | |
668 | } | |
669 | /// If Cl aim Check returns an added lin e that is denied | |
670 | /// we wi ll not add that deni ed line ba ck to the claim. Cl aim Check will | |
671 | /// zero out the ch arges from the origi nal line i tems that were rebun dled. | |
672 | /// in th e added-de nied line item. Sinc e we are n ot adding the denied | |
673 | /// line item and t he total c laim charg e amount m ust balanc e we | |
674 | /// must restore th e original charges t o the orig inal rebun dled lines . | |
675 | /// | |
676 | /// Param eters: | |
677 | /// re turn - Pas sed in by reference, this is t he result from Claim | |
678 | /// Chec k in array format. | |
679 | /// | |
680 | AdjustChar gedAmounts ( ) PUBLIC { | |
681 | ;get the claim ien | |
682 | SET ien = "" | |
683 | SET ien = $ORDER(^T MP($J,"CC- RETURN",ie n)) | |
684 | ; get the last line number in the orign al claim | |
685 | SET lineN um = "" | |
686 | SET lineN um = $ORDE R( ^TMP($J ,"CC-WORKS PACE","PX" , lineNum) , -1 ) | |
687 | ; see if any claims have been added and then deni ed | |
688 | ; store t hose proc codes in a ddedDenied array | |
689 | WHILE (1) { | |
690 | SE T lineNum = $ORDER(^ TMP($J,"CC -RETURN",i en, lineNu m)) | |
691 | QU IT:lineNum ="" | |
692 | SE T procCode = $ORDER( ^TMP($J,"C C-RETURN", ien, lineN um, "")) | |
693 | SE T lnOrig = ^TMP($J," CC-RETURN" ,ien, line Num, procC ode, "CC-L INE-ORIG") | |
694 | SE T result = ^TMP($J," CC-RETURN" ,ien, line Num, procC ode, "CC-R ESULT") | |
695 | ; the follow ing logic tests to s ee if the line was a dded (lnOr ig'["ORG") | |
696 | ; and denied (result'[ "NON") | |
697 | IF ( (lnOrig '["ORG") & & (result' ["NON") ) { | |
698 | SET addedDenie d( procCod e ) = "" | |
699 | } | |
700 | } | |
701 | QUIT:'$D( addedDenie d) ; no aju stments ne eded if th ere are no added-den ied lines | |
702 | SET srvpc = "" ;surviving proc code | |
703 | SET ln = "" | |
704 | WHILE (1) { | |
705 | SE T ln = $OR DER( ^TMP( $J,"CC-RET URN",ien, ln) ) | |
706 | QU IT:ln="" | |
707 | SE T pc = $OR DER( ^TMP( $J,"CC-RET URN",ien, ln, "") ) ; only on e procedur e code per line item | |
708 | SE T srvpc = ^TMP($J,"C C-RETURN", ien, ln, p c, "CC-LIN E-SURV-PRO C-CODE") | |
709 | ; reset the charge amo unt to the original code if th e surving | |
710 | ; procedure was an add ed-denied line item | |
711 | IF ((srvpc ' = "") && ( $DATA(adde dDenied(sr vpc)))) { | |
712 | SET PxRec = ^T MP($J,"CC- WORKSPACE" ,"PX", ln) | |
713 | SET origCharge dAmount = $PIECE(PxR ec, "^", 2 ) | |
714 | SET ^TMP($J,"C C-RETURN", ien, ln, p c, "CC-LIN E-CHARGE-A MOUNT") = origCharge dAmount | |
715 | } | |
716 | } | |
717 | } | |
718 | /// Takes the claim data and tags proce dures for exclusion from | |
719 | /// Claim Check pro cessing. Claim Chec k does not have edit s for | |
720 | /// vario us procedu re codes a nd need no t be sent to Claim C heck. | |
721 | /// Also for some e xpanded pr ocedure co des (e.g., drug code s) only on e | |
722 | /// item in the gro up should be sent. | |
723 | /// | |
724 | /// Param eters: | |
725 | /// cl aimData - Passed in by Referen ce, the wo rking copy of the ^% ZSTAT("CC" , array. | |
726 | /// | |
727 | TagProcsTo Filter( ) PUBLIC { | |
728 | DO Get ProcCounts (.counts) | |
729 | SET index = "" | |
730 | WHILE (1) { | |
731 | SE T index = $ORDER(^TM P($J,"CC-W ORKSPACE", "PX", inde x)) | |
732 | QU IT:index=" " | |
733 | SE T Procedur eCode = $P IECE(^TMP( $J,"CC-WOR KSPACE","P X",index), "^",1) | |
734 | SE T Modifier = $PIECE( ^TMP($J,"C C-WORKSPAC E","PX",in dex),"^",3 ) | |
735 | SE T firstCha r = $EXTRA CT(Procedu reCode,1,1 ) | |
736 | IF (firstCha r = "X") { ; tag homegrown procedures for filte ring | |
737 | SET ^TMP($J,"C C-WORKSPAC E","PX",in dex,"F")=" " | |
738 | } ELSEIF (fi rstChar = "D") { ; tag dental pro cedures fo r filterin g | |
739 | SET ^TMP($J,"C C-WORKSPAC E","PX",in dex,"F")=" " | |
740 | } ELSEIF (co unts(Proce dureCode) > 31){ ; ta g expanded lines wit h over 31 line items , only the first lin e is sent | |
741 | SET ^TMP($J,"C C-WORKSPAC E","PX",in dex,"EF")= "" | |
742 | } ELSE { ; tag expand ed lines w here only the first line is se nt | |
743 | SET exp = $$Fi lterExpand edLines( P rocedureCo de, Modifi er ) | |
744 | IF ( exp) { | |
745 | SET ^TMP($ J,"CC-WORK SPACE","PX ",index,"E F")="" | |
746 | } | |
747 | } | |
748 | } | |
749 | } | |
750 | /// Count s the occu rances of each proce dure code in found i n the | |
751 | /// claim . | |
752 | /// | |
753 | /// Param eters: | |
754 | /// cl aimData - Passed in by referen ce, the wo rking copy of the | |
755 | /// clai mData | |
756 | /// co unts - Pas sed in by reference, an array of each pr ocedure | |
757 | /// foun d in the c laim along with the counts. (e .g., count s(procCode ) = count) | |
758 | /// | |
759 | GetProcCou nts( count s ) PUBLIC { | |
760 | SET index = "" | |
761 | WHILE (1) { | |
762 | SE T index = $ORDER(^TM P($J,"CC-W ORKSPACE", "PX", inde x)) | |
763 | QU IT:index=" " | |
764 | SE T procCode = $PIECE( ^TMP($J,"C C-WORKSPAC E","PX",in dex),"^",1 ) | |
765 | IF ($D(count s(procCode ))) { | |
766 | SET counts(pro cCode) = c ounts(proc Code) + 1 | |
767 | } ELSE { | |
768 | SET counts(pro cCode) = 1 | |
769 | } | |
770 | } | |
771 | } | |
772 | /// Retur ns 1 if th e procedur e code is in the lis t of codes for which | |
773 | /// all e xpanded li nes, other than the first shou ld be filt ered from | |
774 | /// Claim Check, 0 otherwise. | |
775 | /// | |
776 | /// | |
777 | /// Param eters: | |
778 | /// Pr ocode - th e Procedur e code to test. | |
779 | /// Mo d - th e Procedur e modifier . | |
780 | FilterExpa ndedLines( ProcCode, Mod ) PUB LIC { | |
781 | SET r1 = $$IsAnesth isiaCode( ProcCode ) | |
782 | QUIT:r1 1 | |
783 | SET r1 = $$IsAllerg yTestingCo de( ProcCo de ) | |
784 | QUIT:r1 1 | |
785 | SET r1 = $$IsAllerg enImmThrpy Code( Proc Code ) | |
786 | QUIT:r1 1 | |
787 | SET r1 = $$IsImmuno logyCode( ProcCode ) | |
788 | QUIT:r1 1 | |
789 | SET r1 = $$IsPsychT estingCode ( ProcCode ) | |
790 | QUIT:r1 1 | |
791 | SET r1 = $$IsPathol ogyCode( P rocCode ) | |
792 | QUIT:r1 1 | |
793 | SET r1 = $$IsAmbula nceCode( P rocCode ) | |
794 | QUIT:r1 1 | |
795 | SET r1 = $$IsEandPT herapyCode ( ProcCode ) | |
796 | QUIT:r1 1 | |
797 | SET r1 = $$IsDrugCo de( ProcCo de ) | |
798 | QUIT:r1 1 | |
799 | SET r1 = $$IsCardia cEventMoni torCode( P rocCode, M od ) | |
800 | QUIT:r1 1 | |
801 | // if we made it th rough the sieve then none of t he codes | |
802 | // are in the expan ded line e xclusion l ist | |
803 | QUIT 0 | |
804 | } | |
805 | /// Retur ns 1 if a procedure code is an Anesthesi a, 0 other wise. | |
806 | /// Anest hesia code s are in t he range o f 00100-01 999. | |
807 | /// | |
808 | /// Param eters: | |
809 | /// Pr ocCode - t he procedu re code to test. | |
810 | IsAnesthis iaCode( Pr ocCode ) P UBLIC { | |
811 | SET num = +ProcCode ; conver t to a num eric value ("00100" = 100 and "J1000" = 0) | |
812 | QUIT ((10 0 <= num) && (num <= 1999)) | |
813 | } | |
814 | /// Retur ns 1 if a procedure code is an Allergy T esting, 0 otherwise. | |
815 | /// Aller gy testing codes are in the ra nge of 950 04-95024 a nd 95028-9 5052. | |
816 | /// | |
817 | /// Param eters: | |
818 | /// Pr ocCode - t he procedu re code to test. | |
819 | IsAllergyT estingCode ( ProcCode ) PUBLIC { | |
820 | SET num = +ProcCode ; convert to a nume ric value ("00100" = 100 and " J1000" = 0 ) | |
821 | SET t1 = ((95004 <= num) && ( num <= 950 24)) | |
822 | SET t2 = ((95028 <= num) && ( num <= 950 52)) | |
823 | QUIT (t2 || t1) | |
824 | } | |
825 | /// Retur ns 1 if a procedure code is a Allergen I mmunoThera py Code, 0 otherwise . | |
826 | /// Aller gen Immuno therapy Co des are in the range of 95165 - 95180. | |
827 | /// | |
828 | /// Param eters: | |
829 | /// Pr ocCode - t he procedu re code to test. | |
830 | IsAllergen ImmThrpyCo de( ProcCo de ) PUBLI C { | |
831 | SET num = +ProcCode ; convert to a nume ric value ("00100" = 100 and " J1000" = 0 ) | |
832 | QUIT ((95 165 <= num ) && (num <= 95180)) | |
833 | } | |
834 | /// Retur ns 1 if a procedure code is an Immunolog y Code, 0 otherwise | |
835 | /// Immun ology code s are: | |
836 | /// 86 000, 86003 , 86160, 8 6161, 8618 5, 86235, 86255, 862 56, 86316, 86403, | |
837 | /// 86 406, 86586 | |
838 | /// | |
839 | /// Param eters: | |
840 | /// Pr ocCode - t he procedu re code to test. | |
841 | IsImmunolo gyCode( Pr ocCode ) P UBLIC { | |
842 | SET num = +ProcCode ; convert to a nume ric value ("00100" = 100 and " J1000" = 0 ) | |
843 | QUIT ( (8 6000 = num ) || (8600 3 = num) | | (86160 = num) || ( 86161 = nu m) || | |
844 | (8 6185 = num ) || (8623 5 = num) | | (86255 = num) || ( 86256 = nu m) || | |
845 | (8 6316 = num ) || (8640 3 = num) | | (86406 = num) || ( 86586 = nu m)) | |
846 | } | |
847 | /// Retur ns 1 if a procedure code is a Psych Test ing Code, 0 otherwis e | |
848 | /// Psych Testing C odes are i n the rang e of 90801 -90862 | |
849 | /// | |
850 | /// Param eters: | |
851 | /// Pr ocCode - t he procedu re code to test. | |
852 | IsPsychTes tingCode( ProcCode ) PUBLIC { | |
853 | SET num = +ProcCode ; convert to a nume ric value ("00100" = 100 and " J1000" = 0 ) | |
854 | QUIT ((90 801 <= num ) && (num <= 90862)) | |
855 | } | |
856 | /// Retur ns 1 if a procedure code is a Pathology Code, 0 ot herwise. | |
857 | /// Patho logy Codes are in th e range of 88301-883 08 | |
858 | /// | |
859 | /// Param eters: | |
860 | /// Pr ocCode - t he Procedu re code to test. | |
861 | IsPatholog yCode( Pro cCode ) PU BLIC { | |
862 | SET num = +ProcCode ; convert to a nume ric value ("00100" = 100 and " J1000" = 0 ) | |
863 | QUIT ((88 301 <= num ) && (num <= 88308)) | |
864 | } | |
865 | /// Retur ns 1 if a procedure code is an Ambulance Code, 0 o therwise. | |
866 | /// Ambul ance Codes are in th e range of A0021-A09 99 | |
867 | /// | |
868 | /// Param eters: | |
869 | /// Pr ocCode - t he Procedu re code to test. | |
870 | IsAmbulanc eCode( Pro cCode ) PU BLIC { | |
871 | SET match = ProcCod e?1"A"1"0" 3N ; begin s with "A0 " followed by three numerals | |
872 | IF ('matc h) { | |
873 | QU IT 0 | |
874 | } | |
875 | SET num = $EXTRACT( ProcCode,3 ,5) | |
876 | QUIT ((02 1 <= num) && (num <= 999)) | |
877 | } | |
878 | /// Retur ns 1 if a procedure code is an Enteral & Parentera l Therapy Code, 0 ot herwise | |
879 | /// Enter al & Paren teral Ther apy codes are in the range of B4000-B999 9 | |
880 | /// | |
881 | /// Param eters: | |
882 | /// Pr ocCode - t he Procedu re code to test. | |
883 | IsEandPThe rapyCode( ProcCode ) PUBLIC { | |
884 | SET match = ProcCod e?1"B"4N ; begins wi th "B" fol lowed by f our numera ls | |
885 | IF ('matc h) { | |
886 | QU IT 0 | |
887 | } | |
888 | SET num = $EXTRACT( ProcCode, 2, 5) | |
889 | QUIT ((40 00 <= num) && (num < = 9999)) | |
890 | } | |
891 | /// Retur ns 1 if a procedure code is a Drug code, 0 otherwi se | |
892 | /// Drug codes are in the ran ge of : | |
893 | /// J0 120-J9999, K0119-K01 23, or Q40 54-Q4055 | |
894 | /// | |
895 | /// Param eters: | |
896 | /// Pr ocCode - t he Procedu re code to test. | |
897 | IsDrugCode ( ProcCode ) PUBLIC { | |
898 | SET jmatc h = ProcCo de?1"J"4N ; begins w ith "J" fo llowed by four numer als | |
899 | SET kmatc h = ProcCo de?1"K"4N ; begins w ith "K" fo llowed by four numer als | |
900 | SET qmatc h = ProcCo de?1"Q"4N ; begnis w ith "Q" fo llowed by four numer als | |
901 | IF (jmatc h) { | |
902 | SE T num = $E XTRACT(Pro cCode, 2, 5) | |
903 | QU IT ((120 < = num) && (num <= 99 99)) | |
904 | } ELSEIF (kmatch) { | |
905 | SE T num = $E XTRACT(Pro cCode, 2, 5) | |
906 | QU IT ((119 < = num) && (num <= 12 3)) | |
907 | } ELSEIF (qmatch) { | |
908 | SE T num = $E XTRACT(Pro cCode, 2, 5) | |
909 | QU IT ((4054 <= num) && (num <= 4 055)) | |
910 | } ELSE { | |
911 | QU IT 0 | |
912 | } | |
913 | } | |
914 | /// Retur ns 1 if a procedure code is a Cardiac Ev ent Monito r Code, 0 otherwise. | |
915 | /// A Car diac Event Monitor c ode is 932 68 with a 26 modifie r | |
916 | /// | |
917 | /// Param eters: | |
918 | /// Pr ocode - th e Procedur e code to test. | |
919 | /// Mo d - th e Procedur e modifier . | |
920 | IsCardiacE ventMonito rCode( Pro cCode, Mod ifier ) PU BLIC { | |
921 | SET Code = +ProcCod e ; conver t to a num eric value ("00100" = 100 and "J1000" = 0) | |
922 | SET Mod = +Modifie r | |
923 | QUIT ((93 468 = Code ) && (Mod = 26)) | |
924 | } | |
925 | /// saves the XML s tring sent to claimc heck in a file | |
926 | /// | |
927 | /// Para meters: | |
928 | /// MIM - the MIM proxy used to create the XML s tring | |
929 | /// | |
930 | SaveInputX ML(MIM) PU BLIC { | |
931 | //TODO: S ELECT THE CORRECT FI LE FOR THE ENV YOUR RUNNING IN | |
932 | // DEV | |
933 | SET FILEN AME="HAC_H FS$:[ARC.R OUSAVE_DEV ]CC-INPUT. XML" | |
934 | // TST | |
935 | ;SET FILE NAME="HAC_ HFS$:[ARC. ROUSAVE_TS T]CC-INPUT .XML" | |
936 | // TRN | |
937 | ;SET FILE NAME="HAC_ HFS$:[ARC. ROUSAVE_TR N]CC-INPUT .XML" | |
938 | // HAC | |
939 | ;SET FILE NAME="HAC_ HFS$:[ARC. ROUSAVE_HA C]CC-INPUT .XML" | |
940 | SET SAVEI O = $IO | |
941 | SET $ZTRA P="Restore IOExit" | |
942 | OPEN FILE NAME::10 | |
943 | IF ($T) { | |
944 | SET sc = MIM.XML ExportToSt ring(.xmls tr) | |
945 | USE FI LENAME | |
946 | W xmls tr | |
947 | CLOSE FILENAME | |
948 | } | |
949 | RestoreIOE xit | |
950 | SET $Z TRAP="" | |
951 | USE SA VEIO | |
952 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.