VAFHLZCL ;ALB/ESD - Create generic HL7 ZCL Segment ; 02-MAY-1996
;;5.3;Registration;**94,103,102,397,423**;Aug 13, 1993
;
; This function will create VA-specific ZCL segment(s) for a
; given outpatient encounter. The ZCL segment is designed to transfer
; generic information about outpatient classifications.
;
;
EN(DFN,VAFENC,VAFSTR,VAFHLQ,VAFHLFS,VAFARRY) ; Entry point to return the HL7 ZCL segment
;
; Input: DFN - IEN of the Patient (#2) file
; VAFENC - IEN of the Outpatient Encounter (#409.68) file
; VAFSTR - String of fields requested separated by commas
; VAFHLQ - Optional HL7 null variable. If not there, use
; default HL7 variable
; VAFHLFS - Optional HL7 field separator. If not there, use
; default HL7 variable
; VAFARRY - Optional user-supplied array name which will hold ZCL segments
;
; Output: Array of HL7 ZCL segments
;
;
N I,VAFCLASS,VAFIDX,VAFY
S VAFARRY=$G(VAFARRY)
;
; - If VAFARRY not defined, use ^TMP("VAFHL",$J,"CLASS")
S:(VAFARRY="") VAFARRY="^TMP(""VAFHL"",$J,""CLASS"")"
;
; - If VAFHLQ or VAFHLFS aren't passed in, use default HL7 variables
S VAFHLQ=$S($D(VAFHLQ):VAFHLQ,1:$G(HLQ)),VAFHLFS=$S($D(VAFHLFS):VAFHLFS,1:$G(HLFS))
I '$G(DFN)!('$G(VAFENC))!($G(VAFSTR)']"") S @VAFARRY@(1,0)="ZCL"_VAFHLFS_1 G ENQ
S VAFIDX=0,VAFSTR=","_VAFSTR_","
;
ALL ; - All active outpatient classifications for encounter
S VAFCLASS=$$CHKCLASS^SCDXUTL0(DFN,VAFENC)
S VAFCLASS=$G(VAFCLASS)
I '$D(VAFCLASS) S @VAFARRY@(1,0)="ZCL"_VAFHLFS_1 G ENQ
;
; - Build array of HL7 (ZCL) segments
F I=1:1:$L(VAFCLASS,"^") D BUILD
;
ENQ ;
Q
;
;
BUILD ; - Build for each classification question
S $P(VAFY,VAFHLFS,3)="",VAFIDX=VAFIDX+1
;
; - Sequential number (required field)
S $P(VAFY,VAFHLFS,1)=VAFIDX
;
; - Classification type (1=AO,2=IR,3=SC,4=EC,5=MST,6=HNC)
I VAFSTR[",2," S $P(VAFY,VAFHLFS,2)=$S($G(I)]"":I,1:VAFHLQ) ; Outpatient Classification Type
;
; - Value (1=Yes, 0=No, ""=N/A)
I VAFSTR[",3," S $P(VAFY,VAFHLFS,3)=$S($P(VAFCLASS,"^",I)]"":$P(VAFCLASS,"^",I),1:VAFHLQ) ; Value
;
; - If occasion of service, stuff 0 (N) if class value = Y
I (VAFSTR[",3,"),($$CHKOCC^SCMSVDG1(VAFENC)=1),($P(VAFY,VAFHLFS,3)=1) S $P(VAFY,VAFHLFS,3)=0
;
; - Set all outpatient classifications into array
S @VAFARRY@(VAFIDX,0)="ZCL"_VAFHLFS_$G(VAFY)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAFHLZCL 2461 printed Sep 15, 2024@22:27:22 Page 2
VAFHLZCL ;ALB/ESD - Create generic HL7 ZCL Segment ; 02-MAY-1996
+1 ;;5.3;Registration;**94,103,102,397,423**;Aug 13, 1993
+2 ;
+3 ; This function will create VA-specific ZCL segment(s) for a
+4 ; given outpatient encounter. The ZCL segment is designed to transfer
+5 ; generic information about outpatient classifications.
+6 ;
+7 ;
EN(DFN,VAFENC,VAFSTR,VAFHLQ,VAFHLFS,VAFARRY) ; Entry point to return the HL7 ZCL segment
+1 ;
+2 ; Input: DFN - IEN of the Patient (#2) file
+3 ; VAFENC - IEN of the Outpatient Encounter (#409.68) file
+4 ; VAFSTR - String of fields requested separated by commas
+5 ; VAFHLQ - Optional HL7 null variable. If not there, use
+6 ; default HL7 variable
+7 ; VAFHLFS - Optional HL7 field separator. If not there, use
+8 ; default HL7 variable
+9 ; VAFARRY - Optional user-supplied array name which will hold ZCL segments
+10 ;
+11 ; Output: Array of HL7 ZCL segments
+12 ;
+13 ;
+14 NEW I,VAFCLASS,VAFIDX,VAFY
+15 SET VAFARRY=$GET(VAFARRY)
+16 ;
+17 ; - If VAFARRY not defined, use ^TMP("VAFHL",$J,"CLASS")
+18 if (VAFARRY="")
SET VAFARRY="^TMP(""VAFHL"",$J,""CLASS"")"
+19 ;
+20 ; - If VAFHLQ or VAFHLFS aren't passed in, use default HL7 variables
+21 SET VAFHLQ=$SELECT($DATA(VAFHLQ):VAFHLQ,1:$GET(HLQ))
SET VAFHLFS=$SELECT($DATA(VAFHLFS):VAFHLFS,1:$GET(HLFS))
+22 IF '$GET(DFN)!('$GET(VAFENC))!($GET(VAFSTR)']"")
SET @VAFARRY@(1,0)="ZCL"_VAFHLFS_1
GOTO ENQ
+23 SET VAFIDX=0
SET VAFSTR=","_VAFSTR_","
+24 ;
ALL ; - All active outpatient classifications for encounter
+1 SET VAFCLASS=$$CHKCLASS^SCDXUTL0(DFN,VAFENC)
+2 SET VAFCLASS=$GET(VAFCLASS)
+3 IF '$DATA(VAFCLASS)
SET @VAFARRY@(1,0)="ZCL"_VAFHLFS_1
GOTO ENQ
+4 ;
+5 ; - Build array of HL7 (ZCL) segments
+6 FOR I=1:1:$LENGTH(VAFCLASS,"^")
DO BUILD
+7 ;
ENQ ;
+1 QUIT
+2 ;
+3 ;
BUILD ; - Build for each classification question
+1 SET $PIECE(VAFY,VAFHLFS,3)=""
SET VAFIDX=VAFIDX+1
+2 ;
+3 ; - Sequential number (required field)
+4 SET $PIECE(VAFY,VAFHLFS,1)=VAFIDX
+5 ;
+6 ; - Classification type (1=AO,2=IR,3=SC,4=EC,5=MST,6=HNC)
+7 ; Outpatient Classification Type
IF VAFSTR[",2,"
SET $PIECE(VAFY,VAFHLFS,2)=$SELECT($GET(I)]"":I,1:VAFHLQ)
+8 ;
+9 ; - Value (1=Yes, 0=No, ""=N/A)
+10 ; Value
IF VAFSTR[",3,"
SET $PIECE(VAFY,VAFHLFS,3)=$SELECT($PIECE(VAFCLASS,"^",I)]"":$PIECE(VAFCLASS,"^",I),1:VAFHLQ)
+11 ;
+12 ; - If occasion of service, stuff 0 (N) if class value = Y
+13 IF (VAFSTR[",3,")
IF ($$CHKOCC^SCMSVDG1(VAFENC)=1)
IF ($PIECE(VAFY,VAFHLFS,3)=1)
SET $PIECE(VAFY,VAFHLFS,3)=0
+14 ;
+15 ; - Set all outpatient classifications into array
+16 SET @VAFARRY@(VAFIDX,0)="ZCL"_VAFHLFS_$GET(VAFY)
+17 QUIT