source: FOIAVistA/trunk/r/AUTOMATED_INFO_COLLECTION_SYS-IBD/IBDFRPC5.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1IBDFRPC5 ;ALB/AAS - AICS Pass data to PCE, Broker Call ; 24-FEB-96
2 ;;3.0;AUTOMATED INFO COLLECTION SYS;**3,38**;APR 24, 1997
3 ;
4GETALL(RESULT,IBDATA) ; -- called by RPC and by write
5 ; -- get all encounter data
6 ; -- input Result (called by reference)
7 ; IBDATA (called by reference)
8 ; IBDATA("CLINIC") := pointer to hospital location file (44)
9 ; IBDATA("DFN") := pointer to Patient file (2)
10 ; IBDATA("APPT") := date/time of encounter in FM format
11 ; IBDATA("UNFORMAT") := (optional, default :=0) return piece
12 ; as displayable
13 ; -- output Results Array
14 ; A sequential array of all data found for encounters for
15 ; patient/clinic/appt
16 ; if ibdata(unformat) is false then data is preformatted
17 ; suitable for display to a crt.
18 ; if ibdata(unformat) is true then a record as follows:
19 ; P1 := data qualifier (ie primary or secondary)
20 ; P2 := type of data
21 ; p3 := Narrative or Description (Textual name)
22 ; P4 := value (code or date/time)
23 ; P5 := source of data (aics, pce, scheduling)
24 ; P6 := Quantity (cpt codes only)
25 ; The next 4 pieces only set if answered
26 ; P7 := sc (null, 1 or 0) encounter node only
27 ; P8 := ao (null, 1 or 0) encounter node only
28 ; P9 := ir (null, 1 or 0) encounter node only
29 ; P10 := ec (null, 1 or 0) encounter node only
30 ;
31 N CNT,IBDI,ENCTRS,L
32 S CNT=0,ENCTRS=""
33 D GETDATA(.RESULT,.IBDATA,.ENCTRS)
34 S L=" "
35 I +RESULT(0) S RESULT(0)="The following data was found: " D FINDALL^IBDFRPC6(.RESULT)
36 ;F IBDI="VST","PRV","POV","CPT","HF","PED","XAM","SK","IMM","TRT" D @(IBDI_"^IBDFRPC6")
37GETALLQ Q
38 ;
39GETDATA(RESULT,IBDATA,ENCTRS) ; -- return all data for an encounter date time
40 ;
41 N IBDJ,IBDY
42 K ^TMP("PXKENC",$J)
43 I +IBDATA("CLINIC")'=IBDATA("CLINIC"),IBDATA("CLINIC")'="" S IBDATA("CLINIC")=$O(^SC("B",IBDATA("CLINIC"),0))
44 S RESULT(0)="Nothing Processed, Perhaps an Error Occurred"
45 I $G(IBDATA("DFN"))<1!($G(IBDATA("APPT"))<1)!($G(IBDATA("CLINIC"))<1) S RESULT(0)="Insufficient Data Passed to find encounter data" G GETQ
46 ;
47 ; -- first get visit iens
48 S ENCTRS=$$GETENC^PXAPI(IBDATA("DFN"),IBDATA("APPT"),IBDATA("CLINIC"))
49 I ENCTRS=-1 S RESULT(0)="No encounter Data on file." G GETQ
50 I ENCTRS=-2 S RESULT(0)="Error in calling routine, file a NOIS" G GETQ
51 ;
52 ; -- then get all visit data
53 S RESULT(0)="Attempting to Retieve Data"
54 F IBDJ=1:1 S IBDY=$P(ENCTRS,"^",IBDJ) Q:IBDY="" D ENCEVENT^PXAPI(IBDY,1)
55 ;
56 S RESULT(0)="1"
57GETQ Q
58 ;
59WRITE ; -- called by DIR as executable help from IBDFDE
60 N RESULT,IBQUIT,I,CNT
61 W !,"Retrieving Encounter Data from PCE..."
62 D GETALL(.RESULT,.IBDF)
63 W !
64 S I="",IBQUIT=0,CNT=0
65 F S I=$O(RESULT(I)) Q:I="" S CNT=CNT+1 D:'(CNT#10) PAUSE^IBDFDE Q:IBQUIT W !,RESULT(I)
66 Q
67 ;
68APPTLST(RESULT,IBDF) ; -- return past appointment list, called by rpc
69 N I,J,CNT,DFN,VASD,VAERR,VAROOT
70 S RESULT(0)="No Past Appointments Found^^"
71 K ^UTILITY("VASD",$J)
72 ;
73 S DFN=+$G(IBDF("DFN"))
74 S VASD("F")=$S($G(IBDF("F"))>2840000:IBDF("F"),1:DT-10000)
75 S VASD("T")=$S($G(IBDF("T"))>2840000:IBDF("T"),1:DT+.24)
76 S VASD("W")=$S($G(IBDF("W"))'="":IBDF("W"),1:"129")
77 ;
78 D SDA^VADPT
79 ;
80 I $O(^UTILITY("VASD",$J,"")) S CNT=0
81 S I="" F S I=$O(^UTILITY("VASD",$J,I),-1) Q:I="" S RESULT(CNT)=$G(^UTILITY("VASD",$J,I,"E"))_"^"_$G(^UTILITY("VASD",$J,I,"I")),CNT=CNT+1
82 ;
83 I VAERR=1 S RESULT(0)="Invalid Patient Identifier^^"
84 K ^UTILITY("VASD",$J)
85 Q
86 ;
87TEST ;
88 K IBDF,ALAN
89 S IBDF("DFN")=7169761
90 S IBDF("CLINIC")=300
91 S IBDF("APPT")=2970902.0849
92 S IBDF("UNFORMAT")=1
93 D GETALL(.ALAN,.IBDF)
94 Q
95TESTW ;
96 K IBDF
97 S IBDF("DFN")=7169761
98 S IBDF("CLINIC")=300
99 S IBDF("APPT")=2970902.0849
100 D WRITE
101 K IBDF
102 Q
103 ;
104TESTA ;
105 K ALAN,IBDF
106 S IBDF("DFN")=7169761
107 D APPTLST(.ALAN,.IBDF)
108 Q
Note: See TracBrowser for help on using the repository browser.