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

MCARUTL5.m

Go to the documentation of this file.
  1. MCARUTL5 ;HOIFO/WAA-UTILITY FOR VALIDATING ENTRY ;04/13/01 12:00
  1. ;;2.3;Medicine;**33**;09/13/1996
  1. ;
  1. ; VALID Validation function
  1. ;
  1. ; MC*2.3*33 this is a new module to validate the entry
  1. ; is for the stated patient and matched the one on the "AC"
  1. ; The subroutine will work out the "AC" from the procedure.
  1. ; This will ensure that "AC" that the main program is using
  1. ; and the "AC" that I am building are one and the same.
  1. ; if they don't match I will not validate it.
  1. ;
  1. ;Input:
  1. ; ROOT = The root Global Reference for the entry.
  1. ; IEN = The Internal entry number for the procedure being checked
  1. ; DFN = The Patient DFN with in the Medicine Patient file.
  1. ;
  1. ;Outout:
  1. ; VALID = 1 or 0
  1. ; 1 = The entry is a procedure for the indicated Patient
  1. ; 0 = The entry is not a procedure for the indicated Patient
  1. ;
  1. VALID(ROOT,IEN,DFN) ; Main entry point for this function
  1. N VALID,LINE,FN
  1. S VALID=0 ; Init VALID to 0
  1. S FN=$P(ROOT,"(",2) ; parce out the internal entry number
  1. S LINE=$G(^MCAR(FN,IEN,0)) ; validate that the entry exists
  1. I LINE'="" D
  1. . N IEN697,PL,PRODFN,PRODT
  1. . S IEN697=$O(^MCAR(697.2,"C",ROOT,0)) Q:IEN697<1 ; get the procedure info
  1. . S PL=$P(^MCAR(697.2,IEN697,0),U,12) Q:PL="" ; get the location if the pat DFN within the procedure
  1. . S PRODFN=$$GET1^DIQ(FN,IEN,PL,"I") Q:PRODFN<1 ; get the pat DFN
  1. . Q:PRODFN'=DFN ; compare the pat DFN from the procedure with the passed DFN
  1. . S PRODT=9999999.9999-$P(LINE,U) ; get the Procedure date and invert it
  1. . I '$D(^MCAR(690,"AC",PRODFN,PRODT,ROOT,IEN)) Q ; check to see if the entry is in the a valid entry within 690 "AC" Xref
  1. . S VALID=1 ; Valid entry
  1. . Q
  1. Q VALID