source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCMSVZPD.m@ 1361

Last change on this file since 1361 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.4 KB
RevLine 
[613]1SCMSVZPD ;ALB/ESD,JLU HL7 ZPD Segment Validation ;05/08/95
2 ;;5.3;Scheduling;**44,66,142,459,472**;Aug 13, 1993
3 ;
4 ;
5EN(ZPDSEG,HLQ,HLFS,VALERR,ENCDT,NODE) ;
6 ; Entry point to return the HL7 ZPD (Patient Data) validation segment
7 ;
8 ; Input: ZPDSEG - ZPD Segment
9 ; HLQ - HL7 null variable
10 ; HLFS - HL7 field separator
11 ; VALERR - Contains the array in which to put the errors
12 ; ENCDT - The date/time of the encounter being processed
13 ; NODE - The zero node of the entry from the Outpatient
14 ; Encounter file.
15 ;
16 ; Output: 1 if ZPD passed validity check
17 ; Error message if ZPD failed validity check in form of:
18 ; -1^"xxx failed validity check" (xxx=element in ZPD segment)
19 ;
20 ;
21 N I,MSG,DATA,X,CNT,SEG,DSS,DFN,SEGLINE,OFFSET,ZPDSEGSV
22 S MSG="-1^element in ZPD segment failed validity check",CNT=1,SEG="ZPD"
23 S ZPDSEG=$G(ZPDSEG)
24 M ZPDSEGSV=ZPDSEG
25 D VALIDATE^SCMSVUT0(SEG,ZPDSEG,"0007",VALERR,.CNT)
26 I $D(@VALERR@(SEG)) G ENQ
27 ;
28 ;- Convert HLQ to null
29 S ZPDSEG=$$CONVERT^SCMSVUT0(ZPDSEG,HLFS,HLQ)
30 S I=0
31 F S I=$O(ZPDSEG(I)) Q:'I S ZPDSEG(I)=$$CONVERT^SCMSVUT0(ZPDSEG(I),HLFS,HLQ)
32 ;
33 ;Getting the DSS identifier to check for a LAB
34 S DSS=$P(NODE,U,3)
35 S DSS=$G(^DIC(40.7,DSS,0))
36 I DSS]"" S DSS=$P(DSS,U,2)
37 ;
38 ;Get pointer to PATIENT file
39 S DFN=$P(NODE,U,2)
40 ;
41 ;- Validate data elements
42 N NODE
43 S OFFSET=0,NODE=0,SEGLINE=ZPDSEG
44 F I=1,1010,1011,1012,17,18,19,21,41 D
45 . I $L(SEGLINE,HLFS)<($E(I,1,2)-OFFSET) D
46 . . ;Segment wrapped
47 . . S OFFSET=OFFSET+$L(SEGLINE,HLFS)-1
48 . . S NODE=+$O(ZPDSEG(NODE))
49 . . I NODE=0 S SEGLINE="",NODE=+$O(ZPDSEG(NODE),-1) Q
50 . . S SEGLINE=$G(ZPDSEG(NODE))
51 . S DATA=$P(SEGLINE,HLFS,(+$E(I,1,2)-OFFSET))
52 . I I=1011,DSS=108 Q
53 . I I=1012,DSS'=108 Q
54 . I +$E(I,1,2)=10,+DATA S DATA=$$FMDATE^HLFNC(DATA)
55 . D VALIDATE^SCMSVUT0(SEG,DATA,$P($T(@(I)),";",3),VALERR,.CNT)
56 .Q
57 ;
58ENQ M ZPDSEG=ZPDSEGSV
59 Q $S($D(@VALERR@(SEG)):MSG,1:1)
60 ;
61 ;
62ERR ;;Invalid or missing patient ID data for encounter (HL7 ZPD data segment)
63 ;
64 ;
65 ;- ZPD data elements validated
66 ;
671 ;;0035;HL7 SEGMENT NAME
681010 ;;3000;DATE OF DEATH INVALID
691011 ;;2370;DATE OF DEATH BEFORE ENCOUNTER DATE
701012 ;;3030;ENCOUNTER 14 DAYS AFTER THE ENCOUNTER DATE
7117 ;;3100;HOMELESS INDICATOR
7218 ;;3150;POW STATUS INDICATED?
7319 ;;3200;TYPE OF INSURANCE
7421 ;;3250;INVALID/INCONSISTENT POW LOCATION
7541 ;;3400;INVALID EMERGENCY RESPONSE INDICATOR
Note: See TracBrowser for help on using the repository browser.