source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGHTXREF.m@ 1800

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

initial load of WorldVistAEHR

File size: 1.7 KB
RevLine 
[613]1DGHTXREF ;ALB/JRC - Home Telehealth HL7 Message Monitoring Routine ;10 January 2005 ; 9/12/06 2:02pm
2 ;;5.3;Registration;**644**;Aug 13, 1993;Build 11
3 ;
4 ;This routine is called to set or remove cross references on
5 ;file Home Telehealth Patient file (#391.31)
6 ;
7SETXREF(MSGID,SET,TYPE) ;Logic for "HTHNOACK" cross references of
8 ; HOME TELEHEALTH PATIENT file (#391.31)
9 ;
10 ;Input : MSGID - HL7 Message ID
11 ; SET - If 1, set cross reference
12 ; If 0, kill cross reference
13 ; TYPE - If 1, set triggered by tasked job
14 ; If 0, set triggered by manual process
15 ; demands special processing
16 ; OLDMSGID - If there is an old message id
17 ; xref needs to be removed.
18 ;
19 ;Output : None
20 ;
21 ;Check input
22 Q:'$G(MSGID)!'$G(SET)
23 ;Check hl7 message, if status=3 make sure no xref exist and quit
24 I +$$MSGSTAT^HLUTIL(MSGID)=3 D KILLXREF(MSGID) Q
25 ;Declare variables
26 N RECORD,TRANS,NODE0,TNODE,EVNTDATE,ACKCODE,CNT
27 ;Set date and count if exist
28 S EVNTDATE=$G(DGDATE),CNT=$S($G(DGCOUNT)'="":DGCOUNT+1,1:0)
29 ;Get ien and sien of hth patient record and set nodes
30 S RECORD=$O(^DGHT(391.31,"D",MSGID,0)) Q:'RECORD
31 S TRANS=$O(^DGHT(391.31,"D",MSGID,RECORD,0)) Q:'TRANS
32 S NODE0=$G(^DGHT(391.31,RECORD,0)),TNODE=$G(^("TRAN",TRANS,0))
33 ;Check HTH file (#391.31) for AA, if so kill xref and quit
34 I ($P(TNODE,U,6)'="")!($P(TNODE,U,7)'="") D KILLXREF(MSGID) Q
35 ;Get event date/time
36 S EVNTDATE=$S(TYPE=1:DGDATE,TYPE=0:$P(TNODE,U,1),1:"")
37 ;No event date/time - don't set x-ref
38 Q:('EVNTDATE)
39 ;Kill old xref if exist, then set the new xref
40 D KILLXREF(MSGID)
41 S ^DGHT(391.31,"HTHNOACK",MSGID,RECORD,TRANS)=CNT_U_EVNTDATE
42 Q
43 ;
44KILLXREF(MSGID) ;Kill x-ref
45 K ^DGHT(391.31,"HTHNOACK",MSGID)
46 Q
Note: See TracBrowser for help on using the repository browser.