SCMSVZEL ;ALB/ESD HL7 ZEL Segment Validation ; 6/20/05 9:24am
;;5.3;Scheduling;**44,66,142,184,180,222,239,325,441**;Aug 13, 1993;Build 14
;
;
EN(ZELSEG,HLQ,HLFS,VALERR,DFN) ;
; Entry point to return the HL7 ZEL (Patient Eligibility) validation segment
;
; Input: .ZELSEG - ZEL Segment Array
; HLQ - HL7 null variable
; HLFS - HL7 field separator
; VALERR - The array name to put the errors in
; DFN - The DFN of the patient
;
; Output: 1 if ZEL passed validity check
; Error message if ZEL failed validity check in form of:
; -1^"xxx failed validity check" (xxx=element in ZEL segment)
;
;
N I,MSG,X,CNT,DATA,SEG,ELIG,VET,LP,MSTSTAT,MSTDATE,SEGLINE,NODE,OFFSET
N CVET
S SEG="ZEL",CNT=1
S MSG="-1^Element in ZEL segment failed validity check"
S ZELSEG(1)=$G(ZELSEG(1))
D VALIDATE^SCMSVUT0(SEG,ZELSEG(1),"0010",VALERR,.CNT)
I $D(@VALERR@(SEG)) G ENQ
;
;- Convert HLQ to null
S ZELSEG(1)=$$CONVERT^SCMSVUT0(ZELSEG(1),HLFS,HLQ)
S I=0
F S I=+$O(ZELSEG(1,I)) Q:'I S ZELSEG(1,I)=$$CONVERT^SCMSVUT0(ZELSEG(1,I),HLFS,HLQ)
;
S OFFSET=0,NODE=0,SEGLINE=ZELSEG(1)
F I=1,3,9,19,20,23,24,25,30,38,39,41 DO
. I $L(SEGLINE,HLFS)<(I-OFFSET) D
. . ;Segment wrapped
. . S OFFSET=OFFSET+$L(SEGLINE,HLFS)-1
. . S NODE=+$O(ZELSEG(1,NODE))
. . I NODE=0 S SEGLINE="",NODE=+$O(ZELSEG(1,NODE),-1) Q
. . S SEGLINE=$G(ZELSEG(1,NODE))
. S DATA=$P(SEGLINE,HLFS,I-OFFSET)
. I I=3 S ELIG=DATA
. I I=9 S VET=DATA
. I I=24 S MSTSTAT=DATA
. I I=25 S MSTDATE=DATA,DATA=MSTSTAT_"^"_MSTDATE
. I I=38 S CVET=DATA
. I I=39 S DATA=CVET_"^"_DATA
. D VALIDATE^SCMSVUT0(SEG,DATA,$P($T(@(I)),";",3),VALERR,.CNT)
. Q
;
S DATA=ELIG_"^"_VET
F LP=32,91 D VALIDATE^SCMSVUT0(SEG,$S(LP=32:ELIG,LP=91:VET,1:DATA),$P($T(@(LP)),";",3),VALERR,.CNT)
;
ENQ Q $S($D(@VALERR@(SEG)):MSG,1:1)
;
;
;
ERR ;;Invalid or missing patient eligibility data for encounter (HL7 ZEL segment)
;
;
;- ZEL data elements validated
;
1 ;;0035;HL7 SEGMENT NAME
3 ;;7000;ELIGIBILITY CODE MISSING
31 ;;7020;ELIGIBILITY CODE INCONSISTENT WITH VET STATUS
32 ;;7030;ELIGIBILITY CODE INACTIVE
9 ;;7050;VETERAN?
91 ;;7100;VET STATUS INCONSISTENT WITH POW
19 ;;7120;AGENT ORANGE EXPOSURE
23 ;;7150;INVALID/INCONSISTENT RADIATION EXPOSURE METHOD
20 ;;7210;RADIATION EXPOSURE INDICATED
24 ;;7040;INVALID MST CLASSIFICATION
25 ;;7060;MST STATUS DATE INVALID OR INCONSISTENT WITH MST STATUS
30 ;;7130;AGENT ORANGE EXPOSURE LOCATION
38 ;;7330;COMBAT VET INDICATOR
39 ;;7340;COMBAT VET END DATE
41 ;;7370;PROJ 112/SHAD INDICATOR
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCMSVZEL 2637 printed Oct 16, 2024@18:42:51 Page 2
SCMSVZEL ;ALB/ESD HL7 ZEL Segment Validation ; 6/20/05 9:24am
+1 ;;5.3;Scheduling;**44,66,142,184,180,222,239,325,441**;Aug 13, 1993;Build 14
+2 ;
+3 ;
EN(ZELSEG,HLQ,HLFS,VALERR,DFN) ;
+1 ; Entry point to return the HL7 ZEL (Patient Eligibility) validation segment
+2 ;
+3 ; Input: .ZELSEG - ZEL Segment Array
+4 ; HLQ - HL7 null variable
+5 ; HLFS - HL7 field separator
+6 ; VALERR - The array name to put the errors in
+7 ; DFN - The DFN of the patient
+8 ;
+9 ; Output: 1 if ZEL passed validity check
+10 ; Error message if ZEL failed validity check in form of:
+11 ; -1^"xxx failed validity check" (xxx=element in ZEL segment)
+12 ;
+13 ;
+14 NEW I,MSG,X,CNT,DATA,SEG,ELIG,VET,LP,MSTSTAT,MSTDATE,SEGLINE,NODE,OFFSET
+15 NEW CVET
+16 SET SEG="ZEL"
SET CNT=1
+17 SET MSG="-1^Element in ZEL segment failed validity check"
+18 SET ZELSEG(1)=$GET(ZELSEG(1))
+19 DO VALIDATE^SCMSVUT0(SEG,ZELSEG(1),"0010",VALERR,.CNT)
+20 IF $DATA(@VALERR@(SEG))
GOTO ENQ
+21 ;
+22 ;- Convert HLQ to null
+23 SET ZELSEG(1)=$$CONVERT^SCMSVUT0(ZELSEG(1),HLFS,HLQ)
+24 SET I=0
+25 FOR
SET I=+$ORDER(ZELSEG(1,I))
if 'I
QUIT
SET ZELSEG(1,I)=$$CONVERT^SCMSVUT0(ZELSEG(1,I),HLFS,HLQ)
+26 ;
+27 SET OFFSET=0
SET NODE=0
SET SEGLINE=ZELSEG(1)
+28 FOR I=1,3,9,19,20,23,24,25,30,38,39,41
Begin DoDot:1
+29 IF $LENGTH(SEGLINE,HLFS)<(I-OFFSET)
Begin DoDot:2
+30 ;Segment wrapped
+31 SET OFFSET=OFFSET+$LENGTH(SEGLINE,HLFS)-1
+32 SET NODE=+$ORDER(ZELSEG(1,NODE))
+33 IF NODE=0
SET SEGLINE=""
SET NODE=+$ORDER(ZELSEG(1,NODE),-1)
QUIT
+34 SET SEGLINE=$GET(ZELSEG(1,NODE))
End DoDot:2
+35 SET DATA=$PIECE(SEGLINE,HLFS,I-OFFSET)
+36 IF I=3
SET ELIG=DATA
+37 IF I=9
SET VET=DATA
+38 IF I=24
SET MSTSTAT=DATA
+39 IF I=25
SET MSTDATE=DATA
SET DATA=MSTSTAT_"^"_MSTDATE
+40 IF I=38
SET CVET=DATA
+41 IF I=39
SET DATA=CVET_"^"_DATA
+42 DO VALIDATE^SCMSVUT0(SEG,DATA,$PIECE($TEXT(@(I)),";",3),VALERR,.CNT)
+43 QUIT
End DoDot:1
+44 ;
+45 SET DATA=ELIG_"^"_VET
+46 FOR LP=32,91
DO VALIDATE^SCMSVUT0(SEG,$SELECT(LP=32:ELIG,LP=91:VET,1:DATA),$PIECE($TEXT(@(LP)),";",3),VALERR,.CNT)
+47 ;
ENQ QUIT $SELECT($DATA(@VALERR@(SEG)):MSG,1:1)
+1 ;
+2 ;
+3 ;
ERR ;;Invalid or missing patient eligibility data for encounter (HL7 ZEL segment)
+1 ;
+2 ;
+3 ;- ZEL data elements validated
+4 ;
1 ;;0035;HL7 SEGMENT NAME
3 ;;7000;ELIGIBILITY CODE MISSING
31 ;;7020;ELIGIBILITY CODE INCONSISTENT WITH VET STATUS
32 ;;7030;ELIGIBILITY CODE INACTIVE
9 ;;7050;VETERAN?
91 ;;7100;VET STATUS INCONSISTENT WITH POW
19 ;;7120;AGENT ORANGE EXPOSURE
23 ;;7150;INVALID/INCONSISTENT RADIATION EXPOSURE METHOD
20 ;;7210;RADIATION EXPOSURE INDICATED
24 ;;7040;INVALID MST CLASSIFICATION
25 ;;7060;MST STATUS DATE INVALID OR INCONSISTENT WITH MST STATUS
30 ;;7130;AGENT ORANGE EXPOSURE LOCATION
38 ;;7330;COMBAT VET INDICATOR
39 ;;7340;COMBAT VET END DATE
41 ;;7370;PROJ 112/SHAD INDICATOR