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

MHV7B9.m

Go to the documentation of this file.
  1. MHV7B9 ;WAS/DLF - HL7 message builder SECURE MESSAGING RSP^K11 ; 9/25/08 4:08pm
  1. ;;1.0;My HealtheVet;**6**;Aug 23, 2005;Build 82
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. Q
  1. ;
  1. RSPK11(MSGROOT,QRY,ERR,DATAROOT,LEN,HL) ; Build query response
  1. ;
  1. ; Populates the array pointed to by MSGROOT with an RSP^K11 query
  1. ; response message by calling the appropriate segment builders based
  1. ; on the type of response ACK/Data or NAK. Extracted data pointed to
  1. ; by DATAROOT, errors, hit counts, and query information are used to
  1. ; build the segments.
  1. ; An error number in ERR^4 indicates a NAK is needed.
  1. ; DATAROOT being null indicates a dataless ACK (testing purposes).
  1. ;
  1. ; Input:
  1. ; MSGROOT - Global root of message
  1. ; QRY - Query parameters
  1. ; QRY("MID") - original message control ID
  1. ; ERR - Caret delimited error string
  1. ; segment^sequence^field^code^ACK type^error text
  1. ; DATAROOT - Global root of data array
  1. ; HL - HL7 package array variable
  1. ;
  1. ; Output: RSP^K11 message in MSGROOT
  1. ; LEN - Length of formatted message
  1. ;
  1. N CNT,HIT,EXTIME,MTYPE
  1. D LOG^MHVUL2("SM RSP-K11 BUILDER","BEGIN","S","TRACE")
  1. ;
  1. S HIT=0,EXTIME=""
  1. I DATAROOT'="" D
  1. . S HIT=+$P($G(@DATAROOT),"^",1)
  1. . S EXTIME=$P($G(@DATAROOT),"^",2)
  1. . Q
  1. S HIT=HIT_"^"_HIT_"^0"
  1. ;
  1. K @MSGROOT
  1. S CNT=1,@MSGROOT@(CNT)=$$MSA^MHV7BUS($G(QRY("MID")),ERR,.HL)
  1. S LEN=$L(@MSGROOT@(CNT))
  1. I $P(ERR,"^",4) D
  1. .S CNT=CNT+1,HIT="0^0^0",@MSGROOT@(CNT)=$$ERR^MHV7BUS(ERR,.HL)
  1. .S LEN=LEN+$L(@MSGROOT@(CNT))
  1. S CNT=CNT+1,@MSGROOT@(CNT)=$$QAK^MHV7BUS(.QRY,ERR,HIT,.HL)
  1. S LEN=LEN+$L(@MSGROOT@(CNT))
  1. S CNT=CNT+1,@MSGROOT@(CNT)=$$QPD^MHV7BUS(.QRY,EXTIME,.HL)
  1. S LEN=LEN+$L(@MSGROOT@(CNT))
  1. ;
  1. I '$P(ERR,"^",4) D
  1. .D @(QRY("BUILDER")_"(MSGROOT,DATAROOT,.CNT,.LEN,.HL)")
  1. ;
  1. D LOG^MHVUL2("SM RSP-K11 BUILDER","END","S","TRACE")
  1. Q
  1. ;