source: WorldVistAEHR/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQHSH.m@ 623

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

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1VAQHSH ;ALB/JRP - ENCRYPT A DISPLAY ARRAY;29-MAR-93
2 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
3ENCDSP(TRAN,ROOT,ENCPTR,DSPOFF,DSPCNT) ;ENCRYPT A DISPLAY
4 ;INPUT : TRAN - Pointer to VAQ - TRANSACTION file
5 ; ROOT - Where the Display Array is (full global reference)
6 ; ENCPTR - Pointer to VAQ - ENCRYPTION METHOD file
7 ; DSPOFF - Offset into Display Array to begin at
8 ; Only used for Display Arrays (defaults to 0)
9 ; DSPCNT - Number of lines in Display Array
10 ; Only used for Display Arrays (defaults to full array)
11 ;OUTPUT : 0 - Success
12 ; -1^Error_Text - Error
13 ;NOTES : If TRAN>0
14 ; Encryption will be based on the transaction
15 ; Keys will come from the transaction
16 ; Else
17 ; Encryption will be based on ENCPTR
18 ; Keys based on current user
19 ; : Existance of TRAN takes precedence over ENCPTR
20 ;
21 ;CHECK INPUT
22 S TRAN=+$G(TRAN)
23 S ENCPTR=+$G(ENCPTR)
24 Q:(('TRAN)&('ENCPTR)) "-1^Did not pass pointer to transaction or encryption method"
25 I (TRAN) Q:('$D(^VAT(394.61,TRAN))) "-1^Did not pass valid pointer to VAQ - TRANSACTION file"
26 I (TRAN) S ENCPTR=$$TRANENC^VAQUTL3(TRAN,1) Q:('ENCPTR) "-1^Transaction did not contain pointer to encryption method"
27 Q:('ENCPTR) "-1^Did not pass encryption method"
28 Q:($G(ROOT)="") "-1^Did not pass location of extracted segment"
29 S DSPOFF=+$G(DSPOFF)
30 S DSPCNT=+$G(DSPCNT)
31 ;DECLARE VARIABLES
32 N TMP,ENCMTHD,ENCSTR,STRING,KEY1,KEY2,ERROR,SEQ,SENDER
33 S ERROR=0
34 ;GET ENCRYPTION METHOD
35 S TMP=$$ENCMTHD^VAQUTL2(ENCPTR,0)
36 Q:(TMP="") "-1^Could not determine encryption method"
37 S ENCMTHD="S ENCSTR="_TMP
38 ;DETERMINE PRIMARY KEY
39 I (TRAN) S SENDER=$$SENDER^VAQCON2(TRAN) Q:($P(SENDER,"^",1)="-1") "-1^Could not determine encryption keys"
40 S:(TRAN) SENDER=$P(SENDER,"^",1)
41 S:(TRAN) KEY1=$$NAMEKEY^VAQUTL3(SENDER,1)
42 S:('TRAN) KEY1=$$DUZKEY^VAQUTL3($G(DUZ),1)
43 ;DETERMINE SECONDARY KEY
44 S:(TRAN) KEY2=$$NAMEKEY^VAQUTL3(SENDER,0)
45 S:('TRAN) KEY2=$$DUZKEY^VAQUTL3($G(DUZ),0)
46 Q:((KEY1="")!(KEY2="")) "-1^Could not determine encryption keys"
47 ;LOOP THROUGH EACH LINE IN DISPLAY
48 S TMP=DSPOFF-.999999999
49 F SEQ=1:1 Q:((DSPCNT)&(SEQ>DSPCNT)) D Q:((TMP="")!(ERROR))
50 .S TMP=$O(@ROOT@("DISPLAY",TMP))
51 .Q:(TMP="")
52 .;GET LINE
53 .S STRING=@ROOT@("DISPLAY",TMP,0)
54 .;ENCRYPT LINE (DON'T ENCRYPT A NULL LINE)
55 .Q:(STRING="")
56 .X ENCMTHD
57 .I (ENCSTR="") S ERROR="-1^Error using encryption method" Q
58 .;STORE ENCRYPTED LINE
59 .S @ROOT@("DISPLAY",TMP,0)=ENCSTR
60 Q:(ERROR) ERROR
61 Q 0
Note: See TracBrowser for help on using the repository browser.