[613] | 1 | MHV7RUS ;WAS/GPM - HL7 RECEIVER UTILITIES - SEGMENT ; [12/8/07 6:18pm]
|
---|
| 2 | ;;1.0;My HealtheVet;**2**;Aug 23, 2005;Build 22
|
---|
| 3 | ;;Per VHA Directive 2004-038, this routine should not be modified.
|
---|
| 4 | ;
|
---|
| 5 | ; Segment validators common to multiple messages.
|
---|
| 6 | ; Message receivers with message specific segments will contain
|
---|
| 7 | ; those message specific segment builders. Examples would be the
|
---|
| 8 | ; QRD/QRF for QRY^R02 message, or the ORC/RXE for OMP^O09.
|
---|
| 9 | ;
|
---|
| 10 | Q
|
---|
| 11 | ;
|
---|
| 12 | VALIDPID(PID,REQ,ERR) ; Validate PID segment
|
---|
| 13 | ;
|
---|
| 14 | ; Input:
|
---|
| 15 | ; PID - PID array containing parsed PID segment
|
---|
| 16 | ;
|
---|
| 17 | ; Output:
|
---|
| 18 | ; REQ - Request parameter array
|
---|
| 19 | ; REQ("ICN")
|
---|
| 20 | ; REQ("DFN")
|
---|
| 21 | ; REQ("SSN")
|
---|
| 22 | ; ERR - Caret delimited error string
|
---|
| 23 | ; segment^sequence^field^code^ACK type^error text
|
---|
| 24 | ;
|
---|
| 25 | N ICN,DFN,SSN,ID,TYPE,FAMILY,GIVEN,MIDDLE,SUFFIX,I
|
---|
| 26 | S ICN="",DFN="",SSN=""
|
---|
| 27 | F I=1:1:3 Q:'$D(PID(3,I)) D Q:ERR'=""
|
---|
| 28 | . S ID=$G(PID(3,I,1))
|
---|
| 29 | . S TYPE=$G(PID(3,I,5))
|
---|
| 30 | . I ID="" S ERR="PID^1^3^101^AE^Missing Patient ID" Q
|
---|
| 31 | . I TYPE="" S ERR="PID^1^3^101^AE^Missing Patient ID Type" Q
|
---|
| 32 | . I TYPE="NI" S ICN=ID
|
---|
| 33 | . I TYPE="PI" S DFN=ID
|
---|
| 34 | . I TYPE="SS" S SSN=ID
|
---|
| 35 | . Q
|
---|
| 36 | Q:ERR'="" 0
|
---|
| 37 | ;
|
---|
| 38 | S FAMILY=$G(PID(5,1,1))
|
---|
| 39 | S GIVEN=$G(PID(5,1,2))
|
---|
| 40 | S MIDDLE=$G(PID(5,1,3))
|
---|
| 41 | S SUFFIX=$G(PID(5,1,4))
|
---|
| 42 | ;
|
---|
| 43 | I '$$VALIDID^MHV7RU(.ICN,.DFN,.SSN,.ERR) S ERR="PID^1^3^"_ERR Q 0
|
---|
| 44 | ;
|
---|
| 45 | ; Name components required by HL7 but not used by MHV
|
---|
| 46 | ;I FAMILY="" S ERR="PID^1^5^101^AE^Missing Patient Family Name" Q 0
|
---|
| 47 | ;I GIVEN="" S ERR="PID^1^5^101^AE^Missing Patient Given Name" Q 0
|
---|
| 48 | ;
|
---|
| 49 | S REQ("ICN")=ICN
|
---|
| 50 | S REQ("DFN")=DFN
|
---|
| 51 | S REQ("SSN")=SSN
|
---|
| 52 | Q 1
|
---|
| 53 | ;
|
---|
| 54 | VALIDWHO(QRD,REQ,ERR) ; Validate Who subject filter in QRD segments
|
---|
| 55 | ;
|
---|
| 56 | ; Input:
|
---|
| 57 | ; QRD - QRD array containing parsed QRD segment
|
---|
| 58 | ;
|
---|
| 59 | ; Output:
|
---|
| 60 | ; REQ - Request parameter array
|
---|
| 61 | ; REQ("ICN")
|
---|
| 62 | ; REQ("DFN")
|
---|
| 63 | ; REQ("SSN")
|
---|
| 64 | ; ERR - Caret delimited error string
|
---|
| 65 | ; segment^sequence^field^code^ACK type^error text
|
---|
| 66 | ;
|
---|
| 67 | N ICN,DFN,SSN,ID,TYPE,FAMILY,GIVEN,MIDDLE,SUFFIX,I
|
---|
| 68 | S ICN="",DFN="",SSN=""
|
---|
| 69 | F I=1:1:3 Q:'$D(QRD(8,I)) D Q:ERR'=""
|
---|
| 70 | . S ID=$G(QRD(8,I,1))
|
---|
| 71 | . S FAMILY=$G(QRD(8,I,2))
|
---|
| 72 | . S GIVEN=$G(QRD(8,I,3))
|
---|
| 73 | . S MIDDLE=$G(QRD(8,I,4))
|
---|
| 74 | . S SUFFIX=$G(QRD(8,I,5))
|
---|
| 75 | . S TYPE=$G(QRD(8,I,13))
|
---|
| 76 | . I ID="" S ERR="QRD^1^8^101^AE^Missing ID number" Q
|
---|
| 77 | . I TYPE="" S ERR="QRD^1^8^101^AE^Missing identifier type code" Q
|
---|
| 78 | . I TYPE="NI" S ICN=ID
|
---|
| 79 | . I TYPE="PI" S DFN=ID
|
---|
| 80 | . I TYPE="SS" S SSN=ID
|
---|
| 81 | . Q
|
---|
| 82 | Q:ERR'="" 0
|
---|
| 83 | ;
|
---|
| 84 | I '$$VALIDID^MHV7RU(.ICN,.DFN,.SSN,.ERR) S ERR="QRD^1^8^"_ERR Q 0
|
---|
| 85 | ;
|
---|
| 86 | ;I FAMILY="" S ERR="QRD^1^8^101^AE^Missing Patient Family Name" Q 0
|
---|
| 87 | ;I GIVEN="" S ERR="QRD^1^8^101^AE^Missing Patient Given Name" Q 0
|
---|
| 88 | ;
|
---|
| 89 | S REQ("ICN")=ICN
|
---|
| 90 | S REQ("DFN")=DFN
|
---|
| 91 | S REQ("SSN")=SSN
|
---|
| 92 | Q 1
|
---|
| 93 | ;
|
---|