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

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

initial load of WorldVistAEHR

File size: 2.2 KB
RevLine 
[613]1VAFHLZSC ;ALB/ESD - Create generic HL7 ZSC Segment ; 06-MAY-1996
2 ;;5.3;Registration;**94**;Aug 13, 1993
3 ;
4 ; This function will create VA-specific ZSC segment(s) for a
5 ; given outpatient encounter. The ZSC segment is designed to transfer
6 ; service indicator (stop code) information pertaining to a patient
7 ; visit.
8 ;
9EN(VAFENC,VAFSTR,VAFHLQ,VAFHLFS,VAFARRY) ; Entry point to return the HL7 ZSC segment
10 ;
11 ; Input: VAFENC - IEN of the Outpatient Encounter (#409.68) file.
12 ; VAFSTR - String of fields requested separated by commas.
13 ; VAFHLQ - Optional HL7 null variable. If not there, use
14 ; default HL7 variable.
15 ; VAFHLFS - Optional HL7 field separator. If not there, use
16 ; default HL7 variable.
17 ; VAFARRY - Optional user-supplied array name which will hold HL7 ZSC segments
18 ;
19 ; Output: Array of HL7 ZSC segments
20 ;
21 ;
22 N I,VAFIDX,VAFNODE,VAFSCODE,VAFY
23 S VAFARRY=$G(VAFARRY)
24 ;
25 ; - If VAFARRY not defined, use ^TMP("VAFHL",$J,"STOPCODE")
26 S:(VAFARRY="") VAFARRY="^TMP(""VAFHL"",$J,""STOPCODE"")"
27 ;
28 ; - If VAFHLQ or VAFHLFS aren't passed in, use default HL7 variables
29 S VAFHLQ=$S($D(VAFHLQ):VAFHLQ,1:$G(HLQ)),VAFHLFS=$S($D(VAFHLFS):VAFHLFS,1:$G(HLFS))
30 I '$G(VAFENC)!($G(VAFSTR)']"") S @VAFARRY@(1,0)="ZSC"_VAFHLFS_1 G ENQ
31 S VAFIDX=0,VAFSTR=","_VAFSTR_","
32 ;
33 ; - Get stop codes for encounter
34 D SCODE^SCDXUTL0(VAFENC,"VAFSCODE")
35 ;
36 ; - Set stop code array to 0 if no stop codes to loop thru once
37 I '$G(VAFSCODE(0)) S VAFSCODE(1)=0
38 ;
39ALL ; - All stop codes for encounter
40 F I=0:0 S I=$O(VAFSCODE(I)) Q:I="" D
41 .;
42 .S VAFNODE=$G(^DIC(40.7,+VAFSCODE(I),0))
43 .S:($P(VAFNODE,"^",1)="") $P(VAFNODE,"^",1)=VAFHLQ
44 .S:($P(VAFNODE,"^",2)="") $P(VAFNODE,"^",2)=VAFHLQ
45 .;
46 .; - build array of HL7 (ZSC) segments
47 .D BUILD
48 ;
49ENQ Q
50 ;
51 ;
52BUILD ; - Build array of HL7 (ZSC) segments
53 S $P(VAFY,VAFHLFS,3)="",VAFIDX=VAFIDX+1
54 ;
55 ; - Sequential number (required field)
56 S $P(VAFY,VAFHLFS,1)=VAFIDX
57 ;
58 ; - Build HL7 (ZSC) segment fields
59 I VAFSTR[",2," S $P(VAFY,VAFHLFS,2)=$P(VAFNODE,"^",2) ; Stop Code
60 I VAFSTR[",3," S $P(VAFY,VAFHLFS,3)=$P(VAFNODE,"^",1) ; Name
61 ;
62 ; - Set all stop codes into array
63 S @VAFARRY@(VAFIDX,0)="ZSC"_VAFHLFS_$G(VAFY)
64 Q
Note: See TracBrowser for help on using the repository browser.