- MHV7RUS ;WAS/GPM - HL7 RECEIVER UTILITIES - SEGMENT ; [12/8/07 6:18pm]
- ;;1.0;My HealtheVet;**2**;Aug 23, 2005;Build 22
- ;;Per VHA Directive 2004-038, this routine should not be modified.
- ;
- ; Segment validators common to multiple messages.
- ; Message receivers with message specific segments will contain
- ; those message specific segment builders. Examples would be the
- ; QRD/QRF for QRY^R02 message, or the ORC/RXE for OMP^O09.
- ;
- Q
- ;
- VALIDPID(PID,REQ,ERR) ; Validate PID segment
- ;
- ; Input:
- ; PID - PID array containing parsed PID segment
- ;
- ; Output:
- ; REQ - Request parameter array
- ; REQ("ICN")
- ; REQ("DFN")
- ; REQ("SSN")
- ; ERR - Caret delimited error string
- ; segment^sequence^field^code^ACK type^error text
- ;
- N ICN,DFN,SSN,ID,TYPE,FAMILY,GIVEN,MIDDLE,SUFFIX,I
- S ICN="",DFN="",SSN=""
- F I=1:1:3 Q:'$D(PID(3,I)) D Q:ERR'=""
- . S ID=$G(PID(3,I,1))
- . S TYPE=$G(PID(3,I,5))
- . I ID="" S ERR="PID^1^3^101^AE^Missing Patient ID" Q
- . I TYPE="" S ERR="PID^1^3^101^AE^Missing Patient ID Type" Q
- . I TYPE="NI" S ICN=ID
- . I TYPE="PI" S DFN=ID
- . I TYPE="SS" S SSN=ID
- . Q
- Q:ERR'="" 0
- ;
- S FAMILY=$G(PID(5,1,1))
- S GIVEN=$G(PID(5,1,2))
- S MIDDLE=$G(PID(5,1,3))
- S SUFFIX=$G(PID(5,1,4))
- ;
- I '$$VALIDID^MHV7RU(.ICN,.DFN,.SSN,.ERR) S ERR="PID^1^3^"_ERR Q 0
- ;
- ; Name components required by HL7 but not used by MHV
- ;I FAMILY="" S ERR="PID^1^5^101^AE^Missing Patient Family Name" Q 0
- ;I GIVEN="" S ERR="PID^1^5^101^AE^Missing Patient Given Name" Q 0
- ;
- S REQ("ICN")=ICN
- S REQ("DFN")=DFN
- S REQ("SSN")=SSN
- Q 1
- ;
- VALIDWHO(QRD,REQ,ERR) ; Validate Who subject filter in QRD segments
- ;
- ; Input:
- ; QRD - QRD array containing parsed QRD segment
- ;
- ; Output:
- ; REQ - Request parameter array
- ; REQ("ICN")
- ; REQ("DFN")
- ; REQ("SSN")
- ; ERR - Caret delimited error string
- ; segment^sequence^field^code^ACK type^error text
- ;
- N ICN,DFN,SSN,ID,TYPE,FAMILY,GIVEN,MIDDLE,SUFFIX,I
- S ICN="",DFN="",SSN=""
- F I=1:1:3 Q:'$D(QRD(8,I)) D Q:ERR'=""
- . S ID=$G(QRD(8,I,1))
- . S FAMILY=$G(QRD(8,I,2))
- . S GIVEN=$G(QRD(8,I,3))
- . S MIDDLE=$G(QRD(8,I,4))
- . S SUFFIX=$G(QRD(8,I,5))
- . S TYPE=$G(QRD(8,I,13))
- . I ID="" S ERR="QRD^1^8^101^AE^Missing ID number" Q
- . I TYPE="" S ERR="QRD^1^8^101^AE^Missing identifier type code" Q
- . I TYPE="NI" S ICN=ID
- . I TYPE="PI" S DFN=ID
- . I TYPE="SS" S SSN=ID
- . Q
- Q:ERR'="" 0
- ;
- I '$$VALIDID^MHV7RU(.ICN,.DFN,.SSN,.ERR) S ERR="QRD^1^8^"_ERR Q 0
- ;
- ;I FAMILY="" S ERR="QRD^1^8^101^AE^Missing Patient Family Name" Q 0
- ;I GIVEN="" S ERR="QRD^1^8^101^AE^Missing Patient Given Name" Q 0
- ;
- S REQ("ICN")=ICN
- S REQ("DFN")=DFN
- S REQ("SSN")=SSN
- Q 1
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMHV7RUS 2787 printed Feb 18, 2025@23:42:10 Page 2
- MHV7RUS ;WAS/GPM - HL7 RECEIVER UTILITIES - SEGMENT ; [12/8/07 6:18pm]
- +1 ;;1.0;My HealtheVet;**2**;Aug 23, 2005;Build 22
- +2 ;;Per VHA Directive 2004-038, this routine should not be modified.
- +3 ;
- +4 ; Segment validators common to multiple messages.
- +5 ; Message receivers with message specific segments will contain
- +6 ; those message specific segment builders. Examples would be the
- +7 ; QRD/QRF for QRY^R02 message, or the ORC/RXE for OMP^O09.
- +8 ;
- +9 QUIT
- +10 ;
- VALIDPID(PID,REQ,ERR) ; Validate PID segment
- +1 ;
- +2 ; Input:
- +3 ; PID - PID array containing parsed PID segment
- +4 ;
- +5 ; Output:
- +6 ; REQ - Request parameter array
- +7 ; REQ("ICN")
- +8 ; REQ("DFN")
- +9 ; REQ("SSN")
- +10 ; ERR - Caret delimited error string
- +11 ; segment^sequence^field^code^ACK type^error text
- +12 ;
- +13 NEW ICN,DFN,SSN,ID,TYPE,FAMILY,GIVEN,MIDDLE,SUFFIX,I
- +14 SET ICN=""
- SET DFN=""
- SET SSN=""
- +15 FOR I=1:1:3
- if '$DATA(PID(3,I))
- QUIT
- Begin DoDot:1
- +16 SET ID=$GET(PID(3,I,1))
- +17 SET TYPE=$GET(PID(3,I,5))
- +18 IF ID=""
- SET ERR="PID^1^3^101^AE^Missing Patient ID"
- QUIT
- +19 IF TYPE=""
- SET ERR="PID^1^3^101^AE^Missing Patient ID Type"
- QUIT
- +20 IF TYPE="NI"
- SET ICN=ID
- +21 IF TYPE="PI"
- SET DFN=ID
- +22 IF TYPE="SS"
- SET SSN=ID
- +23 QUIT
- End DoDot:1
- if ERR'=""
- QUIT
- +24 if ERR'=""
- QUIT 0
- +25 ;
- +26 SET FAMILY=$GET(PID(5,1,1))
- +27 SET GIVEN=$GET(PID(5,1,2))
- +28 SET MIDDLE=$GET(PID(5,1,3))
- +29 SET SUFFIX=$GET(PID(5,1,4))
- +30 ;
- +31 IF '$$VALIDID^MHV7RU(.ICN,.DFN,.SSN,.ERR)
- SET ERR="PID^1^3^"_ERR
- QUIT 0
- +32 ;
- +33 ; Name components required by HL7 but not used by MHV
- +34 ;I FAMILY="" S ERR="PID^1^5^101^AE^Missing Patient Family Name" Q 0
- +35 ;I GIVEN="" S ERR="PID^1^5^101^AE^Missing Patient Given Name" Q 0
- +36 ;
- +37 SET REQ("ICN")=ICN
- +38 SET REQ("DFN")=DFN
- +39 SET REQ("SSN")=SSN
- +40 QUIT 1
- +41 ;
- VALIDWHO(QRD,REQ,ERR) ; Validate Who subject filter in QRD segments
- +1 ;
- +2 ; Input:
- +3 ; QRD - QRD array containing parsed QRD segment
- +4 ;
- +5 ; Output:
- +6 ; REQ - Request parameter array
- +7 ; REQ("ICN")
- +8 ; REQ("DFN")
- +9 ; REQ("SSN")
- +10 ; ERR - Caret delimited error string
- +11 ; segment^sequence^field^code^ACK type^error text
- +12 ;
- +13 NEW ICN,DFN,SSN,ID,TYPE,FAMILY,GIVEN,MIDDLE,SUFFIX,I
- +14 SET ICN=""
- SET DFN=""
- SET SSN=""
- +15 FOR I=1:1:3
- if '$DATA(QRD(8,I))
- QUIT
- Begin DoDot:1
- +16 SET ID=$GET(QRD(8,I,1))
- +17 SET FAMILY=$GET(QRD(8,I,2))
- +18 SET GIVEN=$GET(QRD(8,I,3))
- +19 SET MIDDLE=$GET(QRD(8,I,4))
- +20 SET SUFFIX=$GET(QRD(8,I,5))
- +21 SET TYPE=$GET(QRD(8,I,13))
- +22 IF ID=""
- SET ERR="QRD^1^8^101^AE^Missing ID number"
- QUIT
- +23 IF TYPE=""
- SET ERR="QRD^1^8^101^AE^Missing identifier type code"
- QUIT
- +24 IF TYPE="NI"
- SET ICN=ID
- +25 IF TYPE="PI"
- SET DFN=ID
- +26 IF TYPE="SS"
- SET SSN=ID
- +27 QUIT
- End DoDot:1
- if ERR'=""
- QUIT
- +28 if ERR'=""
- QUIT 0
- +29 ;
- +30 IF '$$VALIDID^MHV7RU(.ICN,.DFN,.SSN,.ERR)
- SET ERR="QRD^1^8^"_ERR
- QUIT 0
- +31 ;
- +32 ;I FAMILY="" S ERR="QRD^1^8^101^AE^Missing Patient Family Name" Q 0
- +33 ;I GIVEN="" S ERR="QRD^1^8^101^AE^Missing Patient Given Name" Q 0
- +34 ;
- +35 SET REQ("ICN")=ICN
- +36 SET REQ("DFN")=DFN
- +37 SET REQ("SSN")=SSN
- +38 QUIT 1
- +39 ;