source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SCMSVDG1.m@ 1274

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

initial load of FOIAVistA 6/30/08 version

File size: 2.7 KB
Line 
1SCMSVDG1 ;ALB/ESD HL7 DG1 Segment Validation ;05/08/95
2 ;;5.3;Scheduling;**44,57,68,77,85,95,66**;Aug 13, 1993
3 ;
4 ;
5EN(DG1ARRY,HLQ,HLFS,ENCPTR,VALERR,ENCDT) ;
6 ; Entry point to return the HL7 DG1 (Outpatient Diagnosis) validation segment
7 ;
8 ; Input: DG1ARRY - Array of DG1 Segments
9 ; HLQ - HL7 null variable
10 ; HLFS - HL7 field separator
11 ; ENCPTR - Outpatient Encounter IEN (file #409.68)
12 ; VALERR - The array name to put error messages in
13 ; ENCDT - The date of the encounter
14 ;
15 ; Output: 1 if DG1 passed validity check
16 ; Error message if DG1 failed validity check in form of:
17 ; -1^"xxx failed validity check" (xxx=element in DG1 segment)
18 ;
19 ; NOTE: This validity check will pass if at least ONE DG1 segment in
20 ; the DG1 array passes the validity checks.
21 ;
22 ; A check for occasion of service (procedure which does not
23 ; require a diagnosis) is contained in this routine.
24 ;
25 ;
26 N DG1SEG,I,J,MSG,PROCARRY,VALID,X,Z,DATA,CNT,SCSETID,SEG,PRIOR
27 S MSG="-1^Element in DG1 segment failed validity check"
28 S (I,PRIOR)=0,X="",PROCARRY="PROCS",DG1ARRY=$G(DG1ARRY),SEG="DG1",(CNT,SCSETID)=1
29 S:(DG1ARRY="") DG1ARRY="^TMP(""VAFHL"",$J,""DIAGNOSIS"")"
30 ;
31 ;- Check for occasion of service and number od DX's found greater then zero.
32 ; If 00s and NO DX's, kill DG1 array. If 00S and there are DX's, continue
33 ; processing DG1 segment.
34 N SDCNT,SDDXY,QUIT
35 I ($$CHKOCC(ENCPTR)) D SET^SDCO4(ENCPTR) I 'SDCNT D G ENQ
36 . K @DG1ARRY
37 . Q
38 ;
39 F S I=+$O(@DG1ARRY@(I)) Q:'I D Q:$D(QUIT)
40 . S J="",VALID=1
41 . F S J=$O(@DG1ARRY@(I,J)) Q:J="" D Q:$D(QUIT)
42 .. S DG1SEG=$G(@DG1ARRY@(I,J)),DG1SEG=$$CONVERT^SCMSVUT0(DG1SEG,HLFS,HLQ)
43 .. D VALIDATE^SCMSVUT0(SEG,DG1SEG,"0036",VALERR,.CNT)
44 .. I $G(@VALERR@(SEG,CNT-1))="0036" S QUIT=1 Q
45 .. F Z=1,2,3,4,16 DO ;;;*** SWITCHED THIS FROM 6 TO 16 NEED TO TEST
46 ... S DATA=$P(DG1SEG,HLFS,Z)
47 ... I Z=16,DATA=1 S PRIOR=PRIOR+1
48 ... D VALIDATE^SCMSVUT0(SEG,DATA,$P($T(@(Z)),";",3),VALERR,.CNT)
49 ... Q
50 .. Q
51 . Q
52 ;
53 I $D(QUIT) G ENQ
54 D VALIDATE^SCMSVUT0(SEG,PRIOR,"5100",VALERR,.CNT)
55 I '$D(VALID) D VALIDATE^SCMSVUT0(SEG,"","0036",VALERR,.CNT)
56 ;
57ENQ Q $S($D(@VALERR@(SEG)):MSG,1:1)
58 ;
59 ;
60CHKOCC(ENCPTR) ; Occasion of Service Check
61 ;
62 ; Input: ENCPTR - Ptr to outpatient encounter file
63 ;
64 ; Output: 0 if location is not an occasion of service clinic
65 ; 1 if location is an occasion of service clinic
66 ;
67 ;
68 N ENC,LOC,STOP
69 S ENC=$G(^SCE(+ENCPTR,0))
70 S LOC=$P(ENC,"^",4),STOP=$P($G(^SC(+LOC,0)),"^",7)
71 Q $$EX^SDCOU2(STOP,+ENC)
72 ;
73 ;
74 ;- DG1 data elements validated
75 ;
761 ;;0035;HL7 SEGMENT NAME
772 ;;5150;HL7 SEQUENTIAL NUMBER (SET ID)
783 ;;5030;DIAGNOSIS CODING METHOD
794 ;;5000;DIAGNOSIS CODE (ICD 9)
8016 ;;5100;DIAGNOSIS PRIORITY
Note: See TracBrowser for help on using the repository browser.