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

IVMPTRN7.m

Go to the documentation of this file.
  1. IVMPTRN7 ;ALB/KCL/CJM/PHH/BAJ,TDM - HL7 FULL DATA TRANSMISSION (Z07) BUILDER ; 8/15/08 10:30am
  1. ;;2.0;INCOME VERIFICATION MATCH;**9,11,24,34,74,88,105,115,142**;OCT 21, 1994;Build 3
  1. ;
  1. ;
  1. FULL(DFN,IVMMTDT,EVENTS,IVMCT,IVMGTOT,IVMFLL,IVMNOMSH,IVMREC,IVMQUERY) ;
  1. ;Description: This entry point will be used to create an HL7 "Full Data Transmission" message for a patient. Transmission of these messages will be in a batch of 1-100 individual HL7 messages.
  1. ;
  1. ;Input:
  1. ; DFN - Patient IEN
  1. ; IVMMTDT - date of the patient's Means Test or Copay Test
  1. ; EVENTS () - an array of reasons for transmission, pass by reference.
  1. ; EVENTS("IVM") = 1 if transmission due to IVM criteria, 0 otherwise
  1. ; EVENTS(" "DCD")=1 if transmission due to DCD criteria, 0 otherwise
  1. ; EVENTS("ENROLL")=1 if transmission due to enrollment criteria, 0 otherwise
  1. ; IVMCT - count of segments transmitted, pass by reference
  1. ; IVMGTOT - count of batchs transmitted, pass by reference
  1. ; IVMFLL - (optional), flag for creating MSA, QRD segments for FULL query transmission, $G(IVMFLL) means yes
  1. ; IVMNOMSH - (optional), if IVMNOMSH=1, means the MSH segment should not be built
  1. ; IVMREC - (optional), if $G(IVMFLL), then this variable will contain the internal entry number of Query Income Year #301.9001 mult.
  1. ; IVMQUERY - array passed in by reference where
  1. ; IVMQUERY("LTD") -- # of the QUERY that is currently open or
  1. ; undefined, zero, or null if no QUERY opened for
  1. ; last treatment date
  1. ; IVMQUERY("OVIS") -- # of the QUERY that is currently open or
  1. ; undefined, zero, or null if no QUERY opened for
  1. ; finding outpatient visits
  1. ;
  1. ;HL7 variables as defined by call to INIT^IVMUFNC:
  1. ; HLEVN - HL7 message event counter
  1. ; HLSDT - a flag that indicates that the data to be sent is stored in the ^TMP("HLS") global array.
  1. ;
  1. ;The following variables returned by the INIT^HLTRANS entry point:
  1. ; HLNDAP - Non-DHCP Application Pointer from file 770
  1. ; HLNDAP0 - Zero node from file 770 corresponding to HLNDAP
  1. ; HLDAP - DHCP Application Pointer from file 771
  1. ; HLDAN - The DHCP Application Name (.01 field, file 771) for HLDAP
  1. ; HLPID - HL7 processing ID from file 770
  1. ; HLVER - HL7 version number from file 770
  1. ; HLFS - HL7 Field Separater from the 'FS' node of file 771
  1. ; HLECH - HL7 Encoding Characters from the 'EC' node of file 771
  1. ; HLQ - Double quotes ("") for use in building HL7 segments
  1. ; HLERR - if an error is encountered, an error message is returned in the HLERR variable.
  1. ; HLDA - the internal entry number for the entry created in file 772
  1. ;
  1. ; HLDT - the transmission date/time (associated with the entry in in file 772 identified by HLDA) in internal VA FileMan format.
  1. ; HLDT1 - the same transmission date/time as the HLDT variable, only in HL7 format.
  1. ;
  1. ;Output:
  1. ; ^TMP("HLS",$J,IVMCT) - global array containing all segments of the HL7 message that the VistA application wishes to send. The HLSDT variable is defined above and the IVMCT variable is a sequential number starting at 1.
  1. ;
  1. N DGREL,DGINC,DR,I,IVMI,IVMDFN,IVMHLMID,IVMNTE,IVMPAT,IVMQRD,X,IVMCNTID
  1. ;
  1. ; IVM*2.0*142 Quit if test patient unless ^XTMP("IVMTST","Z07",DFN) set and user wishes test patient to send a Z07 for testing purpose.
  1. I $$TESTPAT^VADPT(DFN) Q:'$D(^XTMP("IVMTST","Z07",DFN))
  1. ; IVM*2.0*105 BAJ 10/20/2005
  1. ; Do Z07 Consistency checks and, if fail, prevent Z07 Build
  1. I '$$EN^IVMZ07C(DFN) Q
  1. ;
  1. ; INITIALIZE HL7 1.6 VARIABLES
  1. D INIT^HLFNC2(HLEID,.HL)
  1. ;
  1. ; quit if Pseudo SSN and not verified
  1. ; Q:'$$SNDPSSN(DFN) ;Removed by IVM*2*105
  1. ;
  1. S DGPRIM=$$GET1^DIQ(2,DFN_",",.361)
  1. I $G(DGPRIM)]"" S DGPRIM=$O(^DIC(8,"B",DGPRIM,0))
  1. I $G(DGPRIM)]"" S DGPRIM=$P($G(^DIC(8,DGPRIM,0)),U,9)
  1. I $G(DGPRIM)=14 D REM Q
  1. ;
  1. ; if count=0 and not first batch
  1. ;RMC;I IVMCT=0,$G(IVMGTOT) D FILE^HLTF
  1. ;
  1. ; HL7 event/message counter
  1. S HLEVN=$G(HLEVN)+1
  1. ;
  1. ; CREATE SLOT FOR EACH NEW BATCH
  1. I HLEVN=1 D
  1. . K HLMID,MTIEN,HLDT,HLDT1
  1. . D CREATE^HLTF(.HLMID,.MTIEN,.HLDT,.HLDT1)
  1. ;
  1. ; handle message header processing for HL7 full data trans (Z07) msg
  1. D MSH^IVMUFNC4($G(IVMNOMSH),$G(IVMFLL),$G(IVMREC),.IVMCT,.IVMCNTID)
  1. ;
  1. I IVMMTDT="" D
  1. .S IVMMTDT=$P($$LST^DGMTU(DFN,DT),"^",2)
  1. .I IVMMTDT="" S IVMMTDT=DT
  1. ;
  1. ; build HL7 Full Data Transmission (Z07) message
  1. D BUILD^IVMPTRN8(DFN,IVMMTDT,.IVMCT,.IVMQUERY)
  1. ;
  1. ; log patient transmission
  1. D
  1. .N IVMSTAT
  1. .S X=$$LST^DGMTCOU1(DFN,IVMMTDT,3)
  1. .S IVMSTAT=$S($E($P(X,"^",2),1,3)=$E(IVMMTDT,1,3):$P($G(^DGMT(408.31,+X,0)),"^",3),1:"")
  1. .;
  1. .D FILEPT^IVMPTRN3(DFN,$$LYR^DGMTSCU1(IVMMTDT),HLDT,IVMCNTID,.EVENTS,IVMSTAT,IVMINS)
  1. ;
  1. ;if number of HL7 events/msgs is 100 then call HL7 pkg to transmit batch
  1. I HLEVN=100 D
  1. .N IVMEVENT
  1. .; event code for Full Data Transmission
  1. .S IVMEVENT="Z07"
  1. .I $G(IVMFLL) D FILE1^IVMPTRN3 Q
  1. .D FILE^IVMPTRN3
  1. Q
  1. ;
  1. SNDPSSN(DFN) ; check SSN and patient eligibility
  1. ;
  1. ; Input:
  1. ; DFN Patient file (#2) IEN
  1. ; Output:
  1. ; <expression> 1: Pseudo SSN and Eligibility verified or
  1. ; not a Pseudo SSN
  1. ; 0: Psuedo SSN and Eligibility Pending verification
  1. ; Pending re-verification
  1. ;
  1. N SSN,PFLG
  1. ;
  1. ; Don't process records with corrupted nodes
  1. I '$D(^DPT(DFN,0)) D REM Q 0
  1. ;
  1. S SSN=$P(^DPT(DFN,0),U,9)
  1. S PFLG=($E(SSN,$L(SSN))="P") I 'PFLG Q 1
  1. I ($P($G(^DPT(DFN,.361)),U)="V") Q 1
  1. ;
  1. D REM
  1. Q 0
  1. ;
  1. REM ; Remove Psuedo SSN from Queue
  1. ; Set TRANSMISSION STATUS to transmission not required
  1. S PDATA(.03)=1 I $$UPD^DGENDBS(301.5,IVMDA,.PDATA,.ERR)
  1. K PDATA,ERR
  1. Q