source: WorldVistAEHR/trunk/r/INCOME_VERIFICATION_MATCH-IVM/IVMLINS.m@ 691

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

initial load of WorldVistAEHR

File size: 4.1 KB
Line 
1IVMLINS ;ALB/KCL,PHH - IVM INSURANCE UPLOAD ; 14-JAN-94
2 ;;2.0;INCOME VERIFICATION MATCH;**14,94**; 21-OCT-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ;
6EN ; - main entry point for IVM INSURANCE UPLOAD
7 D BLD
8 ;
9 ; - if no patients in ASEG x-ref goto EXIT
10 I IVMCTR=0 G EXIT
11 ;
12 S IVMINSUP=1
13 ;
14 ; - call list manager
15 D EN^VALM("IVM INSURANCE UPLOAD")
16 ;
17 K IVMINSUP
18 Q
19 ;
20 ;
21BLD ; - build an array of patients with uploadable insurance data
22 K ^TMP("IVMIUPL",$J)
23 W !,"Building patient list for display..."
24 ;
25 ; - change (HLFS) if HL7 segment sep ever changes!
26 S IVMCTR=0,HLFS="^"
27 ;
28 ; - get records from ASEG x-ref
29 S IVMI=0 F S IVMI=$O(^IVM(301.5,"ASEG","IN1",IVMI)) Q:'IVMI D
30 .S IVMJ=0 F S IVMJ=$O(^IVM(301.5,"ASEG","IN1",IVMI,IVMJ)) Q:'IVMJ D
31 ..;
32 ..S IVMCTR=IVMCTR+1 W:'(IVMCTR#15) "."
33 ..;
34 ..; - get node from IVM Patient (#301.5) file
35 ..S IVM0NOD=$G(^IVM(301.5,IVMI,0)) I IVM0NOD']"" Q
36 ..S DFN=+IVM0NOD
37 ..;
38 ..; - get HL7 segment string from (#301.511) sub-file
39 ..S IVMSEG=$G(^IVM(301.5,IVMI,"IN",IVMJ,"ST")) I IVMSEG']"" Q
40 ..S:$D(^IVM(301.5,IVMI,"IN",IVMJ,"ST1")) IVMSEG=IVMSEG_$G(^IVM(301.5,IVMI,"IN",IVMJ,"ST1"))
41 ..;
42 ..; - check for zeroth node Patient (#2) file
43 ..I $G(^DPT(+DFN,0))']"" Q
44 ..;
45 ..; - get patient name and ssn
46 ..S IVMNAME=$P($$PT^IVMUFNC4(DFN),"^"),IVMSSN=$P($$PT^IVMUFNC4(DFN),"^",2)
47 ..;
48 ..; - check for date of death from IVM
49 ..S IVMDOD=$S($P($P($G(^IVM(301.5,IVMI,"IN",IVMJ,0)),"^",7),"/",2)]"":$P($P($G(^IVM(301.5,IVMI,"IN",IVMJ,0)),"^",7),"/",2),1:"")
50 ..;
51 ..; - check if patient has active insurance
52 ..S IVMINS=$$INSUR^IBBAPI(DFN,DT),IVMINS=$S(IVMINS=1:"YES",1:"NO")
53 ..;
54 ..; - build line for list manager display
55 ..D BLDLINE
56 ;
57 I IVMCTR=0 W !!,"There is no IVM insurance data to be uploaded at this time.",!,*7
58 ;
59BLDQ ; - clean up variables
60 K DFN,IVM0NOD,IVMDOD,IVMINS,IVMNAME,IVMREC,IVMSEG,IVMSSN
61 Q
62 ;
63 ;
64BLDLINE ; - build storage array with data for list manager (called from BLD)
65 S ^TMP("IVMIUPL",$J,IVMNAME,IVMI,IVMJ)=DFN_"^"_IVMSSN_"^"_IVMINS_"^"_$P(IVMSEG,HLFS,4)_"^"_$P(IVMSEG,HLFS,36)_"^"_IVMDOD
66 ;
67 ; ^tmp("ivmiupl",$j,pat name, ivm ien, ivm sub ien)=dfn^ssn^active insurance^ins company^subscriber id^ivm date of death
68 Q
69 ;
70 ;
71HDR ; - header code for list manager display
72 S VALMHDR(1)="HEC has identified insurance for the following patients:"
73 S VALMHDR(2)=" (*) - Indicates Death Reported Act"
74 Q
75 ;
76 ;
77INIT ; - init variables and list array
78 K ^TMP("IVMLST",$J)
79 ;
80 ; - set up blank line for padding display fields and init counter
81 S IVMBL="",$P(IVMBL," ",40)="",IVMCTR=0
82 ;
83 S IVMNAME="" F S IVMNAME=$O(^TMP("IVMIUPL",$J,IVMNAME)) Q:IVMNAME']"" S IVMI1="" D
84 .F S IVMI1=$O(^TMP("IVMIUPL",$J,IVMNAME,IVMI1)) Q:'IVMI1 S IVMJ1="" D
85 ..F S IVMJ1=$O(^TMP("IVMIUPL",$J,IVMNAME,IVMI1,IVMJ1)) Q:'IVMJ1 D
86 ...;
87 ...; - node from the data storage array
88 ...S IVMLN=$G(^TMP("IVMIUPL",$J,IVMNAME,IVMI1,IVMJ1))
89 ...;
90 ...S IVMSTAR=$S($P(IVMLN,"^",6)]"":"*",$P($G(^DPT(+$P(IVMLN,"^"),.35)),"^")]"":"*",1:" ")
91 ...;
92 ...; - line for display
93 ...S DFN=$P(IVMLN,"^"),IVMLN=$E(IVMNAME,1,25)_"^"_$P(IVMLN,"^",2,99)
94 ...;
95 ...; - increment counter and write line
96 ...S IVMCTR=IVMCTR+1 D WRLN(IVMLN,IVMCTR)
97 ...;
98 ...; - create index array for look up
99 ...S ^TMP("IVMLST",$J,"IDX",IVMCTR,IVMCTR)=IVMNAME_"^"_$P(IVMLN,"^",2)_"^"_IVMI1_"^"_IVMJ1
100 ...; ^tmp("ivmlst",$j,"idx",counter,counter)=pat name^pat ssn^ien (#301.5) file^ien (#301.501) sub file
101 ;
102 ; - VALMCNT as the number of lines in the list
103 S VALMCNT=IVMCTR
104 ;
105INTQ ; - clean up variables
106 K DFN,IVMBL,IVMCTR,IVMI,IVMI1,IVMJ,IVMJ1,IVMLN,IVMNAME,IVMSSN,IVMSTAR,LINE,NUMBER
107 Q
108 ;
109 ;
110WRLN(LINE,NUMBER) ; - write line out for list manager display
111 ;
112 ; Input: LINE -- as pat name^pat ssn^active ins^ins carrier^subscriber id
113 ; NUMBER -- as line number
114 ;
115 ; Output: None
116 ;
117 N IVMLN
118 S IVMLN=$E(IVMSTAR_$P(LINE,"^",1)_IVMBL,1,16)_" "_$E($P(LINE,"^",2)_IVMBL,1,11)_" "_$E($P(LINE,"^",3)_IVMBL,1,3)_" "_$E($P(LINE,"^",4)_IVMBL,1,24)_" "_$P(LINE,"^",5)
119 S @VALMAR@(NUMBER,0)=$E(NUMBER_" ",1,4)_IVMLN
120 Q
121 ;
122 ;
123HELP ; - help code
124 S X="?" D DISP^XQORM1 W !!
125 Q
126 ;
127 ;
128EXIT ; - exit code
129 K ^TMP("IVMLST",$J),^TMP("IVMIUPL",$J)
130 Q
Note: See TracBrowser for help on using the repository browser.