Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: VAFHLZCL

VAFHLZCL.m

Go to the documentation of this file.
  1. VAFHLZCL ;ALB/ESD - Create generic HL7 ZCL Segment ; 02-MAY-1996
  1. ;;5.3;Registration;**94,103,102,397,423**;Aug 13, 1993
  1. ;
  1. ; This function will create VA-specific ZCL segment(s) for a
  1. ; given outpatient encounter. The ZCL segment is designed to transfer
  1. ; generic information about outpatient classifications.
  1. ;
  1. ;
  1. EN(DFN,VAFENC,VAFSTR,VAFHLQ,VAFHLFS,VAFARRY) ; Entry point to return the HL7 ZCL segment
  1. ;
  1. ; Input: DFN - IEN of the Patient (#2) file
  1. ; VAFENC - IEN of the Outpatient Encounter (#409.68) file
  1. ; VAFSTR - String of fields requested separated by commas
  1. ; VAFHLQ - Optional HL7 null variable. If not there, use
  1. ; default HL7 variable
  1. ; VAFHLFS - Optional HL7 field separator. If not there, use
  1. ; default HL7 variable
  1. ; VAFARRY - Optional user-supplied array name which will hold ZCL segments
  1. ;
  1. ; Output: Array of HL7 ZCL segments
  1. ;
  1. ;
  1. N I,VAFCLASS,VAFIDX,VAFY
  1. S VAFARRY=$G(VAFARRY)
  1. ;
  1. ; - If VAFARRY not defined, use ^TMP("VAFHL",$J,"CLASS")
  1. S:(VAFARRY="") VAFARRY="^TMP(""VAFHL"",$J,""CLASS"")"
  1. ;
  1. ; - If VAFHLQ or VAFHLFS aren't passed in, use default HL7 variables
  1. S VAFHLQ=$S($D(VAFHLQ):VAFHLQ,1:$G(HLQ)),VAFHLFS=$S($D(VAFHLFS):VAFHLFS,1:$G(HLFS))
  1. I '$G(DFN)!('$G(VAFENC))!($G(VAFSTR)']"") S @VAFARRY@(1,0)="ZCL"_VAFHLFS_1 G ENQ
  1. S VAFIDX=0,VAFSTR=","_VAFSTR_","
  1. ;
  1. ALL ; - All active outpatient classifications for encounter
  1. S VAFCLASS=$$CHKCLASS^SCDXUTL0(DFN,VAFENC)
  1. S VAFCLASS=$G(VAFCLASS)
  1. I '$D(VAFCLASS) S @VAFARRY@(1,0)="ZCL"_VAFHLFS_1 G ENQ
  1. ;
  1. ; - Build array of HL7 (ZCL) segments
  1. F I=1:1:$L(VAFCLASS,"^") D BUILD
  1. ;
  1. ENQ ;
  1. Q
  1. ;
  1. ;
  1. BUILD ; - Build for each classification question
  1. S $P(VAFY,VAFHLFS,3)="",VAFIDX=VAFIDX+1
  1. ;
  1. ; - Sequential number (required field)
  1. S $P(VAFY,VAFHLFS,1)=VAFIDX
  1. ;
  1. ; - Classification type (1=AO,2=IR,3=SC,4=EC,5=MST,6=HNC)
  1. I VAFSTR[",2," S $P(VAFY,VAFHLFS,2)=$S($G(I)]"":I,1:VAFHLQ) ; Outpatient Classification Type
  1. ;
  1. ; - Value (1=Yes, 0=No, ""=N/A)
  1. I VAFSTR[",3," S $P(VAFY,VAFHLFS,3)=$S($P(VAFCLASS,"^",I)]"":$P(VAFCLASS,"^",I),1:VAFHLQ) ; Value
  1. ;
  1. ; - If occasion of service, stuff 0 (N) if class value = Y
  1. I (VAFSTR[",3,"),($$CHKOCC^SCMSVDG1(VAFENC)=1),($P(VAFY,VAFHLFS,3)=1) S $P(VAFY,VAFHLFS,3)=0
  1. ;
  1. ; - Set all outpatient classifications into array
  1. S @VAFARRY@(VAFIDX,0)="ZCL"_VAFHLFS_$G(VAFY)
  1. Q