source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFHLZRD.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1VAFHLZRD ;ALB/KCL - CREATE HL7 RATED DISABILITIES (ZRD) SEGMENTS ; 13-SEPTEMBER-1997
2 ;;5.3;Registration;**122,144**;Aug 13,1993
3 ;
4 ;
5 ; This generic function creates HL7 VA-Specific Rated Disabilities
6 ; (ZRD) segments for a patient.
7 ;
8EN(DFN,VAFSTR,VAFHLQ,VAFHLFS,VAFARRY) ;--
9 ; Entry point to return HL7 Rated Disabilities (ZRD) segments.
10 ;
11 ; Input:
12 ; DFN - internal entry number of Patient (#2) file
13 ; VAFSTR - (optional) string of fields requested, separated
14 ; by commas. If not passed return all data fields.
15 ; VAFHLQ - (optional) HL7 null variable.
16 ; VAFHLS - (optional) HL7 field separator.
17 ; VAFARRY - (optional) user-supplied array name which will
18 ; hold HL7 ZRD segments. Otherwise, ^TMP("VAFZRD",$J
19 ; will be used.
20 ;
21 ; Output:
22 ; Array containing the HL7 ZRD segments.
23 ;
24 N VAFINDX,VAFSUB,VAFNODE,VAFY,X
25 S VAFARRY=$G(VAFARRY)
26 ;
27 ; if VAFHLQ or VAFHLFS not passed, use default HL7 variables
28 S VAFHLQ=$S($D(VAFHLQ):VAFHLQ,1:$G(HLQ)),VAFHLFS=$S($D(VAFHLFS):VAFHLFS,1:$G(HLFS))
29 ;
30 ; if VAFARRY not defined, use ^TMP("VAFZRD",$J)
31 S:(VAFARRY="") VAFARRY="^TMP(""VAFZRD"",$J)"
32 ;
33 ; if DFN not passed, exit
34 I '$G(DFN) S @VAFARRY@(1,0)="ZRD"_VAFHLFS_1 G ENQ
35 ;
36 ; if VAFSTR not passed, return all data fields
37 I $G(VAFSTR)']"" S VAFSTR="1,2,3,4"
38 S (VAFINDX,VAFSUB)=0,VAFSTR=","_VAFSTR_","
39 ;
40 ; get all rated disabilities for patient
41 F S VAFSUB=$O(^DPT(DFN,.372,VAFSUB)) Q:'VAFSUB D
42 .;
43 .; - get rated disabilities node
44 .S VAFNODE=$G(^DPT(DFN,.372,+VAFSUB,0))
45 .;
46 .; - build array of ZRD segments
47 .D BUILD
48 ;
49 ; if no rated disabilities, build ZRD
50 I 'VAFINDX D
51 .S @VAFARRY@(1,0)="ZRD"_VAFHLFS_1_VAFHLFS_VAFHLFS_VAFHLFS
52 ;
53ENQ Q
54 ;
55 ;
56BUILD ; Build array of ZRD segments
57 N DCNODE ;0 node of Disability Condition
58 N DXCODE
59 N NAME
60 ;
61 ;if the Rated Disability node doesn't point to a Disability Condition,
62 ;then the data is meaningless and should not be sent
63 Q:'$P(VAFNODE,"^")
64 S DCNODE=$G(^DIC(31,$P(VAFNODE,"^"),0))
65 S DXCODE=$P(DCNODE,"^",3)
66 Q:DXCODE=""
67 S NAME=$P(DCNODE,"^",1)
68 ;
69 S VAFINDX=VAFINDX+1,$P(VAFY,"^",4)=""
70 S $P(VAFY,VAFHLFS,1)=VAFINDX ; Set ID
71 I VAFSTR[",2," S $P(VAFY,VAFHLFS,2)=DXCODE_$E($G(HLECH))_NAME ;Disabilty Condition
72 I VAFSTR[",3," S $P(VAFY,VAFHLFS,3)=$S($P(VAFNODE,"^",2)]"":$P(VAFNODE,"^",2),1:VAFHLQ) ; Disability %
73 I VAFSTR[",4," S $P(VAFY,VAFHLFS,4)=$S($P(VAFNODE,"^",3)]"":$P(VAFNODE,"^",3),1:VAFHLQ) ; Service Connected?
74 ;
75 ; set segment into array
76 S @VAFARRY@(VAFINDX,0)="ZRD"_VAFHLFS_$G(VAFY)
77 Q
Note: See TracBrowser for help on using the repository browser.