SCMSVZCL ;ALB/ESD HL7 ZCL Segment Validation ; 11/9/99 2:28pm
;;5.3;Scheduling;**44,66,180,239**;Aug 13, 1993
;
;
EN(ZCLARRY,HLQ,HLFS,VALERR,DFN) ;
; Entry point to return the HL7 ZCL (Outpatient Classification) validation segment
;
; Input: ZCLARRY - Array of ZCL Segments
; HLQ - HL7 null variable
; HLFS - HL7 field separator
; VALERR - Array to put the errors in
; DFN - The patient's DFN
;
;
; Output: 1 if ZCL passed validity check
; Error message if ZCL failed validity check in form of:
; -1^"xxx failed validity check" (xxx=element in ZCL segment)
;
;
N I,J,MSG,VALID,X,Z,ZCLSEG,SEG,CNT,DATA,SCSETID,VAR,SCCLASS,VALUE,TYPE
S VALID=1,MSG="-1^Element in ZCL segment failed validity check"
S I=0,J="",ZCLARRY=$G(ZCLARRY),SEG="ZCL",(SCSETID,CNT)=1
S:(ZCLARRY="") ZCLARRY="^TMP(""VAFHL"",$J,""CLASS"")"
;
;- Validate classification fields
F S I=+$O(@ZCLARRY@(I)) Q:'I F S J=$O(@ZCLARRY@(I,J)) Q:J="" D
. S VALID=1
. S ZCLSEG=$G(@ZCLARRY@(I,J))
. S ZCLSEG=$$CONVERT^SCMSVUT0(ZCLSEG,HLFS,HLQ)
. D VALIDATE^SCMSVUT0(SEG,ZCLSEG,"0012",VALERR,.CNT)
. I $G(@VALERR@(SEG,CNT-1))="0012" Q
. S TYPE=$P(ZCLSEG,HLFS,3)
. F Z=1,2,3,32,4,41 DO
.. S DATA=$P(ZCLSEG,HLFS,$E(Z,1,1))
.. ;
.. ;MST check for type 5 encounter 1
.. I (Z=32),DATA'=5 Q
.. I (Z=32),DATA=5 S VALUE=$P(ZCLSEG,HLFS,4) Q:VALUE'=1
.. ;
.. D VALIDATE^SCMSVUT0(SEG,DATA,$P($T(@(Z)),";",3),VALERR,.CNT)
.. K VALUE
.. Q
. Q
;
I '$D(VALID) D VALIDATE^SCMSVUT0(SEG,"","0012",VALERR,.CNT)
;
ENQ Q $S($D(@VALERR@(SEG)):MSG,1:1)
;
;
;- ZCL data elements validated
;
1 ;;0035;HL7 SEGMENT NAME
2 ;;9150;HL7 SEQUENTIAL NUMBER (SET ID)
3 ;;9000;CLASSIFICATION TYPE
32 ;;9030;MST status inconsistent with classification type
4 ;;9050;Answer to classification questions missing
41 ;;9020;Veteran status inconsistent with classification type
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCMSVZCL 1976 printed Oct 16, 2024@18:42:50 Page 2
SCMSVZCL ;ALB/ESD HL7 ZCL Segment Validation ; 11/9/99 2:28pm
+1 ;;5.3;Scheduling;**44,66,180,239**;Aug 13, 1993
+2 ;
+3 ;
EN(ZCLARRY,HLQ,HLFS,VALERR,DFN) ;
+1 ; Entry point to return the HL7 ZCL (Outpatient Classification) validation segment
+2 ;
+3 ; Input: ZCLARRY - Array of ZCL Segments
+4 ; HLQ - HL7 null variable
+5 ; HLFS - HL7 field separator
+6 ; VALERR - Array to put the errors in
+7 ; DFN - The patient's DFN
+8 ;
+9 ;
+10 ; Output: 1 if ZCL passed validity check
+11 ; Error message if ZCL failed validity check in form of:
+12 ; -1^"xxx failed validity check" (xxx=element in ZCL segment)
+13 ;
+14 ;
+15 NEW I,J,MSG,VALID,X,Z,ZCLSEG,SEG,CNT,DATA,SCSETID,VAR,SCCLASS,VALUE,TYPE
+16 SET VALID=1
SET MSG="-1^Element in ZCL segment failed validity check"
+17 SET I=0
SET J=""
SET ZCLARRY=$GET(ZCLARRY)
SET SEG="ZCL"
SET (SCSETID,CNT)=1
+18 if (ZCLARRY="")
SET ZCLARRY="^TMP(""VAFHL"",$J,""CLASS"")"
+19 ;
+20 ;- Validate classification fields
+21 FOR
SET I=+$ORDER(@ZCLARRY@(I))
if 'I
QUIT
FOR
SET J=$ORDER(@ZCLARRY@(I,J))
if J=""
QUIT
Begin DoDot:1
+22 SET VALID=1
+23 SET ZCLSEG=$GET(@ZCLARRY@(I,J))
+24 SET ZCLSEG=$$CONVERT^SCMSVUT0(ZCLSEG,HLFS,HLQ)
+25 DO VALIDATE^SCMSVUT0(SEG,ZCLSEG,"0012",VALERR,.CNT)
+26 IF $GET(@VALERR@(SEG,CNT-1))="0012"
QUIT
+27 SET TYPE=$PIECE(ZCLSEG,HLFS,3)
+28 FOR Z=1,2,3,32,4,41
Begin DoDot:2
+29 SET DATA=$PIECE(ZCLSEG,HLFS,$EXTRACT(Z,1,1))
+30 ;
+31 ;MST check for type 5 encounter 1
+32 IF (Z=32)
IF DATA'=5
QUIT
+33 IF (Z=32)
IF DATA=5
SET VALUE=$PIECE(ZCLSEG,HLFS,4)
if VALUE'=1
QUIT
+34 ;
+35 DO VALIDATE^SCMSVUT0(SEG,DATA,$PIECE($TEXT(@(Z)),";",3),VALERR,.CNT)
+36 KILL VALUE
+37 QUIT
End DoDot:2
+38 QUIT
End DoDot:1
+39 ;
+40 IF '$DATA(VALID)
DO VALIDATE^SCMSVUT0(SEG,"","0012",VALERR,.CNT)
+41 ;
ENQ QUIT $SELECT($DATA(@VALERR@(SEG)):MSG,1:1)
+1 ;
+2 ;
+3 ;- ZCL data elements validated
+4 ;
1 ;;0035;HL7 SEGMENT NAME
2 ;;9150;HL7 SEQUENTIAL NUMBER (SET ID)
3 ;;9000;CLASSIFICATION TYPE
32 ;;9030;MST status inconsistent with classification type
4 ;;9050;Answer to classification questions missing
41 ;;9020;Veteran status inconsistent with classification type