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

MHV7RUS.m

Go to the documentation of this file.
  1. MHV7RUS ;WAS/GPM - HL7 RECEIVER UTILITIES - SEGMENT ; [12/8/07 6:18pm]
  1. ;;1.0;My HealtheVet;**2**;Aug 23, 2005;Build 22
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. ; Segment validators common to multiple messages.
  1. ; Message receivers with message specific segments will contain
  1. ; those message specific segment builders. Examples would be the
  1. ; QRD/QRF for QRY^R02 message, or the ORC/RXE for OMP^O09.
  1. ;
  1. Q
  1. ;
  1. VALIDPID(PID,REQ,ERR) ; Validate PID segment
  1. ;
  1. ; Input:
  1. ; PID - PID array containing parsed PID segment
  1. ;
  1. ; Output:
  1. ; REQ - Request parameter array
  1. ; REQ("ICN")
  1. ; REQ("DFN")
  1. ; REQ("SSN")
  1. ; ERR - Caret delimited error string
  1. ; segment^sequence^field^code^ACK type^error text
  1. ;
  1. N ICN,DFN,SSN,ID,TYPE,FAMILY,GIVEN,MIDDLE,SUFFIX,I
  1. S ICN="",DFN="",SSN=""
  1. F I=1:1:3 Q:'$D(PID(3,I)) D Q:ERR'=""
  1. . S ID=$G(PID(3,I,1))
  1. . S TYPE=$G(PID(3,I,5))
  1. . I ID="" S ERR="PID^1^3^101^AE^Missing Patient ID" Q
  1. . I TYPE="" S ERR="PID^1^3^101^AE^Missing Patient ID Type" Q
  1. . I TYPE="NI" S ICN=ID
  1. . I TYPE="PI" S DFN=ID
  1. . I TYPE="SS" S SSN=ID
  1. . Q
  1. Q:ERR'="" 0
  1. ;
  1. S FAMILY=$G(PID(5,1,1))
  1. S GIVEN=$G(PID(5,1,2))
  1. S MIDDLE=$G(PID(5,1,3))
  1. S SUFFIX=$G(PID(5,1,4))
  1. ;
  1. I '$$VALIDID^MHV7RU(.ICN,.DFN,.SSN,.ERR) S ERR="PID^1^3^"_ERR Q 0
  1. ;
  1. ; Name components required by HL7 but not used by MHV
  1. ;I FAMILY="" S ERR="PID^1^5^101^AE^Missing Patient Family Name" Q 0
  1. ;I GIVEN="" S ERR="PID^1^5^101^AE^Missing Patient Given Name" Q 0
  1. ;
  1. S REQ("ICN")=ICN
  1. S REQ("DFN")=DFN
  1. S REQ("SSN")=SSN
  1. Q 1
  1. ;
  1. VALIDWHO(QRD,REQ,ERR) ; Validate Who subject filter in QRD segments
  1. ;
  1. ; Input:
  1. ; QRD - QRD array containing parsed QRD segment
  1. ;
  1. ; Output:
  1. ; REQ - Request parameter array
  1. ; REQ("ICN")
  1. ; REQ("DFN")
  1. ; REQ("SSN")
  1. ; ERR - Caret delimited error string
  1. ; segment^sequence^field^code^ACK type^error text
  1. ;
  1. N ICN,DFN,SSN,ID,TYPE,FAMILY,GIVEN,MIDDLE,SUFFIX,I
  1. S ICN="",DFN="",SSN=""
  1. F I=1:1:3 Q:'$D(QRD(8,I)) D Q:ERR'=""
  1. . S ID=$G(QRD(8,I,1))
  1. . S FAMILY=$G(QRD(8,I,2))
  1. . S GIVEN=$G(QRD(8,I,3))
  1. . S MIDDLE=$G(QRD(8,I,4))
  1. . S SUFFIX=$G(QRD(8,I,5))
  1. . S TYPE=$G(QRD(8,I,13))
  1. . I ID="" S ERR="QRD^1^8^101^AE^Missing ID number" Q
  1. . I TYPE="" S ERR="QRD^1^8^101^AE^Missing identifier type code" Q
  1. . I TYPE="NI" S ICN=ID
  1. . I TYPE="PI" S DFN=ID
  1. . I TYPE="SS" S SSN=ID
  1. . Q
  1. Q:ERR'="" 0
  1. ;
  1. I '$$VALIDID^MHV7RU(.ICN,.DFN,.SSN,.ERR) S ERR="QRD^1^8^"_ERR Q 0
  1. ;
  1. ;I FAMILY="" S ERR="QRD^1^8^101^AE^Missing Patient Family Name" Q 0
  1. ;I GIVEN="" S ERR="QRD^1^8^101^AE^Missing Patient Given Name" Q 0
  1. ;
  1. S REQ("ICN")=ICN
  1. S REQ("DFN")=DFN
  1. S REQ("SSN")=SSN
  1. Q 1
  1. ;