source: FOIAVistA/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLUOPTF1.m@ 811

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

initial load of FOIAVistA 6/30/08 version

File size: 2.1 KB
Line 
1HLUOPTF1 ;ALB/CJM-HL7 -Set Logic for the AI x-ref on file 773 ;02/04/2004
2 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
3 ;
4PXREF(IEN,STATUS) ;sets the AI x-ref on file 773 and the FAST PURGE DT/TM fields in file 772 and 773
5 ;Input: IEN is the ien of record in file 773
6 ; STATUS is the new value of the STATUS field
7 ;Output: none
8 ;
9 Q:'$G(IEN)
10 ;
11 ;don't set the x-ref if status is not Successfully Completed
12 Q:($G(STATUS)'=3)
13 ;
14 N NODE,WHEN,CHILD
15 ;
16 ;also not if DON'T PURGE field is set
17 Q:$P($G(^HLMA(IEN,2)),"^")=1
18 ;
19 ;also not if this isn't the initial message
20 S NODE=$G(^HLMA(IEN,0))
21 I $P(NODE,"^",6),$P(NODE,"^",6)'=IEN Q
22 ;
23 ;This record can be purged via FAST PURGE
24 ;determine the dt/tm the record can be purged
25 S WHEN=$$NOW^XLFDT
26 S WHEN=$$FMADD^XLFDT(WHEN,$$WAIT)
27 ;
28 ;set the FAST PURGE DT/TM and x-ref, and do the same for file 772 record
29 D SET(IEN,WHEN,+NODE)
30 ;
31 ;All the records in file 773 that point to this record (children) should be purged at the same time
32 S CHILD=0
33 F S CHILD=$O(^HLMA("AF",IEN,CHILD)) Q:'CHILD D:(CHILD'=IEN) SET(CHILD,WHEN,+$G(^HLMA(CHILD,0)))
34 Q
35 ;
36SET(IEN773,WHEN,IEN772) ;sets FAST PURGE DT/TM for and the AI x~ref for both file 772 & 773
37 ;Input:
38 ; IEN773 - ien of record to be purged in file 773
39 ; WHEN - date/time to purge
40 ; IEN772 - ien of corresponding record in file 772
41 ;
42 N OLDWHEN
43 ;if the fast purge dt/tm changed, kill the old xref
44 S OLDWHEN=$P($G(^HLMA(IEN773,2)),"^",2)
45 I $L(OLDWHEN) K ^HLMA("AI",OLDWHEN,773,IEN773)
46 ;
47 ;set the FAST PURGE DATE
48 S $P(^HLMA(IEN773,2),"^",2)=WHEN
49 ;
50 ;set the AI x-ref
51 S ^HLMA("AI",WHEN,773,IEN773)=""
52 ;
53 ;do the same for the corresponding entry in file 772
54 I IEN772,$D(^HL(772,IEN772,0)) D
55 .;if the fast purge dt/tm changed, kill the old xref
56 .S OLDWHEN=$P($G(^HL(772,IEN772,2)),"^",2)
57 .I $L(OLDWHEN) K ^HLMA("AI",OLDWHEN,772,IEN772)
58 .;set the FAST PURGE DATE
59 .S $P(^HL(772,IEN772,2),"^",2)=WHEN
60 .;
61 .;set the AI x-ref
62 .S ^HLMA("AI",WHEN,772,IEN772)=""
63 Q
64 ;
65WAIT() ;
66 ;returns the wait time to purge completed messages from file 869.3
67 N IEN
68 S IEN=$O(^HLCS(869.3,0))
69 Q:'IEN 0
70 Q +$G(^HLCS(869.3,IEN,4))
Note: See TracBrowser for help on using the repository browser.