source: WorldVistAEHR/trunk/r/ENROLLMENT_APPLICATION_SYSTEM-EAS/EASPREC3.m@ 1009

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

initial load of WorldVistAEHR

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