source: WorldVistAEHR/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQPST21.m@ 862

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1VAQPST21 ;ALB/JRP - POST INIT (FILE CONVERSION);11-JUN-93
2 ;;1.5;PATIENT DATA EXCHANGE;**1**;NOV 17, 1993
3REQUEST(SITE,DOMAIN,OUTARR,DEBUG) ;CONVERT LOCAL REQUESTS
4 ;INPUT : SITE - Name of local site (used as requesting site)
5 ; DOMAIN - Domain of local site (used as requesting domain)
6 ; OUTARR - Where to store correlation of 1.0 request with it's
7 ; entry in 394.61 (full global reference)
8 ; DEBUG - Turns on debug mode (info written to screen)
9 ; 1 - Debug on
10 ; 0 - Debug off (default)
11 ;OUTPUT : X - Number of requests successfully converted
12 ; -1^Error_Text - Error (nothing converted)
13 ;NOTES : OUTARR will be in the format
14 ; OUTARR(X,Y)=Z
15 ; X = 1.0 request number
16 ; Y = 1.5 request number
17 ; Z = 1.5 IFN
18 ;
19 ;CHECK INPUT
20 S SITE=$G(SITE)
21 Q:(SITE="") "-1^Did not pass name of local site"
22 S DOMAIN=$G(DOMAIN)
23 Q:(DOMAIN="") "-1^Did not pass domain of local site"
24 S OUTARR=$G(OUTARR)
25 Q:(OUTARR="") "-1^Did not pass reference to output array"
26 S DEBUG=+$G(DEBUG)
27 N RQSTPTR,ACKPTR,TMP,NODE0,NODE1,PTR10,TRAN10,COUNT
28 N REMTRAN,ERRCNT,RELEASE,PATPTR,NAME,SSN,DOB,PID,DATE
29 N USER,REMOTE,PTR15,TRAN15,STATUS,RETURN
30 ;DETERMIN CONSTANTS
31 S RQSTPTR=+$O(^VAT(394.3,"B",10,""))
32 Q:('RQSTPTR) "-1^PDX STATUS file (#394.3) did not contain status # 10 (request)"
33 S ACKPTR=+$O(^VAT(394.3,"B",19,""))
34 Q:('ACKPTR) "-1^PDX STATUS file (#394.3) did not contain status # 19 (acknowledgement)"
35 W:(DEBUG) !!!!
36 W:(DEBUG) !,"******************************"
37 W:(DEBUG) !,"* *"
38 W:(DEBUG) !,"* Local Request Conversion *"
39 W:(DEBUG) !,"* *"
40 W:(DEBUG) !,"******************************"
41 W:(DEBUG) !!,"Pointer Information"
42 W:(DEBUG) !,"-------------------"
43 W:(DEBUG) !,"Request Pointer: ",RQSTPTR
44 W:(DEBUG) !,"Acknowledgement Pointer: ",ACKPTR
45 ;FILE REQUESTS
46 W:(DEBUG) !!,"Converting local requests",!," Time: ",$$NOW^VAQUTL99,!
47 S COUNT=0
48 S ERRCNT=0
49 S PTR10=0
50 F S PTR10=+$O(^VAT(394,"AD",RQSTPTR,PTR10)) Q:('PTR10) D FILE K ^VAT(394,"AD",RQSTPTR,PTR10)
51 S PTR10=0
52 F S PTR10=+$O(^VAT(394,"AD",ACKPTR,PTR10)) Q:('PTR10) D FILE K ^VAT(394,"AD",ACKPTR,PTR10)
53 Q (COUNT-ERRCNT)
54 ;
55FILE ;FILE REQUESTS
56 ;INCREMENT COUNT
57 S COUNT=COUNT+1
58 I (DEBUG) W:(('(COUNT#5))&(COUNT#100)) "." W:('(COUNT#100)) "#"
59 ;GET INFO FROM 1.0 TRANSACTION
60 I ('$D(^VAT(394,PTR10))) S ERRCNT=ERRCNT+1 Q
61 S NODE0=$G(^VAT(394,PTR10,0))
62 S NODE1=$G(^VAT(394,PTR10,1))
63 S TRAN10=+$P(NODE0,"^",2)
64 I ('TRAN10) S ERRCNT=ERRCNT+1 Q
65 S TMP=+$P(NODE0,"^",12)
66 I ((TMP'=RQSTPTR)&(TMP'=ACKPTR)) S ERRCNT=ERRCNT+1 Q
67 S STATUS=$S((TMP=ACKPTR):"VAQ-RQACK",1:"VAQ-RQST")
68 S PATPTR=$P(NODE0,"^",9)
69 S NAME=$P(NODE0,"^",4)
70 S DOB=$P(NODE0,"^",7)
71 S SSN=$P(NODE0,"^",5)
72 S PID=$S(SSN="":"",1:($E(SSN,1,3)_"-"_$E(SSN,4,5)_"-"_$E(SSN,6,10)))
73 I (PATPTR="") S:(SSN'="") PATPTR=$O(^DPT("SSN",SSN,""))
74 S DATE=$P(NODE0,"^",1)
75 S USER=$P(NODE0,"^",19)
76 S REMOTE=$P(NODE0,"^",17)
77 I (REMOTE) D
78 .S TMP=+$O(^DIC(4,"D",REMOTE,""))
79 .Q:('TMP)
80 .S REMOTE=$P($G(^DIC(4,TMP,0)),"^",1)
81 .S:(REMOTE="") REMOTE=$P(NODE0,"^",17)
82 S RELEASE="VAQ-RQST"
83 S RETURN=""
84 S REMTRAN=""
85 ;GO TO CONTINUATION ROUTINE
86 D CNVRT^VAQPST24
87 ;STORE CORRELATION
88 Q:(('TRAN10)!('$G(TRAN15)))
89 S @OUTARR@(TRAN10,TRAN15)=PTR15
90 Q
Note: See TracBrowser for help on using the repository browser.