source: FOIAVistA/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQDBIP3.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.3 KB
Line 
1VAQDBIP3 ;ALB/JRP - MINIMUM PATIENT INFO EXTRACTION;9-MAR-93
2 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
3MINXTRCT(TRAN,DFN,ARRAY) ;EXTRACT MINIMUM (EXTRACTION ARRAY)
4 ;INPUT : TRAN - Pointer to VAQ - TRANSACTION file
5 ; DFN - Pointer to patient in PATIENT file
6 ; ARRAY - Where to store information (full global reference)
7 ;OUTPUT : 0 - Extraction was successfull
8 ; -1^Error_Text - Extraction was not successfull
9 ;NOTE : If the minimum patient information can not be extracted,
10 ; the "VALUE" and "ID" nodes in ARRAY will be deleted.
11 ; : If TRAN is passed
12 ; The patient pointer of the transaction will be used
13 ; Encryption will be based on the transaction
14 ; If DFN is passed
15 ; Encryption will be based on the site parameter
16 ; : Pointer to transaction takes precedence over DFN ... if
17 ; TRAN>0 the DFN will be based on the transaction
18 ;
19 ;CHECK INPUT
20 S TRAN=+$G(TRAN)
21 S DFN=+$G(DFN)
22 Q:(('TRAN)&('DFN)) "-1^Did not pass pointer to transaction or patient"
23 I (TRAN) Q:('$D(^VAT(394.61,TRAN))) "-1^Did not pass valid pointer to VAQ - TRANSACTION file"
24 I (TRAN) S DFN=+$P($G(^VAT(394.61,TRAN,0)),"^",3) Q:('DFN) "-1^Transaction did not contain pointer to PATIENT file"
25 Q:('$D(^DPT(DFN))) "-1^Did not pass valid pointer to PATIENT file"
26 Q:($G(ARRAY)="") "-1^Did not pass output array"
27 ;DECLARE VARIABLES
28 N ERROR,TMP,LOOP,ENCPTR,KEY1,KEY2,SENDER
29 ;DETERMINE IF ENCRYPTION IS ON - SAVE POINTER TO ENCRYPTION METHOD
30 S:('TRAN) ENCPTR=$$NCRYPTON^VAQUTL2(0)
31 S:(TRAN) ENCPTR=$$TRANENC^VAQUTL3(TRAN,1)
32 ;DETERMINE PRIMARY KEY
33 I (TRAN) S SENDER=$$SENDER^VAQCON2(TRAN) Q:($P(SENDER,"^",1)="-1") "-1^Could not determine encryption keys"
34 S:(TRAN) SENDER=$P(SENDER,"^",1)
35 S:(TRAN) KEY1=$$NAMEKEY^VAQUTL3(SENDER,1)
36 S:('TRAN) KEY1=$$DUZKEY^VAQUTL3($G(DUZ),1)
37 ;DETERMINE SECONDARY KEY
38 S:(TRAN) KEY2=$$NAMEKEY^VAQUTL3(SENDER,0)
39 S:('TRAN) KEY2=$$DUZKEY^VAQUTL3($G(DUZ),0)
40 I (ENCPTR) Q:((KEY1="")!(KEY2="")) "-1^Could not determine encryption keys"
41 S ERROR=0
42 ;EXTRACT INFORMATION
43 F LOOP=1:1 D Q:(ERROR)
44 .S TMP=$T(MIN+LOOP^VAQDBII1)
45 .I ($P(TMP,";;",2)="") S ERROR=1 Q
46 .S ERROR=$$XTRCT^VAQDBIP2(TMP,DFN,"",ARRAY,ENCPTR,KEY1,KEY2)
47 .I ERROR D Q
48 ..S TMP=$$KILLARR^VAQUTL1(ARRAY,"VALUE")
49 ..S TMP=$$KILLARR^VAQUTL1(ARRAY,"ID")
50 Q:(ERROR<0) ERROR
51 Q 0
Note: See TracBrowser for help on using the repository browser.