| 1 | SCMSVZEL ;ALB/ESD HL7 ZEL Segment Validation ; 8/11/99 9:24am
|
---|
| 2 | ;;5.3;Scheduling;**44,66,142,184,180,222,239,325**;Aug 13, 1993
|
---|
| 3 | ;
|
---|
| 4 | ;
|
---|
| 5 | EN(ZELSEG,HLQ,HLFS,VALERR,DFN) ;
|
---|
| 6 | ; Entry point to return the HL7 ZEL (Patient Eligibility) validation segment
|
---|
| 7 | ;
|
---|
| 8 | ; Input: .ZELSEG - ZEL Segment Array
|
---|
| 9 | ; HLQ - HL7 null variable
|
---|
| 10 | ; HLFS - HL7 field separator
|
---|
| 11 | ; VALERR - The array name to put the errors in
|
---|
| 12 | ; DFN - The DFN of the patient
|
---|
| 13 | ;
|
---|
| 14 | ; Output: 1 if ZEL passed validity check
|
---|
| 15 | ; Error message if ZEL failed validity check in form of:
|
---|
| 16 | ; -1^"xxx failed validity check" (xxx=element in ZEL segment)
|
---|
| 17 | ;
|
---|
| 18 | ;
|
---|
| 19 | N I,MSG,X,CNT,DATA,SEG,ELIG,VET,LP,MSTSTAT,MSTDATE,SEGLINE,NODE,OFFSET
|
---|
| 20 | N CVET
|
---|
| 21 | S SEG="ZEL",CNT=1
|
---|
| 22 | S MSG="-1^Element in ZEL segment failed validity check"
|
---|
| 23 | S ZELSEG(1)=$G(ZELSEG(1))
|
---|
| 24 | D VALIDATE^SCMSVUT0(SEG,ZELSEG(1),"0010",VALERR,.CNT)
|
---|
| 25 | I $D(@VALERR@(SEG)) G ENQ
|
---|
| 26 | ;
|
---|
| 27 | ;- Convert HLQ to null
|
---|
| 28 | S ZELSEG(1)=$$CONVERT^SCMSVUT0(ZELSEG(1),HLFS,HLQ)
|
---|
| 29 | S I=0
|
---|
| 30 | F S I=+$O(ZELSEG(1,I)) Q:'I S ZELSEG(1,I)=$$CONVERT^SCMSVUT0(ZELSEG(1,I),HLFS,HLQ)
|
---|
| 31 | ;
|
---|
| 32 | S OFFSET=0,NODE=0,SEGLINE=ZELSEG(1)
|
---|
| 33 | F I=1,3,9,19,20,23,24,25,30,38,39 DO
|
---|
| 34 | . I $L(SEGLINE,HLFS)<(I-OFFSET) D
|
---|
| 35 | . . ;Segment wrapped
|
---|
| 36 | . . S OFFSET=OFFSET+$L(SEGLINE,HLFS)-1
|
---|
| 37 | . . S NODE=+$O(ZELSEG(1,NODE))
|
---|
| 38 | . . I NODE=0 S SEGLINE="",NODE=+$O(ZELSEG(1,NODE),-1) Q
|
---|
| 39 | . . S SEGLINE=$G(ZELSEG(1,NODE))
|
---|
| 40 | . S DATA=$P(SEGLINE,HLFS,I-OFFSET)
|
---|
| 41 | . I I=3 S ELIG=DATA
|
---|
| 42 | . I I=9 S VET=DATA
|
---|
| 43 | . I I=24 S MSTSTAT=DATA
|
---|
| 44 | . I I=25 S MSTDATE=DATA,DATA=MSTSTAT_"^"_MSTDATE
|
---|
| 45 | . I I=38 S CVET=DATA
|
---|
| 46 | . I I=39 S DATA=CVET_"^"_DATA
|
---|
| 47 | . D VALIDATE^SCMSVUT0(SEG,DATA,$P($T(@(I)),";",3),VALERR,.CNT)
|
---|
| 48 | . Q
|
---|
| 49 | ;
|
---|
| 50 | S DATA=ELIG_"^"_VET
|
---|
| 51 | F LP=32,91 D VALIDATE^SCMSVUT0(SEG,$S(LP=32:ELIG,LP=91:VET,1:DATA),$P($T(@(LP)),";",3),VALERR,.CNT)
|
---|
| 52 | ;
|
---|
| 53 | ENQ Q $S($D(@VALERR@(SEG)):MSG,1:1)
|
---|
| 54 | ;
|
---|
| 55 | ;
|
---|
| 56 | ;
|
---|
| 57 | ERR ;;Invalid or missing patient eligibility data for encounter (HL7 ZEL segment)
|
---|
| 58 | ;
|
---|
| 59 | ;
|
---|
| 60 | ;- ZEL data elements validated
|
---|
| 61 | ;
|
---|
| 62 | 1 ;;0035;HL7 SEGMENT NAME
|
---|
| 63 | 3 ;;7000;ELIGIBILITY CODE MISSING
|
---|
| 64 | 31 ;;7020;ELIGIBILITY CODE INCONSISTENT WITH VET STATUS
|
---|
| 65 | 32 ;;7030;ELIGIBILITY CODE INACTIVE
|
---|
| 66 | 9 ;;7050;VETERAN?
|
---|
| 67 | 91 ;;7100;VET STATUS INCONSISTENT WITH POW
|
---|
| 68 | 19 ;;7120;AGENT ORANGE EXPOSURE
|
---|
| 69 | 23 ;;7150;INVALID/INCONSISTENT RADIATION EXPOSURE METHOD
|
---|
| 70 | 20 ;;7210;RADIATION EXPOSURE INDICATED
|
---|
| 71 | 24 ;;7040;INVALID MST CLASSIFICATION
|
---|
| 72 | 25 ;;7060;MST STATUS DATE INVALID OR INCONSISTENT WITH MST STATUS
|
---|
| 73 | 30 ;;7130;AGENT ORANGE EXPOSURE LOCATION
|
---|
| 74 | 38 ;;7330;COMBAT VET INDICATOR
|
---|
| 75 | 39 ;;7340;COMBAT VET END DATE
|
---|