1 | DGENUPL7 ;ISA/KWP/CKN/TMK - PROCESS INCOMING (Z11 EVENT TYPE) HL7 MESSAGES ; 10/19/05
|
---|
2 | ;;5.3;REGISTRATION;**232,367,397,417,379,431,513,628,673,653,742**;Aug 13,1993;Build 7
|
---|
3 | ;Phase II split from DGENUPL
|
---|
4 | Z11(MSGIEN,MSGID,CURLINE,DFN,ERRCOUNT) ;
|
---|
5 | ;Description: This is used to process a single ORU~Z11 or ORF~Z11 msg.
|
---|
6 | ;Input:
|
---|
7 | ; MSGIEN - the internal entry number of the HL7 message in the
|
---|
8 | ; HL7 MESSAGE TEXT file (772)
|
---|
9 | ; MSGID -message control id of HL7 msg in the MSH segment
|
---|
10 | ; CURLINE - the subscript of the MSH segment of the current message (pass by reference)
|
---|
11 | ; DFN - identifies the patient, is the ien of a record in the PATIENT file.
|
---|
12 | ; ERRCOUNT - is a count of the number of messages in the batch that can not be processed (pass by reference)
|
---|
13 | ;
|
---|
14 | ;Output:
|
---|
15 | ; CURLINE - upon leaving the procedure this parameter should be set to the end of the current message. (pass by reference)
|
---|
16 | ; ERRCOUNT - set to count of messages that were not processed due to errors encountered (pass by reference)
|
---|
17 | ;
|
---|
18 | N DGELG,DGENR,DGPAT,DGCDIS,DGOEIF,ERROR,ERRMSG,MSGS,DGELGSUB,DGENUPLD,DGCON
|
---|
19 | N DGNEWVAL,DIV,SUB,OLDELG,OLDPAT,OLDDCDIS,OLDEIF,DGSEC,OLDSEC,DGNTR,DGMST,DGPHINC
|
---|
20 | ;
|
---|
21 | ;some process is killing these HL7 variables, so need to protect them
|
---|
22 | S SUB=HLFS
|
---|
23 | S DIV=HLECH
|
---|
24 | N HLDA,HLDAN,HLDAP,HLDT,HLDT1,HLECH,HLFS,HLNDAP,HLNDAP0,HLPID,HLQ,HLVER,HLERR,HLMTN,HLSDT
|
---|
25 | S HLFS=SUB
|
---|
26 | S HLECH=DIV
|
---|
27 | K DIV,SUB
|
---|
28 | ;
|
---|
29 | ;drops out of block on error
|
---|
30 | D
|
---|
31 | .Q:'$$PARSE^DGENUPL1(MSGIEN,MSGID,.CURLINE,.ERRCOUNT,.DGPAT,.DGELG,.DGENR,.DGCDIS,.DGOEIF,.DGSEC,.DGNTR,.DGMST)
|
---|
32 | .D GETLOCKS^DGENUPL5(DFN)
|
---|
33 | .;
|
---|
34 | .;Used by cross-references to determine if an upload is in progress.
|
---|
35 | .S DGENUPLD="ENROLLMENT/ELIGIBILITY UPLOAD IN PROGRESS"
|
---|
36 | .;
|
---|
37 | .;Update the PATIENT, ELIGIBILITY, CATASTROPHIC DISABILITY objects in memory
|
---|
38 | .Q:'$$UOBJECTS^DGENUPL4(DFN,.DGPAT,.DGELG,.DGCDIS,.DGOEIF,MSGID,.ERRCOUNT,.MSGS,.OLDPAT,.OLDELG,.OLDCDIS,.OLDEIF)
|
---|
39 | .S ERROR=0
|
---|
40 | .;if the msg contains patient security, process it
|
---|
41 | .I $D(DGSEC) D Q:ERROR
|
---|
42 | ..S DGSEC("DFN")=DFN
|
---|
43 | ..S DGSEC("USER")=.5
|
---|
44 | ..I DGSEC("LEVEL")'="" D
|
---|
45 | ...I DGSEC("DATETIME")="" S DGSEC("DATETIME")=$$NOW^XLFDT ;DG*5.3*653
|
---|
46 | ..;
|
---|
47 | ..; check consistency of patient security record
|
---|
48 | ..I '$$CHECK^DGENSEC(.DGSEC,.ERRMSG) D Q
|
---|
49 | ...S ERROR=1
|
---|
50 | ...D ADDERROR^DGENUPL(MSGID,DGPAT("SSN"),ERRMSG,.ERRCOUNT)
|
---|
51 | ..;
|
---|
52 | ..; upload patient security, consistency checks passed
|
---|
53 | ..D SECUPLD^DGENUPL5(DFN,.DGSEC,.OLDSEC)
|
---|
54 | .;
|
---|
55 | .;if the msg has an enrollment process it
|
---|
56 | .I DGENR("STATUS")!DGENR("APP") D Q:ERROR
|
---|
57 | ..;use $$PRIORITY to get the eligibility data used to compute priority
|
---|
58 | ..I $$PRIORITY^DGENELA4(DFN,.DGELG,.DGELGSUB,DGENR("DATE"),DGENR("APP"))
|
---|
59 | ..;
|
---|
60 | ..;store the eligibility data in the enrollment record and other missing fields
|
---|
61 | ..M DGENR("ELIG")=DGELGSUB
|
---|
62 | ..S DGENR("DFN")=DFN
|
---|
63 | ..S DGENR("PRIORREC")=""
|
---|
64 | ..S DGENR("USER")=.5
|
---|
65 | ..S DGENR("DATETIME")=$$NOW^XLFDT
|
---|
66 | ..;
|
---|
67 | ..;Allow null overwrites of Ineligible data (Ineligible Project):
|
---|
68 | ..I $D(DGENR("DATE")),DGENR("DATE")="" S DGENR("DATE")="@"
|
---|
69 | ..I $D(DGENR("FACREC")),DGENR("FACREC")="" S DGENR("FACREC")="@"
|
---|
70 | ..;
|
---|
71 | ..;check the consistency of the enrollment record
|
---|
72 | ..I '$$CHECK^DGENA3(.DGENR,.DGPAT,.ERRMSG) D Q
|
---|
73 | ...S ERROR=1
|
---|
74 | ...D ADDERROR^DGENUPL(MSGID,DGPAT("SSN"),ERRMSG,.ERRCOUNT)
|
---|
75 | ..;
|
---|
76 | ..; removed EGT consistency check with DG*5.3*628
|
---|
77 | ..;Phase II EGT consistency checks (SRS 6.5.1.3)
|
---|
78 | ..;Only do the EGT consistency checks for Rejected-Fiscal Year (11),Rejected-Mid Cycle (12),Rejected-Stop enrolling new apps (13),Rejected-Initil App by VAMC (14),Rejected below EGT threshold (22)
|
---|
79 | ..;I "^11^12^13^14^22^"[("^"_DGENR("STATUS")_"^"),$$ABOVE^DGENEGT1(DGENR("DFN"),DGENR("PRIORITY"),DGENR("SUBGRP"),"","",1) D Q
|
---|
80 | ..;.S ERROR=1
|
---|
81 | ..;.S ERRMSG="THE ENROLLMENT RECORD DID NOT PASS THE EGT CONSISTENCY CHECKS."
|
---|
82 | ..;.D ADDERROR^DGENUPL(MSGID,DGPAT("SSN"),ERRMSG,.ERRCOUNT)
|
---|
83 | ..;
|
---|
84 | ..;Allow null overwrites for Ineligible vets (Ineligible Project):
|
---|
85 | ..I $G(DGPAT("INELDATE"))'="" S (DGENR("PRIORITY"),DGENR("SUBGRP"))=""
|
---|
86 | ..I DGENR("DATE")="@" S DGENR("DATE")=""
|
---|
87 | ..I DGENR("FACREC")="@" S DGENR("FACREC")=""
|
---|
88 | ..;
|
---|
89 | ..D ENRUPLD^DGENUPL8(.DGENR,.DGPAT)
|
---|
90 | .;
|
---|
91 | .;Store the PATIENT, ELIGIBILITY, & CAT. DISB. objects
|
---|
92 | .I $$STORE^DGENPTA1(.DGPAT,,1)
|
---|
93 | .I $$STORE^DGENELA1(.DGELG,.DGPAT,.DGCDIS,,1)
|
---|
94 | .I $G(DGCDIS("VCD"))'="",$$STORE^DGENCDA2(DFN,.DGCDIS) ;checks first if there is catastrophic disability information
|
---|
95 | .;
|
---|
96 | .;Call PIMS api to file NTR data.
|
---|
97 | .I $D(DGNTR),$$ENRUPD^DGNTAPI1(DFN,.DGNTR)
|
---|
98 | .;
|
---|
99 | .;Call PIMS api to file MST data.
|
---|
100 | .I DGMST("MSTSTAT")'="",DGMST("MSTDT")'="",DGMST("MSTST")'="" D
|
---|
101 | ..I $$NEWSTAT^DGMSTAPI(DFN,DGMST("MSTSTAT"),DGMST("MSTDT"),".5",DGMST("MSTST"),0)
|
---|
102 | .;
|
---|
103 | .;Since HEC is authoritative source, If no OEF/OIF data in Z11, set count to 0 so existing data in VistA will be deleted.
|
---|
104 | .I '$D(DGOEIF) S DGOEIF("COUNT")=0
|
---|
105 | .;Call PIMS api to file OEF/OIF data.
|
---|
106 | .I $D(DGOEIF) D OEIFUPD^DGCLAPI1(DFN,.DGOEIF)
|
---|
107 | .;
|
---|
108 | .;if the current enrollment is a local then log patient for transmission
|
---|
109 | .I $$SOURCE^DGENA(DFN)=1!$G(DGPHINC) K DGENUPLD,DGPHINC D EVENT^IVMPLOG(DFN)
|
---|
110 | .;
|
---|
111 | .;create the audit trail
|
---|
112 | .I $$AUDIT^DGENUPA1(,MSGID,.OLDPAT,.DGPAT,.OLDELG,.DGELG,.OLDCDIS,.DGCDIS,.DGSEC,.OLDSEC)
|
---|
113 | .;send notifications
|
---|
114 | .D NOTIFY^DGENUPL3(.DGPAT,.MSGS)
|
---|
115 | .;
|
---|
116 | .;invoke registration consistency checker
|
---|
117 | .D REGCHECK^DGENUPL2(DFN)
|
---|
118 | ;
|
---|
119 | D UNLOCK^DGENUPL5(DFN)
|
---|
120 | Q
|
---|