source: WorldVistAEHR/trunk/r/INCOME_VERIFICATION_MATCH-IVM/IVMPREC2.m@ 634

Last change on this file since 634 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1IVMPREC2 ;ALB/KCL - ROUTE INCOMING HL7 (ORU) MESSAGES BY EVENT TYPE ;5/17/02 1:43pm
2 ;;2.0;INCOME VERIFICATION MATCH;**12,34,112,118**;21-OCT-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ; This routine will process (ORU) HL7 messages received from the
6 ; IVM center. Event type code indicating type of transmission is
7 ; in the BHS segment. Routines based on type will be called to
8 ; process these messages. For each batch an ACK will be sent to
9 ; the IVM Center indicating errors found. If any errors are found
10 ; a batch message with AE(indicating error(s)) is sent. If no errors
11 ; only a MSH and MSA with AA(no errors) is sent. The following event
12 ; type codes are processed in the following routines:
13 ;
14 ; EVENT CODE TRANSMISSION TYPE PROCESSING ROUTINE
15 ; ==============================================================
16 ; Z03 SSN TRANSMISSIONS IVMPREC5
17 ; Z04 INSURANCE TRANSMISSIONS IVMPREC3
18 ; Z05 DEMOGRAPHIC TRANSMISSIONS IVMPREC6
19 ; Z06 MEANS TEST TRANSMISSIONS IVMPREC7
20 ; Z08 CASE STATUS TRANSMISSIONS IVMPREC4
21 ; Z10 INCOME TEST TRANSMISSIONS IVMCM
22 ; Z11 ENROLLMENT/ELIGIBILTY ORUZ11^DGENUPL
23 ;
24 ;
25ORU ; - Receive Observational Results Unsolicited Message
26 ;
27 N DIC,%,%H,%I D NOW^%DTC S HLDT=%
28 K HLERR,IVMSEG1,IVMSEG2,IVMSEG3
29 S (HLEVN,IVMCT,IVMERROR,IVMCNTR)=0
30 ; Make sure POSTMASTER DUZ instead of DUZ of Person who
31 ; started Incoming Logical Link
32 S DUZ=.5
33 ;
34 ; - get incoming segment from HL7 (#772) file
35 N IVMRTN,SEGCNT,CNT,STATION,HLEID,HLEIDS
36 S IVMRTN="IVMPREC2" K ^TMP($J,IVMRTN),^TMP("HLA",$J),^TMP("HLS",$J)
37 F SEGCNT=1:1 X HLNEXT Q:HLQUIT'>0 D
38 . S CNT=0
39 . S ^TMP($J,IVMRTN,SEGCNT,CNT)=HLNODE
40 . F S CNT=$O(HLNODE(CNT)) Q:'CNT S ^TMP($J,IVMRTN,SEGCNT,CNT)=HLNODE(CNT)
41 ;
42 S HLDA=HLMTIEN
43 S IVMSEG=$G(^TMP($J,IVMRTN,1,0)) I IVMSEG']"" G ORUQ
44 ;
45 ; - check for BHS
46 I $E(IVMSEG,1,3)'="BHS" G ORUQ
47 ;
48 ; - get batch control id
49 S HLFS=HL("FS")
50 S HLECH=HL("ECH")
51 S HLQ=$G(HL("HLQ")) S:HLQ="" HLQ=""""""
52 S IVMHLMID=$P(IVMSEG,HLFS,11)
53 S STATION=$P(IVMSEG,HLFS,6)
54 ;
55 ; - get event type code
56 S IVMETC=$P($P(IVMSEG,HLFS,9),$E(HLECH),3)
57 S IVMETC=$P(IVMETC,$E(HLECH,2),2)
58 S HLEID="VAMC "_STATION_" ORU-"_IVMETC_" SERVER"
59 I IVMETC="Z04" S HLEID=HLEID_" H" ;HEC TO VAMC
60 S HLEID=$O(^ORD(101,"B",HLEID,0)),HLEIDS=""
61 I HLEID]"" S HLEIDS=$O(^ORD(101,HLEID,775,"B",0))
62 ;
63 ; - process the message according to the event type code
64 S IVMDO=$S(IVMETC="Z03":"EN^IVMPREC5",IVMETC="Z04":"EN^IVMPREC3",IVMETC="Z05":"EN^IVMPREC6",IVMETC="Z06":"EN^IVMPREC7",IVMETC="Z08":"EN^IVMPREC4",IVMETC="Z10":"ORU^IVMCM",IVMETC="Z11":"ORUZ11^DGENUPL",1:"ORUQ")
65 I IVMETC="Z11" D
66 .D ORUZ11^DGENUPL(HLDA,.IVMERROR)
67 .S IVMCT=2*IVMERROR
68 .S HLEVN=IVMERROR
69 I IVMETC'="Z11" D
70 .D @IVMDO
71 Q:IVMDO="ORUQ"
72 ;
73 ; - if no error send ACK 'AA' message
74 S HLMTN="ACK"
75 K HLARYTYP,HLMTIENA,HLRESLTA,HLP
76 I 'IVMERROR S HLMID=IVMHLMID D ACK^IVMPREC S HLARYTYP="GM",HLMTIENA=""
77 I IVMERROR S HLARYTYP="GB",HLMTIENA=HLMTIEN ;HLMTIEN comes from ACK^IVMPREC
78 K ^TMP("HLA",$J) M ^TMP("HLA",$J)=^TMP("HLS",$J) K ^TMP("HLS",$J)
79 D GENACK^HLMA1(HLEID,HLMTIENS,HLEIDS,HLARYTYP,1,.HLRESLTA,HLMTIENA,.HLP)
80 ; The following line is added for PFSS Registration. This line will ensure any patient
81 ; registration updates received from the HEC are forwarded to a COTS billing application
82 ; See DBIA#4840
83 S X="DGPFSS2" X ^%ZOSF("TEST") I $T D BATCH^DGPFSS2(IVMRTN)
84 ;
85ORUQ ;
86 K DFN,IVMCNTR,IVMCT,IVMDA,IVMERR,IVMERROR,IVMHLMID,IVMNDE,IVMPTID
87 K IVMSEG,IVMSEG1,IVMSEG2,IVMSEG3,IVMTEXT,XMSUB
88 K HLARYTYP,HLMTIENA,HLRESLTA,HLP
89 K ^TMP($J,IVMRTN),^TMP("HLA",$J),^TMP("HLS",$J)
90 Q
Note: See TracBrowser for help on using the repository browser.