source: WorldVistAEHR/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQFILE1.m@ 1639

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

initial load of WorldVistAEHR

File size: 3.5 KB
Line 
1VAQFILE1 ;ALB/JRP/KLD - MESSAGE FILING;12-MAY-93 [ 09/16/96 9:44 AM ]
2 ;;1.5;PATIENT DATA EXCHANGE;**22,34**;NOV 17, 1993
3NEWDATA() ;MAKE NEW ENTRY IN DATA FILE
4 ;INPUT : NONE
5 ;OUTPUT : IFN - Success
6 ; -1^Error_text - Error
7 ;
8 ;DECLARE VARIABLES
9 N DD,DIC,X,DINUM,Y,DLAYGO
10 S DIC="^VAT(394.62,",DLAYGO=394.62
11 S DIC(0)="L"
12 S X="+" ;-- auto numbering - see ^DD(394.62,.01,7.5). It involves $$AUTO^VAQXRF2(2) and file 394.86.
13 D ^DIC
14 I Y<0 Q "-1^Could not create entry in data file"
15 Q $P(Y,"^",1)
16 ;
17DELDATA(DA) ;DELETE ENTRY IN DATA FILE
18 ;INPUT : DA - Pointer to VAQ - DATA file
19 ;OUTPUT : 0 - Success
20 ; -1^Error_text - Error
21 ;
22 ;CHECK INPUT
23 Q:('(+$G(DA))) "-1^Did not pass pointer to data"
24 ;IF DATA DOES NOT EXIST RETURN SUCCESS
25 ;Q:('$D(^VAT(394.62,DA))) 0
26 Q:('$D(^VAT(394.62,DA))) "-1^No Data Exist Record not Deleted"
27 ;DECLARE VARIABLES
28 N DIK
29 ;DELETE ENTRY
30 S DIK="^VAT(394.62,"
31 D ^DIK
32 Q:('$D(^VAT(394.62,DA))) 0
33 Q "-1^Unable to delete data"
34 ;
35DELSEG(SEG,TRAN) ;DELETE SEGMENT IN DATA FILE FOR A TRANSACTION
36 ;INPUT : SEG - Segment abbreviation
37 ; TRAN - Pointer to VAQ - TRANSACTION file
38 ;OUTPUT : 0 - Success
39 ; -1^Error_Text - Error
40 ;
41 ;CHECK INPUT
42 Q:($G(SEG)="") "-1^Did not pass segment abbreviation"
43 S TRAN=+$G(TRAN)
44 Q:(('TRAN)!('$D(^VAT(394.61,TRAN)))) "-1^Did not pass valid transaction"
45 ;DECLARE VARIABLES
46 N DATAPTR,TMP,SEGPTR
47 ;GET SEGMENT POINTER
48 S SEGPTR=+$O(^VAT(394.71,"C",SEG,""))
49 Q:('SEGPTR) "-1^Did not pass valid segment abbreviation"
50 ;DELETE ENTRIES IN DATA FILE
51 S DATAPTR=""
52 F S DATAPTR=+$O(^VAT(394.62,"A-SEGMENT",TRAN,SEGPTR,"")) Q:('DATAPTR) S TMP=$$DELDATA(DATAPTR)
53 Q 0
54 ;
55STUBDATA(SEG,TRAN) ;CREATE STUB ENTRY IN DATA FILE
56 ;INPUT : SEG - Segment abbreviation
57 ; TRAN - Pointer to VAQ - TRANSACTION file
58 ;OUTPUT : IFN - Success
59 ; -1^Error_text - Error
60 ;NOTES : The following fields (in addition to .01) will be filled in
61 ; .02 - Segment
62 ; .05 - Display Ready
63 ; 40 - Transaction Number
64 ;
65 ;CHECK INPUT
66 Q:($G(SEG)="") "-1^Did not pass segment abbreviation"
67 S TRAN=+$G(TRAN)
68 Q:(('TRAN)!('$D(^VAT(394.61,TRAN)))) "-1^Did not pass valid transaction"
69 ;DECLARE VARIABLES
70 N IFN,SEGNAME,TMP,TRANNUM,DIE,DR,Y,DA,DISPLAY
71 ;GET SEGMENT NAME
72 S TMP=+$O(^VAT(394.71,"C",SEG,""))
73 Q:('TMP) "-1^Did not pass valid segment abbreviation"
74 S TMP=$G(^VAT(394.71,TMP,0))
75 S SEGNAME=$P(TMP,"^",1)
76 Q:(SEGNAME="") "-1^Could not determine segment name"
77 ;DETERMINE IF SEGMENT IS DISPLAY READY
78 S DISPLAY=+$P(TMP,"^",3)
79 S DISPLAY=$S(DISPLAY:"YES",1:"NO")
80 ;GET TRANSACTION NUMBER
81 S TRANNUM=+$G(^VAT(394.61,TRAN,0))
82 Q:('TRANNUM) "-1^Could not determine transaction number"
83 ;MAKE ENTRY IN DATA FILE
84 S IFN=+$$NEWDATA
85 Q:(IFN<0) "-1^Could not create entry in data file"
86 ;PLACE INFO IN NEW ENTRY
87 L +^VAT(394.62,IFN):60 I ('$T) S TMP=$$DELDATA(IFN) Q "-1^Could not edit entry (locked by other user)"
88 ;PLACE SEGMENT NAME INTO DATA
89 S DIE="^VAT(394.62,"
90 S DA=IFN
91 S DR=".02///"_SEGNAME
92 D ^DIE
93 I ($D(Y)#2) L -^VAT(394.62,IFN) S TMP=$$DELDATA(IFN) Q "-1^Could not file segment name"
94 ;PLACE DISPLAY READY FLAG INTO DATA
95 S DIE="^VAT(394.62,"
96 S DA=IFN
97 S DR=".05///"_DISPLAY
98 D ^DIE
99 I ($D(Y)#2) L -^VAT(394.62,IFN) S TMP=$$DELDATA(IFN) Q "-1^Could not file display ready flag"
100 ;PLACE TRANSACTION NUBMER INTO DATA
101 S DIE="^VAT(394.62,"
102 S DA=IFN
103 S DR="40///"_TRANNUM
104 D ^DIE
105 I ($D(Y)#2) L -^VAT(394.62,IFN) S TMP=$$DELDATA(IFN) Q "-1^Could not file transaction number"
106 L -^VAT(394.62,IFN)
107 Q IFN
Note: See TracBrowser for help on using the repository browser.