Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SCMSVDG1

SCMSVDG1.m

Go to the documentation of this file.
  1. SCMSVDG1 ;ALB/ESD HL7 DG1 Segment Validation ;05/08/95
  1. ;;5.3;Scheduling;**44,57,68,77,85,95,66,1015**;Aug 13, 1993;Build 21
  1. ;
  1. ;
  1. EN(DG1ARRY,HLQ,HLFS,ENCPTR,VALERR,ENCDT) ;
  1. ; Entry point to return the HL7 DG1 (Outpatient Diagnosis) validation segment
  1. ;
  1. ; Input: DG1ARRY - Array of DG1 Segments
  1. ; HLQ - HL7 null variable
  1. ; HLFS - HL7 field separator
  1. ; ENCPTR - Outpatient Encounter IEN (file #409.68)
  1. ; VALERR - The array name to put error messages in
  1. ; ENCDT - The date of the encounter
  1. ;
  1. ; Output: 1 if DG1 passed validity check
  1. ; Error message if DG1 failed validity check in form of:
  1. ; -1^"xxx failed validity check" (xxx=element in DG1 segment)
  1. ;
  1. ; NOTE: This validity check will pass if at least ONE DG1 segment in
  1. ; the DG1 array passes the validity checks.
  1. ;
  1. ; A check for occasion of service (procedure which does not
  1. ; require a diagnosis) is contained in this routine.
  1. ;
  1. ;
  1. N DG1SEG,I,J,MSG,PROCARRY,VALID,X,Z,DATA,CNT,SCSETID,SEG,PRIOR
  1. S MSG="-1^Element in DG1 segment failed validity check"
  1. S (I,PRIOR)=0,X="",PROCARRY="PROCS",DG1ARRY=$G(DG1ARRY),SEG="DG1",(CNT,SCSETID)=1
  1. S:(DG1ARRY="") DG1ARRY="^TMP(""VAFHL"",$J,""DIAGNOSIS"")"
  1. ;
  1. ;- Check for occasion of service and number od DX's found greater then zero.
  1. ; If 00s and NO DX's, kill DG1 array. If 00S and there are DX's, continue
  1. ; processing DG1 segment.
  1. N SDCNT,SDDXY,QUIT
  1. I ($$CHKOCC(ENCPTR)) D SET^SDCO4(ENCPTR) I 'SDCNT D G ENQ
  1. . K @DG1ARRY
  1. . Q
  1. ;
  1. F S I=+$O(@DG1ARRY@(I)) Q:'I D Q:$D(QUIT)
  1. . S J="",VALID=1
  1. . F S J=$O(@DG1ARRY@(I,J)) Q:J="" D Q:$D(QUIT)
  1. .. S DG1SEG=$G(@DG1ARRY@(I,J)),DG1SEG=$$CONVERT^SCMSVUT0(DG1SEG,HLFS,HLQ)
  1. .. D VALIDATE^SCMSVUT0(SEG,DG1SEG,"0036",VALERR,.CNT)
  1. .. I $G(@VALERR@(SEG,CNT-1))="0036" S QUIT=1 Q
  1. .. F Z=1,2,3,4,16 DO ;;;*** SWITCHED THIS FROM 6 TO 16 NEED TO TEST
  1. ... S DATA=$P(DG1SEG,HLFS,Z)
  1. ... I Z=16,DATA=1 S PRIOR=PRIOR+1
  1. ... D VALIDATE^SCMSVUT0(SEG,DATA,$P($T(@(Z)),";",3),VALERR,.CNT)
  1. ... Q
  1. .. Q
  1. . Q
  1. ;
  1. I $D(QUIT) G ENQ
  1. D VALIDATE^SCMSVUT0(SEG,PRIOR,"5100",VALERR,.CNT)
  1. I '$D(VALID) D VALIDATE^SCMSVUT0(SEG,"","0036",VALERR,.CNT)
  1. ;
  1. ENQ Q $S($D(@VALERR@(SEG)):MSG,1:1)
  1. ;
  1. ;
  1. CHKOCC(ENCPTR) ; Occasion of Service Check
  1. ;
  1. ; Input: ENCPTR - Ptr to outpatient encounter file
  1. ;
  1. ; Output: 0 if location is not an occasion of service clinic
  1. ; 1 if location is an occasion of service clinic
  1. ;
  1. ;
  1. N ENC,LOC,STOP
  1. S ENC=$G(^SCE(+ENCPTR,0))
  1. S LOC=$P(ENC,"^",4),STOP=$P($G(^SC(+LOC,0)),"^",7)
  1. Q $$EX^SDCOU2(STOP,+ENC)
  1. ;
  1. ;
  1. ;- DG1 data elements validated
  1. ;
  1. 1 ;;0035;HL7 SEGMENT NAME
  1. 2 ;;5150;HL7 SEQUENTIAL NUMBER (SET ID)
  1. 3 ;;5030;DIAGNOSIS CODING METHOD
  1. 4 ;;5000;DIAGNOSIS CODE (ICD 9)
  1. 16 ;;5100;DIAGNOSIS PRIORITY