source: WorldVistAEHR/trunk/r/HINQ-DVB--DVBA--DVBE--DVBC/DVBHQR11.m@ 1608

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

initial load of WorldVistAEHR

File size: 6.1 KB
RevLine 
[613]1DVBHQR11 ;ISC-ALBANY/PKE-parse HINQ response ; 8/29/05 8:49am
2 ;;4.0;HINQ;**32,35,49**;03/25/92
3 ;
4 ;
5STAT ;Parse Statistics Segment for the records that have it.
6 I ($P(DVBBAS(1),U,6)="A"!($P(DVBBAS(1),U,6)="E")),$P(DVBBAS(1),U,4)="00" D ASTAT
7 I $P(DVBBAS(1),U,6)="B"!($P(DVBBAS(1),U,6)="F") D BSTAT
8 I $P(DVBBAS(1),U,6)="E",$P(DVBBAS(1),U,4)'="00" D BSTAT
9 I $P(DVBBAS(1),U,6)="C",$P(DVBBAS(1),U,4)=10 D CSTAT
10 I $P(DVBBAS(1),U,6)="C",$P(DVBBAS(1),U,4)'=10 S DVBVET="C^^^^"
11 ;
12 G CHILD ;changing the order of the response message - diag will
13 ;come at the very end to accommodate variable length records
14 ;
15DIAG ;Diagnostics Segment.
16 K DXP,DX,DVBDX,DVBEFF
17 N DVBCUR,DVBEXT,DVBORIG
18 ;with the HINQ replacement, interim solution (DVB*4*49) there are
19 ;several changes to the diagnostic segment. Total # codes, Add'l
20 ;codes, length of segment are not longer being sent. # SC Codes is
21 ;being stored in DVBDXNO. The for loop at DIAG+15 will terminate
22 ;after DVBDXNO, the 6 code limit from VBA has been increased to 150.
23 ;Total # of SC Diagnostic Codes.
24 S DVBV1=$E(X,1,3)
25 I DVBV1["{" S DVBV2=2 D SIGN^DVBHUTIL Q:$G(DVBERCS) ;????
26 S DVBDXNO=+DVBV1
27 ;Combined Degree of Disability, Effective Date of Combined SC% Eval
28 S DVBDXPCT=$E(X,4,6)
29 S DVBDXPCT=$TR(DVBDXPCT," ")
30 S DVBEFF=$E(X,7,14)
31 S DVBEFF=$TR(DVBEFF," ")
32 S L=15 D RON S L=1
33 ;Y=Diagnostic Codes; DXP(I)=Percent of Disability:
34 F I=1:1:DVBDXNO D
35 . D RON S L=1
36 . I $E(X,L,L+3)[" "!($E(X,L,L+3)']"") S L=L+25 Q
37 . S Y=$E(X,L,L+3),DXP(I)=$E(X,L+4,L+6)
38 . S DVBEXT(I)=$E(X,L+7,L+8)
39 . S DVBEXT(I)=$TR(DVBEXT(I)," ")
40 . S DVBORIG(I)=$E(X,L+9,L+16)
41 . S DVBORIG(I)=$TR(DVBORIG(I)," ")
42 . S DVBCUR(I)=$E(X,L+17,L+24)
43 . S DVBCUR(I)=$TR(DVBCUR(I)," ")
44 . S L=L+25 I DXP(I)'=" " S DX(I)="" F J=1:1:4 S Z=$E(Y,J) S:Z'?1N Z=$A(Z)-64 S:Z>9 Z=0 S DX(I)=DX(I)_Z
45 F I=0:0 S I=$O(DX(I)) Q:'I S Y=DX(I),DX(I)=$S($O(^DIC(31,"C",+DX(I),0)):$O(^(0)),1:"") S DVBDX(I)=Y_"^"_DX(I)_"^"_DXP(I)_"^"_$G(DVBEXT(I))_"^"_$G(DVBORIG(I))_"^"_$G(DVBCUR(I))
46 ;
47 ;sorting by SC% so that they will be saved and displayed that way
48 N DVBCT,DVBDD,DVBE,DVBEE
49 F DVBE=0:0 S DVBE=$O(DVBDX(DVBE)) Q:DVBE'>0 S DVBDD(+$P(DVBDX(DVBE),U,3),DVBE)=DVBDX(DVBE)
50 S DVBE="",DVBCT=1
51 F S DVBE=$O(DVBDD(DVBE),-1) Q:DVBE']"" D
52 . F DVBEE=0:0 S DVBEE=$O(DVBDD(DVBE,DVBEE)) Q:DVBEE'>0 D
53 . . S DVBDX(DVBCT)=DVBDD(DVBE,DVBEE) S DVBCT=DVBCT+1
54 K DVBDD,DX,DXP
55 Q
56 S L=L+1 D RON
57 ;
58CHILD ;Child-Birth-Data.
59 S $P(DVBCHI,U,1)=$E(X,1,2)
60 S DVBV1=$E(X,3,4)
61 I DVBV1?1N1A!(DVBV1["{") S DVBV2=2 D SIGN^DVBHUTIL Q:$G(DVBERCS)
62 S DVBCHNO=DVBV1,L=5,J1=0 D RON
63 I 'DVBCHNO S DVBCHNO=0 F DVBV=1:1:20 S L=20 D RON
64 E F DVBV=1:1:20 S DVBV1=$E(X,1,19),L=20 D RON I DVBV'>DVBCHNO S DVBCHDOB=$E(DVBV1,1,8) S:DVBCHDOB?8N J1=J1+1,DVBCHILD(J1_DVBCHDOB)=$E(DVBV1,9)_U_$E(DVBV1,10,19)
65 K DVBCHDOB,J1,DVBV1,DVBV
66 ;
67WITH ;WITHHOLDING-APPORTIONED-SEGMENT.
68 S $P(DVBWIT,U,1)=$E(X,1),DVBV1=$E(X,2,7)
69 I DVBV1?5N1A!(DVBV1["{") S DVBV2=6 D SIGN^DVBHUTIL Q:$G(DVBERCS)
70 S $P(DVBWIT,U,2)=+$E(DVBV1,1,4)_"."_$E(DVBV1,5,6)
71 S DVBV1=$E(X,8,13)
72 I DVBV1?5N1A!(DVBV1["{") S DVBV2=6 D SIGN^DVBHUTIL Q:$G(DVBERCS)
73 S $P(DVBWIT,U,3)=+$E(DVBV1,1,4)_"."_$E(DVBV1,5,6)
74 S DVBV1=$E(X,14,19)
75 I DVBV1?5N1A!(DVBV1["{") S DVBV2=6 D SIGN^DVBHUTIL Q:$G(DVBERCS)
76 S $P(DVBWIT,U,4)=+$E(DVBV1,1,4)_"."_$E(DVBV1,5,6),$P(DVBWIT,U,5)=$E(X,20)
77 S L=21 D RON
78 ;
79NMADR ;ADDRESS-SEGMENT.
80 S M("+")=7 F I=65:1:70 S M($C(I))=71-I
81 S M("-")=15 F I=74:1:80 S M($C(I))=88-I
82 F I=84:1:88 S M($C(I))=104-I
83 S M("&")=7
84 ;Blank & Length of Segment:
85 S $P(DVBADD,U,1)=$E(X,1),DVBV1=$E(X,2,4)
86 I DVBV1?2N1A!(DVBV1["{") S DVBV2=3 D SIGN^DVBHUTIL Q:$G(DVBERCS)
87 S $P(DVBADD,U,2)=DVBV1
88 ;Sequence Control:
89 S $P(DVBADD,U,3)=$E(X,5)
90 ;Name Line Indicator:
91 S $P(DVBADD,U,4)=$E(X,6)
92 ;Zip Code:
93 S DVBZIP=$E(X,7,15)
94 S DVBZIP=$E(DVBZIP,1,5) ;use only 1st 5 digits - DVB*4*49
95 S L=16,L1=15
96 F I=1:1:DVBADRLN Q:$E(X,L)=" "!($E(X,L)="") Q:'$G(M($E(X,L))) S M=M($E(X,L)),DVBADR(I)=$E(X,L+1,L+M),L=L+M+1,L1=L1+M+1 D RON S L=1
97 S $P(DVBADD,U,18)=145-L1
98 S L=$P(DVBADD,U,18)+1 D RON
99 K M,L1
100 ;instead of calling DEDBL^DVBHQR12 call REF^DVBHQR12, since the DED/BAL
101 ;segments will no longer be included in the VBA resp message, DVB*4*49
102 G REF^DVBHQR12
103 ;
104RON S X=$E(X,L,999),LX=$L(X),LY=254-LX I $D(X(2)),(LX+$L(X(2)))<256 S X=X_X(2) K X(2) D RON1 Q
105 I $D(X(2)) S X=X_$E(X(2),1,LY),X(2)=$E(X(2),LY+1,999) Q
106 Q
107 ;
108RON1 F Z1=3:1:99 I $D(X(Z1)),'$D(X(Z1-1)) S X(Z1-1)=X(Z1) K X(Z1) Q:'$O(X(Z1))
109 QUIT
110 ;
111ASTAT ;Statistics Segment of Type A Record.
112 S $P(DVBVET,U,1)="A",$P(DVBVET,U,2)=$E(X,1)
113 S $P(DVBVET,U,3)=$E(X,2)
114 S DVBBOS(1)=$E(X,3),DVBEOD(1)=$E(X,4,11),DVBRAD(1)=$E(X,12,19),DVBASVC=$E(X,20),DVBDOB=$E(X,21,28)
115 S $P(DVBVET,U,9)=$E(X,29,30),$P(DVBVET,U,10)=$E(X,31)
116 S $P(DVBP(2),U,2)=$E(X,32)
117 S DVBEI=$E(X,33),DVBCI=$E(X,34)
118 S $P(DVBVET,U,14)=$E(X,35)
119 S DVBCPS=$E(X,36)
120 S DVBPTI=$E(X,37)
121 S $P(DVBP(2),U,6)=$E(X,38,39),$P(DVBP(2),U,3)=$E(X,40,41),$P(DVBP(2),U,1)=$E(X,42,43),$P(DVBP(2),U,4)=$E(X,44),$P(DVBP(2),U,5)=$E(X,45)
122 S L=46 D RON
123 S DVBSPDOB=$E(X,1,8)
124 ;leave spouse DOB in format MMDDYYYY
125 S DVBSPNAM=$E(X,9,18) ;;;DVBPTI=$E(X,40)
126 ;Hospitalized SMC code:
127 S $P(DVBVET,U,24)=$E(X,19,20)
128 ;DOB of Father:
129 S $P(DVBVET,U,25)=$E(X,21,28)
130 ;DOB of Mother:
131 S $P(DVBVET,U,26)=$E(X,29,36)
132 ;Blanks:
133 S $P(DVBVET,U,27)=$E(X,37,40)
134 S L=41 D RON
135 Q
136 ;
137BSTAT ;Statistics Segment of Type B Record.
138 S $P(DVBVET,U,1)="B",$P(DVBVET,U,2)=$E(X,1)
139 S $P(DVBVET,U,3)=$E(X,2)
140 S DVBBOS(1)=$E(X,3),DVBEOD(1)=$E(X,4,11),DVBRAD(1)=$E(X,12,19),DVBASVC=$E(X,20),DVBDOB=$E(X,21,28)
141 S DVBDOB=$E(DVBDOB,5,8)_$E(DVBDOB,1,4)
142 S $P(DVBVET,U,9)=$E(X,29,30),$P(DVBVET,U,10)=$E(X,31,37)
143 ;Age at Death & Death Date:
144 S $P(DVBVET,U,11)=$E(X,38,39),$P(DVBVET,U,12)=$E(X,40,47)
145 ;Blank & Pay Grade
146 S $P(DVBVET,U,13)=$E(X,48),$P(DVBVET,U,14)=$E(X,49,50)
147 ;DOB of Payee & DOB of 3rd Party:
148 S $P(DVBVET,U,15)=$E(X,51,58),$P(DVBVET,U,16)=$E(X,59,66)
149 ;Name of 3rd Party & Filler
150 S $P(DVBVET,U,17)=$E(X,67,73),$P(DVBVET,U,18)=$E(74,85)
151 S L=86 D RON
152 Q
153 ;
154CSTAT ;Statistics Segment of Type C Record.
155 S $P(DVBVET,U,1)="C",$P(DVBVET,U,2)=$E(X,1)
156 ;CP-APPORT-SPOUSE NAME & DOB
157 S $P(DVBVET,U,3)=$E(X,2,11),$P(DVBVET,U,4)=$E(X,12,19)
158 S $P(DVBVET,U,5)=$E(X,20,25)
159 S L=86 D RON
160 Q
Note: See TracBrowser for help on using the repository browser.