source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IB20P244.m@ 1572

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

initial load of FOIAVistA 6/30/08 version

File size: 8.0 KB
Line 
1IB20P244 ;ISP/TDP - Post-Init routine for IB*2.0*244 ;10/14/2003
2 ;;2.0;INTEGRATED BILLING;**244**;21-MAR-94
3POST ; This routine is to remove hyphens from the SUBSCRIBER ID (#1) field
4 ; of the INSURANCE TYPE SUB-FIELD (#2.312) file of the PATIENT (#2)
5 ; file. It also will delete invalid entries from the IB DM EXTRACT
6 ; DATA (#351.71) file.
7 ;
8EN ; Start of Post-Init process.
9 N %,IBDATE,IBNOW,IBPURGE,X,X1,X2
10 D NOW^%DTC S (IBNOW,X1)=X,IBDATE=%
11 S X2=120
12 D C^%DTC S IBPURGE=X
13 ;K ^XTMP("IB20P244",IBDATE)
14 S ^XTMP("IB20P244",0)=IBPURGE_"^"_IBNOW_"^"_$G(DUZ)
15 D SUBSCR
16 D INSUR
17 D END
18 Q
19SUBSCR ;Remove all hyphens from subscriber ID's in the INSURANCE TYPE
20 ;SUB-FIELD (#2.312) file of the PATIENT (#2) file.
21 D MES^XPDUTL("SUBSCRIBER ID clean up started in the")
22 D MES^XPDUTL(" INSURANCE TYPE SUB-FIELD (#2.312) file.")
23 D MES^XPDUTL("> Searching for SUBSCRIBER ID's containing invalid characters.")
24 D MES^XPDUTL(" ")
25 N DA,DFN,DIE,DR,IBCHAR,IBCHAR1,IBCNT,IBHICN,IBINS,IBINSCO,IBNAME,IBNODE
26 N IBRC,IBSSN,IBSUB,IBSUB1,IBSUB2,IBWNR
27 K ^TMP("IB20P244",$J)
28 S ^TMP("IB20P244",$J)=""
29 S IBCHAR="~` !@#$%^&*()_-+={}[]|\/:;<>,.?'"""
30 S IBCHAR1="~`!@$%^&*()_+={}[]|:;<>?'"""
31 S IBWNR=+$$GETWNR^IBCNSMM1
32 S (DFN,IBRC,IBCNT)=0
33 ; Loop through Patient (#2) file
34 F S DFN=$O(^DPT(DFN)) Q:DFN="" D
35 . S IBINS=0
36 . ; Loop through Insurance Type Sub-Field
37 . F S IBINS=$O(^DPT(DFN,.312,IBINS)) Q:IBINS="" D
38 .. S IBCNT=IBCNT+1 I IBCNT>999 W ". " S IBCNT=0
39 .. S IBNODE=$G(^DPT(DFN,.312,IBINS,0))
40 .. ; Get Subscriber ID
41 .. S IBSUB=$P(IBNODE,U,2) I IBSUB="" Q
42 .. S IBSSN=$TR($P($G(^DPT(DFN,0)),U,9),IBCHAR,"")
43 .. S IBNAME=$P($G(^DPT(DFN,0)),U,1)
44 .. ; Remove non-alphanumeric characters
45 .. I $P(IBNODE,U,1)=IBWNR D ;Medicare
46 ... S IBSUB1=$TR(IBSUB,IBCHAR,"")
47 ... ; Check for invalid HICN format and no date of death
48 ... I '$$VALHIC^IBCNSMM(IBSUB1),'$P($G(^DPT(DFN,.35)),U,1) S ^TMP("IB20P244",$J,"HICN INVALID",IBNAME_" ("_IBSSN_")")=IBSUB_"^"_IBSUB1
49 .. I $P(IBNODE,U,1)'=IBWNR D ;non-Medicare
50 ... S IBSUB1=$TR(IBSUB,IBCHAR1,"")
51 ... ;If subscriber id is SSN, then remove all extraneous characters
52 ... S IBSUB2=$TR(IBSUB1," #-/\,.","")
53 ... I IBSUB2=IBSSN,$L(IBSSN)=9 S IBSUB1=IBSUB2
54 .. ;I IBHICN S ^TMP("IB20P244",$J,"HICN INVALID",IBNAME_" ("_IBSSN_")")=IBSUB_"^"_IBSUB1 S IBHICN=0
55 .. ; Quit if no change in data
56 .. I IBSUB1=IBSUB Q
57 .. S IBINSCO=$P($G(^DIC(36,$P($G(^DPT(DFN,.312,IBINS,0)),U,1),0)),U,1)
58 .. S IBRC=IBRC+1
59 .. S ^XTMP("IB20P244",IBDATE,"SUB",DFN,IBINS)=IBSUB_"^"_IBSUB1
60 .. ; Save newly cleaned Subscriber ID
61 .. S DA=IBINS,DA(1)=DFN,DR="1////"_$S(IBSUB1="":"@",1:IBSUB1),DIE="^DPT(DFN,.312," D ^DIE
62 .. ;D MES^XPDUTL(">> Converted SUBSCRIBER ID of patient "_IBNAME_" ("_IBSSN_") from "_IBSUB_" to "_IBSUB1_" for insurance company "_IBINSCO)
63 D BMES^XPDUTL("> "_IBRC_" total SUBSCRIBER ID(S) were cleaned up.")
64 I $D(^TMP("IB20P244",$J,"HICN INVALID")) D MESSAGE
65 K ^TMP("IB20P244",$J)
66 Q
67 ;
68END ; display message that post-init has completed successfully
69 K X,Y
70 D MES^XPDUTL(" ")
71 D BMES^XPDUTL("Data clean up conversions complete.")
72 Q
73 ;
74INSUR ;This will remove all future dates and all past date entries which
75 ;contain a day other than "00". For example, 3031000 is a valid entry
76 ;while 3051200 and 3031014 are not based on a current date of 3031015.
77 N FTDT,PTDT
78 D MES^XPDUTL(" ")
79 D BMES^XPDUTL("IB DM EXTRACT DATA (#351.71) file clean up started.")
80 D MES^XPDUTL("> Searching for invalid entries.")
81 D FUTURE
82 D PAST
83 D MES^XPDUTL(" ")
84 I FTDT D MES^XPDUTL(">> "_FTDT_" invalid future date entries were deleted.")
85 I 'FTDT D MES^XPDUTL(">> There were no invalid future date entries found.")
86 I PTDT D MES^XPDUTL(">> "_PTDT_" invalid past date entries were deleted.")
87 I 'PTDT D MES^XPDUTL(">> There were no invalid past date entries found.")
88 D BMES^XPDUTL("> IB DM EXTRACT DATA (#351.71) file clean up completed.")
89INSURQ Q
90 ;
91FUTURE ;This utility searches for and deletes future date entries from file
92 ;351.71.
93 ;Outputs: FTDT - number of future date entries deleted from 351.71.
94 ; ^XTMP("IB20P244",IBDATE,"INS","FUT") - This global is created
95 ; to temporarily store the data from the deleted future
96 ; date entries. Will not exist if no future dates are
97 ; found.
98 N CDT,DA,DATE,DIK
99 S FTDT=0
100 D NOW^%DTC S CDT=X
101 S DATE=99999999
102 F S DATE=$O(^IBE(351.71,DATE),-1) Q:DATE'>CDT D
103 . M ^XTMP("IB20P244",IBDATE,"INS","FUT",DATE)=^IBE(351.71,DATE)
104 . S DIK="^IBE(351.71,",DA=DATE D ^DIK
105 . S FTDT=FTDT+1
106 . Q
107 Q
108 ;
109PAST ;This utility searches for and deletes past date entries from file
110 ;351.71 that end with something other than "00".
111 ;Outputs: PTDT - number of entries deleted from 351.71.
112 ; ^XTMP("IB20P244",IBDATE,"INS","PST") - This global is created
113 ; to temporarily store the data from the deleted past
114 ; date entries. Will not exist if no past dates are
115 ; found.
116 N DA,DATE,DIK
117 S PTDT=0
118 S DATE=0
119 F S DATE=$O(^IBE(351.71,DATE)) Q:DATE="" D
120 . I $E(DATE,6,7)="00" Q
121 . I 'DATE Q
122 . M ^XTMP("IB20P244",IBDATE,"INS","PST",DATE)=^IBE(351.71,DATE)
123 . S DIK="^IBE(351.71,",DA=DATE D ^DIK
124 . S PTDT=PTDT+1
125 . Q
126 Q
127 ;
128MESSAGE ; Send message reporting invalid HICN format
129 N IBC,IBBCNT,IBCNT,IBDATA,IBFCNT,IBIDENT,IBGROUP,IBGRP,IBINSCO,IBMMSG
130 N IBMSG,IBNETNM,IBPARAM,IBSUB,IBTCNT,IBTST,IBTXT,XMDUZ,XMERR,XMSUB
131 N XMTEXT,XMY
132 S IBTCNT=0,IBIDENT=""
133 F S IBIDENT=$O(^TMP("IB20P244",$J,"HICN INVALID",IBIDENT)) Q:IBIDENT="" D
134 . S IBTCNT=IBTCNT+1
135 S IBSUB=0
136 D MSGHDR
137 I DUZ="" N DUZ S DUZ=.5 ; if user not defined set to postmaster
138 S XMDUZ=DUZ,XMTEXT=$NA(^TMP($J))
139 S IBPARAM("FROM")="PATCH IB*2.0*244 POST-INIT"
140 S IBGROUP="IB EDI SUPERVISOR"
141 S IBGRP=$O(^XMB(3.8,"B",IBGROUP,"")) I IBGRP D ;billing group defined
142 . I +$P($G(^XMB(3.8,IBGRP,1,0)),U,4)'>0 Q ; no members defined
143 . S XMY("G."_IBGROUP)="" ; send message to the group.
144 ;I '$D(^XMB(3.8,"B",IBGROUP)) S IBGROUP=DUZ ; billing group not defined - send to the user
145 ;E S IBGROUP="G."_IBGROUP
146 S XMY(DUZ)="" ; send message to user
147 ;Send to developer if not test account (next 3 lines)
148 S IBTST=".TEST.MIR.TST.MIRROR.TRAIN." ; various test names
149 S IBNETNM=$G(^XMB("NETNAME"))
150 I IBNETNM'="",('$F(IBTST,"."_$P(IBNETNM,".",1)_".")) S XMY("PHELPS,TY@FORUM.VA.GOV")=""
151 ;
152 S IBINSCO=$P($G(^DIC(36,IBWNR,0)),U,1)
153MSG1 S IBC=0
154 S IBC=IBC+1,^TMP($J,IBC)="This message has been sent by patch IB*2.0*244 at the completion of"
155 S IBC=IBC+1,^TMP($J,IBC)="the post-init routine."
156 S IBC=IBC+1,^TMP($J,IBC)="The following "_IBINSCO_" SUBSCRIBER ID entries remain in an invalid state:"
157 S IBC=IBC+1,^TMP($J,IBC)=" "
158 S IBC=IBC+1,^TMP($J,IBC)="NAME(SSN) ^ ORIGINAL ID ^ MODIFIED ID"
159 S IBC=IBC+1,^TMP($J,IBC)=" "
160 S (IBMMSG,IBMSG)=0
161 I IBSUB=1 S IBCNT=0,IBIDENT="",IBBCNT=1
162 I IBSUB>1 S IBBCNT=IBCNT+1
163 F S IBIDENT=$O(^TMP("IB20P244",$J,"HICN INVALID",IBIDENT)) Q:IBIDENT="" D G:IBMSG MSG1
164 . S IBDATA=$G(^TMP("IB20P244",$J,"HICN INVALID",IBIDENT))
165 . S IBC=IBC+1,^TMP($J,IBC)=IBIDENT_"^"_IBDATA
166 . S IBCNT=IBCNT+1
167 . I 'IBMMSG S IBMMSG=1
168 . I IBC>9500 S IBFCNT=IBCNT D
169 .. S IBC=IBC+1,^TMP($J,IBC)=" "
170 .. S IBC=IBC+1,^TMP($J,IBC)="This message contains "_IBBCNT_" thru "_IBFCNT_" of "_IBTCNT_" total"
171 .. S IBC=IBC+1,^TMP($J,IBC)="records left in an invalid state."
172 .. D SNDMSG,MSGHDR S IBMSG=1
173 S IBC=IBC+1,^TMP($J,IBC)=" "
174 I IBSUB=1 D
175 .S IBC=IBC+1,^TMP($J,IBC)="Total records left in an invalid state: "_IBCNT_"."
176 I IBSUB>1 D
177 . S IBC=IBC+1,^TMP($J,IBC)="This message contains "_IBBCNT_" thru "_IBCNT_" of "_IBTCNT_" total"
178 . S IBC=IBC+1,^TMP($J,IBC)="records left in an invalid state."
179 I IBMMSG D SNDMSG
180 Q
181SNDMSG ;
182 D SENDMSG^XMXAPI(XMDUZ,XMSUB,XMTEXT,.XMY,.IBPARAM,"","")
183 S IBTXT="Invalid Medicare SUBSCRIBER ID message #"_IBSUB_" "_$S($D(XMERR):"not sent due to error in message set up.",1:"sent to ")_$S($D(XMY("G.IB EDI SUPERVISOR")):"IB EDI SUPERVISOR mail group, ",1:"")
184 D BMES^XPDUTL(IBTXT)
185 S IBTXT=" the "_$S(DUZ=.5:"POSTMASTER ",1:"user ")_"and the patch developer."
186 D MES^XPDUTL(IBTXT)
187 K ^TMP($J)
188 Q
189 ;
190MSGHDR ;Creates message subject line
191 K ^TMP($J)
192 S IBSUB=IBSUB+1
193 S XMSUB="SUBSCRIBER ID CLEAN UP COMPLETE"
194 I IBSUB>1 S XMSUB=XMSUB_" (MSG #"_IBSUB_")"
195 Q
Note: See TracBrowser for help on using the repository browser.