source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCMSVZSC.m@ 1710

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

initial load of WorldVistAEHR

File size: 1.7 KB
Line 
1SCMSVZSC ;ALB/ESD HL7 ZSC Segment Validation ;05/08/95
2 ;;5.3;Scheduling;**44,66,143**;Aug 13, 1993
3 ;
4 ;
5EN(ZSCARRY,HLQ,HLFS,VALERR,ENCPTR) ;
6 ; Entry point to return the HL7 ZSC (Stop Code) validation segment
7 ;
8 ; Input: ZSCARRY - Array of ZSC Segments
9 ; HLQ - HL7 null variable
10 ; HLFS - HL7 field separator
11 ;
12 ;
13 ; Output: 1 if ZSC passed validity check
14 ; Error message if ZSC failed validity check in form of:
15 ; -1^"xxx failed validity check" (xxx=element in ZSC segment)
16 ;
17 ;
18 N I,J,MSG,VALID,X,Z,ZSCSEG,CNT,SEG,SCSETID,DATA
19 S MSG="-1^Element in ZSC segment failed validity check"
20 S I=0,X="",ZSCARRY=$G(ZSCARRY),SEG="ZSC",(SCSETID,CNT)=1
21 S:(ZSCARRY="") ZSCARRY="^TMP(""VAFHL"",$J,""STOPCODE"")"
22 ;
23 F S I=+$O(@ZSCARRY@(I)) Q:'I D
24 . S J="",VALID(1)=1
25 . F S J=$O(@ZSCARRY@(I,J)) Q:J="" D
26 .. S ZSCSEG=$G(@ZSCARRY@(I,J)),ZSCSEG=$$CONVERT^SCMSVUT0(ZSCSEG,HLFS,HLQ)
27 .. D VALIDATE^SCMSVUT0(SEG,ZSCSEG,"0013",VALERR,.CNT)
28 .. I $G(@VALERR@(SEG,CNT-1))="0013" Q
29 .. F Z=1,2,3,31 DO
30 ... S DATA=$P(ZSCSEG,HLFS,+$E(Z,1,1))
31 ... I Z=31 S DATA=$$STPCOD(DATA,ENCPTR)
32 ... D VALIDATE^SCMSVUT0(SEG,DATA,$P($T(@(Z)),";",3),VALERR,.CNT)
33 ...Q
34 ..Q
35 .Q
36 ;
37 I '$D(VALID) D VALIDATE^SCMSVUT0(SEG,"","0013",VALERR,.CNT)
38 ;
39ENQ Q $S($D(@VALERR@(SEG)):MSG,1:1)
40 ;
41 ;
42 ;- ZSC data elements validated
43 ;
44STPCOD(DATA,ENCPTR) ;
45 N LP,ANS,STPARY
46 D SCODE^SCDXUTL0(ENCPTR,"STPARY")
47 I '$G(STPARY(0)) Q 0
48 S ANS=0
49 F LP=0:0 S LP=$O(STPARY(LP)) Q:'LP DO Q:+ANS>0
50 .N STPNOD
51 .S STPNOD=$G(^DIC(40.7,STPARY(LP),0))
52 .Q:STPNOD=""
53 .I $P(STPNOD,U,2)=DATA S ANS=+STPARY(LP)
54 .Q
55 Q ANS
56 ;
571 ;;0035;HL7 SEGMENT NAME
582 ;;A050;HL7 SEQUENTIAL NUMBER (SET ID)
593 ;;A000;STOP CODE
6031 ;;A020;INACTIVE STOP CODE
Note: See TracBrowser for help on using the repository browser.