source: WorldVistAEHR/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQFIL17.m@ 1764

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

initial load of WorldVistAEHR

File size: 3.3 KB
RevLine 
[613]1VAQFIL17 ;ALB/JRP - MESSAGE FILING;14-MAY-93
2 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
3DISPLAY(MESSNUM,PARSARR,TRANPTR) ;FILE ALL DISPLAY BLOCKS
4 ;INPUT : MESSNUM - Message number in transmission (not XMZ)
5 ; (defaults to 1)
6 ; PARSARR - Parsing array (full global reference)
7 ; TRANPTR - Pointer to VAQ - TRANSACTION file
8 ; (As defined by MailMan)
9 ; XMFROM, XMREC,XMZ
10 ;OUTPUT : 0 - Success
11 ; -1^Error_Text - Error
12 ;NOTES : It is the responsibility of the calling program to correct
13 ; the transaction being updated if an error occurs.
14 ; : If the displayable segment can not be added, it will delete
15 ; the entry that is created for it in VAQ - DATA file.
16 ;
17 ;CHECK INPUT
18 S:($G(MESSNUM)="") MESSNUM=1
19 Q:($G(PARSARR)="") "-1^Did not pass reference to parsing array"
20 Q:('$D(@PARSARR@(MESSNUM))) "-1^Did not pass valid message number"
21 Q:('$D(@PARSARR@(MESSNUM,"DISPLAY"))) 0
22 S TRANPTR=+$G(TRANPTR)
23 Q:(('TRANPTR)!('$D(^VAT(394.61,TRANPTR)))) "-1^Did not pass a valid transaction"
24 ;DECLARE VARIABLES
25 N BLOCKSEQ,TMP,TYPE,LINE,OFFSET,DATAPTR,SEGABB
26 N DECRYPT,KEY1,KEY2,STRING,DECSTR,DECMTHD,ENCRYPT,DSPLINES
27 ;GET MESSAGE TYPE
28 S TMP=$$STATYPE^VAQFIL11(MESSNUM,PARSARR)
29 Q:($P(TMP,"^",1)="-1") "-1^Could not determine message type"
30 S TYPE=$P(TMP,"^",2)
31 ;ACK & RETRANSMIT & REQUEST DON'T HAVE DISPLAY BLOCKS
32 Q:((TYPE="ACK")!(TYPE="RET")!(TYPE="REQ")) "-1^Message type does not require display block"
33 ;GET DECRYPTION METHOD & KEYS
34 S DECMTHD=$$DECMTHD^VAQFIL11(MESSNUM,PARSARR,2)
35 S KEY1=$$KEY^VAQFIL13(MESSNUM,PARSARR,1)
36 S KEY2=$$KEY^VAQFIL13(MESSNUM,PARSARR,0)
37 ;LOOP THROUGH EACH DISPLAY BLOCK
38 S BLOCKSEQ=""
39 F S BLOCKSEQ=$O(@PARSARR@(MESSNUM,"DISPLAY",BLOCKSEQ)) Q:(BLOCKSEQ="") D
40 .;MAKE SURE IT'S A DISPLAY BLOCK
41 .S TMP=$G(@PARSARR@(MESSNUM,"DISPLAY",BLOCKSEQ,1))
42 .S:(TMP=" ") TMP=""
43 .Q:((TMP="")!(TMP'="$DISPLAY"))
44 .;GET SEGMENT ABBREVIATION
45 .S SEGABB=$G(@PARSARR@(MESSNUM,"DISPLAY",BLOCKSEQ,2))
46 .S:(SEGABB=" ") SEGABB=""
47 .Q:((SEGABB="")!(SEGABB="$$DISPLAY"))
48 .S TMP=$G(@PARSARR@(MESSNUM,"DISPLAY",BLOCKSEQ,3))
49 .S:(TMP=" ") TMP=""
50 .Q:((TMP="")!(TMP="$$DISPLAY"))
51 .S ENCRYPT=+$P(TMP,"^",1)
52 .S DSPLINES=+$P(TMP,"^",2)
53 .;SET UP FOR DECRYPTION
54 .Q:((ENCRYPT)&(DECMTHD=""))
55 .S:(ENCRYPT) DECRYPT=("S DECSTR="_DECMTHD)
56 .S:('ENCRYPT) DECRYPT="S DECSTR=STRING"
57 .Q:((ENCRYPT)&((KEY1="")!(KEY2="")))
58 .;CHECK NUMBER OF LINES IN DISPLAY
59 .Q:('DSPLINES)
60 .S DSPLINES=DSPLINES+1
61 .;MAKE STUB ENTRY IN DATA FILE
62 .S DATAPTR=$$STUBDATA^VAQFILE1(SEGABB,TRANPTR)
63 .Q:(DATAPTR<0)
64 .;PUT BLANK LINE INTO DISPLAY (SETS ZERO NODE)
65 .S TMP=$$FILEINFO^VAQFILE(394.62,DATAPTR,50," ")
66 .I (TMP) S TMP=$$DELDATA^VAQFILE1(DATAPTR) Q
67 .;STORE SEGMENT
68 .S LINE=1
69 .S OFFSET=3
70 .S TMP=""
71 .F S OFFSET=$O(@PARSARR@(MESSNUM,"DISPLAY",BLOCKSEQ,OFFSET)) Q:((OFFSET="")!(LINE=DSPLINES)) D
72 ..S STRING=$G(@PARSARR@(MESSNUM,"DISPLAY",BLOCKSEQ,OFFSET))
73 ..S:(STRING=" ") STRING=""
74 ..X DECRYPT
75 ..S TMP=DECSTR
76 ..S ^VAT(394.62,DATAPTR,"DSP",LINE,0)=TMP
77 ..S LINE=LINE+1
78 .I (OFFSET="") S TMP=$$DELDATA^VAQFILE1(DATAPTR) Q
79 .S TMP=$G(@PARSARR@(MESSNUM,"DISPLAY",BLOCKSEQ,OFFSET))
80 .I (TMP'="$$DISPLAY") S TMP=$$DELDATA^VAQFILE1(DATAPTR) Q
81 .;UPDATE ZERO NODE
82 .S LINE=LINE-1
83 .S TMP=$G(^VAT(394.62,DATAPTR,"DSP",0))
84 .S $P(TMP,"^",3)=LINE
85 .S $P(TMP,"^",4)=LINE
86 .S ^VAT(394.62,DATAPTR,"DSP",0)=TMP
87 Q 0
Note: See TracBrowser for help on using the repository browser.