-
Notifications
You must be signed in to change notification settings - Fork 1
/
IVM_2_P147.KID
1466 lines (1418 loc) · 36 KB
/
IVM_2_P147.KID
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
KIDS Distribution saved on Apr 11, 2011@16:20:02
PATCHES IVM*2*147 AND DG*5.3*829
**KIDS**:IVM*2.0*147^DG*5.3*829^
**INSTALL NAME**
IVM*2.0*147
"BLD",7737,0)
IVM*2.0*147^INCOME VERIFICATION MATCH^0^3110411^y
"BLD",7737,4,0)
^9.64PA^^
"BLD",7737,6.3)
4
"BLD",7737,"ABPKG")
n
"BLD",7737,"KRN",0)
^9.67PA^779.2^20
"BLD",7737,"KRN",.4,0)
.4
"BLD",7737,"KRN",.401,0)
.401
"BLD",7737,"KRN",.402,0)
.402
"BLD",7737,"KRN",.403,0)
.403
"BLD",7737,"KRN",.5,0)
.5
"BLD",7737,"KRN",.84,0)
.84
"BLD",7737,"KRN",3.6,0)
3.6
"BLD",7737,"KRN",3.8,0)
3.8
"BLD",7737,"KRN",9.2,0)
9.2
"BLD",7737,"KRN",9.8,0)
9.8
"BLD",7737,"KRN",9.8,"NM",0)
^9.68A^2^2
"BLD",7737,"KRN",9.8,"NM",1,0)
IVMPTRN^^0^B51345879
"BLD",7737,"KRN",9.8,"NM",2,0)
IVMZ07C^^0^B18525978
"BLD",7737,"KRN",9.8,"NM","B","IVMPTRN",1)
"BLD",7737,"KRN",9.8,"NM","B","IVMZ07C",2)
"BLD",7737,"KRN",19,0)
19
"BLD",7737,"KRN",19.1,0)
19.1
"BLD",7737,"KRN",101,0)
101
"BLD",7737,"KRN",409.61,0)
409.61
"BLD",7737,"KRN",771,0)
771
"BLD",7737,"KRN",779.2,0)
779.2
"BLD",7737,"KRN",870,0)
870
"BLD",7737,"KRN",8989.51,0)
8989.51
"BLD",7737,"KRN",8989.52,0)
8989.52
"BLD",7737,"KRN",8994,0)
8994
"BLD",7737,"KRN","B",.4,.4)
"BLD",7737,"KRN","B",.401,.401)
"BLD",7737,"KRN","B",.402,.402)
"BLD",7737,"KRN","B",.403,.403)
"BLD",7737,"KRN","B",.5,.5)
"BLD",7737,"KRN","B",.84,.84)
"BLD",7737,"KRN","B",3.6,3.6)
"BLD",7737,"KRN","B",3.8,3.8)
"BLD",7737,"KRN","B",9.2,9.2)
"BLD",7737,"KRN","B",9.8,9.8)
"BLD",7737,"KRN","B",19,19)
"BLD",7737,"KRN","B",19.1,19.1)
"BLD",7737,"KRN","B",101,101)
"BLD",7737,"KRN","B",409.61,409.61)
"BLD",7737,"KRN","B",771,771)
"BLD",7737,"KRN","B",779.2,779.2)
"BLD",7737,"KRN","B",870,870)
"BLD",7737,"KRN","B",8989.51,8989.51)
"BLD",7737,"KRN","B",8989.52,8989.52)
"BLD",7737,"KRN","B",8994,8994)
"BLD",7737,"QUES",0)
^9.62^^
"BLD",7737,"REQB",0)
^9.611^2^2
"BLD",7737,"REQB",1,0)
IVM*2.0*134^2
"BLD",7737,"REQB",2,0)
IVM*2.0*143^2
"BLD",7737,"REQB","B","IVM*2.0*134",1)
"BLD",7737,"REQB","B","IVM*2.0*143",2)
"MBREQ")
0
"PKG",220,-1)
1^1
"PKG",220,0)
INCOME VERIFICATION MATCH^IVM^IVM Software for interface with the IVM Center
"PKG",220,20,0)
^9.402P^^
"PKG",220,22,0)
^9.49I^1^1
"PKG",220,22,1,0)
2.0^2941021
"PKG",220,22,1,"PAH",1,0)
147^3110411^123456800
"QUES","XPF1",0)
Y
"QUES","XPF1","??")
^D REP^XPDH
"QUES","XPF1","A")
Shall I write over your |FLAG| File
"QUES","XPF1","B")
YES
"QUES","XPF1","M")
D XPF1^XPDIQ
"QUES","XPF2",0)
Y
"QUES","XPF2","??")
^D DTA^XPDH
"QUES","XPF2","A")
Want my data |FLAG| yours
"QUES","XPF2","B")
YES
"QUES","XPF2","M")
D XPF2^XPDIQ
"QUES","XPI1",0)
YO
"QUES","XPI1","??")
^D INHIBIT^XPDH
"QUES","XPI1","A")
Want KIDS to INHIBIT LOGONs during the install
"QUES","XPI1","B")
NO
"QUES","XPI1","M")
D XPI1^XPDIQ
"QUES","XPM1",0)
PO^VA(200,:EM
"QUES","XPM1","??")
^D MG^XPDH
"QUES","XPM1","A")
Enter the Coordinator for Mail Group '|FLAG|'
"QUES","XPM1","B")
"QUES","XPM1","M")
D XPM1^XPDIQ
"QUES","XPO1",0)
Y
"QUES","XPO1","??")
^D MENU^XPDH
"QUES","XPO1","A")
Want KIDS to Rebuild Menu Trees Upon Completion of Install
"QUES","XPO1","B")
NO
"QUES","XPO1","M")
D XPO1^XPDIQ
"QUES","XPZ1",0)
Y
"QUES","XPZ1","??")
^D OPT^XPDH
"QUES","XPZ1","A")
Want to DISABLE Scheduled Options, Menu Options, and Protocols
"QUES","XPZ1","B")
NO
"QUES","XPZ1","M")
D XPZ1^XPDIQ
"QUES","XPZ2",0)
Y
"QUES","XPZ2","??")
^D RTN^XPDH
"QUES","XPZ2","A")
Want to MOVE routines to other CPUs
"QUES","XPZ2","B")
NO
"QUES","XPZ2","M")
D XPZ2^XPDIQ
"RTN")
2
"RTN","IVMPTRN")
0^1^B51345879
"RTN","IVMPTRN",1,0)
IVMPTRN ;ALB/MLI,SEK,RTK,BRM,BAJ,LBD - IVM BACKGROUND JOB/TRANSMISSIONS TO IVM CENTER; 10/28/2005 ; 7/13/10 4:11pm
"RTN","IVMPTRN",2,0)
;;2.0;INCOME VERIFICATION MATCH;**1,9,11,12,17,28,34,74,79,89,105,143,147**;JUL 8,1996;Build 4
"RTN","IVMPTRN",3,0)
;;Per VHA Directive 10-93-142, this routine should not be modified.
"RTN","IVMPTRN",4,0)
;
"RTN","IVMPTRN",5,0)
; This routine is run nightly to send HL7 messages to the IVM Center for
"RTN","IVMPTRN",6,0)
; processing.
"RTN","IVMPTRN",7,0)
;
"RTN","IVMPTRN",8,0)
BGJ ; - IVM Nightly Background Job
"RTN","IVMPTRN",9,0)
;
"RTN","IVMPTRN",10,0)
;for tests being held for the future, make them primary if now effective
"RTN","IVMPTRN",11,0)
D FUTUREMT,FUTURERX
"RTN","IVMPTRN",12,0)
;
"RTN","IVMPTRN",13,0)
; - retransmit enrollment/eligibility queries with no reply
"RTN","IVMPTRN",14,0)
D BATCH^DGENQRY1
"RTN","IVMPTRN",15,0)
;
"RTN","IVMPTRN",16,0)
; - retransmit income test (financial) queries with no reply
"RTN","IVMPTRN",17,0)
D MONITOR^IVMCQ2
"RTN","IVMPTRN",18,0)
;
"RTN","IVMPTRN",19,0)
; - current year and previous year
"RTN","IVMPTRN",20,0)
S IVMCURYR=$$LYR^DGMTSCU1(DT),IVMPREYR=$$LYR^DGMTSCU1(IVMCURYR)
"RTN","IVMPTRN",21,0)
;
"RTN","IVMPTRN",22,0)
;
"RTN","IVMPTRN",23,0)
; - Master Query Processing
"RTN","IVMPTRN",24,0)
;
"RTN","IVMPTRN",25,0)
; - respond to Master Query for previous year, if necessary
"RTN","IVMPTRN",26,0)
S IVMREC=$$QRY(IVMPREYR) I IVMREC D RESP(IVMPREYR,+IVMREC),END
"RTN","IVMPTRN",27,0)
;
"RTN","IVMPTRN",28,0)
; - respond to Master Query for current year, if necessary
"RTN","IVMPTRN",29,0)
S IVMREC=$$QRY(IVMCURYR) I IVMREC D RESP(IVMCURYR,+IVMREC),END
"RTN","IVMPTRN",30,0)
;
"RTN","IVMPTRN",31,0)
; - send regular 'nightly' transmissions
"RTN","IVMPTRN",32,0)
D REG,END
"RTN","IVMPTRN",33,0)
;
"RTN","IVMPTRN",34,0)
; - perform retransmission processing
"RTN","IVMPTRN",35,0)
D ENTRY^IVMPTRN4,END
"RTN","IVMPTRN",36,0)
;
"RTN","IVMPTRN",37,0)
; - process billing activity
"RTN","IVMPTRN",38,0)
D EN^IVMPTRN5
"RTN","IVMPTRN",39,0)
;
"RTN","IVMPTRN",40,0)
; - auto-upload address changes from #301.5 if >14 days old
"RTN","IVMPTRN",41,0)
; - auto-delete non address changes from #301.5 if >30 days old
"RTN","IVMPTRN",42,0)
N ADDRDT S ADDRDT(0)=30,ADDRDT(1)=14 D EN^IVMLDEMC(.ADDRDT)
"RTN","IVMPTRN",43,0)
;
"RTN","IVMPTRN",44,0)
END ; - cleanup
"RTN","IVMPTRN",45,0)
I $D(ZTQUEUED) S ZTREQ="@"
"RTN","IVMPTRN",46,0)
K DA,DFN,DIE,DIK,DR,IVMCT,IVMDA,IVMDT,IVMGTOT,IVMINCYR,IVMINS,IVMMTDT
"RTN","IVMPTRN",47,0)
K IVMNODE,IVMPAT,IVMPID,IVMQDT,IVMREC,IVMSTAT,X,%,VAFPID,IVMPREYR,IVMIY
"RTN","IVMPTRN",48,0)
D CLEAN^IVMUFNC
"RTN","IVMPTRN",49,0)
K ^TMP($J,"CC")
"RTN","IVMPTRN",50,0)
Q
"RTN","IVMPTRN",51,0)
;
"RTN","IVMPTRN",52,0)
REG ; Creates FULL query transmission for patient's
"RTN","IVMPTRN",53,0)
; that exist in file (#301.5) "ATR" x-ref
"RTN","IVMPTRN",54,0)
;
"RTN","IVMPTRN",55,0)
;
"RTN","IVMPTRN",56,0)
; - initialize variables for HL7/IVM
"RTN","IVMPTRN",57,0)
S HLMTN="ORU"
"RTN","IVMPTRN",58,0)
S HLEID="VAMC "_$P($$SITE^VASITE,"^",3)_" "_HLMTN_"-Z07 SERVER"
"RTN","IVMPTRN",59,0)
S HLEID=$O(^ORD(101,"B",HLEID,0))
"RTN","IVMPTRN",60,0)
K ^TMP($J,"CC") ;refresh Consistency Check counter
"RTN","IVMPTRN",61,0)
D INIT^IVMUFNC(HLEID,.HL)
"RTN","IVMPTRN",62,0)
;
"RTN","IVMPTRN",63,0)
; - roll thru ATR x-ref for patients that require transmission
"RTN","IVMPTRN",64,0)
K IVMQUERY("LTD"),IVMQUERY("OVIS") ;Variables needed to open/close last visit date and outpt visit QUERIES
"RTN","IVMPTRN",65,0)
S IVMIY=0
"RTN","IVMPTRN",66,0)
F S IVMIY=$O(^IVM(301.5,"ATR",0,IVMIY)) Q:'IVMIY D
"RTN","IVMPTRN",67,0)
.S IVMDA=0
"RTN","IVMPTRN",68,0)
.F S IVMDA=$O(^IVM(301.5,"ATR",0,IVMIY,IVMDA)) Q:'IVMDA D
"RTN","IVMPTRN",69,0)
..;
"RTN","IVMPTRN",70,0)
..N EVENTS
"RTN","IVMPTRN",71,0)
..; - get node, income year, dfn
"RTN","IVMPTRN",72,0)
..S IVMNODE=$G(^IVM(301.5,+IVMDA,0)),IVMDT=+$P(IVMNODE,"^",2),DFN=+IVMNODE
"RTN","IVMPTRN",73,0)
..I 'DFN!'IVMDT Q
"RTN","IVMPTRN",74,0)
..;
"RTN","IVMPTRN",75,0)
..Q:($$STATUS^IVMPLOG(IVMDA,.EVENTS)=1)
"RTN","IVMPTRN",76,0)
..;
"RTN","IVMPTRN",77,0)
..; - if merged patient record, then update Transmission Status to
"RTN","IVMPTRN",78,0)
..; remove from "ATR" x-ref and do not create Z07 (IVM*2*147)
"RTN","IVMPTRN",79,0)
..I $D(^DPT(DFN,-9)) S X=$$CLEAR^IVMPLOG(IVMDA) K X Q
"RTN","IVMPTRN",80,0)
..;
"RTN","IVMPTRN",81,0)
..S IVMMTDT=$$GETMTDT(DFN,IVMDT) ;IVM*2*143
"RTN","IVMPTRN",82,0)
..;
"RTN","IVMPTRN",83,0)
..; - prepare FULL transmission
"RTN","IVMPTRN",84,0)
..D FULL^IVMPTRN7(DFN,IVMMTDT,.EVENTS,.IVMCT,.IVMGTOT,,,,.IVMQUERY)
"RTN","IVMPTRN",85,0)
;
"RTN","IVMPTRN",86,0)
; After all transmissions send Bulletin of inconsistency check totals
"RTN","IVMPTRN",87,0)
D EN^IVMPBUL
"RTN","IVMPTRN",88,0)
;
"RTN","IVMPTRN",89,0)
F Z="LTD","OVIS" I $G(IVMQUERY(Z)) D CLOSE^SDQ(IVMQUERY(Z)) K IVMQUERY(Z)
"RTN","IVMPTRN",90,0)
; - transmit remaining records
"RTN","IVMPTRN",91,0)
D
"RTN","IVMPTRN",92,0)
.N IVMEVENT
"RTN","IVMPTRN",93,0)
.; event code for Full Data Transmission
"RTN","IVMPTRN",94,0)
.S IVMEVENT="Z07"
"RTN","IVMPTRN",95,0)
.D FILE^IVMPTRN3
"RTN","IVMPTRN",96,0)
Q
"RTN","IVMPTRN",97,0)
;
"RTN","IVMPTRN",98,0)
RESP(IVMINCYR,IVMREC) ; Response to the Master Query.
"RTN","IVMPTRN",99,0)
;
"RTN","IVMPTRN",100,0)
; Input: IVMINCYR - The income year for which the query was sent
"RTN","IVMPTRN",101,0)
; IVMREC - Internal entry number of query to be updated
"RTN","IVMPTRN",102,0)
;
"RTN","IVMPTRN",103,0)
N DFN,IVMDA,IVMMTDT,DA,DR,DIE,EVENTS
"RTN","IVMPTRN",104,0)
;
"RTN","IVMPTRN",105,0)
; - initialize variables for HL7/IVM
"RTN","IVMPTRN",106,0)
S HLMTN="ORF"
"RTN","IVMPTRN",107,0)
S HLEID="VAMC "_$P($$SITE^VASITE,"^",3)_" "_HLMTN_"-Z07 SERVER"
"RTN","IVMPTRN",108,0)
S HLEID=$O(^ORD(101,"B",HLEID,0))
"RTN","IVMPTRN",109,0)
D INIT^IVMUFNC(HLEID,.HL)
"RTN","IVMPTRN",110,0)
;
"RTN","IVMPTRN",111,0)
; - roll thru AYR x-ref
"RTN","IVMPTRN",112,0)
F DFN=0:0 S DFN=$O(^IVM(301.5,"AYR",IVMINCYR,DFN)) Q:'DFN D
"RTN","IVMPTRN",113,0)
.F IVMDA=0:0 S IVMDA=$O(^IVM(301.5,"AYR",IVMINCYR,DFN,IVMDA)) Q:'IVMDA D
"RTN","IVMPTRN",114,0)
..;
"RTN","IVMPTRN",115,0)
..; - check for STOP FLAG in file #301.5.
"RTN","IVMPTRN",116,0)
..I '$$CLOSED^IVMPLOG(IVMDA) D
"RTN","IVMPTRN",117,0)
...;
"RTN","IVMPTRN",118,0)
...; if means test was deleted, -10000 could be entered as income year
"RTN","IVMPTRN",119,0)
...; in ^IVM(301.5. close case if deleted.
"RTN","IVMPTRN",120,0)
...S IVMMTDT=$P($$LST^DGMTU(DFN,($E(IVMINCYR,1,3)+1)_"1231.9999"),"^",2)
"RTN","IVMPTRN",121,0)
...I IVMMTDT="" D CLOSE^IVMPTRN1(IVMINCYR,DFN,1,3) Q
"RTN","IVMPTRN",122,0)
...;
"RTN","IVMPTRN",123,0)
...;get EVENTS() array
"RTN","IVMPTRN",124,0)
...I $$STATUS^IVMPLOG(+IVMDA,.EVENTS)
"RTN","IVMPTRN",125,0)
...;
"RTN","IVMPTRN",126,0)
...; - prepare FULL transmission
"RTN","IVMPTRN",127,0)
...; note: 6th parameter is IVMFLL (=1 to include MSA segment)
"RTN","IVMPTRN",128,0)
...D FULL^IVMPTRN7(DFN,IVMMTDT,.EVENTS,.IVMCT,.IVMGTOT,1,,$G(IVMREC),.IVMQUERY)
"RTN","IVMPTRN",129,0)
;
"RTN","IVMPTRN",130,0)
; - transmit remaining records
"RTN","IVMPTRN",131,0)
D
"RTN","IVMPTRN",132,0)
.N IVMEVENT
"RTN","IVMPTRN",133,0)
.; event code for Full Data Transmission
"RTN","IVMPTRN",134,0)
.S IVMEVENT="Z07"
"RTN","IVMPTRN",135,0)
.D FILE1^IVMPTRN3 ; added for v1.6 because of MSA segment (note: the original call was to FILE^IVMPTRN3)
"RTN","IVMPTRN",136,0)
;
"RTN","IVMPTRN",137,0)
;
"RTN","IVMPTRN",138,0)
; - update multiple in file #301.9. Stuff (.03) field with date/time
"RTN","IVMPTRN",139,0)
; of FULL query transmission.
"RTN","IVMPTRN",140,0)
S DIE="^IVM(301.9,1,10,",DA=+IVMREC,DA(1)=1,DR=".03////"_$$NOW^XLFDT D ^DIE
"RTN","IVMPTRN",141,0)
Q
"RTN","IVMPTRN",142,0)
;
"RTN","IVMPTRN",143,0)
QRY(YEAR) ; See if Master Query has been satisfied for YEAR.
"RTN","IVMPTRN",144,0)
; Input: YEAR - The income year being checked
"RTN","IVMPTRN",145,0)
;
"RTN","IVMPTRN",146,0)
; Output: 1^2, where 1 = 0, if query does not need a response
"RTN","IVMPTRN",147,0)
; >0, if query needs a response (value
"RTN","IVMPTRN",148,0)
; equal to ien of sub-file entry
"RTN","IVMPTRN",149,0)
; in #301.9
"RTN","IVMPTRN",150,0)
; 2 = 0, if the request has not been received
"RTN","IVMPTRN",151,0)
; 1, if the request has been received
"RTN","IVMPTRN",152,0)
N IVM,X,Y,Z
"RTN","IVMPTRN",153,0)
I '$G(YEAR) S X="0^0" G QRYQ
"RTN","IVMPTRN",154,0)
S Y=$O(^IVM(301.9,1,10,"AB",YEAR,"")) I 'Y S X="0^0" G QRYQ
"RTN","IVMPTRN",155,0)
S IVM=$O(^IVM(301.9,1,10,"AB",YEAR,Y,0)) I 'IVM S X="0^0" G QRYQ
"RTN","IVMPTRN",156,0)
S Z=$P($G(^IVM(301.9,1,10,+IVM,0)),"^",3)
"RTN","IVMPTRN",157,0)
S X=$S(Z:0,1:IVM)_"^1"
"RTN","IVMPTRN",158,0)
QRYQ Q X
"RTN","IVMPTRN",159,0)
;
"RTN","IVMPTRN",160,0)
FUTUREMT ;
"RTN","IVMPTRN",161,0)
;Find future tests, and if now effective then make them primary. Will
"RTN","IVMPTRN",162,0)
;call the MT event driver unless NOT required, in which case the status
"RTN","IVMPTRN",163,0)
;will have the status will be changed to NO LONGER REQUIRED
"RTN","IVMPTRN",164,0)
;and may auto-create a Rx copay test
"RTN","IVMPTRN",165,0)
;
"RTN","IVMPTRN",166,0)
N FDATE,IVMPAT,MTIEN,NODE,DFN,DATA
"RTN","IVMPTRN",167,0)
;
"RTN","IVMPTRN",168,0)
S FDATE=0
"RTN","IVMPTRN",169,0)
F S FDATE=$O(^IVM(301.5,"AC",FDATE)) Q:('FDATE) Q:(FDATE>DT) D
"RTN","IVMPTRN",170,0)
.S IVMPAT=0
"RTN","IVMPTRN",171,0)
.F S IVMPAT=$O(^IVM(301.5,"AC",FDATE,IVMPAT)) Q:'IVMPAT D
"RTN","IVMPTRN",172,0)
..S MTIEN=$O(^IVM(301.5,"AC",FDATE,IVMPAT,""),-1)
"RTN","IVMPTRN",173,0)
..I '$$FUTURECK("AC",FDATE,IVMPAT,MTIEN) K ^IVM(301.5,"AC",FDATE,IVMPAT,MTIEN)
"RTN","IVMPTRN",174,0)
..K DATA S DATA(.06)="" I $$UPD^DGENDBS(301.5,IVMPAT,.DATA)
"RTN","IVMPTRN",175,0)
..S DFN=+$G(^IVM(301.5,IVMPAT,0))
"RTN","IVMPTRN",176,0)
..I DFN S NODE=$$LST^DGMTU(DFN,DT_.9999,1) I $E($P(NODE,"^",2),1,3)=$E(DT,1,3),$P(NODE,"^",4)'="","R"'=$P(NODE,"^",4) K ^IVM(301.5,"AC",FDATE,IVMPAT,MTIEN) Q
"RTN","IVMPTRN",177,0)
..D MTPRIME^DGMTU4(MTIEN)
"RTN","IVMPTRN",178,0)
Q
"RTN","IVMPTRN",179,0)
;
"RTN","IVMPTRN",180,0)
FUTURERX ;
"RTN","IVMPTRN",181,0)
;Find future COPAY tests, and if now effective then make it primary.
"RTN","IVMPTRN",182,0)
;Will change the status to NO LONGER APPLICABLE if the vet is not
"RTN","IVMPTRN",183,0)
;subject to pharmacy copayments
"RTN","IVMPTRN",184,0)
;
"RTN","IVMPTRN",185,0)
N FDATE,IVMPAT,MTIEN,NODE,DFN,DATA
"RTN","IVMPTRN",186,0)
;
"RTN","IVMPTRN",187,0)
S FDATE=0
"RTN","IVMPTRN",188,0)
F S FDATE=$O(^IVM(301.5,"AD",FDATE)) Q:('FDATE) Q:(FDATE>DT) D
"RTN","IVMPTRN",189,0)
.S IVMPAT=0
"RTN","IVMPTRN",190,0)
.F S IVMPAT=$O(^IVM(301.5,"AD",FDATE,IVMPAT)) Q:'IVMPAT D
"RTN","IVMPTRN",191,0)
..S MTIEN=$O(^IVM(301.5,"AD",FDATE,IVMPAT,""),-1)
"RTN","IVMPTRN",192,0)
..I '$$FUTURECK("AD",FDATE,IVMPAT,MTIEN) K ^IVM(301.5,"AD",FDATE,IVMPAT,MTIEN)
"RTN","IVMPTRN",193,0)
..K DATA S DATA(.07)="" I $$UPD^DGENDBS(301.5,IVMPAT,.DATA)
"RTN","IVMPTRN",194,0)
..S DFN=+$G(^IVM(301.5,IVMPAT,0))
"RTN","IVMPTRN",195,0)
..I DFN S NODE=$$LST^DGMTU(DFN,DT_.9999,2) I $E($P(NODE,"^",2),1,3)=$E(DT,1,3),$P(NODE,"^",4)'="" K ^IVM(301.5,"AD",FDATE,IVMPAT,MTIEN) Q
"RTN","IVMPTRN",196,0)
..D RXPRIME^DGMTU4(MTIEN)
"RTN","IVMPTRN",197,0)
Q
"RTN","IVMPTRN",198,0)
;
"RTN","IVMPTRN",199,0)
FUTURECK(TYPE,FDATE,IVMPAT,MTIEN) ;
"RTN","IVMPTRN",200,0)
; Check the Future MT or CP xref for a valid income test entry,
"RTN","IVMPTRN",201,0)
; and Delete all invalid xref entries.
"RTN","IVMPTRN",202,0)
N VALID,MTREC S VALID=1,MTREC=0
"RTN","IVMPTRN",203,0)
;
"RTN","IVMPTRN",204,0)
; Remove duplicate entries from cross reference, leaving last entry
"RTN","IVMPTRN",205,0)
F S MTREC=$O(^IVM(301.5,TYPE,FDATE,IVMPAT,MTREC)) Q:(MTREC=MTIEN!('MTREC)) K ^IVM(301.5,TYPE,FDATE,IVMPAT,MTREC)
"RTN","IVMPTRN",206,0)
;
"RTN","IVMPTRN",207,0)
I '$D(^IVM(301.5,IVMPAT,0)) S VALID=0 Q VALID
"RTN","IVMPTRN",208,0)
I '$D(^DGMT(408.31,MTIEN,0)) S VALID=0 Q VALID
"RTN","IVMPTRN",209,0)
I FDATE'=+(^DGMT(408.31,MTIEN,0)) S VALID=0 Q VALID
"RTN","IVMPTRN",210,0)
;
"RTN","IVMPTRN",211,0)
Q VALID
"RTN","IVMPTRN",212,0)
;
"RTN","IVMPTRN",213,0)
GETMTDT(DFN,IVMDT) ;Get date of primary Means Test or RX Copay Test (IVM*2*143)
"RTN","IVMPTRN",214,0)
N IDT,MT,MTDT,MTSTA,RX,RXDT,RXSTA
"RTN","IVMPTRN",215,0)
I '$G(DFN)!('$G(IVMDT)) Q ""
"RTN","IVMPTRN",216,0)
S IDT=($E(IVMDT,1,3)+1)_"1231.9999"
"RTN","IVMPTRN",217,0)
;Get most recent primary MT
"RTN","IVMPTRN",218,0)
S MT=$$LST^DGMTU(DFN,IDT,1),MTDT=$P(MT,"^",2),MTSTA=$P(MT,"^",4)
"RTN","IVMPTRN",219,0)
;Get most recent primary RX Copay Test
"RTN","IVMPTRN",220,0)
S RX=$$LST^DGMTU(DFN,IDT,2),RXDT=$P(RX,"^",2),RXSTA=$P(RX,"^",4)
"RTN","IVMPTRN",221,0)
;If there's no RX Copay Test, then return the Means Test date.
"RTN","IVMPTRN",222,0)
I 'RXDT Q MTDT
"RTN","IVMPTRN",223,0)
;If the RX Copay Test date is greater than or equal to the Means
"RTN","IVMPTRN",224,0)
;Test date, and the RX Copay Test status is Exempt, Non-Exempt,
"RTN","IVMPTRN",225,0)
;or Pending Adjudication, then return the RX Copay Test date.
"RTN","IVMPTRN",226,0)
I RXDT'<MTDT,("^E^M^P^"[("^"_RXSTA_"^")) Q RXDT
"RTN","IVMPTRN",227,0)
;Otherwise, return the Means Test date.
"RTN","IVMPTRN",228,0)
Q MTDT
"RTN","IVMZ07C")
0^2^B18525978
"RTN","IVMZ07C",1,0)
IVMZ07C ;BAJ/PHH/LBD - HL7 Z07 CONSISTENCY CHECKER -- DRIVER ROUTINE ; 7/14/10 11:54am
"RTN","IVMZ07C",2,0)
;;2.0;INCOME VERIFICATION MATCH;**105,128,134,147**;JUL 8,1996;Build 4
"RTN","IVMZ07C",3,0)
;
"RTN","IVMZ07C",4,0)
;
"RTN","IVMZ07C",5,0)
; This routine calls various checking subroutines and manages arrays and data filing
"RTN","IVMZ07C",6,0)
; for inconsistency checking prior to building a Z07 HL7 record. This routine returns
"RTN","IVMZ07C",7,0)
; a value and must be called as an API:
"RTN","IVMZ07C",8,0)
;
"RTN","IVMZ07C",9,0)
; I '$$EN^IVMZ07C(DFN) Q
"RTN","IVMZ07C",10,0)
;
"RTN","IVMZ07C",11,0)
; Values returned:
"RTN","IVMZ07C",12,0)
; 0 = Fail: inconsistencies found, do not build Z07 record
"RTN","IVMZ07C",13,0)
; 1 = Pass: No inconsistencies found, Ok to build Z07 record
"RTN","IVMZ07C",14,0)
;
"RTN","IVMZ07C",15,0)
; Must be called from entry point
"RTN","IVMZ07C",16,0)
Q
"RTN","IVMZ07C",17,0)
;
"RTN","IVMZ07C",18,0)
EN(DFN) ; entry point. Patient DFN is sent from calling routine.
"RTN","IVMZ07C",19,0)
; initialize working variables
"RTN","IVMZ07C",20,0)
N PASS,DGP,DGSD,U
"RTN","IVMZ07C",21,0)
S U="^"
"RTN","IVMZ07C",22,0)
;
"RTN","IVMZ07C",23,0)
; Input: DFN = ^DPT(DFN) of record to check
"RTN","IVMZ07C",24,0)
; BATCH = 1 batch/background job records should be counted
"RTN","IVMZ07C",25,0)
; = 0 single job, do not count records
"RTN","IVMZ07C",26,0)
; structure:
"RTN","IVMZ07C",27,0)
; 1. delete existing Z07 inconsistencies
"RTN","IVMZ07C",28,0)
; 2. load data arrays
"RTN","IVMZ07C",29,0)
; 3. call subroutines
"RTN","IVMZ07C",30,0)
; 4. check for Pass/Fail
"RTN","IVMZ07C",31,0)
; 5. update file 38.5 if necessary
"RTN","IVMZ07C",32,0)
; 6. return Pass/Fail
"RTN","IVMZ07C",33,0)
;
"RTN","IVMZ07C",34,0)
; Set flag
"RTN","IVMZ07C",35,0)
S PASS=0
"RTN","IVMZ07C",36,0)
I '$D(^DPT(DFN)) Q PASS
"RTN","IVMZ07C",37,0)
; If DFN is for a merged patient, quit (IVM*2*147)
"RTN","IVMZ07C",38,0)
I $D(^DPT(DFN,-9)) Q PASS
"RTN","IVMZ07C",39,0)
;
"RTN","IVMZ07C",40,0)
S PASS=1
"RTN","IVMZ07C",41,0)
;
"RTN","IVMZ07C",42,0)
; Load Patient and Spouse/dependent data
"RTN","IVMZ07C",43,0)
D LOADPT(DFN,.DGP),LOADSD^IVMZ072(DFN,.DGSD)
"RTN","IVMZ07C",44,0)
;
"RTN","IVMZ07C",45,0)
; Do checks and file inconsistencies
"RTN","IVMZ07C",46,0)
D WORK(DFN,.DGP,.DGSD)
"RTN","IVMZ07C",47,0)
;
"RTN","IVMZ07C",48,0)
; Delete old Inconsistency info
"RTN","IVMZ07C",49,0)
D DELETE(DFN)
"RTN","IVMZ07C",50,0)
;
"RTN","IVMZ07C",51,0)
; File new inconsistencies if necessary
"RTN","IVMZ07C",52,0)
I $$FILE(DFN) S PASS=0
"RTN","IVMZ07C",53,0)
;
"RTN","IVMZ07C",54,0)
; update counters
"RTN","IVMZ07C",55,0)
D COUNT(PASS)
"RTN","IVMZ07C",56,0)
;
"RTN","IVMZ07C",57,0)
; return pass/fail flag
"RTN","IVMZ07C",58,0)
Q PASS
"RTN","IVMZ07C",59,0)
;
"RTN","IVMZ07C",60,0)
COUNT(PASS) ; counter for batch run
"RTN","IVMZ07C",61,0)
N I
"RTN","IVMZ07C",62,0)
; Set it up the first time through
"RTN","IVMZ07C",63,0)
I '$D(^TMP($J,"CC")) D
"RTN","IVMZ07C",64,0)
. F I=0,1 S ^TMP($J,"CC",I)=0
"RTN","IVMZ07C",65,0)
;
"RTN","IVMZ07C",66,0)
; Increment Batch counter
"RTN","IVMZ07C",67,0)
S ^TMP($J,"CC",PASS)=^TMP($J,"CC",PASS)+1
"RTN","IVMZ07C",68,0)
Q
"RTN","IVMZ07C",69,0)
;
"RTN","IVMZ07C",70,0)
LOADPT(DFN,DGP) ; load patient data into arrays
"RTN","IVMZ07C",71,0)
N NIEN,IEN,I,DTTM,NAMCOM,NAME
"RTN","IVMZ07C",72,0)
; we need to load data from the following files
"RTN","IVMZ07C",73,0)
; Patient File 2
"RTN","IVMZ07C",74,0)
; Name Components 20
"RTN","IVMZ07C",75,0)
; Patient Enrollment 27.11
"RTN","IVMZ07C",76,0)
; Means test file 408.31
"RTN","IVMZ07C",77,0)
; MST History file 29.11
"RTN","IVMZ07C",78,0)
; Note: we also need Catastrophic data info, but that subroutine loads its own data array.
"RTN","IVMZ07C",79,0)
;
"RTN","IVMZ07C",80,0)
; ***************************
"RTN","IVMZ07C",81,0)
; DGP("PAT") Patient file
"RTN","IVMZ07C",82,0)
F I=0,.3,.15,.29,.31,.32,.321,.322,.35,.36,.361,.38,.52,"SSN","TYPE","VET" S DGP("PAT",I)=$G(^DPT(DFN,I))
"RTN","IVMZ07C",83,0)
S NAME=$P($G(^DPT(DFN,0)),"^",1),NAMCOM=$P($G(^DPT(DFN,"NAME")),"^",1)'=""
"RTN","IVMZ07C",84,0)
;
"RTN","IVMZ07C",85,0)
; ***************************
"RTN","IVMZ07C",86,0)
; DGP("NAME") Name Components
"RTN","IVMZ07C",87,0)
I NAMCOM S NIEN=$P(^DPT(DFN,"NAME"),U,1) I '$D(^VA(20,NIEN,1)) S NAMCOM=0
"RTN","IVMZ07C",88,0)
S DGP("NAME",1)=$S(NAMCOM:$G(^VA(20,NIEN,1)),1:$P(NAME,",")_"^"_$P($P(NAME,",",2)," ",1)_"^"_$P($P(NAME,",",2)," ",2))
"RTN","IVMZ07C",89,0)
;
"RTN","IVMZ07C",90,0)
; ***************************
"RTN","IVMZ07C",91,0)
;
"RTN","IVMZ07C",92,0)
; DGP("ENR") Patient Enrollment
"RTN","IVMZ07C",93,0)
S NIEN="",NIEN=$P($G(^DPT(DFN,"ENR")),U,1)
"RTN","IVMZ07C",94,0)
I NIEN]"",$D(^DGEN(27.11,NIEN)) M DGP("ENR")=^DGEN(27.11,NIEN)
"RTN","IVMZ07C",95,0)
;
"RTN","IVMZ07C",96,0)
; ***************************
"RTN","IVMZ07C",97,0)
; DGP("MEANS") Means Test
"RTN","IVMZ07C",98,0)
S NIEN=+$$LST^DGMTU(DFN) I NIEN,$D(^DGMT(408.31,NIEN,0)) S DGP("MEANS",0)=^DGMT(408.31,NIEN,0)
"RTN","IVMZ07C",99,0)
;
"RTN","IVMZ07C",100,0)
; ***************************
"RTN","IVMZ07C",101,0)
; DGP("MST") MST History
"RTN","IVMZ07C",102,0)
S (DTTM,NIEN)=""
"RTN","IVMZ07C",103,0)
S DTTM=$O(^DGMS(29.11,"APDT",DFN,""),-1)
"RTN","IVMZ07C",104,0)
I DTTM'="" D
"RTN","IVMZ07C",105,0)
. S NIEN=$O(^DGMS(29.11,"APDT",DFN,DTTM,""),-1)
"RTN","IVMZ07C",106,0)
. I $D(^DGMS(29.11,NIEN,0)) S DGP("MST",0)=^DGMS(29.11,NIEN,0)
"RTN","IVMZ07C",107,0)
;
"RTN","IVMZ07C",108,0)
; ***************************
"RTN","IVMZ07C",109,0)
Q
"RTN","IVMZ07C",110,0)
;
"RTN","IVMZ07C",111,0)
WORK(DFN,DGP,DGSD) ;
"RTN","IVMZ07C",112,0)
; call subroutines to run rules and file any inconsistencies
"RTN","IVMZ07C",113,0)
;
"RTN","IVMZ07C",114,0)
; Demographics rules
"RTN","IVMZ07C",115,0)
D EN^IVMZ7CD(DFN,.DGP,.DGSD)
"RTN","IVMZ07C",116,0)
;
"RTN","IVMZ07C",117,0)
; Enrollment/Eligibility rules
"RTN","IVMZ07C",118,0)
D EN^IVMZ7CE(DFN,.DGP)
"RTN","IVMZ07C",119,0)
;
"RTN","IVMZ07C",120,0)
; Service rules
"RTN","IVMZ07C",121,0)
D EN^IVMZ7CS(DFN,.DGP)
"RTN","IVMZ07C",122,0)
;
"RTN","IVMZ07C",123,0)
; Catastrophic Disability rules
"RTN","IVMZ07C",124,0)
D EN^IVMZ7CCD(DFN)
"RTN","IVMZ07C",125,0)
;
"RTN","IVMZ07C",126,0)
; Registration Inconsistencies
"RTN","IVMZ07C",127,0)
D EN^IVMZ7CR(DFN,.DGP,.DGSD)
"RTN","IVMZ07C",128,0)
;
"RTN","IVMZ07C",129,0)
Q
"RTN","IVMZ07C",130,0)
;
"RTN","IVMZ07C",131,0)
DELETE(DFN) ; delete all Z07 inconsistencies from INCONSISTENT DATA file (#38.5). Since we're not sure which rules
"RTN","IVMZ07C",132,0)
; will block a Z07 record, we need to loop through the INCONSISTENT DATA ELEMENTS file (#38.6) and grab only
"RTN","IVMZ07C",133,0)
; those rules which are marked to prevent building a Z07 record:
"RTN","IVMZ07C",134,0)
;
"RTN","IVMZ07C",135,0)
;
"RTN","IVMZ07C",136,0)
N DELARRY,RULE,DIK,DA
"RTN","IVMZ07C",137,0)
;
"RTN","IVMZ07C",138,0)
; create an array of rules which prevent Z07 records
"RTN","IVMZ07C",139,0)
S RULE=0 F S RULE=$O(^DGIN(38.6,RULE)) Q:RULE="" Q:$A(RULE)>$A(9) D
"RTN","IVMZ07C",140,0)
. I $P(^DGIN(38.6,RULE,0),U,6) S DELARRY(RULE)=""
"RTN","IVMZ07C",141,0)
;
"RTN","IVMZ07C",142,0)
; Now we have to check the patient INCONSISTENT DATA file (#38.5) and delete any records which have to be rechecked.
"RTN","IVMZ07C",143,0)
;
"RTN","IVMZ07C",144,0)
S DIK="^DGIN(38.5,"_DFN_","_"""I"""_","
"RTN","IVMZ07C",145,0)
;
"RTN","IVMZ07C",146,0)
S DA="" F S DA=$O(DELARRY(DA)) Q:DA="" D ^DIK
"RTN","IVMZ07C",147,0)
Q
"RTN","IVMZ07C",148,0)
;
"RTN","IVMZ07C",149,0)
FILE(DFN) ;
"RTN","IVMZ07C",150,0)
N FILE,SUCCESS,CCS,I,DGENDA,DATA,SUBFILE,DIK,DA
"RTN","IVMZ07C",151,0)
S FILE=38.5,CCS=0
"RTN","IVMZ07C",152,0)
; if no inconsistencies, return 0
"RTN","IVMZ07C",153,0)
I '$D(^TMP($J,DFN)) D Q CCS
"RTN","IVMZ07C",154,0)
. ; clean up INCONSISTENT DATA file if no inconsistencies exist
"RTN","IVMZ07C",155,0)
. I '$P($G(^DGIN(38.5,DFN,"I",0)),"^",4) D
"RTN","IVMZ07C",156,0)
. . S DIK="^DGIN(38.5,",DA=DFN
"RTN","IVMZ07C",157,0)
. . D ^DIK
"RTN","IVMZ07C",158,0)
;
"RTN","IVMZ07C",159,0)
; else process inconsistencies and return PASS=0
"RTN","IVMZ07C",160,0)
S CCS=1
"RTN","IVMZ07C",161,0)
; if a new entry, create a stub
"RTN","IVMZ07C",162,0)
S DATA(.01)=DFN
"RTN","IVMZ07C",163,0)
I '$D(^DGIN(FILE,"B",DFN)) D
"RTN","IVMZ07C",164,0)
. S DATA(2)=$$DT^XLFDT,DATA(3)=.5
"RTN","IVMZ07C",165,0)
. S SUCCESS=$$ADD^DGENDBS(FILE,,.DATA,,DFN)
"RTN","IVMZ07C",166,0)
;
"RTN","IVMZ07C",167,0)
; update file header with data and user info.
"RTN","IVMZ07C",168,0)
; Last Updated field (#4) = Today's date