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

MHV7BUS.m

Go to the documentation of this file.
  1. MHV7BUS ;WAS/GPM - HL7 BUILDER UTILITIES - SEGMENTS ; 1/21/08 8:28pm
  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 builders common to multiple messages.
  1. ; Message builders with message specific segments will contain
  1. ; those message specific segment builders. Examples would be the
  1. ; RDF for RTB^K13 messages or the PID for the ADR^A19.
  1. ;
  1. Q
  1. ;
  1. MSA(MID,ERROR,HL) ;build MSA segment
  1. N MSA,ACK
  1. S ACK=$P(ERROR,"^",5)
  1. I ACK="" S ACK="AA"
  1. S MSA(0)="MSA"
  1. S MSA(1)=ACK ;ACK code
  1. S MSA(2)=MID ;message control ID
  1. S MSA(3)=$$ESCAPE^MHV7U($P(ERROR,"^",6),.HL) ;text message
  1. Q $$BLDSEG^MHV7U(.MSA,.HL)
  1. ;
  1. ERR(ERROR,HL) ;build ERR segment
  1. N ERR
  1. S ERR(0)="ERR"
  1. S ERR(1,1,1)=$P(ERROR,"^",1) ;segment
  1. S ERR(1,1,2)=$P(ERROR,"^",2) ;sequence
  1. S ERR(1,1,3)=$P(ERROR,"^",3) ;field
  1. S ERR(1,1,4,1)=$P(ERROR,"^",4) ;code
  1. S ERR(1,1,4,2)=$$ESCAPE^MHV7U($P(ERROR,"^",6),.HL) ;text
  1. Q $$BLDSEG^MHV7U(.ERR,.HL)
  1. ;
  1. QAK(QRY,ERROR,HIT,HL) ;build QAK segment
  1. N QAK,STATUS
  1. S STATUS=$P(ERROR,"^",5)
  1. I STATUS="" S STATUS="OK"
  1. I STATUS="OK",HIT<1 S STATUS="NF"
  1. S QAK(0)="QAK"
  1. I $D(QRY("QPD")) D ;QBP style query
  1. . S QAK(1)=$G(QRY("QPD",2)) ;query tag
  1. . M QAK(3)=QRY("QPD",1) ;message query name
  1. . Q
  1. I $D(QRY("QRD")) D ;old style query
  1. . S QAK(1)=$G(QRY("QRD",4)) ;query tag
  1. . M QAK(3)=QRY("QRD",9) ;message query name
  1. . S QAK(3,1,2)=$G(QRY("QRD",10))
  1. . Q
  1. S QAK(2)=STATUS ;query response status
  1. S QAK(4)=$P(HIT,"^",1) ;hit count total
  1. S QAK(5)=$P(HIT,"^",2) ;hits this payload
  1. S QAK(6)=$P(HIT,"^",3) ;hits remaining
  1. Q $$BLDSEG^MHV7U(.QAK,.HL)
  1. ;
  1. QPD(QRY,EXTIME,HL) ;build QPD segment
  1. N QPD
  1. M QPD=QRY("QPD")
  1. S QPD(0)="QPD"
  1. S QPD(7)=$G(QRY("ICN")) ;ICN
  1. S QPD(8)=$G(QRY("DFN")) ;DFN
  1. S QPD(9)=$$FMTHL7^MHV7BU(EXTIME) ;Extract time
  1. Q $$BLDSEG^MHV7U(.QPD,.HL)
  1. ;
  1. QRD(QRY,EXTIME,HL) ; Build QRD segment
  1. N QRD
  1. M QRD=QRY("QRD")
  1. S QRD(0)="QRD"
  1. S QRD(1)=$$FMTHL7^MHV7BU(EXTIME) ;Extract time
  1. Q $$BLDSEG^MHV7U(.QRD,.HL)
  1. ;
  1. QRF(QRY,HL) ; Build QRF segment
  1. N QRF
  1. M QRF=QRY("QRF")
  1. S QRF(0)="QRF"
  1. Q $$BLDSEG^MHV7U(.QRF,.HL)
  1. ;
  1. PID(QRY,HL) ; Build basic PID segment
  1. N PID,NAME,ICN,DFN,SSN
  1. S ICN=$G(QRY("ICN"))
  1. S DFN=$G(QRY("DFN"))
  1. S SSN=$G(QRY("SSN"))
  1. S PID(0)="PID"
  1. D PID3^MHV7BU(.PID,ICN,DFN,SSN) ;ID list
  1. D FMTNAME2^MHV7BU(DFN,2,.NAME,.HL,"XPN")
  1. M PID(5,1)=NAME
  1. Q $$BLDSEG^MHV7U(.PID,.HL)
  1. ;