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

DGQEHL71.m

Go to the documentation of this file.
  1. DGQEHL71 ;ALB/JFP - VIC Single HL7 Message Builder;09/01/96
  1. ;;5.3;Registration;**73,1015**;DEC 11,1996;Build 21
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. EVENT(DGQEEVN,DFN) ; Entry point
  1. ;This option is the main entry point for the ID card driver.
  1. ;All VIC events will processed through this routine.
  1. ;
  1. ;Input : DGQEEVN - HL7 event type to process
  1. ; DFN - pointer to Patient file (#2)
  1. ;
  1. ;Output : Message ID in file 772 sucessful
  1. ; -1^error text
  1. ;
  1. ; -- Check parameters
  1. Q:'$D(DGQEEVN) "-1^Required parameter not passed - event type"
  1. Q:'$D(DFN) "-1^Required parameter not passed - DFN"
  1. ; -- Declare variables
  1. N STATUS,HL7XMIT,CNT,INCREM
  1. N HLECH,HLEID,HLFS,HLMTIEN,HLRESLT,HLSAN
  1. N CLERK,OPT,SAPPL,RAPPL,MID
  1. S STATUS=0
  1. ;
  1. EVNA08 ; -- A08 Update patient information for VIC
  1. I DGQEEVN="A08" D Q STATUS
  1. .D A08
  1. Q "-1^No mumps code for event type "_DGQEEVN
  1. ;
  1. A08 ; -- Builds update patient record
  1. ; -- Initialize variables
  1. ;
  1. ; -- Get pointer to sending event
  1. S HLEID=+$O(^ORD(101,"B","DGQE HL7 A08 VIC SERVER",0))
  1. ; -- Check existance of event, send error bulletin, done
  1. I ('HLEID) D Q
  1. .S STATUS="-1^Unable to initialize HL7 variables - protocol not found"
  1. .D ERRBULL^DGQEHL70(STATUS) Q
  1. ; -- Get variables from HL7 package
  1. D INIT^HLFNC2(HLEID,.HL)
  1. ; -- Check existance of HL variables, send error bulletin, done
  1. I ($O(HL(""))="") S STATUS="-1^"_$P(HL,"^",2) D ERRBULL^DGQEHL70(STATUS) Q
  1. S SAPPL=$S($D(HL("SAN")):$G(HL("SAN")),1:" ")
  1. ; -- Set global array
  1. S HL7XMIT="^TMP(""HLS"","_$J_")"
  1. K @HL7XMIT
  1. ; -- Build HL7 message, message header build by HL7 package
  1. S CNT=0
  1. S INCREM=$$BLDA08^DGQEHL73(DFN,.HL,"",HL7XMIT,CNT)
  1. ; -- Check for error, increment less than 1
  1. I (INCREM<0) D Q
  1. .S STATUS="-1^"_$P(INCREM,"^",2)
  1. .D ERRBULL^DGQEHL70(STATUS)
  1. ; -- Send HL7 message - immediate priority
  1. S HLP("PRIORITY")="I"
  1. D GENERATE^HLMA(HLEID,"GM",1,.HLRESLT,"",.HLP)
  1. ; -- Check for error
  1. I ($P(HLRESLT,"^",2)'="") D Q
  1. .S STATUS=$P(HLRESLT,"^",2)_"^"_$P(HLRESLT,"^",3)
  1. .D ERRBULL^DGQEHL70(STATUS)
  1. ; -- Successful call, message ID returned
  1. S MID=$P(HLRESLT,"^",1)
  1. I $D(JPTEST) W !,"Message ID = ",MID
  1. ; -- Create tracking entry in ADT/HL7 TRANSMISSION file (#39.4)
  1. S CLERK=$S(DUZ'="":$P($G(^VA(200,DUZ,0)),"^",1),1:" ")
  1. S OPT=$S($D(XQY0):$P($G(XQY0),"^",1),1:" ")
  1. S FILE=$$FILE^DGQEHL74(MID,DFN,CLERK,OPT,SAPPL)
  1. I FILE=-1 D ERRBULL^DGQEHL70($P(FILE,"^",2)) Q
  1. Q
  1. ;
  1. END ; -- End of code
  1. Q
  1. ;