source: WorldVistAEHR/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQUTL97.m@ 1211

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1VAQUTL97 ;ALB/JFP,JRP - PDX Patient Lookup ;24-JAN-93
2 ;;1.5;PATIENT DATA EXCHANGE;**2,9,29,35**;NOV 17, 1993
3 ;
4GETDFN(PATIENT,TASK) ;-- Return DFN of patient
5 ; -- This will return the same information that DIC returns in Y
6 N DIC,X,Y,RESULT,USRABORT
7 S USRABORT=-1
8 S:'$D(PATIENT) PATIENT=""
9 S:'$D(TASK) TASK=0
10 ; -- User interface
11 S DIC(0)="M"
12 I (PATIENT="")&('TASK) S DIC(0)=DIC(0)_"A"
13 I (PATIENT="")&(TASK) S RESULT=USRABORT Q RESULT
14 S:TASK DIC(0)=DIC(0)_"XZ"
15 S:'TASK DIC(0)=DIC(0)_"EQZ"
16 S X=PATIENT
17 S DIC="^DPT("
18 ; -- Prevent sensitive record bulletin if called in TASK mode
19 S:(TASK) DGSENFLG=""
20 D ^DIC
21 K DGSENFLG
22 ; -- User aborted process
23 Q:$D(DTOUT) USRABORT
24 Q:$D(DUOUT) USRABORT
25 Q Y
26 ;
27GETSEN(DFN) ; -- Returns code for sensitive patient or not
28 ; INPUT: DFN = Dictionary file number
29 ; OUTPUT: 1 = Sensitive patient
30 ; 0 = Non sensitive
31 ; -1 = Bad input
32 ;
33 Q:'$D(DFN) -1
34 Q:DFN="" -1
35 Q:DFN=0 -1
36 Q:'$D(^DGSL(38.1,DFN,0)) -0 ; -- not sensitive patient
37 Q $P($G(^DGSL(38.1,DFN,0)),U,2) ; -- 1 SENSITIVE, 0 NON-SENSITIVE
38 ;
39EXPTRN(TRANDA) ; -- Determines if any entry in the transactions file is
40 ; marked for purge or exceed the life days.
41 ; Also checks to make sure that requesting domain is
42 ; not closed. If it is, it marks the transaction file
43 ; entry for purging.
44 ; INPUT : TRANDA DA TO TRANSACTION RECORD
45 ; OUTOUT: -1 error in data
46 ; 0 not expired
47 ; 1 expired
48 ;
49 N X,LDAY,PURGE
50 S PURGE=$P($G(^VAT(394.61,TRANDA,"PRG")),U,1)
51 I PURGE=1 Q 1 ; -- purge flag set
52 ;
53 S X1=$$NOW^VAQUTL99(1,1) ; -- Current date
54 S X2=$P($G(^VAT(394.61,TRANDA,"ATHR1")),U,1)
55 I X2="" S X2=$P($G(^VAT(394.61,TRANDA,"RQST1")),U,1)
56 S X2=$P(X2,".",1)
57 I X2="" Q -1 ; -- error in data
58 ;
59 S LDAY=$P($G(^VAT(394.81,1,"LIFE")),U,1)
60 I LDAY="" Q 0 ; -- no life days set
61 ;
62 D ^%DTC
63 I X>LDAY Q 1 ; -- Expired
64 Q 0
65CLOSDOM(TRANDA,DOMAIN) ; Function, given domain, returns whether
66 ; the domain is closed or not. (1=closed; 0=not closed)
67 ; If the domain is closed, then the transaction is marked for purging.
68 Q:'$$CLOSED(DOMAIN) 0
69 D SETPURGE(TRANDA)
70 Q 1
71CLOSTRAN(TRANDA,NODE) ; Function, given transaction number, returns whether
72 ; the domain is closed or not. (1=closed; 0=not closed)
73 ; If NODE="RQST2", we are checking the domain that sent the request.
74 ; If NODE="ATHR2", we are checking the domain to which we are sending
75 ; the request. If the domain is closed, then the transaction is marked
76 ; for purging.
77 Q:'$$CLOSED($P($G(^VAT(394.61,TRANDA,NODE)),U,2)) 0
78 D SETPURGE(TRANDA)
79 Q 1
80CLOSED(DOMAIN) ; Function, given domain name, returns whether the domain
81 ; is closed or not. 1=closed; 0=not closed
82 N VIEN
83 S VIEN=$$FIND1^DIC(4.2,"","MQX",DOMAIN,"B^C") Q:'VIEN 0
84 Q $P($G(^DIC(4.2,VIEN,0)),U,2)["C"
85SETPURGE(TRANDA) ;
86 N VFDA
87 S VFDA(394.61,TRANDA_",",90)=1 ; set purge flag
88 D FILE^DIE("","VFDA")
89 Q
90 ;
91GETINST(DOMAIN) ;-- Return name of institution for domain
92 ;
93 ; INPUT: DOMAIN -
94 ; OUTPUT: NULL - ERROR
95 ; INSTITUTION - SUCCESS
96 ;
97 N DOMNO,INSTDA,STNO,INST
98 ;
99 ;W !,"Domain = ",DOMAIN
100 Q:'$D(DOMAIN) ""
101 ;
102 S DOMNO=+$$FIND1^DIC(4.2,"","BMX",DOMAIN,"B^C","","ERROR")
103 Q:DOMNO=0 ""
104 S INSTDA=$P($G(^DIC(4.2,DOMNO,0)),U,13) Q:INSTDA="" ""
105 S STNO="",STNO=$O(^DIC(4,"D",INSTDA,"")) Q:STNO="" ""
106 S INST=$P($G(^DIC(4,STNO,0)),U,1)
107 Q:INST="" ""
108 Q INST
109 ;
Note: See TracBrowser for help on using the repository browser.